diff --git a/libretroshare/src/retroshare/rspeers.h b/libretroshare/src/retroshare/rspeers.h index b4b0a64d0..9d04968a0 100644 --- a/libretroshare/src/retroshare/rspeers.h +++ b/libretroshare/src/retroshare/rspeers.h @@ -396,10 +396,6 @@ struct RsPeerStateChangedEvent : RsEvent class RsPeers { public: - - RsPeers() {} - virtual ~RsPeers() {} - /** * @brief Get own SSL peer id * @return own peer id @@ -416,6 +412,14 @@ public: */ virtual bool getFriendList(std::list& sslIds) = 0; + /** + * @brief Get trusted PGP ids list + * @jsonapi{development} + * @param[out] pgpIds storage for the trusted PGP ids + * @return false if error occurred, true otherwise + */ + virtual bool getPgpFriendList(std::vector& pgpIds) = 0; + /** * @brief Get connected peers list * @jsonapi{development} @@ -498,6 +502,8 @@ public: */ virtual RsPgpId getGPGId(const RsPeerId& sslId) = 0; virtual bool isKeySupported(const RsPgpId& gpg_ids) = 0; + + RS_DEPRECATED_FOR(getPgpFriendList) virtual bool getGPGAcceptedList(std::list &gpg_ids) = 0; virtual bool getGPGSignedList(std::list &gpg_ids) = 0;// keys signed by our own PGP key. virtual bool getGPGValidList(std::list &gpg_ids) = 0;// all PGP keys without filtering @@ -847,4 +853,6 @@ public: RS_DEPRECATED_FOR(isPgpFriend) virtual bool isGPGAccepted(const RsPgpId &gpg_id_is_friend) = 0; + + virtual ~RsPeers(); }; diff --git a/libretroshare/src/rsserver/p3peers.cc b/libretroshare/src/rsserver/p3peers.cc index 1924b69dd..1e74a5eb9 100644 --- a/libretroshare/src/rsserver/p3peers.cc +++ b/libretroshare/src/rsserver/p3peers.cc @@ -647,6 +647,18 @@ bool p3Peers::getGPGSignedList(std::list &ids) return true; } +bool p3Peers::getPgpFriendList(std::vector& pgpIds) +{ + std::list ids; + if(AuthGPG::getAuthGPG()->getGPGAcceptedList(ids)) + { + pgpIds.clear(); + std::copy(ids.begin(), ids.end(), std::back_inserter(pgpIds)); + return true; + } + return false; +} + bool p3Peers::getGPGAcceptedList(std::list &ids) { #ifdef P3PEERS_DEBUG @@ -1873,3 +1885,5 @@ void p3Peers::setServicePermissionFlags(const RsPgpId& gpg_id,const ServicePermi RsPeerStateChangedEvent::RsPeerStateChangedEvent(RsPeerId sslId) : RsEvent(RsEventType::PEER_STATE_CHANGED), mSslId(sslId) {} + +RsPeers::~RsPeers() = default; diff --git a/libretroshare/src/rsserver/p3peers.h b/libretroshare/src/rsserver/p3peers.h index e44e7d23a..a814aec34 100644 --- a/libretroshare/src/rsserver/p3peers.h +++ b/libretroshare/src/rsserver/p3peers.h @@ -83,6 +83,11 @@ public: virtual const RsPgpId& getGPGOwnId(); virtual RsPgpId getGPGId(const RsPeerId &ssl_id); virtual bool isKeySupported(const RsPgpId& ids); + + /// @see RsPeers + bool getPgpFriendList(std::vector& pgpIds) override; + + RS_DEPRECATED_FOR(getPgpFriendList) virtual bool getGPGAcceptedList(std::list &ids); virtual bool getGPGSignedList(std::list &ids); virtual bool getGPGValidList(std::list &ids);