Merge pull request #1881 from PhenomRetroShare/Add_VotesOn_getPostData

Add Votes when calling getPostData.
This commit is contained in:
csoler 2020-05-21 22:38:06 +02:00 committed by GitHub
commit 2a5adddc3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 208 additions and 117 deletions

View File

@ -314,7 +314,8 @@ public:
*/ */
virtual bool getChannelAllContent( const RsGxsGroupId& channelId, virtual bool getChannelAllContent( const RsGxsGroupId& channelId,
std::vector<RsGxsChannelPost>& posts, std::vector<RsGxsChannelPost>& posts,
std::vector<RsGxsComment>& comments ) = 0; std::vector<RsGxsComment>& comments,
std::vector<RsGxsVote>& votes ) = 0;
/** /**
* @brief Get channel messages and comments corresponding to the given IDs. * @brief Get channel messages and comments corresponding to the given IDs.
@ -326,12 +327,14 @@ public:
* @param[in] contentsIds ids of requested contents * @param[in] contentsIds ids of requested contents
* @param[out] posts storage for posts * @param[out] posts storage for posts
* @param[out] comments storage for the comments * @param[out] comments storage for the comments
* @param[out] votes storage for the votes
* @return false if something failed, true otherwhise * @return false if something failed, true otherwhise
*/ */
virtual bool getChannelContent( const RsGxsGroupId& channelId, virtual bool getChannelContent( const RsGxsGroupId& channelId,
const std::set<RsGxsMessageId>& contentsIds, const std::set<RsGxsMessageId>& contentsIds,
std::vector<RsGxsChannelPost>& posts, std::vector<RsGxsChannelPost>& posts,
std::vector<RsGxsComment>& comments ) = 0; std::vector<RsGxsComment>& comments,
std::vector<RsGxsVote>& votes ) = 0;
/** /**
* @brief Get channel comments corresponding to the given IDs. * @brief Get channel comments corresponding to the given IDs.
@ -571,6 +574,9 @@ public:
RS_DEPRECATED_FOR(getChannelsInfo) RS_DEPRECATED_FOR(getChannelsInfo)
virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsChannelGroup> &groups) = 0; virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsChannelGroup> &groups) = 0;
RS_DEPRECATED_FOR(getChannelContent)
virtual bool getPostData(const uint32_t &token, std::vector<RsGxsChannelPost> &posts, std::vector<RsGxsComment> &cmts, std::vector<RsGxsVote> &votes) = 0;
RS_DEPRECATED_FOR(getChannelContent) RS_DEPRECATED_FOR(getChannelContent)
virtual bool getPostData(const uint32_t &token, std::vector<RsGxsChannelPost> &posts, std::vector<RsGxsComment> &cmts) = 0; virtual bool getPostData(const uint32_t &token, std::vector<RsGxsChannelPost> &posts, std::vector<RsGxsComment> &cmts) = 0;

View File

@ -154,13 +154,15 @@ public:
virtual bool getBoardAllContent( virtual bool getBoardAllContent(
const RsGxsGroupId& boardId, const RsGxsGroupId& boardId,
std::vector<RsPostedPost>& posts, std::vector<RsPostedPost>& posts,
std::vector<RsGxsComment>& comments ) = 0; std::vector<RsGxsComment>& comments,
std::vector<RsGxsVote>& votes ) = 0;
virtual bool getBoardContent( virtual bool getBoardContent(
const RsGxsGroupId& boardId, const RsGxsGroupId& boardId,
const std::set<RsGxsMessageId>& contentsIds, const std::set<RsGxsMessageId>& contentsIds,
std::vector<RsPostedPost>& posts, std::vector<RsPostedPost>& posts,
std::vector<RsGxsComment>& comments ) = 0; std::vector<RsGxsComment>& comments,
std::vector<RsGxsVote>& votes ) = 0;
virtual bool editBoard(RsPostedGroup& board) =0; virtual bool editBoard(RsPostedGroup& board) =0;
@ -176,6 +178,11 @@ public:
virtual bool getGroupData( const uint32_t& token, virtual bool getGroupData( const uint32_t& token,
std::vector<RsPostedGroup> &groups ) = 0; std::vector<RsPostedGroup> &groups ) = 0;
RS_DEPRECATED_FOR(getBoardsContent)
virtual bool getPostData(
const uint32_t& token, std::vector<RsPostedPost>& posts,
std::vector<RsGxsComment>& cmts, std::vector<RsGxsVote>& vots) = 0;
RS_DEPRECATED_FOR(getBoardsContent) RS_DEPRECATED_FOR(getBoardsContent)
virtual bool getPostData( virtual bool getPostData(
const uint32_t& token, std::vector<RsPostedPost>& posts, const uint32_t& token, std::vector<RsPostedPost>& posts,

View File

@ -452,16 +452,17 @@ bool p3GxsChannels::groupShareKeys(
bool p3GxsChannels::getPostData( bool p3GxsChannels::getPostData(
const uint32_t &token, std::vector<RsGxsChannelPost> &msgs, const uint32_t &token, std::vector<RsGxsChannelPost> &msgs,
std::vector<RsGxsComment> &cmts ) std::vector<RsGxsComment> &cmts,
std::vector<RsGxsVote> &vots)
{ {
#ifdef GXSCHANNELS_DEBUG #ifdef GXSCHANNELS_DEBUG
std::cerr << __PRETTY_FUNCTION__ << std::cerr << std::endl; RsDbg() << __PRETTY_FUNCTION__ << std::endl;
#endif #endif
GxsMsgDataMap msgData; GxsMsgDataMap msgData;
if(!RsGenExchange::getMsgData(token, msgData)) if(!RsGenExchange::getMsgData(token, msgData))
{ {
std::cerr << __PRETTY_FUNCTION__ <<" ERROR in request" << std::endl; RsErr() << __PRETTY_FUNCTION__ << " ERROR in request" << std::endl;
return false; return false;
} }
@ -495,39 +496,62 @@ bool p3GxsChannels::getPostData(
cmt = cmtItem->mMsg; cmt = cmtItem->mMsg;
cmt.mMeta = mi->meta; cmt.mMeta = mi->meta;
#ifdef GXSCOMMENT_DEBUG #ifdef GXSCOMMENT_DEBUG
std::cerr << "p3GxsChannels::getPostData Found Comment:" << std::endl; RsDbg() << __PRETTY_FUNCTION__ << " Found Comment:" << std::endl;
cmt.print(std::cerr," ", "cmt"); cmt.print(std::cerr," ", "cmt");
#endif #endif
cmts.push_back(cmt); cmts.push_back(cmt);
delete cmtItem; delete cmtItem;
} }
else else
{
RsGxsVoteItem* votItem =
dynamic_cast<RsGxsVoteItem*>(*vit);
if(votItem)
{
RsGxsVote vot;
RsGxsMsgItem *mi = (*vit);
vot = votItem->mMsg;
vot.mMeta = mi->meta;
vots.push_back(vot);
delete votItem;
}
else
{ {
RsGxsMsgItem* msg = (*vit); RsGxsMsgItem* msg = (*vit);
//const uint16_t RS_SERVICE_GXS_TYPE_CHANNELS = 0x0217; //const uint16_t RS_SERVICE_GXS_TYPE_CHANNELS = 0x0217;
//const uint8_t RS_PKT_SUBTYPE_GXSCHANNEL_POST_ITEM = 0x03; //const uint8_t RS_PKT_SUBTYPE_GXSCHANNEL_POST_ITEM = 0x03;
//const uint8_t RS_PKT_SUBTYPE_GXSCOMMENT_COMMENT_ITEM = 0xf1; //const uint8_t RS_PKT_SUBTYPE_GXSCOMMENT_COMMENT_ITEM = 0xf1;
std::cerr << __PRETTY_FUNCTION__ //const uint8_t RS_PKT_SUBTYPE_GXSCOMMENT_VOTE_ITEM = 0xf2;
RsErr() << __PRETTY_FUNCTION__
<< " Not a GxsChannelPostItem neither a " << " Not a GxsChannelPostItem neither a "
<< "RsGxsCommentItem PacketService=" << std::hex << "RsGxsCommentItem neither a RsGxsVoteItem"
<< (int)msg->PacketService() << std::dec << " PacketService=" << std::hex << (int)msg->PacketService() << std::dec
<< " PacketSubType=" << std::hex << " PacketSubType=" << std::hex << (int)msg->PacketSubType() << std::dec
<< (int)msg->PacketSubType() << std::dec << " type name =" << typeid(*msg).name()
<< " , deleting!" << std::endl; << " , deleting!" << std::endl;
delete *vit; delete *vit;
} }
} }
} }
} }
}
return true; return true;
} }
bool p3GxsChannels::getPostData(
const uint32_t& token, std::vector<RsGxsChannelPost>& posts, std::vector<RsGxsComment>& cmts )
{
std::vector<RsGxsVote> vots;
return getPostData(token, posts, cmts, vots);
}
bool p3GxsChannels::getPostData( bool p3GxsChannels::getPostData(
const uint32_t& token, std::vector<RsGxsChannelPost>& posts ) const uint32_t& token, std::vector<RsGxsChannelPost>& posts )
{ {
std::vector<RsGxsComment> cmts; std::vector<RsGxsComment> cmts;
return getPostData(token, posts, cmts); std::vector<RsGxsVote> vots;
return getPostData(token, posts, cmts, vots);
} }
//Not currently used //Not currently used
@ -1091,7 +1115,8 @@ bool p3GxsChannels::getContentSummaries(
bool p3GxsChannels::getChannelAllContent( const RsGxsGroupId& channelId, bool p3GxsChannels::getChannelAllContent( const RsGxsGroupId& channelId,
std::vector<RsGxsChannelPost>& posts, std::vector<RsGxsChannelPost>& posts,
std::vector<RsGxsComment>& comments ) std::vector<RsGxsComment>& comments,
std::vector<RsGxsVote>& votes )
{ {
uint32_t token; uint32_t token;
RsTokReqOptions opts; RsTokReqOptions opts;
@ -1100,13 +1125,14 @@ bool p3GxsChannels::getChannelAllContent( const RsGxsGroupId& channelId,
if( !requestMsgInfo(token, opts,std::list<RsGxsGroupId>({channelId})) || waitToken(token) != RsTokenService::COMPLETE ) if( !requestMsgInfo(token, opts,std::list<RsGxsGroupId>({channelId})) || waitToken(token) != RsTokenService::COMPLETE )
return false; return false;
return getPostData(token, posts, comments); return getPostData(token, posts, comments,votes);
} }
bool p3GxsChannels::getChannelContent( const RsGxsGroupId& channelId, bool p3GxsChannels::getChannelContent( const RsGxsGroupId& channelId,
const std::set<RsGxsMessageId>& contentIds, const std::set<RsGxsMessageId>& contentIds,
std::vector<RsGxsChannelPost>& posts, std::vector<RsGxsChannelPost>& posts,
std::vector<RsGxsComment>& comments ) std::vector<RsGxsComment>& comments,
std::vector<RsGxsVote>& votes )
{ {
uint32_t token; uint32_t token;
RsTokReqOptions opts; RsTokReqOptions opts;
@ -1118,7 +1144,7 @@ bool p3GxsChannels::getChannelContent( const RsGxsGroupId& channelId,
if( !requestMsgInfo(token, opts, msgIds) || waitToken(token) != RsTokenService::COMPLETE ) if( !requestMsgInfo(token, opts, msgIds) || waitToken(token) != RsTokenService::COMPLETE )
return false; return false;
return getPostData(token, posts, comments); return getPostData(token, posts, comments, votes);
} }
bool p3GxsChannels::getChannelComments(const RsGxsGroupId &channelId, bool p3GxsChannels::getChannelComments(const RsGxsGroupId &channelId,
@ -1293,8 +1319,9 @@ bool p3GxsChannels::createVoteV2(
std::set<RsGxsMessageId> s({commentId}); std::set<RsGxsMessageId> s({commentId});
std::vector<RsGxsChannelPost> posts; std::vector<RsGxsChannelPost> posts;
std::vector<RsGxsComment> comments; std::vector<RsGxsComment> comments;
std::vector<RsGxsVote> votes;
if(!getChannelContent(channelId, s, posts, comments)) if(!getChannelContent(channelId, s, posts, comments, votes))
{ {
errorMessage = "You cannot vote on comment " errorMessage = "You cannot vote on comment "
+ commentId.toStdString() + " of channel with Id " + commentId.toStdString() + " of channel with Id "
@ -1454,8 +1481,9 @@ bool p3GxsChannels::createPostV2(
std::set<RsGxsMessageId> s({origPostId}); std::set<RsGxsMessageId> s({origPostId});
std::vector<RsGxsChannelPost> posts; std::vector<RsGxsChannelPost> posts;
std::vector<RsGxsComment> comments; std::vector<RsGxsComment> comments;
std::vector<RsGxsVote> votes;
if(!getChannelContent(channelId,s,posts,comments)) if(!getChannelContent(channelId,s,posts,comments,votes))
{ {
errorMessage = "You cannot edit post " + origPostId.toStdString() errorMessage = "You cannot edit post " + origPostId.toStdString()
+ " of channel with Id " + channelId.toStdString() + " of channel with Id " + channelId.toStdString()
@ -1525,9 +1553,11 @@ bool p3GxsChannels::createCommentV2(
std::vector<RsGxsChannelPost> posts; std::vector<RsGxsChannelPost> posts;
std::vector<RsGxsComment> comments; std::vector<RsGxsComment> comments;
std::vector<RsGxsVote> votes;
if(!getChannelContent( // does the post thread exist? if(!getChannelContent( // does the post thread exist?
channelId,std::set<RsGxsMessageId>({threadId}), posts, comments )) channelId, std::set<RsGxsMessageId>({threadId}),
posts, comments, votes) )
return failure( "You cannot comment post " + threadId.toStdString() + return failure( "You cannot comment post " + threadId.toStdString() +
" of channel with Id " + channelId.toStdString() + " of channel with Id " + channelId.toStdString() +
": this post does not exists locally!" ); ": this post does not exists locally!" );
@ -1539,19 +1569,18 @@ bool p3GxsChannels::createCommentV2(
": supplied threadId is not a thread, or parentMsgId is" ": supplied threadId is not a thread, or parentMsgId is"
" not a comment!"); " not a comment!");
if(!getChannelContent( // does the post thread exist? if(!getChannelContent( // does the post parent exist?
channelId, std::set<RsGxsMessageId>({parentId}), channelId, std::set<RsGxsMessageId>({parentId}),
posts, comments )) posts, comments, votes) )
return failure( "You cannot comment post " + parentId.toStdString() + return failure( "You cannot comment post " + parentId.toStdString() +
": supplied parent doesn't exists locally!" ); ": supplied parent doesn't exists locally!" );
if(!origCommentId.isNull()) if(!origCommentId.isNull())
{ {
std::set<RsGxsMessageId> s({origCommentId}); std::set<RsGxsMessageId> s({origCommentId});
std::vector<RsGxsChannelPost> posts; std::vector<RsGxsComment> cmts;
std::vector<RsGxsComment> comments;
if( !getChannelContent(channelId, s, posts, comments) || if( !getChannelContent(channelId, s, posts, cmts, votes) ||
comments.size() != 1 ) comments.size() != 1 )
return failure( "You cannot edit comment " + return failure( "You cannot edit comment " +
origCommentId.toStdString() + origCommentId.toStdString() +

View File

@ -82,9 +82,10 @@ virtual void handle_event(uint32_t event_type, const std::string &elabel);
public: public:
virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsChannelGroup> &groups); virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsChannelGroup> &groups ) override;
virtual bool getPostData(const uint32_t &token, std::vector<RsGxsChannelPost> &posts, std::vector<RsGxsComment> &cmts); virtual bool getPostData(const uint32_t &token, std::vector<RsGxsChannelPost> &posts, std::vector<RsGxsComment> &cmts, std::vector<RsGxsVote> &vots) override;
virtual bool getPostData(const uint32_t &token, std::vector<RsGxsChannelPost> &posts); virtual bool getPostData(const uint32_t &token, std::vector<RsGxsChannelPost> &posts, std::vector<RsGxsComment> &cmts) override;
virtual bool getPostData(const uint32_t &token, std::vector<RsGxsChannelPost> &posts) override;
//Not currently used //Not currently used
//virtual bool getRelatedPosts(const uint32_t &token, std::vector<RsGxsChannelPost> &posts); //virtual bool getRelatedPosts(const uint32_t &token, std::vector<RsGxsChannelPost> &posts);
@ -188,13 +189,15 @@ virtual bool ExtraFileRemove(const RsFileHash &hash);
/// Implementation of @see RsGxsChannels::getChannelAllMessages /// Implementation of @see RsGxsChannels::getChannelAllMessages
bool getChannelAllContent(const RsGxsGroupId& channelId, bool getChannelAllContent(const RsGxsGroupId& channelId,
std::vector<RsGxsChannelPost>& posts, std::vector<RsGxsChannelPost>& posts,
std::vector<RsGxsComment>& comments ) override; std::vector<RsGxsComment>& comments,
std::vector<RsGxsVote>& votes ) override;
/// Implementation of @see RsGxsChannels::getChannelMessages /// Implementation of @see RsGxsChannels::getChannelMessages
bool getChannelContent(const RsGxsGroupId& channelId, bool getChannelContent(const RsGxsGroupId& channelId,
const std::set<RsGxsMessageId>& contentIds, const std::set<RsGxsMessageId>& contentIds,
std::vector<RsGxsChannelPost>& posts, std::vector<RsGxsChannelPost>& posts,
std::vector<RsGxsComment>& comments ) override; std::vector<RsGxsComment>& comments,
std::vector<RsGxsVote>& votes ) override;
/// Implementation of @see RsGxsChannels::getChannelComments /// Implementation of @see RsGxsChannels::getChannelComments
virtual bool getChannelComments(const RsGxsGroupId &channelId, virtual bool getChannelComments(const RsGxsGroupId &channelId,

View File

@ -94,19 +94,23 @@ bool p3Posted::getGroupData(const uint32_t &token, std::vector<RsPostedGroup> &g
return ok; return ok;
} }
bool p3Posted::getPostData(const uint32_t &token, std::vector<RsPostedPost> &msgs, std::vector<RsGxsComment> &cmts) bool p3Posted::getPostData(
const uint32_t &token, std::vector<RsPostedPost> &msgs,
std::vector<RsGxsComment> &cmts,
std::vector<RsGxsVote> &vots)
{ {
#ifdef POSTED_DEBUG #ifdef POSTED_DEBUG
std::cerr << "p3Posted::getPostData()"; RsDbg() << __PRETTY_FUNCTION__ << std::endl;
std::cerr << std::endl;
#endif #endif
GxsMsgDataMap msgData; GxsMsgDataMap msgData;
bool ok = RsGenExchange::getMsgData(token, msgData);
rstime_t now = time(NULL); rstime_t now = time(NULL);
if(!RsGenExchange::getMsgData(token, msgData))
if(ok)
{ {
RsErr() << __PRETTY_FUNCTION__ << " ERROR in request" << std::endl;
return false;
}
GxsMsgDataMap::iterator mit = msgData.begin(); GxsMsgDataMap::iterator mit = msgData.begin();
for(; mit != msgData.end(); ++mit) for(; mit != msgData.end(); ++mit)
@ -116,10 +120,12 @@ bool p3Posted::getPostData(const uint32_t &token, std::vector<RsPostedPost> &msg
for(; vit != msgItems.end(); ++vit) for(; vit != msgItems.end(); ++vit)
{ {
RsGxsPostedPostItem* postItem = dynamic_cast<RsGxsPostedPostItem*>(*vit); RsGxsPostedPostItem* postItem =
dynamic_cast<RsGxsPostedPostItem*>(*vit);
if(postItem) if(postItem)
{ {
// TODO Really needed all of these lines?
RsPostedPost msg = postItem->mPost; RsPostedPost msg = postItem->mPost;
msg.mMeta = postItem->meta; msg.mMeta = postItem->meta;
postItem->toPostedPost(msg, true); postItem->toPostedPost(msg, true);
@ -130,7 +136,8 @@ bool p3Posted::getPostData(const uint32_t &token, std::vector<RsPostedPost> &msg
} }
else else
{ {
RsGxsCommentItem* cmtItem = dynamic_cast<RsGxsCommentItem*>(*vit); RsGxsCommentItem* cmtItem =
dynamic_cast<RsGxsCommentItem*>(*vit);
if(cmtItem) if(cmtItem)
{ {
RsGxsComment cmt; RsGxsComment cmt;
@ -138,19 +145,35 @@ bool p3Posted::getPostData(const uint32_t &token, std::vector<RsPostedPost> &msg
cmt = cmtItem->mMsg; cmt = cmtItem->mMsg;
cmt.mMeta = mi->meta; cmt.mMeta = mi->meta;
#ifdef GXSCOMMENT_DEBUG #ifdef GXSCOMMENT_DEBUG
std::cerr << "p3Posted::getPostData Found Comment:" << std::endl; RsDbg() << __PRETTY_FUNCTION__ << " Found Comment:" << std::endl;
cmt.print(std::cerr," ", "cmt"); cmt.print(std::cerr," ", "cmt");
#endif #endif
cmts.push_back(cmt); cmts.push_back(cmt);
delete cmtItem; delete cmtItem;
} }
else else
{
RsGxsVoteItem* votItem =
dynamic_cast<RsGxsVoteItem*>(*vit);
if(votItem)
{
RsGxsVote vot;
RsGxsMsgItem *mi = (*vit);
vot = votItem->mMsg;
vot.mMeta = mi->meta;
vots.push_back(vot);
delete votItem;
}
else
{ {
RsGxsMsgItem* msg = (*vit); RsGxsMsgItem* msg = (*vit);
//const uint16_t RS_SERVICE_GXS_TYPE_CHANNELS = 0x0217; //const uint16_t RS_SERVICE_GXS_TYPE_CHANNELS = 0x0217;
//const uint8_t RS_PKT_SUBTYPE_GXSCHANNEL_POST_ITEM = 0x03; //const uint8_t RS_PKT_SUBTYPE_GXSCHANNEL_POST_ITEM = 0x03;
//const uint8_t RS_PKT_SUBTYPE_GXSCOMMENT_COMMENT_ITEM = 0xf1; //const uint8_t RS_PKT_SUBTYPE_GXSCOMMENT_COMMENT_ITEM = 0xf1;
std::cerr << "Not a PostedPostItem neither a RsGxsCommentItem" //const uint8_t RS_PKT_SUBTYPE_GXSCOMMENT_VOTE_ITEM = 0xf2;
RsErr() << __PRETTY_FUNCTION__
<< "Not a PostedPostItem neither a "
<< "RsGxsCommentItem neither a RsGxsVoteItem"
<< " PacketService=" << std::hex << (int)msg->PacketService() << std::dec << " PacketService=" << std::hex << (int)msg->PacketService() << std::dec
<< " PacketSubType=" << std::hex << (int)msg->PacketSubType() << std::dec << " PacketSubType=" << std::hex << (int)msg->PacketSubType() << std::dec
<< " type name =" << typeid(*msg).name() << " type name =" << typeid(*msg).name()
@ -161,13 +184,23 @@ bool p3Posted::getPostData(const uint32_t &token, std::vector<RsPostedPost> &msg
} }
} }
} }
else
{
std::cerr << "p3GxsChannels::getPostData() ERROR in request";
std::cerr << std::endl;
}
return ok; return true;
}
bool p3Posted::getPostData(
const uint32_t &token, std::vector<RsPostedPost> &posts, std::vector<RsGxsComment> &cmts)
{
std::vector<RsGxsVote> vots;
return getPostData( token, posts, cmts, vots);
}
bool p3Posted::getPostData(
const uint32_t &token, std::vector<RsPostedPost> &posts)
{
std::vector<RsGxsComment> cmts;
std::vector<RsGxsVote> vots;
return getPostData( token, posts, cmts, vots);
} }
//Not currently used //Not currently used
@ -324,7 +357,8 @@ bool p3Posted::getBoardsInfo(
bool p3Posted::getBoardAllContent( const RsGxsGroupId& groupId, bool p3Posted::getBoardAllContent( const RsGxsGroupId& groupId,
std::vector<RsPostedPost>& posts, std::vector<RsPostedPost>& posts,
std::vector<RsGxsComment>& comments ) std::vector<RsGxsComment>& comments,
std::vector<RsGxsVote>& votes )
{ {
uint32_t token; uint32_t token;
RsTokReqOptions opts; RsTokReqOptions opts;
@ -333,13 +367,14 @@ bool p3Posted::getBoardAllContent( const RsGxsGroupId& groupId,
if( !requestMsgInfo(token, opts, std::list<RsGxsGroupId>({groupId})) || waitToken(token) != RsTokenService::COMPLETE ) if( !requestMsgInfo(token, opts, std::list<RsGxsGroupId>({groupId})) || waitToken(token) != RsTokenService::COMPLETE )
return false; return false;
return getPostData(token, posts, comments); return getPostData(token, posts, comments, votes);
} }
bool p3Posted::getBoardContent( const RsGxsGroupId& groupId, bool p3Posted::getBoardContent( const RsGxsGroupId& groupId,
const std::set<RsGxsMessageId>& contentsIds, const std::set<RsGxsMessageId>& contentsIds,
std::vector<RsPostedPost>& posts, std::vector<RsPostedPost>& posts,
std::vector<RsGxsComment>& comments ) std::vector<RsGxsComment>& comments,
std::vector<RsGxsVote>& votes )
{ {
uint32_t token; uint32_t token;
RsTokReqOptions opts; RsTokReqOptions opts;
@ -351,7 +386,7 @@ bool p3Posted::getBoardContent( const RsGxsGroupId& groupId,
if( !requestMsgInfo(token, opts, msgIds) || if( !requestMsgInfo(token, opts, msgIds) ||
waitToken(token) != RsTokenService::COMPLETE ) return false; waitToken(token) != RsTokenService::COMPLETE ) return false;
return getPostData(token, posts, comments); return getPostData(token, posts, comments, votes);
} }
bool p3Posted::getBoardsSummaries(std::list<RsGroupMetaData>& boards ) bool p3Posted::getBoardsSummaries(std::list<RsGroupMetaData>& boards )

View File

@ -65,12 +65,14 @@ virtual void receiveHelperChanges(std::vector<RsGxsNotify*>& changes)
bool getBoardAllContent(const RsGxsGroupId& groupId, bool getBoardAllContent(const RsGxsGroupId& groupId,
std::vector<RsPostedPost>& posts, std::vector<RsPostedPost>& posts,
std::vector<RsGxsComment>& comments ) override; std::vector<RsGxsComment>& comments,
std::vector<RsGxsVote>& votes ) override;
bool getBoardContent(const RsGxsGroupId& groupId, bool getBoardContent(const RsGxsGroupId& groupId,
const std::set<RsGxsMessageId>& contentsIds, const std::set<RsGxsMessageId>& contentsIds,
std::vector<RsPostedPost>& posts, std::vector<RsPostedPost>& posts,
std::vector<RsGxsComment>& comments ) override; std::vector<RsGxsComment>& comments,
std::vector<RsGxsVote>& votes ) override;
bool getBoardsSummaries(std::list<RsGroupMetaData>& groupInfo) override; bool getBoardsSummaries(std::list<RsGroupMetaData>& groupInfo) override;
@ -82,9 +84,10 @@ virtual void receiveHelperChanges(std::vector<RsGxsNotify*>& changes)
bool createBoard(RsPostedGroup& board) override; bool createBoard(RsPostedGroup& board) override;
virtual bool getGroupData(const uint32_t &token, std::vector<RsPostedGroup> &groups); virtual bool getGroupData(const uint32_t &token, std::vector<RsPostedGroup> &groups) override;
virtual bool getPostData(const uint32_t &token, std::vector<RsPostedPost> &posts, std::vector<RsGxsComment> &cmts); virtual bool getPostData(const uint32_t &token, std::vector<RsPostedPost> &posts, std::vector<RsGxsComment> &cmts, std::vector<RsGxsVote> &vots) override;
virtual bool getPostData(const uint32_t &token, std::vector<RsPostedPost> &posts) { std::vector<RsGxsComment> cmts; return getPostData( token, posts, cmts);} virtual bool getPostData(const uint32_t &token, std::vector<RsPostedPost> &posts, std::vector<RsGxsComment> &cmts) override;
virtual bool getPostData(const uint32_t &token, std::vector<RsPostedPost> &posts) override;
//Not currently used //Not currently used
//virtual bool getRelatedPosts(const uint32_t &token, std::vector<RsPostedPost> &posts); //virtual bool getRelatedPosts(const uint32_t &token, std::vector<RsPostedPost> &posts);

View File

@ -167,8 +167,9 @@ void BasePostedItem::loadMessage()
std::vector<RsPostedPost> posts; std::vector<RsPostedPost> posts;
std::vector<RsGxsComment> comments; std::vector<RsGxsComment> comments;
std::vector<RsGxsVote> votes;
if(! rsPosted->getBoardContent( groupId(), std::set<RsGxsMessageId>( { messageId() } ),posts,comments)) if(! rsPosted->getBoardContent( groupId(), std::set<RsGxsMessageId>( { messageId() } ),posts,comments,votes))
{ {
RsErr() << "BasePostedItem::loadMessage() ERROR getting data" << std::endl; RsErr() << "BasePostedItem::loadMessage() ERROR getting data" << std::endl;
mIsLoadingMessage = false; mIsLoadingMessage = false;
@ -227,8 +228,9 @@ void BasePostedItem::loadComment()
std::vector<RsPostedPost> posts; std::vector<RsPostedPost> posts;
std::vector<RsGxsComment> comments; std::vector<RsGxsComment> comments;
std::vector<RsGxsVote> votes;
if(! rsPosted->getBoardContent( groupId(),msgIds,posts,comments)) if(! rsPosted->getBoardContent( groupId(),msgIds,posts,comments,votes))
{ {
RsErr() << "BasePostedItem::loadGroup() ERROR getting data" << std::endl; RsErr() << "BasePostedItem::loadGroup() ERROR getting data" << std::endl;
mIsLoadingComment = false; mIsLoadingComment = false;

View File

@ -1033,8 +1033,9 @@ void PostedListWidget::getMsgData(const std::set<RsGxsMessageId>& msgIds,std::ve
{ {
std::vector<RsPostedPost> posts; std::vector<RsPostedPost> posts;
std::vector<RsGxsComment> comments; std::vector<RsGxsComment> comments;
std::vector<RsGxsVote> votes;
rsPosted->getBoardContent( groupId(),msgIds,posts,comments ); rsPosted->getBoardContent( groupId(),msgIds,posts,comments,votes );
psts.clear(); psts.clear();
@ -1046,8 +1047,9 @@ void PostedListWidget::getAllMsgData(std::vector<RsGxsGenericMsgData*>& psts)
{ {
std::vector<RsPostedPost> posts; std::vector<RsPostedPost> posts;
std::vector<RsGxsComment> comments; std::vector<RsGxsComment> comments;
std::vector<RsGxsVote> votes;
rsPosted->getBoardAllContent( groupId(),posts,comments ); rsPosted->getBoardAllContent( groupId(),posts,comments,votes );
psts.clear(); psts.clear();

View File

@ -319,8 +319,9 @@ void GxsChannelPostItem::loadMessage()
std::vector<RsGxsChannelPost> posts; std::vector<RsGxsChannelPost> posts;
std::vector<RsGxsComment> comments; std::vector<RsGxsComment> comments;
std::vector<RsGxsVote> votes;
if(! rsGxsChannels->getChannelContent( groupId(), std::set<RsGxsMessageId>( { messageId() } ),posts,comments)) if(! rsGxsChannels->getChannelContent( groupId(), std::set<RsGxsMessageId>( { messageId() } ),posts,comments,votes))
{ {
RsErr() << "GxsGxsChannelGroupItem::loadGroup() ERROR getting data" << std::endl; RsErr() << "GxsGxsChannelGroupItem::loadGroup() ERROR getting data" << std::endl;
return; return;

View File

@ -738,8 +738,9 @@ void CreateGxsChannelMsg::loadOriginalChannelPostInfo()
{ {
std::vector<RsGxsChannelPost> posts; std::vector<RsGxsChannelPost> posts;
std::vector<RsGxsComment> comments; std::vector<RsGxsComment> comments;
std::vector<RsGxsVote> votes;
if( !rsGxsChannels->getChannelContent(mChannelId,std::set<RsGxsMessageId>({mOrigPostId}),posts,comments) || posts.size() != 1) if( !rsGxsChannels->getChannelContent(mChannelId,std::set<RsGxsMessageId>({mOrigPostId}),posts,comments,votes) || posts.size() != 1)
{ {
std::cerr << "Cannot get channel post data for channel " << mChannelId << " and post " << mOrigPostId << std::endl; std::cerr << "Cannot get channel post data for channel " << mChannelId << " and post " << mOrigPostId << std::endl;
return; return;

View File

@ -694,7 +694,7 @@ void GxsChannelPostsWidget::insertChannelPosts(std::vector<RsGxsChannelPost>& po
break; break;
if (thread) if (thread)
thread->emitAddPost(qVariantFromValue(*it), related, ++pos, count); thread->emitAddPost(QVariant::fromValue(*it), related, ++pos, count);
else else
createPostItem(*it, related); createPostItem(*it, related);
} }
@ -812,8 +812,9 @@ void GxsChannelPostsWidget::getMsgData(const std::set<RsGxsMessageId>& msgIds,st
{ {
std::vector<RsGxsChannelPost> posts; std::vector<RsGxsChannelPost> posts;
std::vector<RsGxsComment> comments; std::vector<RsGxsComment> comments;
std::vector<RsGxsVote> votes;
rsGxsChannels->getChannelContent( groupId(),msgIds,posts,comments ); rsGxsChannels->getChannelContent( groupId(),msgIds,posts,comments,votes );
psts.clear(); psts.clear();
@ -825,8 +826,9 @@ void GxsChannelPostsWidget::getAllMsgData(std::vector<RsGxsGenericMsgData*>& pst
{ {
std::vector<RsGxsChannelPost> posts; std::vector<RsGxsChannelPost> posts;
std::vector<RsGxsComment> comments; std::vector<RsGxsComment> comments;
std::vector<RsGxsVote> votes;
rsGxsChannels->getChannelAllContent( groupId(),posts,comments ); rsGxsChannels->getChannelAllContent( groupId(),posts,comments,votes );
psts.clear(); psts.clear();