From c2fcd8bc7177fca8a227e23747fdd2bf6c62e46a Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 16 Apr 2013 20:10:31 +0000 Subject: [PATCH] patch from Henry Morgan to avoid removing peer permission flags when removing locations git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6309 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/pqi/p3peermgr.cc | 9 +++++---- libretroshare/src/pqi/p3peermgr.h | 4 ++-- libretroshare/src/rsserver/p3peers.cc | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/libretroshare/src/pqi/p3peermgr.cc b/libretroshare/src/pqi/p3peermgr.cc index bbb0a324a..0127c858a 100644 --- a/libretroshare/src/pqi/p3peermgr.cc +++ b/libretroshare/src/pqi/p3peermgr.cc @@ -576,7 +576,7 @@ bool p3PeerMgrIMPL::addFriend(const std::string& input_id, const std::string& in } -bool p3PeerMgrIMPL::removeFriend(const std::string &id) +bool p3PeerMgrIMPL::removeFriend(const std::string &id, bool removePgpId) { #ifdef PEER_DEBUG @@ -605,7 +605,8 @@ bool p3PeerMgrIMPL::removeFriend(const std::string &id) peerState peer = it->second; sslid_toRemove.push_back(it->second.id); - pgpid_toRemove.push_back(it->second.gpg_id); + if(removePgpId) + pgpid_toRemove.push_back(it->second.gpg_id); mOthersList[id] = peer; mStatusChanged = true; @@ -1889,7 +1890,7 @@ bool p3PeerMgrIMPL::removeAllFriendLocations(const std::string &gpgid) std::list::iterator it; for(it = sslIds.begin(); it != sslIds.end(); it++) { - removeFriend(*it); + removeFriend(*it, true); } return true; @@ -1979,7 +1980,7 @@ bool p3PeerMgrIMPL::removeUnusedLocations() for(it = toRemove.begin(); it != toRemove.end(); it++) { - removeFriend(*it); + removeFriend(*it,false); } return true; diff --git a/libretroshare/src/pqi/p3peermgr.h b/libretroshare/src/pqi/p3peermgr.h index dda107a55..58ced9df5 100644 --- a/libretroshare/src/pqi/p3peermgr.h +++ b/libretroshare/src/pqi/p3peermgr.h @@ -124,7 +124,7 @@ virtual ~p3PeerMgr() { return; } virtual bool addFriend(const std::string &ssl_id, const std::string &gpg_id, uint32_t netMode = RS_NET_MODE_UDP, uint32_t visState = RS_VIS_STATE_STD , time_t lastContact = 0,ServicePermissionFlags = ServicePermissionFlags(RS_SERVICE_PERM_ALL)) = 0; -virtual bool removeFriend(const std::string &ssl_id) = 0; +virtual bool removeFriend(const std::string &ssl_id, bool removePgpId) = 0; virtual bool isFriend(const std::string &ssl_id) = 0; @@ -215,7 +215,7 @@ class p3PeerMgrIMPL: public p3PeerMgr, public p3Config virtual bool addFriend(const std::string &ssl_id, const std::string &gpg_id, uint32_t netMode = RS_NET_MODE_UDP, uint32_t visState = RS_VIS_STATE_STD , time_t lastContact = 0,ServicePermissionFlags = ServicePermissionFlags(RS_SERVICE_PERM_ALL)); -virtual bool removeFriend(const std::string &ssl_id); +virtual bool removeFriend(const std::string &ssl_id, bool removePgpId); virtual bool isFriend(const std::string &ssl_id); diff --git a/libretroshare/src/rsserver/p3peers.cc b/libretroshare/src/rsserver/p3peers.cc index 4ff8eaa97..d8cd2756f 100644 --- a/libretroshare/src/rsserver/p3peers.cc +++ b/libretroshare/src/rsserver/p3peers.cc @@ -630,7 +630,7 @@ bool p3Peers::removeFriendLocation(const std::string &sslId) std::cerr << "p3Peers::removeFriendLocation() " << sslId << std::endl; #endif //will remove if it's a ssl id - mPeerMgr->removeFriend(sslId); + mPeerMgr->removeFriend(sslId, false); return true; }