diff --git a/libretroshare/src/retroshare/rsgxschannels.h b/libretroshare/src/retroshare/rsgxschannels.h index f1aef6e7f..8c7d29766 100644 --- a/libretroshare/src/retroshare/rsgxschannels.h +++ b/libretroshare/src/retroshare/rsgxschannels.h @@ -256,7 +256,7 @@ public: * @param[in] subscribe true to subscribe, false to unsubscribe * @return false on error, true otherwise */ - virtual bool subscribeToChannel( const RsGxsGroupId &channelId, + virtual bool subscribeToChannel( const RsGxsGroupId& channelId, bool subscribe ) = 0; /** diff --git a/libretroshare/src/retroshare/rsgxsforums.h b/libretroshare/src/retroshare/rsgxsforums.h index 4c6b6e483..e98020e3c 100644 --- a/libretroshare/src/retroshare/rsgxsforums.h +++ b/libretroshare/src/retroshare/rsgxsforums.h @@ -159,6 +159,16 @@ public: */ virtual bool markRead(const RsGxsGrpMsgIdPair& messageId, bool read) = 0; + /** + * @brief Subscrbe to a forum. Blocking API + * @jsonapi{development} + * @param[in] forumId Forum id + * @param[in] subscribe true to subscribe, false to unsubscribe + * @return false on error, true otherwise + */ + virtual bool subscribeToForum( const RsGxsGroupId& forumId, + bool subscribe ) = 0; + /* Specific Service Data */ RS_DEPRECATED_FOR("getForumsSummaries, getForumsInfo") virtual bool getGroupData(const uint32_t &token, std::vector &groups) = 0; diff --git a/libretroshare/src/services/p3gxsforums.cc b/libretroshare/src/services/p3gxsforums.cc index 09680f196..c8819662f 100644 --- a/libretroshare/src/services/p3gxsforums.cc +++ b/libretroshare/src/services/p3gxsforums.cc @@ -476,6 +476,15 @@ bool p3GxsForums::markRead(const RsGxsGrpMsgIdPair& msgId, bool read) return true; } +bool p3GxsForums::subscribeToForum( + const RsGxsGroupId& groupId, bool subscribe ) +{ + uint32_t token; + if( !RsGenExchange::subscribeToGroup(token, groupId, subscribe) + || waitToken(token) != RsTokenService::COMPLETE ) return false; + return true; +} + bool p3GxsForums::createGroup(uint32_t &token, RsGxsForumGroup &group) { std::cerr << "p3GxsForums::createGroup()" << std::endl; diff --git a/libretroshare/src/services/p3gxsforums.h b/libretroshare/src/services/p3gxsforums.h index 36b40a972..5e40cb3e7 100644 --- a/libretroshare/src/services/p3gxsforums.h +++ b/libretroshare/src/services/p3gxsforums.h @@ -80,6 +80,10 @@ public: /// @see RsGxsForums::markRead virtual bool markRead(const RsGxsGrpMsgIdPair& messageId, bool read); + /// @see RsGxsForums::subscribeToForum + virtual bool subscribeToForum( const RsGxsGroupId& forumId, + bool subscribe ); + virtual bool getGroupData(const uint32_t &token, std::vector &groups); virtual bool getMsgData(const uint32_t &token, std::vector &msgs); virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read);