Extend libresapi with minimal support for channels

The code is not elegant as this version of the API will be soon obsolete
  but it offer a bunch of channels functionalities, comments and votes
  are not implemented yet

/channels/list_channels get all visibile channels
/channels/get_channel get content of a subscribed channel
/channels/toggle_subscribe subscribe/unsubscribe to a channel
/channels/toggle_auto_download set/unset auto-download for files attached
  to posts in a channel
/channels/toggle_read mark a post as read
/channels/create_channel create a new channel
/channels/create_post create a new post in given channel, group_id
  paramenter renamed to channel_id for consistence

mChannels use reference instead of pointer as it must be valid
  for the whole lifetime of the object
RsGxsCommentService and derivatives use proper types for parameter, avoid
  reference when unneeded
This commit is contained in:
Gioacchino Mazzurco 2018-03-28 16:30:35 +02:00
parent 73c6deebf4
commit 8d1f1da242
No known key found for this signature in database
GPG key ID: A1FBCA3872E87051
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;
};