mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-06 08:05:18 -04:00
added notification when distant chat has undelivered messages. Updated the text to remove technical terms such as tunnels
This commit is contained in:
parent
56fa3edd77
commit
ea9f88a32f
6 changed files with 124 additions and 53 deletions
|
@ -178,8 +178,7 @@ bool DistantChatService::acceptDataFromPeer(const RsGxsId& gxs_id,const RsGxsTun
|
|||
return res ;
|
||||
}
|
||||
|
||||
void DistantChatService::notifyTunnelStatus(
|
||||
const RsGxsTunnelId& tunnel_id, uint32_t tunnel_status )
|
||||
void DistantChatService::notifyTunnelStatus( const RsGxsTunnelId& tunnel_id, uint32_t tunnel_status )
|
||||
{
|
||||
#ifdef DEBUG_DISTANT_CHAT
|
||||
DISTANT_CHAT_DEBUG() << "DistantChatService::notifyTunnelStatus(): got notification " << std::hex << tunnel_status << std::dec << " for tunnel " << tunnel_id << std::endl;
|
||||
|
@ -195,18 +194,17 @@ void DistantChatService::notifyTunnelStatus(
|
|||
RsServer::notify()->notifyPeerStatusChanged(tunnel_id.toStdString(),RS_STATUS_ONLINE) ;
|
||||
break ;
|
||||
|
||||
case RsGxsTunnelService::RS_GXS_TUNNEL_STATUS_TUNNEL_DN: RsServer::notify()->notifyChatStatus(ChatId(DistantChatPeerId(tunnel_id)),"tunnel is down...") ;
|
||||
case RsGxsTunnelService::RS_GXS_TUNNEL_STATUS_TUNNEL_DN: RsServer::notify()->notifyChatStatus(ChatId(DistantChatPeerId(tunnel_id)),"Tunnel is down...") ;
|
||||
RsServer::notify()->notifyPeerStatusChanged(tunnel_id.toStdString(),RS_STATUS_OFFLINE) ;
|
||||
break ;
|
||||
|
||||
case RsGxsTunnelService::RS_GXS_TUNNEL_STATUS_REMOTELY_CLOSED: RsServer::notify()->notifyChatStatus(ChatId(DistantChatPeerId(tunnel_id)),"tunnel is down...") ;
|
||||
case RsGxsTunnelService::RS_GXS_TUNNEL_STATUS_REMOTELY_CLOSED: RsServer::notify()->notifyChatStatus(ChatId(DistantChatPeerId(tunnel_id)),"Tunnel is down...") ;
|
||||
RsServer::notify()->notifyPeerStatusChanged(tunnel_id.toStdString(),RS_STATUS_OFFLINE) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
void DistantChatService::receiveData(
|
||||
const RsGxsTunnelId& tunnel_id, unsigned char* data, uint32_t data_size)
|
||||
void DistantChatService::receiveData( const RsGxsTunnelId& tunnel_id, unsigned char* data, uint32_t data_size)
|
||||
{
|
||||
#ifdef DEBUG_DISTANT_CHAT
|
||||
DISTANT_CHAT_DEBUG() << "DistantChatService::receiveData(): got data of size " << std::dec << data_size << " for tunnel " << tunnel_id << std::endl;
|
||||
|
@ -303,16 +301,14 @@ bool DistantChatService::getDistantChatStatus(const DistantChatPeerId& tunnel_id
|
|||
|
||||
cinfo.to_id = tinfo.destination_gxs_id;
|
||||
cinfo.own_id = tinfo.source_gxs_id;
|
||||
cinfo.pending_items = tinfo.pending_data_packets;
|
||||
cinfo.peer_id = tunnel_id;
|
||||
|
||||
switch(tinfo.tunnel_status)
|
||||
{
|
||||
case RsGxsTunnelService::RS_GXS_TUNNEL_STATUS_CAN_TALK :
|
||||
cinfo.status = RS_DISTANT_CHAT_STATUS_CAN_TALK; break;
|
||||
case RsGxsTunnelService::RS_GXS_TUNNEL_STATUS_TUNNEL_DN:
|
||||
cinfo.status = RS_DISTANT_CHAT_STATUS_TUNNEL_DN; break;
|
||||
case RsGxsTunnelService::RS_GXS_TUNNEL_STATUS_REMOTELY_CLOSED:
|
||||
cinfo.status = RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED; break;
|
||||
case RsGxsTunnelService::RS_GXS_TUNNEL_STATUS_CAN_TALK : cinfo.status = RS_DISTANT_CHAT_STATUS_CAN_TALK; break;
|
||||
case RsGxsTunnelService::RS_GXS_TUNNEL_STATUS_TUNNEL_DN: cinfo.status = RS_DISTANT_CHAT_STATUS_TUNNEL_DN; break;
|
||||
case RsGxsTunnelService::RS_GXS_TUNNEL_STATUS_REMOTELY_CLOSED: cinfo.status = RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED; break;
|
||||
case RsGxsTunnelService::RS_GXS_TUNNEL_STATUS_UNKNOWN:
|
||||
default:
|
||||
cinfo.status = RS_DISTANT_CHAT_STATUS_UNKNOWN; break;
|
||||
|
|
|
@ -1596,7 +1596,13 @@ bool p3GxsTunnelService::getTunnelInfo(const RsGxsTunnelId& tunnel_id,GxsTunnelI
|
|||
|
||||
// Data packets
|
||||
|
||||
info.pending_data_packets = 0;
|
||||
info.pending_data_packets = 0;
|
||||
RsPeerId p(tunnel_id);
|
||||
|
||||
for(auto it(pendingGxsTunnelDataItems.begin());it!=pendingGxsTunnelDataItems.end();++it)
|
||||
if(it->second.data_item->PeerId() == p)
|
||||
++info.pending_data_packets ;
|
||||
|
||||
info.total_data_packets_sent=0 ;
|
||||
info.total_data_packets_received=0 ;
|
||||
|
||||
|
@ -1704,7 +1710,16 @@ bool p3GxsTunnelService::getTunnelsInfo(std::vector<RsGxsTunnelService::GxsTunne
|
|||
ti.tunnel_status = it->second.status ;
|
||||
ti.total_size_sent = it->second.total_sent ;
|
||||
ti.total_size_received = it->second.total_received ;
|
||||
|
||||
|
||||
ti.pending_data_packets = 0;
|
||||
RsPeerId p(it->first);
|
||||
for(auto it(pendingGxsTunnelDataItems.begin());it!=pendingGxsTunnelDataItems.end();++it)
|
||||
if(it->second.data_item->PeerId() == p)
|
||||
++ti.pending_data_packets ;
|
||||
|
||||
ti.total_data_packets_sent =0; // not accounted for yet.
|
||||
ti.total_data_packets_received=0 ; // not accounted for yet.
|
||||
|
||||
infos.push_back(ti) ;
|
||||
}
|
||||
|
||||
|
|
|
@ -322,10 +322,13 @@ struct MsgTagType : RsSerializable
|
|||
|
||||
struct DistantChatPeerInfo
|
||||
{
|
||||
DistantChatPeerInfo() : status(0),pending_items(0) {}
|
||||
|
||||
RsGxsId to_id ;
|
||||
RsGxsId own_id ;
|
||||
DistantChatPeerId peer_id ; // this is the tunnel id actually
|
||||
uint32_t status ; // see the values in rsmsgs.h
|
||||
uint32_t status ; // see the values in rsmsgs.h
|
||||
uint32_t pending_items; // items not sent, waiting for a tunnel
|
||||
};
|
||||
|
||||
// Identifier for an chat endpoint like
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue