From a69629cf73a5880575f47b13f8165dc7f69187e8 Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 6 Jul 2016 22:16:05 -0400 Subject: [PATCH] added missing own id from group list, and removed possible duplicates in random group ids --- libretroshare/src/pqi/p3peermgr.cc | 6 ++++-- retroshare-gui/src/gui/common/FriendSelectionWidget.cpp | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libretroshare/src/pqi/p3peermgr.cc b/libretroshare/src/pqi/p3peermgr.cc index c12692d28..a2c21284c 100644 --- a/libretroshare/src/pqi/p3peermgr.cc +++ b/libretroshare/src/pqi/p3peermgr.cc @@ -2304,7 +2304,8 @@ bool p3PeerMgrIMPL::loadList(std::list& load) ginfo.flag = gitem->flag ; ginfo.name = gitem->name ; ginfo.peerIds = gitem->pgpList.ids ; - ginfo.id = RsNodeGroupId::random() ; + + do { ginfo.id = RsNodeGroupId::random(); } while(groupList.find(ginfo.id) != groupList.end()) ; // Ensure backward compatibility when loading the group in old format. The id must matchthe standard default id. @@ -2484,7 +2485,8 @@ bool p3PeerMgrIMPL::addGroup(RsGroupInfo &groupInfo) { RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/ - groupInfo.id = RsNodeGroupId::random() ;//groupItem->id; // at creation time, we generate a random id. + do { groupInfo.id = RsNodeGroupId::random(); } while(groupList.find(groupInfo.id) != groupList.end()) ; + RsGroupInfo groupItem(groupInfo) ; // remove standard flag diff --git a/retroshare-gui/src/gui/common/FriendSelectionWidget.cpp b/retroshare-gui/src/gui/common/FriendSelectionWidget.cpp index 568fbe79a..1f9d694fd 100644 --- a/retroshare-gui/src/gui/common/FriendSelectionWidget.cpp +++ b/retroshare-gui/src/gui/common/FriendSelectionWidget.cpp @@ -305,6 +305,9 @@ void FriendSelectionWidget::secured_fillList() else rsPeers->getGPGAcceptedList(gpgIds); + // add own pgp id to the list + gpgIds.push_back(rsPeers->getGPGOwnId()) ; + std::list sslIds; std::list::iterator sslIt;