added notification when distant chat has undelivered messages. Updated the text to remove technical terms such as tunnels

This commit is contained in:
csoler 2019-10-26 22:57:13 +02:00
parent 56fa3edd77
commit ea9f88a32f
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
6 changed files with 124 additions and 53 deletions

View file

@ -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;

View file

@ -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) ;
}

View file

@ -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