mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-29 09:26:18 -05:00
fixed display of TOR connexions in the friend list
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7642 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
bdc83c6748
commit
90b57337f5
@ -91,6 +91,7 @@ const uint32_t RS_PEER_CONNECTSTATE_TRYING_TCP = 2;
|
||||
const uint32_t RS_PEER_CONNECTSTATE_TRYING_UDP = 3;
|
||||
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_TCP = 4;
|
||||
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_UDP = 5;
|
||||
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_TOR = 6;
|
||||
|
||||
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN = 7;
|
||||
|
||||
|
@ -432,20 +432,22 @@ bool p3Peers::getPeerDetails(const RsPeerId& id, RsPeerDetails &d)
|
||||
}
|
||||
}
|
||||
else if (pcs.state & RS_PEER_S_CONNECTED)
|
||||
{
|
||||
if (pcs.connecttype == RS_NET_CONN_TCP_ALL)
|
||||
{
|
||||
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_TCP;
|
||||
}
|
||||
else if (pcs.connecttype == RS_NET_CONN_UDP_ALL)
|
||||
{
|
||||
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_UDP;
|
||||
}
|
||||
else
|
||||
{
|
||||
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN;
|
||||
}
|
||||
}
|
||||
{
|
||||
if(isProxyAddress(pcs.connectaddr))
|
||||
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_TOR;
|
||||
else if (pcs.connecttype == RS_NET_CONN_TCP_ALL)
|
||||
{
|
||||
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_TCP;
|
||||
}
|
||||
else if (pcs.connecttype == RS_NET_CONN_UDP_ALL)
|
||||
{
|
||||
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_UDP;
|
||||
}
|
||||
else
|
||||
{
|
||||
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
d.wasDeniedConnection = pcs.wasDeniedConnection;
|
||||
d.deniedTS = pcs.deniedTS;
|
||||
@ -453,6 +455,18 @@ bool p3Peers::getPeerDetails(const RsPeerId& id, RsPeerDetails &d)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3Peers::isProxyAddress(const sockaddr_storage& addr)
|
||||
{
|
||||
uint16_t port ;
|
||||
std::string string_addr;
|
||||
uint32_t status ;
|
||||
|
||||
if(!getProxyServer(string_addr, port, status))
|
||||
return false ;
|
||||
|
||||
return sockaddr_storage_iptostring(addr)==string_addr && sockaddr_storage_port(addr)==port ;
|
||||
}
|
||||
|
||||
bool p3Peers::isKeySupported(const RsPgpId& id)
|
||||
{
|
||||
return AuthGPG::getAuthGPG()->isKeySupported(id);
|
||||
|
@ -30,6 +30,7 @@
|
||||
class p3LinkMgr;
|
||||
class p3PeerMgr;
|
||||
class p3NetMgr;
|
||||
struct sockaddr_storage;
|
||||
|
||||
|
||||
class p3Peers: public RsPeers
|
||||
@ -95,6 +96,7 @@ virtual bool setVisState(const RsPeerId &id, uint16_t vs_disc, uint16_t vs_dht);
|
||||
|
||||
virtual bool getProxyServer(std::string &addr, uint16_t &port,uint32_t& status);
|
||||
virtual bool setProxyServer(const std::string &addr, const uint16_t port);
|
||||
virtual bool isProxyAddress(const sockaddr_storage&);
|
||||
|
||||
virtual void getIPServersList(std::list<std::string>& ip_servers) ;
|
||||
virtual void allowServerIPDetermination(bool) ;
|
||||
|
@ -156,6 +156,9 @@ QString StatusDefs::connectStateString(RsPeerDetails &details)
|
||||
case RS_PEER_CONNECTSTATE_CONNECTED_UDP:
|
||||
stateString = qApp->translate("StatusDefs", "Connected: UDP");
|
||||
break;
|
||||
case RS_PEER_CONNECTSTATE_CONNECTED_TOR:
|
||||
stateString = qApp->translate("StatusDefs", "Connected: TOR");
|
||||
break;
|
||||
case RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN:
|
||||
stateString = qApp->translate("StatusDefs", "Connected: Unknown");
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user