mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-06 08:05:18 -04:00
added tunnel state light to distant chat popup dialog. Added proper peer name. Changed method for adding widgets in the chat bar
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-GenericTunneling@6337 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
6ddfe35353
commit
cb9f174efa
14 changed files with 56 additions and 26 deletions
|
@ -312,7 +312,7 @@ virtual ChatLobbyId createChatLobby(const std::string& lobby_name,const std::str
|
|||
virtual bool createDistantChatInvite(const std::string& pgp_id,time_t time_of_validity,std::string& encrypted_string) = 0 ;
|
||||
virtual bool getDistantChatInviteList(std::vector<DistantChatInviteInfo>& invites) = 0;
|
||||
virtual bool initiateDistantChatConnexion(const std::string& encrypted_string,std::string& hash,uint32_t& error_code) = 0;
|
||||
virtual uint32_t getDistantChatStatus(const std::string& hash) = 0;
|
||||
virtual bool getDistantChatStatus(const std::string& hash,uint32_t& status,std::string& pgp_id) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -342,8 +342,8 @@ bool p3Msgs::initiateDistantChatConnexion(const std::string& encrypted_str,std::
|
|||
{
|
||||
return mChatSrv->initiateDistantChatConnexion(encrypted_str,hash,error_code) ;
|
||||
}
|
||||
uint32_t p3Msgs::getDistantChatStatus(const std::string& hash)
|
||||
bool p3Msgs::getDistantChatStatus(const std::string& hash,uint32_t& status,std::string& pgp_id)
|
||||
{
|
||||
return mChatSrv->getDistantChatStatus(hash) ;
|
||||
return mChatSrv->getDistantChatStatus(hash,status,pgp_id) ;
|
||||
}
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ class p3Msgs: public RsMsgs
|
|||
virtual bool createDistantChatInvite(const std::string& pgp_id,time_t time_of_validity,std::string& encrypted_string) ;
|
||||
virtual bool getDistantChatInviteList(std::vector<DistantChatInviteInfo>& invites);
|
||||
virtual bool initiateDistantChatConnexion(const std::string& encrypted_string,std::string& hash,uint32_t& error_code) ;
|
||||
virtual uint32_t getDistantChatStatus(const std::string& hash) ;
|
||||
virtual bool getDistantChatStatus(const std::string& hash,uint32_t& status,std::string& pgp_id) ;
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -420,12 +420,13 @@ bool p3ChatService::isOnline(const std::string& id)
|
|||
{
|
||||
// check if the id is a tunnel id or a peer id.
|
||||
|
||||
uint32_t res = getDistantChatStatus(id) ;
|
||||
uint32_t status ;
|
||||
std::string pgp_id ;
|
||||
|
||||
if(!res)
|
||||
if(!getDistantChatStatus(id,status,pgp_id))
|
||||
return mLinkMgr->isOnline(id) ;
|
||||
|
||||
return res == RS_DISTANT_CHAT_STATUS_TUNNEL_OK ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool p3ChatService::sendPrivateChat(const std::string &id, const std::wstring &msg)
|
||||
|
@ -2897,6 +2898,7 @@ void p3ChatService::addVirtualPeer(const TurtleFileHash& hash,const TurtleVirtua
|
|||
info.last_contact = now ;
|
||||
info.status = RS_DISTANT_CHAT_STATUS_TUNNEL_OK ;
|
||||
info.virtual_peer_id = virtual_peer_id ;
|
||||
info.pgp_id = it->second.destination_pgp_id ;
|
||||
memcpy(info.aes_key,it->second.aes_key,DISTANT_CHAT_AES_KEY_SIZE) ;
|
||||
|
||||
_distant_chat_peers[hash] = info ;
|
||||
|
@ -3226,6 +3228,7 @@ bool p3ChatService::initiateDistantChatConnexion(const std::string& encrypted_st
|
|||
|
||||
info.last_contact = time(NULL) ;
|
||||
info.status = RS_DISTANT_CHAT_STATUS_TUNNEL_DN ;
|
||||
info.pgp_id = pgp_id.toStdString() ;
|
||||
memcpy(info.aes_key,data+DISTANT_CHAT_HASH_SIZE,DISTANT_CHAT_AES_KEY_SIZE) ;
|
||||
|
||||
_distant_chat_peers[hash] = info ;
|
||||
|
@ -3286,16 +3289,19 @@ bool p3ChatService::getDistantChatInviteList(std::vector<DistantChatInviteInfo>&
|
|||
return true ;
|
||||
}
|
||||
|
||||
uint32_t p3ChatService::getDistantChatStatus(const std::string& hash)
|
||||
bool p3ChatService::getDistantChatStatus(const std::string& hash,uint32_t& status,std::string& pgp_id)
|
||||
{
|
||||
RsStackMutex stack(mChatMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
std::map<TurtleFileHash,DistantChatPeerInfo>::const_iterator it = _distant_chat_peers.find(hash) ;
|
||||
|
||||
if(it == _distant_chat_peers.end())
|
||||
return RS_DISTANT_CHAT_STATUS_UNKNOWN ;
|
||||
else
|
||||
return it->second.status ;
|
||||
return false ;
|
||||
|
||||
status = it->second.status ;
|
||||
pgp_id = it->second.pgp_id ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -313,7 +313,8 @@ class p3ChatService: public p3Service, public p3Config, public pqiMonitor, publi
|
|||
bool createDistantChatInvite(const std::string& pgp_id,time_t time_of_validity,TurtleFileHash& hash) ;
|
||||
bool getDistantChatInviteList(std::vector<DistantChatInviteInfo>& invites) ;
|
||||
bool initiateDistantChatConnexion(const std::string& encrypted_string,std::string& hash,uint32_t& error_code) ;
|
||||
virtual uint32_t getDistantChatStatus(const std::string& hash) ;
|
||||
|
||||
virtual bool getDistantChatStatus(const std::string& hash,uint32_t& status,std::string& pgp_id) ;
|
||||
|
||||
private:
|
||||
struct DistantChatInvite
|
||||
|
@ -330,6 +331,7 @@ class p3ChatService: public p3Service, public p3Config, public pqiMonitor, publi
|
|||
unsigned char aes_key[16] ; // key to encrypt packets
|
||||
uint32_t status ; // info: do we have a tunnel ?
|
||||
std::string virtual_peer_id; // given by the turtle router. Identifies the tunnel.
|
||||
std::string pgp_id ; // pgp id of the peer we're talking to.
|
||||
};
|
||||
|
||||
// This map contains the ongoing invites. This is the list where to look to
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue