diff --git a/libretroshare/src/retroshare/rsturtle.h b/libretroshare/src/retroshare/rsturtle.h index 59b787c8e..4ad7f2d02 100644 --- a/libretroshare/src/retroshare/rsturtle.h +++ b/libretroshare/src/retroshare/rsturtle.h @@ -129,6 +129,8 @@ class RsTurtle /// virtual void registerTunnelService(RsTurtleClientService *service) = 0; + virtual std::string getPeerNameForVirtualPeerId(const RsPeerId& virtual_peer_id) = 0; + // Get info from the turtle router. I use std strings to hide the internal structs. // virtual void getInfo(std::vector >&,std::vector >&, diff --git a/libretroshare/src/turtle/p3turtle.cc b/libretroshare/src/turtle/p3turtle.cc index 997fe0e7e..53e3bf9d8 100644 --- a/libretroshare/src/turtle/p3turtle.cc +++ b/libretroshare/src/turtle/p3turtle.cc @@ -2001,6 +2001,25 @@ void p3turtle::getTrafficStatistics(TurtleTrafficStatisticsInfo& info) const } } +std::string p3turtle::getPeerNameForVirtualPeerId(const RsPeerId& virtual_peer_id) +{ + std::string name = "unknown"; + std::map::const_iterator it(_virtual_peers.find(virtual_peer_id)) ; + if(it != _virtual_peers.end()) + { + TurtleTunnelId tunnel_id = it->second ; + std::map::iterator it2( _local_tunnels.find(tunnel_id) ) ; + if(it2 != _local_tunnels.end()) + { + if(it2->second.local_src == _own_id) + mLinkMgr->getPeerName(it2->second.local_dst,name); + else + mLinkMgr->getPeerName(it2->second.local_src,name); + } + } + return name; +} + void p3turtle::getInfo( std::vector >& hashes_info, std::vector >& tunnels_info, std::vector& search_reqs_info, diff --git a/libretroshare/src/turtle/p3turtle.h b/libretroshare/src/turtle/p3turtle.h index d9d51456b..ab523f63f 100644 --- a/libretroshare/src/turtle/p3turtle.h +++ b/libretroshare/src/turtle/p3turtle.h @@ -275,6 +275,8 @@ class p3turtle: public p3Service, public RsTurtle, public p3Config /// virtual void registerTunnelService(RsTurtleClientService *service) ; + virtual std::string getPeerNameForVirtualPeerId(const RsPeerId& virtual_peer_id); + /// get info about tunnels virtual void getInfo(std::vector >&, std::vector >&, diff --git a/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp b/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp index 522ac5fb8..60d42af3f 100644 --- a/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp @@ -58,6 +58,8 @@ #include #include +#include + /* Images for context menu icons */ #define IMAGE_INFO ":/images/fileinfo.png" #define IMAGE_CANCEL ":/images/delete.png" @@ -1388,10 +1390,11 @@ QString TransfersDialog::getPeerName(const RsPeerId& id) const // if(res == "") { + res = QString::fromStdString(rsTurtle->getPeerNameForVirtualPeerId(id)); if(rsFiles->isEncryptedSource(id)) - return tr("Anonymous end-to-end encrypted tunnel 0x")+QString::fromStdString(id.toStdString()).left(8) ; + return tr("e2ee tunnel ")+QString::fromStdString(id.toStdString()).left(8) + " via " +res ; else - return tr("Anonymous tunnel 0x")+QString::fromStdString(id.toStdString()).left(8) ; + return tr("Anon tunnel ")+QString::fromStdString(id.toStdString()).left(8) + " via " +res ; } else return res ;