Merge pull request #1264 from G10h4ck/channel_json_api_v2

Channel json api v2
This commit is contained in:
G10h4ck 2018-05-16 10:49:28 +02:00 committed by GitHub
commit 9f37b63e4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 449 additions and 77 deletions

View file

@ -124,24 +124,27 @@ class RsGxsComment
};
class RsGxsCommentService
struct RsGxsCommentService
{
public:
RsGxsCommentService() {}
virtual ~RsGxsCommentService() {}
RsGxsCommentService() { return; }
virtual ~RsGxsCommentService() { return; }
/** Get previously requested comment data with token */
virtual bool getCommentData( uint32_t token,
std::vector<RsGxsComment> &comments ) = 0;
virtual bool getRelatedComments( uint32_t token,
std::vector<RsGxsComment> &comments ) = 0;
virtual bool getCommentData(const uint32_t &token, std::vector<RsGxsComment> &comments) = 0;
virtual bool getRelatedComments(const uint32_t &token, std::vector<RsGxsComment> &comments) = 0;
virtual bool createComment(uint32_t &token, RsGxsComment &comment) = 0;
virtual bool createVote(uint32_t &token, RsGxsVote &vote) = 0;
//virtual bool getDetailedCommentData(const uint32_t &token, std::vector<RsGxsComment> &comments);
virtual bool createComment(uint32_t &token, RsGxsComment &comment) = 0;
virtual bool createVote(uint32_t &token, RsGxsVote &vote) = 0;
virtual bool acknowledgeComment(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId) = 0;
virtual bool acknowledgeVote(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId) = 0;
virtual bool acknowledgeComment(
uint32_t token,
std::pair<RsGxsGroupId, RsGxsMessageId>& msgId ) = 0;
virtual bool acknowledgeVote(
uint32_t token,
std::pair<RsGxsGroupId, RsGxsMessageId>& msgId ) = 0;
};

View file

@ -1179,7 +1179,9 @@ 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( uint32_t& token,
const RsGxsGrpMsgIdPair& msgId,
bool read )
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << "p3GxsChannels::setMessageReadStatus()";
@ -1189,10 +1191,8 @@ void p3GxsChannels::setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPai
/* Always remove status unprocessed */
uint32_t mask = GXS_SERV::GXS_MSG_STATUS_GUI_NEW | GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD;
uint32_t status = GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD;
if (read)
{
status = 0;
}
if (read) status = 0;
setMsgStatusFlags(token, msgId, status, mask);
}

View file

@ -108,15 +108,12 @@ virtual bool setChannelDownloadDirectory(const RsGxsGroupId &groupId, const std:
virtual bool getChannelDownloadDirectory(const RsGxsGroupId &groupId, std::string& directory);
/* Comment service - Provide RsGxsCommentService - redirect to p3GxsCommentService */
virtual bool getCommentData(const uint32_t &token, std::vector<RsGxsComment> &msgs)
{
return mCommentService->getGxsCommentData(token, msgs);
}
virtual bool getCommentData(uint32_t token, std::vector<RsGxsComment> &msgs)
{ return mCommentService->getGxsCommentData(token, msgs); }
virtual bool getRelatedComments(const uint32_t &token, std::vector<RsGxsComment> &msgs)
{
return mCommentService->getGxsRelatedComments(token, msgs);
}
virtual bool getRelatedComments( uint32_t token,
std::vector<RsGxsComment> &msgs )
{ return mCommentService->getGxsRelatedComments(token, msgs); }
virtual bool createComment(uint32_t &token, RsGxsComment &msg)
{
@ -128,13 +125,13 @@ virtual bool createVote(uint32_t &token, RsGxsVote &msg)
return mCommentService->createGxsVote(token, msg);
}
virtual bool acknowledgeComment(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId)
virtual bool acknowledgeComment(uint32_t token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId)
{
return acknowledgeMsg(token, msgId);
}
virtual bool acknowledgeVote(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId)
virtual bool acknowledgeVote(uint32_t token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId)
{
if (mCommentService->acknowledgeVote(token, msgId))
{

View file

@ -83,16 +83,14 @@ virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgI
}
/* Comment service - Provide RsGxsCommentService - redirect to p3GxsCommentService */
virtual bool getCommentData(const uint32_t &token, std::vector<RsGxsComment> &msgs)
{
return mCommentService->getGxsCommentData(token, msgs);
}
/** Comment service - Provide RsGxsCommentService -
* redirect to p3GxsCommentService */
virtual bool getCommentData(uint32_t token, std::vector<RsGxsComment> &msgs)
{ return mCommentService->getGxsCommentData(token, msgs); }
virtual bool getRelatedComments(const uint32_t &token, std::vector<RsGxsComment> &msgs)
{
return mCommentService->getGxsRelatedComments(token, msgs);
}
virtual bool getRelatedComments( uint32_t token,
std::vector<RsGxsComment> &msgs )
{ return mCommentService->getGxsRelatedComments(token, msgs); }
virtual bool createComment(uint32_t &token, RsGxsComment &msg)
{
@ -104,17 +102,14 @@ virtual bool createVote(uint32_t &token, RsGxsVote &msg)
return mCommentService->createGxsVote(token, msg);
}
virtual bool acknowledgeComment(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId)
{
return acknowledgeMsg(token, msgId);
}
virtual bool acknowledgeComment(
uint32_t token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId )
{ return acknowledgeMsg(token, msgId); }
virtual bool acknowledgeVote(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId)
virtual bool acknowledgeVote(
uint32_t token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId )
{
if (mCommentService->acknowledgeVote(token, msgId))
{
return true;
}
if (mCommentService->acknowledgeVote(token, msgId)) return true;
return acknowledgeMsg(token, msgId);
}
};