diff --git a/libretroshare/src/pqi/p3connmgr.cc b/libretroshare/src/pqi/p3connmgr.cc index cae28aa59..fb9706aef 100644 --- a/libretroshare/src/pqi/p3connmgr.cc +++ b/libretroshare/src/pqi/p3connmgr.cc @@ -1998,6 +1998,13 @@ void p3ConnectMgr::peerConnectRequest(std::string id, struct sockaddr_in radd bool p3ConnectMgr::addFriend(std::string id, std::string gpg_id, uint32_t netMode, uint32_t visState, time_t lastContact) { + if (id == AuthSSL::getAuthSSL()->OwnId()) { +#ifdef CONN_DEBUG + std::cerr << "p3ConnectMgr::addFriend() cannot add own id as a friend." << std::endl; +#endif + /* (1) already exists */ + return false; + } /* so four possibilities * (1) already exists as friend -> do nothing. * (2) is in others list -> move over. @@ -2028,7 +2035,7 @@ bool p3ConnectMgr::addFriend(std::string id, std::string gpg_id, uint32_t netMod } //Authentication is now tested at connection time, we don't store the ssl cert anymore - if (!AuthGPG::getAuthGPG()->isGPGAccepted(gpg_id)) + if (!AuthGPG::getAuthGPG()->isGPGAccepted(gpg_id) && gpg_id != AuthGPG::getAuthGPG()->getGPGOwnId()) { #ifdef CONN_DEBUG std::cerr << "p3ConnectMgr::addFriend() gpg is not accepted" << std::endl; diff --git a/retroshare-gui/src/gui/PeersDialog.cpp b/retroshare-gui/src/gui/PeersDialog.cpp index d1de98021..77321b283 100644 --- a/retroshare-gui/src/gui/PeersDialog.cpp +++ b/retroshare-gui/src/gui/PeersDialog.cpp @@ -279,6 +279,13 @@ void PeersDialog::insertPeers() rsPeers->getGPGAcceptedList(gpgFriends); + //add own gpg id, if we have more than on location (ssl client) + std::list ownSslContacts; + rsPeers->getSSLChildListOfGPGId(rsPeers->getGPGOwnId(), ownSslContacts); + if (ownSslContacts.size() > 0) { + gpgFriends.push_back(rsPeers->getGPGOwnId()); + } + /* get a link to the table */ QTreeWidget *peertreeWidget = ui.peertreeWidget; @@ -294,7 +301,7 @@ void PeersDialog::insertPeers() int index = 0; while (index < peertreeWidget->topLevelItemCount()) { std::string gpg_id = (peertreeWidget->topLevelItem(index))->text(3).toStdString(); - if (!rsPeers->isGPGAccepted(gpg_id)) { + if (!rsPeers->isGPGAccepted(gpg_id) && gpg_id != rsPeers->getGPGOwnId()) { peertreeWidget->takeTopLevelItem(index); } else { index++; @@ -305,9 +312,9 @@ void PeersDialog::insertPeers() //add the gpg friends for(it = gpgFriends.begin(); it != gpgFriends.end(); it++) { std::cerr << "" << *it << std::endl; - if (*it == rsPeers->getGPGOwnId()) { - continue; - } +// if (*it == rsPeers->getGPGOwnId()) { +// continue; +// } /* make a widget per friend */ QTreeWidgetItem *gpg_item; @@ -320,7 +327,8 @@ void PeersDialog::insertPeers() } RsPeerDetails detail; - if (!rsPeers->getPeerDetails(*it, detail) || !detail.accept_connection) { + if ((!rsPeers->getPeerDetails(*it, detail) || !detail.accept_connection) + && detail.gpg_id != rsPeers->getGPGOwnId()) { //don't accept anymore connection, remove from the view peertreeWidget->takeTopLevelItem(peertreeWidget->indexOfTopLevelItem(gpg_item)); continue; @@ -352,6 +360,10 @@ void PeersDialog::insertPeers() std::list sslContacts; rsPeers->getSSLChildListOfGPGId(detail.gpg_id, sslContacts); for(std::list::iterator sslIt = sslContacts.begin(); sslIt != sslContacts.end(); sslIt++) { +// if (*it == rsPeers->getGPGOwnId()) { +// continue; +// } + QTreeWidgetItem *sslItem;