diff --git a/src/retroshare/rsgxschannels.h b/src/retroshare/rsgxschannels.h index 1639dcffb..6082527ae 100644 --- a/src/retroshare/rsgxschannels.h +++ b/src/retroshare/rsgxschannels.h @@ -395,13 +395,22 @@ public: /** * @brief Toggle post read status. Blocking API. * @jsonapi{development} - * @param[in] postId post identifier + * @param[in] msgId post identifier * @param[in] read true to mark as read, false to mark as unread * @return false on error, true otherwise */ - virtual bool markRead(const RsGxsGrpMsgIdPair& postId, bool read) = 0; + virtual bool setCommentReadStatus(const RsGxsGrpMsgIdPair &msgId, bool read) override =0; - /** + /** + * @brief Toggle post read status. Blocking API. + * @jsonapi{development} + * @param[in] msgId post identifier + * @param[in] read true to mark as read, false to mark as unread + * @return false on error, true otherwise + */ + virtual bool setMessageReadStatus(const RsGxsGrpMsgIdPair &msgId, bool read) =0; + + /** * @brief Share channel publishing key * This can be used to authorize other peers to post on the channel * @jsonapi{development} @@ -639,8 +648,8 @@ public: * @param[in] msgId * @param[in] read */ - RS_DEPRECATED_FOR(markRead) - virtual void setMessageReadStatus( + RS_DEPRECATED_FOR(setMessageReadStatus) + virtual void setMessageReadStatus_deprecated( uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) = 0; /** diff --git a/src/retroshare/rsgxscommon.h b/src/retroshare/rsgxscommon.h index 6f2a5b206..398b5e22b 100644 --- a/src/retroshare/rsgxscommon.h +++ b/src/retroshare/rsgxscommon.h @@ -168,6 +168,8 @@ public: RsGxsMessageId& voteId = RS_DEFAULT_STORAGE_PARAM(RsGxsMessageId), std::string& errorMessage = RS_DEFAULT_STORAGE_PARAM(std::string) ) = 0; + virtual bool setCommentReadStatus(const RsGxsGrpMsgIdPair& msg,bool read) =0; + /** Get previously requested comment data with token */ virtual bool getCommentData( uint32_t token, std::vector &comments ) = 0; virtual bool getRelatedComments( uint32_t token, std::vector &comments ) = 0; diff --git a/src/retroshare/rsposted.h b/src/retroshare/rsposted.h index 8ffe5db77..1712b1e81 100644 --- a/src/retroshare/rsposted.h +++ b/src/retroshare/rsposted.h @@ -320,7 +320,16 @@ public: * @param[in] read New read status * @return false on error, true otherwise */ - virtual bool setPostReadStatus(const RsGxsGrpMsgIdPair& msgId, bool read) = 0; + virtual bool setCommentReadStatus(const RsGxsGrpMsgIdPair& msgId, bool read) override = 0; + + /** + * @brief Updates the read status of a post + * @jsonapi{development} + * @param[in] msgId Pair containing the group ID and post ID to act on + * @param[in] read New read status + * @return false on error, true otherwise + */ + virtual bool setPostReadStatus(const RsGxsGrpMsgIdPair& msgId, bool read) = 0; enum RS_DEPRECATED RankType {TopRankType, HotRankType, NewRankType }; @@ -342,7 +351,7 @@ public: virtual bool getPostData( const uint32_t& token, std::vector& posts) = 0; - RS_DEPRECATED_FOR(setPostReadStatus) + RS_DEPRECATED_FOR(setCommentReadStatus) virtual bool setCommentAsRead(uint32_t& token,const RsGxsGroupId& gid,const RsGxsMessageId& comment_msg_id) override =0; RS_DEPRECATED_FOR(setPostReadStatus) diff --git a/src/services/p3gxschannels.cc b/src/services/p3gxschannels.cc index 812e4cb62..a27867c25 100644 --- a/src/services/p3gxschannels.cc +++ b/src/services/p3gxschannels.cc @@ -1686,10 +1686,14 @@ bool p3GxsChannels::subscribeToChannel( const RsGxsGroupId& groupId, bool subscr return true; } -bool p3GxsChannels::markRead(const RsGxsGrpMsgIdPair& msgId, bool read) +bool p3GxsChannels::setCommentReadStatus(const RsGxsGrpMsgIdPair &msgId, bool read) +{ + return setMessageReadStatus(msgId,read); +} +bool p3GxsChannels::setMessageReadStatus(const RsGxsGrpMsgIdPair &msgId, bool read) { uint32_t token; - setMessageReadStatus(token, msgId, read); + setMessageReadStatus_deprecated(token, msgId, read); if(waitToken(token) != RsTokenService::COMPLETE ) return false; RsGxsGrpMsgIdPair p; @@ -1872,9 +1876,7 @@ void p3GxsChannels::setMessageProcessedStatus(uint32_t& token, const RsGxsGrpMsg setMsgStatusFlags(token, msgId, status, mask); } -void p3GxsChannels::setMessageReadStatus( uint32_t& token, - const RsGxsGrpMsgIdPair& msgId, - bool read ) +void p3GxsChannels::setMessageReadStatus_deprecated(uint32_t &token, const RsGxsGrpMsgIdPair &msgId, bool read) { #ifdef GXSCHANNELS_DEBUG std::cerr << "p3GxsChannels::setMessageReadStatus()"; diff --git a/src/services/p3gxschannels.h b/src/services/p3gxschannels.h index 052a01a08..ebdabc94b 100644 --- a/src/services/p3gxschannels.h +++ b/src/services/p3gxschannels.h @@ -76,152 +76,73 @@ protected: virtual DistantSearchGroupStatus getDistantSearchStatus(const RsGxsGroupId& group_id) override; // Overloaded to cache new groups. -virtual RsGenExchange::ServiceCreate_Return service_CreateGroup(RsGxsGrpItem* grpItem, RsTlvSecurityKeySet& keySet) override; + virtual RsGenExchange::ServiceCreate_Return service_CreateGroup(RsGxsGrpItem* grpItem, RsTlvSecurityKeySet& keySet) override; -virtual void notifyChanges(std::vector& changes) override; + virtual void notifyChanges(std::vector& changes) override; - // Overloaded from RsTickEvent. -virtual void handle_event(uint32_t event_type, const std::string &elabel) override; - -public: - -virtual bool getGroupData(const uint32_t &token, std::vector &groups ) override; -virtual bool getPostData(const uint32_t &token, std::vector &posts, std::vector &cmts, std::vector &vots) override; -virtual bool getPostData(const uint32_t &token, std::vector &posts, std::vector &cmts) override; -virtual bool getPostData(const uint32_t &token, std::vector &posts) override; -//Not currently used -//virtual bool getRelatedPosts(const uint32_t &token, std::vector &posts); - - ////////////////////////////////////////////////////////////////////////////// - -//virtual bool setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask); -//virtual bool setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask); - -//virtual bool groupRestoreKeys(const std::string &groupId); - virtual bool groupShareKeys( - const RsGxsGroupId &groupId, const std::set& peers) override; - -virtual bool createGroup(uint32_t &token, RsGxsChannelGroup &group) override; -virtual bool createPost(uint32_t &token, RsGxsChannelPost &post) override; - -virtual bool updateGroup(uint32_t &token, RsGxsChannelGroup &group) override; - -// no tokens... should be cached. -virtual bool setChannelAutoDownload(const RsGxsGroupId &groupId, bool enabled) override; -virtual bool getChannelAutoDownload(const RsGxsGroupId &groupid, bool& enabled) override; -virtual bool setChannelDownloadDirectory(const RsGxsGroupId &groupId, const std::string& directory) override; -virtual bool getChannelDownloadDirectory(const RsGxsGroupId &groupId, std::string& directory) override; - -#ifdef TO_REMOVE - /// @see RsGxsChannels::turtleSearchRequest - virtual bool turtleSearchRequest(const std::string& matchString, - const std::function& multiCallback, - rstime_t maxWait = 300 ) override; - - /// @see RsGxsChannels::turtleChannelRequest - virtual bool turtleChannelRequest( - const RsGxsGroupId& channelId, - const std::function& multiCallback, - rstime_t maxWait = 300 ) override; - - /// @see RsGxsChannels::localSearchRequest - virtual bool localSearchRequest(const std::string& matchString, - const std::function& multiCallback, - rstime_t maxWait = 30 ) override; -#endif + // Overloaded from RsTickEvent. + virtual void handle_event(uint32_t event_type, const std::string &elabel) override; /** - * Receive results from turtle search @see RsGenExchange @see RsNxsObserver - * @see RsGxsNetService::receiveTurtleSearchResults - * @see p3turtle::handleSearchResult - */ - void receiveDistantSearchResults( TurtleRequestId id, - const RsGxsGroupId& grpId ) override; + * Receive results from turtle search @see RsGenExchange @see RsNxsObserver + * @see RsGxsNetService::receiveTurtleSearchResults + * @see p3turtle::handleSearchResult + */ + void receiveDistantSearchResults( TurtleRequestId id, const RsGxsGroupId& grpId ) override; /* Blocking API from RsGxsCommentService */ virtual bool getRelatedComments(const RsGxsGroupId& gid, const std::set &msgIds, std::vector &comments ) override; - /* Comment service - Provide RsGxsCommentService - redirect to p3GxsCommentService */ - virtual bool getCommentData(uint32_t token, std::vector &msgs) override - { return mCommentService->getGxsCommentData(token, msgs); } + /// @see RsGxsChannels + bool setCommentReadStatus(const RsGxsGrpMsgIdPair &msgId, bool read) override; - virtual bool getRelatedComments( uint32_t token, - std::vector &msgs ) override - { return mCommentService->getGxsRelatedComments(token, msgs); } + /// @see RsGxsChannels + bool setMessageReadStatus(const RsGxsGrpMsgIdPair& msgId, bool read) override; - virtual bool createNewComment(uint32_t &token, const RsGxsComment &msg) override - { - return mCommentService->createGxsComment(token, msg); - } + virtual bool groupShareKeys(const RsGxsGroupId &groupId, const std::set& peers) override; - virtual bool setCommentAsRead(uint32_t& token,const RsGxsGroupId& gid,const RsGxsMessageId& comment_msg_id) override - { - setMessageReadStatus(token,RsGxsGrpMsgIdPair(gid,comment_msg_id),true); - return true; - } + // no tokens... should be cached. + virtual bool setChannelAutoDownload(const RsGxsGroupId &groupId, bool enabled) override; + virtual bool getChannelAutoDownload(const RsGxsGroupId &groupid, bool& enabled) override; + virtual bool setChannelDownloadDirectory(const RsGxsGroupId &groupId, const std::string& directory) override; + virtual bool getChannelDownloadDirectory(const RsGxsGroupId &groupId, std::string& directory) override; - virtual bool createNewVote(uint32_t &token, RsGxsVote &msg) override - { - return mCommentService->createGxsVote(token, msg); - } - - virtual bool acknowledgeComment(uint32_t token, std::pair& msgId) override - { - return acknowledgeMsg(token, msgId); - } - - virtual bool acknowledgeVote(uint32_t token, std::pair& msgId) override - { - if (mCommentService->acknowledgeVote(token, msgId)) - { - return true; - } - return acknowledgeMsg(token, msgId); - } - - // Overloaded from RsGxsIface. -virtual bool subscribeToGroup(uint32_t &token, const RsGxsGroupId &groupId, bool subscribe) override; - - // Set Statuses. -virtual void setMessageProcessedStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool processed); -virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) override; - - // File Interface - virtual bool ExtraFileHash(const std::string& path) override; -virtual bool ExtraFileRemove(const RsFileHash &hash) override; + // File Interface + virtual bool ExtraFileHash(const std::string& path) override; + virtual bool ExtraFileRemove(const RsFileHash &hash) override; - /// Implementation of @see RsGxsChannels::getChannelsSummaries - bool getChannelsSummaries(std::list& channels) override; + /// Implementation of @see RsGxsChannels::getChannelsSummaries + bool getChannelsSummaries(std::list& channels) override; - /// Implementation of @see RsGxsChannels::getChannelsInfo - bool getChannelsInfo( - const std::list& chanIds, - std::vector& channelsInfo ) override; + /// Implementation of @see RsGxsChannels::getChannelsInfo + bool getChannelsInfo( + const std::list& chanIds, + std::vector& channelsInfo ) override; - /// Implementation of @see RsGxsChannels::getChannelAllMessages - bool getChannelAllContent(const RsGxsGroupId& channelId, - std::vector& posts, - std::vector& comments, - std::vector& votes ) override; + /// Implementation of @see RsGxsChannels::getChannelAllMessages + bool getChannelAllContent(const RsGxsGroupId& channelId, + std::vector& posts, + std::vector& comments, + std::vector& votes ) override; - /// Implementation of @see RsGxsChannels::getChannelMessages - bool getChannelContent(const RsGxsGroupId& channelId, - const std::set& contentIds, - std::vector& posts, - std::vector& comments, - std::vector& votes ) override; + /// Implementation of @see RsGxsChannels::getChannelMessages + bool getChannelContent(const RsGxsGroupId& channelId, + const std::set& contentIds, + std::vector& posts, + std::vector& comments, + std::vector& votes ) override; - /// Implementation of @see RsGxsChannels::getChannelComments - virtual bool getChannelComments(const RsGxsGroupId &channelId, - const std::set &contentIds, - std::vector &comments) override; + /// Implementation of @see RsGxsChannels::getChannelComments + virtual bool getChannelComments(const RsGxsGroupId &channelId, + const std::set &contentIds, + std::vector &comments) override; - /// Implementation of @see RsGxsChannels::getContentSummaries - bool getContentSummaries( - const RsGxsGroupId& channelId, - std::vector& summaries ) override; + /// Implementation of @see RsGxsChannels::getContentSummaries + bool getContentSummaries( + const RsGxsGroupId& channelId, + std::vector& summaries ) override; /// Implementation of @see RsGxsChannels::getChannelStatistics bool getChannelStatistics(const RsGxsGroupId& channelId,GxsGroupStatistic& stat) override; @@ -229,187 +150,268 @@ virtual bool ExtraFileRemove(const RsFileHash &hash) override; /// Iplementation of @see RsGxsChannels::getChannelServiceStatistics bool getChannelServiceStatistics(GxsServiceStatistic& stat) override; - /// Implementation of @see RsGxsChannels::createChannelV2 - bool createChannelV2( - const std::string& name, const std::string& description, - const RsGxsImage& thumbnail = RsGxsImage(), - const RsGxsId& authorId = RsGxsId(), - RsGxsCircleType circleType = RsGxsCircleType::PUBLIC, - const RsGxsCircleId& circleId = RsGxsCircleId(), - RsGxsGroupId& channelId = RS_DEFAULT_STORAGE_PARAM(RsGxsGroupId), - std::string& errorMessage = RS_DEFAULT_STORAGE_PARAM(std::string) - ) override; + /// Implementation of @see RsGxsChannels::createChannelV2 + bool createChannelV2( + const std::string& name, const std::string& description, + const RsGxsImage& thumbnail = RsGxsImage(), + const RsGxsId& authorId = RsGxsId(), + RsGxsCircleType circleType = RsGxsCircleType::PUBLIC, + const RsGxsCircleId& circleId = RsGxsCircleId(), + RsGxsGroupId& channelId = RS_DEFAULT_STORAGE_PARAM(RsGxsGroupId), + std::string& errorMessage = RS_DEFAULT_STORAGE_PARAM(std::string) + ) override; - /// Implementation of @see RsGxsChannels::createComment - bool createCommentV2( - const RsGxsGroupId& channelId, - const RsGxsMessageId& threadId, - const std::string& comment, - const RsGxsId& authorId, - const RsGxsMessageId& parentId = RsGxsMessageId(), - const RsGxsMessageId& origCommentId = RsGxsMessageId(), - RsGxsMessageId& commentMessageId = RS_DEFAULT_STORAGE_PARAM(RsGxsMessageId), - std::string& errorMessage = RS_DEFAULT_STORAGE_PARAM(std::string) - ) override; + /// Implementation of @see RsGxsChannels::createComment + bool createCommentV2( + const RsGxsGroupId& channelId, + const RsGxsMessageId& threadId, + const std::string& comment, + const RsGxsId& authorId, + const RsGxsMessageId& parentId = RsGxsMessageId(), + const RsGxsMessageId& origCommentId = RsGxsMessageId(), + RsGxsMessageId& commentMessageId = RS_DEFAULT_STORAGE_PARAM(RsGxsMessageId), + std::string& errorMessage = RS_DEFAULT_STORAGE_PARAM(std::string) + ) override; - /// Implementation of @see RsGxsChannels::editChannel - bool editChannel(RsGxsChannelGroup& channel) override; + /// Implementation of @see RsGxsChannels::editChannel + bool editChannel(RsGxsChannelGroup& channel) override; - /// Implementation of @see RsGxsChannels::createPostV2 - bool createPostV2( - const RsGxsGroupId& channelId, const std::string& title, - const std::string& body, - const std::list& files = std::list(), - const RsGxsImage& thumbnail = RsGxsImage(), - const RsGxsMessageId& origPostId = RsGxsMessageId(), - RsGxsMessageId& postId = RS_DEFAULT_STORAGE_PARAM(RsGxsMessageId), - std::string& errorMessage = RS_DEFAULT_STORAGE_PARAM(std::string) - ) override; + /// Implementation of @see RsGxsChannels::createPostV2 + bool createPostV2( + const RsGxsGroupId& channelId, const std::string& title, + const std::string& body, + const std::list& files = std::list(), + const RsGxsImage& thumbnail = RsGxsImage(), + const RsGxsMessageId& origPostId = RsGxsMessageId(), + RsGxsMessageId& postId = RS_DEFAULT_STORAGE_PARAM(RsGxsMessageId), + std::string& errorMessage = RS_DEFAULT_STORAGE_PARAM(std::string) + ) override; /// Implementation of @see RsGxsChannels::voteForComment bool voteForComment( - const RsGxsGroupId& channelId, const RsGxsMessageId& postId, - const RsGxsMessageId& commentId, const RsGxsId& authorId, - RsGxsVoteType vote, - RsGxsMessageId& voteId = RS_DEFAULT_STORAGE_PARAM(RsGxsMessageId), - std::string& errorMessage = RS_DEFAULT_STORAGE_PARAM(std::string) - ) override; + const RsGxsGroupId& channelId, const RsGxsMessageId& postId, + const RsGxsMessageId& commentId, const RsGxsId& authorId, + RsGxsVoteType vote, + RsGxsMessageId& voteId = RS_DEFAULT_STORAGE_PARAM(RsGxsMessageId), + std::string& errorMessage = RS_DEFAULT_STORAGE_PARAM(std::string) + ) override; /// Implementation of @see RsGxsChannels::subscribeToChannel - bool subscribeToChannel( const RsGxsGroupId &groupId, - bool subscribe ) override; + bool subscribeToChannel( const RsGxsGroupId &groupId, + bool subscribe ) override; - /// @see RsGxsChannels - virtual bool markRead(const RsGxsGrpMsgIdPair& msgId, bool read) override; + /// @see RsGxsChannels + bool exportChannelLink( + std::string& link, const RsGxsGroupId& chanId, + bool includeGxsData = true, + const std::string& baseUrl = DEFAULT_CHANNEL_BASE_URL, + std::string& errMsg = RS_DEFAULT_STORAGE_PARAM(std::string) + ) override; - /// @see RsGxsChannels - bool exportChannelLink( - std::string& link, const RsGxsGroupId& chanId, - bool includeGxsData = true, - const std::string& baseUrl = DEFAULT_CHANNEL_BASE_URL, - std::string& errMsg = RS_DEFAULT_STORAGE_PARAM(std::string) - ) override; + /// @see RsGxsChannels + bool importChannelLink( + const std::string& link, + RsGxsGroupId& chanId = RS_DEFAULT_STORAGE_PARAM(RsGxsGroupId), + std::string& errMsg = RS_DEFAULT_STORAGE_PARAM(std::string) + ) override; - /// @see RsGxsChannels - bool importChannelLink( - const std::string& link, - RsGxsGroupId& chanId = RS_DEFAULT_STORAGE_PARAM(RsGxsGroupId), - std::string& errMsg = RS_DEFAULT_STORAGE_PARAM(std::string) - ) override; + virtual bool shareChannelKeys( + const RsGxsGroupId& channelId, const std::set& peers ) override; - virtual bool shareChannelKeys( - const RsGxsGroupId& channelId, const std::set& peers ) override; - /// Implementation of @see RsGxsChannels::createChannel - RS_DEPRECATED_FOR(createChannelV2) - bool createChannel(RsGxsChannelGroup& channel) override; +protected: // made protected because it's all deprecated + virtual bool getGroupData(const uint32_t &token, std::vector &groups ) override; + virtual bool getPostData(const uint32_t &token, std::vector &posts, std::vector &cmts, std::vector &vots) override; + virtual bool getPostData(const uint32_t &token, std::vector &posts, std::vector &cmts) override; + virtual bool getPostData(const uint32_t &token, std::vector &posts) override; - /// @deprecated Implementation of @see RsGxsChannels::createPost - RS_DEPRECATED_FOR(createPostV2) - bool createPost(RsGxsChannelPost& post) override; + //Not currently used + //virtual bool getRelatedPosts(const uint32_t &token, std::vector &posts); - /// @deprecated Implementation of @see RsGxsChannels::createComment - RS_DEPRECATED_FOR(createCommentV2) - bool createComment(RsGxsComment &comment) override; + ////////////////////////////////////////////////////////////////////////////// + + //virtual bool setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask); + //virtual bool setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask); + + //virtual bool groupRestoreKeys(const std::string &groupId); + virtual bool createGroup(uint32_t &token, RsGxsChannelGroup &group) override; + virtual bool createPost(uint32_t &token, RsGxsChannelPost &post) override; + + virtual bool updateGroup(uint32_t &token, RsGxsChannelGroup &group) override; + +#ifdef TO_REMOVE + /// @see RsGxsChannels::turtleSearchRequest + virtual bool turtleSearchRequest(const std::string& matchString, + const std::function& multiCallback, + rstime_t maxWait = 300 ) override; + + /// @see RsGxsChannels::turtleChannelRequest + virtual bool turtleChannelRequest( + const RsGxsGroupId& channelId, + const std::function& multiCallback, + rstime_t maxWait = 300 ) override; + + /// @see RsGxsChannels::localSearchRequest + virtual bool localSearchRequest(const std::string& matchString, + const std::function& multiCallback, + rstime_t maxWait = 30 ) override; +#endif + + /* Comment service - Provide RsGxsCommentService - redirect to p3GxsCommentService */ + virtual bool getCommentData(uint32_t token, std::vector &msgs) override + { return mCommentService->getGxsCommentData(token, msgs); } + + virtual bool getRelatedComments( uint32_t token, + std::vector &msgs ) override + { return mCommentService->getGxsRelatedComments(token, msgs); } + + virtual bool createNewComment(uint32_t &token, const RsGxsComment &msg) override + { + return mCommentService->createGxsComment(token, msg); + } + + virtual bool setCommentAsRead(uint32_t& token,const RsGxsGroupId& gid,const RsGxsMessageId& comment_msg_id) override + { + setMessageReadStatus_deprecated(token,RsGxsGrpMsgIdPair(gid,comment_msg_id),true); + return true; + } + + virtual bool createNewVote(uint32_t &token, RsGxsVote &msg) override + { + return mCommentService->createGxsVote(token, msg); + } + + virtual bool acknowledgeComment(uint32_t token, std::pair& msgId) override + { + return acknowledgeMsg(token, msgId); + } + + virtual bool acknowledgeVote(uint32_t token, std::pair& msgId) override + { + if (mCommentService->acknowledgeVote(token, msgId)) + { + return true; + } + return acknowledgeMsg(token, msgId); + } + + // Overloaded from RsGxsIface. + virtual bool subscribeToGroup(uint32_t &token, const RsGxsGroupId &groupId, bool subscribe) override; + + // Set Statuses. + virtual void setMessageProcessedStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool processed); + virtual void setMessageReadStatus_deprecated(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) override; + + /// Implementation of @see RsGxsChannels::createChannel + RS_DEPRECATED_FOR(createChannelV2) + bool createChannel(RsGxsChannelGroup& channel) override; + + /// @deprecated Implementation of @see RsGxsChannels::createPost + RS_DEPRECATED_FOR(createPostV2) + bool createPost(RsGxsChannelPost& post) override; + + /// @deprecated Implementation of @see RsGxsChannels::createComment + RS_DEPRECATED_FOR(createCommentV2) + bool createComment(RsGxsComment &comment) override; protected: - // Overloaded from GxsTokenQueue for Request callbacks. - virtual void handleResponse(uint32_t token, uint32_t req_type - , RsTokenService::GxsRequestStatus status) override; + // Overloaded from GxsTokenQueue for Request callbacks. + virtual void handleResponse(uint32_t token, uint32_t req_type + , RsTokenService::GxsRequestStatus status) override; private: bool vote(const RsGxsVote& vote,RsGxsMessageId& voteId,std::string& errorMessage); -static uint32_t channelsAuthenPolicy(); + static uint32_t channelsAuthenPolicy(); - // Handle Processing. - void request_AllSubscribedGroups(); - void request_SpecificSubscribedGroups(const std::list &groups); - void load_SubscribedGroups(const uint32_t &token); + // Handle Processing. + void request_AllSubscribedGroups(); + void request_SpecificSubscribedGroups(const std::list &groups); + void load_SubscribedGroups(const uint32_t &token); - void request_SpecificUnprocessedPosts(std::list > &ids); - void request_GroupUnprocessedPosts(const std::list &grouplist); - void load_unprocessedPosts(uint32_t token); + void request_SpecificUnprocessedPosts(std::list > &ids); + void request_GroupUnprocessedPosts(const std::list &grouplist); + void load_unprocessedPosts(uint32_t token); - void handleUnprocessedPost(const RsGxsChannelPost &msg); + void handleUnprocessedPost(const RsGxsChannelPost &msg); - // Local Cache of Subscribed Groups. and AutoDownload Flag. - void updateSubscribedGroup(const RsGroupMetaData &group); - void clearUnsubscribedGroup(const RsGxsGroupId &id); - bool setAutoDownload(const RsGxsGroupId &groupId, bool enabled); - bool autoDownloadEnabled(const RsGxsGroupId &groupId, bool &enabled); + // Local Cache of Subscribed Groups. and AutoDownload Flag. + void updateSubscribedGroup(const RsGroupMetaData &group); + void clearUnsubscribedGroup(const RsGxsGroupId &id); + bool setAutoDownload(const RsGxsGroupId &groupId, bool enabled); + bool autoDownloadEnabled(const RsGxsGroupId &groupId, bool &enabled); bool checkForOldAndUnusedChannels(); -// DUMMY DATA, -virtual bool generateDummyData(); + // DUMMY DATA, + virtual bool generateDummyData(); -std::string genRandomId(); + std::string genRandomId(); -void dummy_tick(); + void dummy_tick(); -bool generatePost(uint32_t &token, const RsGxsGroupId &grpId); -bool generateComment(uint32_t &token, const RsGxsGroupId &grpId, - const RsGxsMessageId &parentId, const RsGxsMessageId &threadId); -bool generateVote(uint32_t &token, const RsGxsGroupId &grpId, - const RsGxsMessageId &parentId, const RsGxsMessageId &threadId); + bool generatePost(uint32_t &token, const RsGxsGroupId &grpId); + bool generateComment(uint32_t &token, const RsGxsGroupId &grpId, + const RsGxsMessageId &parentId, const RsGxsMessageId &threadId); + bool generateVote(uint32_t &token, const RsGxsGroupId &grpId, + const RsGxsMessageId &parentId, const RsGxsMessageId &threadId); -bool generateGroup(uint32_t &token, std::string groupName); + bool generateGroup(uint32_t &token, std::string groupName); - class ChannelDummyRef - { - public: - ChannelDummyRef() {} - ChannelDummyRef( - const RsGxsGroupId &grpId, const RsGxsMessageId &threadId, - const RsGxsMessageId &msgId ) : - mGroupId(grpId), mThreadId(threadId), mMsgId(msgId) {} + class ChannelDummyRef + { + public: + ChannelDummyRef() {} + ChannelDummyRef( + const RsGxsGroupId &grpId, const RsGxsMessageId &threadId, + const RsGxsMessageId &msgId ) : + mGroupId(grpId), mThreadId(threadId), mMsgId(msgId) {} - RsGxsGroupId mGroupId; - RsGxsMessageId mThreadId; - RsGxsMessageId mMsgId; - }; + RsGxsGroupId mGroupId; + RsGxsMessageId mThreadId; + RsGxsMessageId mMsgId; + }; - std::map mSubscribedGroups; - RsMutex mSubscribedGroupsMutex; + std::map mSubscribedGroups; + RsMutex mSubscribedGroupsMutex; - /** G10h4ck: Is this stuff really used? And for what? BEGIN */ - uint32_t mGenToken; - bool mGenActive; - int mGenCount; - std::vector mGenRefs; - RsGxsMessageId mGenThreadId; - /** G10h4ck: Is this stuff really used? And for what? END */ + /** G10h4ck: Is this stuff really used? And for what? BEGIN */ + uint32_t mGenToken; + bool mGenActive; + int mGenCount; + std::vector mGenRefs; + RsGxsMessageId mGenThreadId; + /** G10h4ck: Is this stuff really used? And for what? END */ - p3GxsCommentService* mCommentService; + p3GxsCommentService* mCommentService; - std::map mKnownChannels; - RsMutex mKnownChannelsMutex; + std::map mKnownChannels; + RsMutex mKnownChannelsMutex; rstime_t mLastDistantSearchNotificationTS; std::map > mSearchResultsToNotify; #ifdef TO_REMOVE - /** Store search callbacks with timeout*/ - std::map< - TurtleRequestId, - std::pair< - std::function, - std::chrono::system_clock::time_point > - > mSearchCallbacksMap; - RsMutex mSearchCallbacksMapMutex; + /** Store search callbacks with timeout*/ + std::map< + TurtleRequestId, + std::pair< + std::function, + std::chrono::system_clock::time_point > + > mSearchCallbacksMap; + RsMutex mSearchCallbacksMapMutex; - /** Store distant channels requests callbacks with timeout*/ - std::map< - TurtleRequestId, - std::pair< - std::function, - std::chrono::system_clock::time_point > - > mDistantChannelsCallbacksMap; - RsMutex mDistantChannelsCallbacksMapMutex; + /** Store distant channels requests callbacks with timeout*/ + std::map< + TurtleRequestId, + std::pair< + std::function, + std::chrono::system_clock::time_point > + > mDistantChannelsCallbacksMap; + RsMutex mDistantChannelsCallbacksMapMutex; - /// Cleanup mSearchCallbacksMap and mDistantChannelsCallbacksMap - void cleanTimedOutCallbacks(); + /// Cleanup mSearchCallbacksMap and mDistantChannelsCallbacksMap + void cleanTimedOutCallbacks(); #endif }; diff --git a/src/services/p3posted.cc b/src/services/p3posted.cc index 2779a1583..5126dda5c 100644 --- a/src/services/p3posted.cc +++ b/src/services/p3posted.cc @@ -614,7 +614,11 @@ bool p3Posted::vote(const RsGxsVote& vote,RsGxsMessageId& voteId,std::string& er return true; } -bool p3Posted::setPostReadStatus(const RsGxsGrpMsgIdPair& msgId, bool read) +bool p3Posted::setPostReadStatus(const RsGxsGrpMsgIdPair &msgId, bool read) +{ + return setCommentReadStatus(msgId,read); +} +bool p3Posted::setCommentReadStatus(const RsGxsGrpMsgIdPair &msgId, bool read) { uint32_t token; diff --git a/src/services/p3posted.h b/src/services/p3posted.h index ce7a3c218..9ad7391b4 100644 --- a/src/services/p3posted.h +++ b/src/services/p3posted.h @@ -95,7 +95,8 @@ virtual void receiveHelperChanges(std::vector& changes) RsGxsMessageId& voteId, std::string& errorMessage ) override; - bool setPostReadStatus(const RsGxsGrpMsgIdPair& msgId, bool read) override; + bool setCommentReadStatus(const RsGxsGrpMsgIdPair &msgId, bool read) override; + bool setPostReadStatus(const RsGxsGrpMsgIdPair &msgId, bool read) override; bool getRelatedComments( const RsGxsGroupId& gid,const std::set& msgIds, std::vector &comments ) override;