Forum API add missing subscribe method

This commit is contained in:
Gioacchino Mazzurco 2018-11-22 16:41:19 +01:00
parent a802e494f8
commit abec811d31
No known key found for this signature in database
GPG Key ID: A1FBCA3872E87051
4 changed files with 24 additions and 1 deletions

View File

@ -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;
/**

View File

@ -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<RsGxsForumGroup> &groups) = 0;

View File

@ -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;

View File

@ -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<RsGxsForumGroup> &groups);
virtual bool getMsgData(const uint32_t &token, std::vector<RsGxsForumMsg> &msgs);
virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read);