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,
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.
@ -326,12 +327,14 @@ public:
* @param[in] contentsIds ids of requested contents
* @param[out] posts storage for posts
* @param[out] comments storage for the comments
* @param[out] votes storage for the votes
* @return false if something failed, true otherwhise
*/
virtual bool getChannelContent( const RsGxsGroupId& channelId,
const std::set<RsGxsMessageId>& contentsIds,
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.
@ -571,6 +574,9 @@ public:
RS_DEPRECATED_FOR(getChannelsInfo)
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)
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(
const RsGxsGroupId& boardId,
std::vector<RsPostedPost>& posts,
std::vector<RsGxsComment>& comments ) = 0;
std::vector<RsGxsComment>& comments,
std::vector<RsGxsVote>& votes ) = 0;
virtual bool getBoardContent(
const RsGxsGroupId& boardId,
const std::set<RsGxsMessageId>& contentsIds,
std::vector<RsPostedPost>& posts,
std::vector<RsGxsComment>& comments ) = 0;
std::vector<RsGxsComment>& comments,
std::vector<RsGxsVote>& votes ) = 0;
virtual bool editBoard(RsPostedGroup& board) =0;
@ -176,6 +178,11 @@ public:
virtual bool getGroupData( const uint32_t& token,
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)
virtual bool getPostData(
const uint32_t& token, std::vector<RsPostedPost>& posts,

View File

@ -452,22 +452,23 @@ bool p3GxsChannels::groupShareKeys(
bool p3GxsChannels::getPostData(
const uint32_t &token, std::vector<RsGxsChannelPost> &msgs,
std::vector<RsGxsComment> &cmts )
std::vector<RsGxsComment> &cmts,
std::vector<RsGxsVote> &vots)
{
#ifdef GXSCHANNELS_DEBUG
std::cerr << __PRETTY_FUNCTION__ << std::cerr << std::endl;
RsDbg() << __PRETTY_FUNCTION__ << std::endl;
#endif
GxsMsgDataMap 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;
}
GxsMsgDataMap::iterator mit = msgData.begin();
for(; mit != msgData.end(); ++mit)
for(; mit != msgData.end(); ++mit)
{
std::vector<RsGxsMsgItem*>& msgItems = mit->second;
std::vector<RsGxsMsgItem*>::iterator vit = msgItems.begin();
@ -495,7 +496,7 @@ bool p3GxsChannels::getPostData(
cmt = cmtItem->mMsg;
cmt.mMeta = mi->meta;
#ifdef GXSCOMMENT_DEBUG
std::cerr << "p3GxsChannels::getPostData Found Comment:" << std::endl;
RsDbg() << __PRETTY_FUNCTION__ << " Found Comment:" << std::endl;
cmt.print(std::cerr," ", "cmt");
#endif
cmts.push_back(cmt);
@ -503,18 +504,33 @@ bool p3GxsChannels::getPostData(
}
else
{
RsGxsMsgItem* msg = (*vit);
//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_GXSCOMMENT_COMMENT_ITEM = 0xf1;
std::cerr << __PRETTY_FUNCTION__
<< " Not a GxsChannelPostItem neither a "
<< "RsGxsCommentItem PacketService=" << std::hex
<< (int)msg->PacketService() << std::dec
<< " PacketSubType=" << std::hex
<< (int)msg->PacketSubType() << std::dec
<< " , deleting!" << std::endl;
delete *vit;
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);
//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_GXSCOMMENT_COMMENT_ITEM = 0xf1;
//const uint8_t RS_PKT_SUBTYPE_GXSCOMMENT_VOTE_ITEM = 0xf2;
RsErr() << __PRETTY_FUNCTION__
<< " Not a GxsChannelPostItem neither a "
<< "RsGxsCommentItem neither a RsGxsVoteItem"
<< " PacketService=" << std::hex << (int)msg->PacketService() << std::dec
<< " PacketSubType=" << std::hex << (int)msg->PacketSubType() << std::dec
<< " type name =" << typeid(*msg).name()
<< " , deleting!" << std::endl;
delete *vit;
}
}
}
}
@ -523,11 +539,19 @@ bool p3GxsChannels::getPostData(
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(
const uint32_t& token, std::vector<RsGxsChannelPost>& posts )
{
std::vector<RsGxsComment> cmts;
return getPostData(token, posts, cmts);
std::vector<RsGxsVote> vots;
return getPostData(token, posts, cmts, vots);
}
//Not currently used
@ -1091,22 +1115,24 @@ bool p3GxsChannels::getContentSummaries(
bool p3GxsChannels::getChannelAllContent( const RsGxsGroupId& channelId,
std::vector<RsGxsChannelPost>& posts,
std::vector<RsGxsComment>& comments )
std::vector<RsGxsComment>& comments,
std::vector<RsGxsVote>& votes )
{
uint32_t token;
RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
if( !requestMsgInfo(token, opts,std::list<RsGxsGroupId>({channelId})) || waitToken(token) != RsTokenService::COMPLETE )
return false;
if( !requestMsgInfo(token, opts,std::list<RsGxsGroupId>({channelId})) || waitToken(token) != RsTokenService::COMPLETE )
return false;
return getPostData(token, posts, comments);
return getPostData(token, posts, comments,votes);
}
bool p3GxsChannels::getChannelContent( const RsGxsGroupId& channelId,
const std::set<RsGxsMessageId>& contentIds,
std::vector<RsGxsChannelPost>& posts,
std::vector<RsGxsComment>& comments )
std::vector<RsGxsComment>& comments,
std::vector<RsGxsVote>& votes )
{
uint32_t token;
RsTokReqOptions opts;
@ -1118,7 +1144,7 @@ bool p3GxsChannels::getChannelContent( const RsGxsGroupId& channelId,
if( !requestMsgInfo(token, opts, msgIds) || waitToken(token) != RsTokenService::COMPLETE )
return false;
return getPostData(token, posts, comments);
return getPostData(token, posts, comments, votes);
}
bool p3GxsChannels::getChannelComments(const RsGxsGroupId &channelId,
@ -1293,8 +1319,9 @@ bool p3GxsChannels::createVoteV2(
std::set<RsGxsMessageId> s({commentId});
std::vector<RsGxsChannelPost> posts;
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 "
+ commentId.toStdString() + " of channel with Id "
@ -1454,8 +1481,9 @@ bool p3GxsChannels::createPostV2(
std::set<RsGxsMessageId> s({origPostId});
std::vector<RsGxsChannelPost> posts;
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()
+ " of channel with Id " + channelId.toStdString()
@ -1525,9 +1553,11 @@ bool p3GxsChannels::createCommentV2(
std::vector<RsGxsChannelPost> posts;
std::vector<RsGxsComment> comments;
std::vector<RsGxsVote> votes;
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() +
" of channel with Id " + channelId.toStdString() +
": this post does not exists locally!" );
@ -1539,19 +1569,18 @@ bool p3GxsChannels::createCommentV2(
": supplied threadId is not a thread, or parentMsgId is"
" not a comment!");
if(!getChannelContent( // does the post thread exist?
if(!getChannelContent( // does the post parent exist?
channelId, std::set<RsGxsMessageId>({parentId}),
posts, comments ))
posts, comments, votes) )
return failure( "You cannot comment post " + parentId.toStdString() +
": supplied parent doesn't exists locally!" );
if(!origCommentId.isNull())
{
std::set<RsGxsMessageId> s({origCommentId});
std::vector<RsGxsChannelPost> posts;
std::vector<RsGxsComment> comments;
std::vector<RsGxsComment> cmts;
if( !getChannelContent(channelId, s, posts, comments) ||
if( !getChannelContent(channelId, s, posts, cmts, votes) ||
comments.size() != 1 )
return failure( "You cannot edit comment " +
origCommentId.toStdString() +

View File

@ -82,9 +82,10 @@ virtual void handle_event(uint32_t event_type, const std::string &elabel);
public:
virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsChannelGroup> &groups);
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);
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, std::vector<RsGxsVote> &vots) override;
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
//virtual bool getRelatedPosts(const uint32_t &token, std::vector<RsGxsChannelPost> &posts);
@ -187,14 +188,16 @@ virtual bool ExtraFileRemove(const RsFileHash &hash);
/// Implementation of @see RsGxsChannels::getChannelAllMessages
bool getChannelAllContent(const RsGxsGroupId& channelId,
std::vector<RsGxsChannelPost>& posts,
std::vector<RsGxsComment>& comments ) override;
std::vector<RsGxsChannelPost>& posts,
std::vector<RsGxsComment>& comments,
std::vector<RsGxsVote>& votes ) override;
/// Implementation of @see RsGxsChannels::getChannelMessages
bool getChannelContent(const RsGxsGroupId& channelId,
const std::set<RsGxsMessageId>& contentIds,
std::vector<RsGxsChannelPost>& posts,
std::vector<RsGxsComment>& comments ) override;
std::vector<RsGxsComment>& comments,
std::vector<RsGxsVote>& votes ) override;
/// Implementation of @see RsGxsChannels::getChannelComments
virtual bool getChannelComments(const RsGxsGroupId &channelId,

View File

@ -94,55 +94,75 @@ bool p3Posted::getGroupData(const uint32_t &token, std::vector<RsPostedGroup> &g
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
std::cerr << "p3Posted::getPostData()";
std::cerr << std::endl;
RsDbg() << __PRETTY_FUNCTION__ << std::endl;
#endif
GxsMsgDataMap msgData;
bool ok = RsGenExchange::getMsgData(token, msgData);
rstime_t now = time(NULL);
if(ok)
if(!RsGenExchange::getMsgData(token, msgData))
{
GxsMsgDataMap::iterator mit = msgData.begin();
for(; mit != msgData.end(); ++mit)
RsErr() << __PRETTY_FUNCTION__ << " ERROR in request" << std::endl;
return false;
}
GxsMsgDataMap::iterator mit = msgData.begin();
for(; mit != msgData.end(); ++mit)
{
std::vector<RsGxsMsgItem*>& msgItems = mit->second;
std::vector<RsGxsMsgItem*>::iterator vit = msgItems.begin();
for(; vit != msgItems.end(); ++vit)
{
std::vector<RsGxsMsgItem*>& msgItems = mit->second;
std::vector<RsGxsMsgItem*>::iterator vit = msgItems.begin();
for(; vit != msgItems.end(); ++vit)
RsGxsPostedPostItem* postItem =
dynamic_cast<RsGxsPostedPostItem*>(*vit);
if(postItem)
{
RsGxsPostedPostItem* postItem = dynamic_cast<RsGxsPostedPostItem*>(*vit);
// TODO Really needed all of these lines?
RsPostedPost msg = postItem->mPost;
msg.mMeta = postItem->meta;
postItem->toPostedPost(msg, true);
msg.calculateScores(now);
if(postItem)
msgs.push_back(msg);
delete postItem;
}
else
{
RsGxsCommentItem* cmtItem =
dynamic_cast<RsGxsCommentItem*>(*vit);
if(cmtItem)
{
RsPostedPost msg = postItem->mPost;
msg.mMeta = postItem->meta;
postItem->toPostedPost(msg, true);
msg.calculateScores(now);
msgs.push_back(msg);
delete postItem;
RsGxsComment cmt;
RsGxsMsgItem *mi = (*vit);
cmt = cmtItem->mMsg;
cmt.mMeta = mi->meta;
#ifdef GXSCOMMENT_DEBUG
RsDbg() << __PRETTY_FUNCTION__ << " Found Comment:" << std::endl;
cmt.print(std::cerr," ", "cmt");
#endif
cmts.push_back(cmt);
delete cmtItem;
}
else
{
RsGxsCommentItem* cmtItem = dynamic_cast<RsGxsCommentItem*>(*vit);
if(cmtItem)
RsGxsVoteItem* votItem =
dynamic_cast<RsGxsVoteItem*>(*vit);
if(votItem)
{
RsGxsComment cmt;
RsGxsVote vot;
RsGxsMsgItem *mi = (*vit);
cmt = cmtItem->mMsg;
cmt.mMeta = mi->meta;
#ifdef GXSCOMMENT_DEBUG
std::cerr << "p3Posted::getPostData Found Comment:" << std::endl;
cmt.print(std::cerr," ", "cmt");
#endif
cmts.push_back(cmt);
delete cmtItem;
vot = votItem->mMsg;
vot.mMeta = mi->meta;
vots.push_back(vot);
delete votItem;
}
else
{
@ -150,24 +170,37 @@ bool p3Posted::getPostData(const uint32_t &token, std::vector<RsPostedPost> &msg
//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_GXSCOMMENT_COMMENT_ITEM = 0xf1;
std::cerr << "Not a PostedPostItem neither a RsGxsCommentItem"
<< " PacketService=" << std::hex << (int)msg->PacketService() << std::dec
<< " PacketSubType=" << std::hex << (int)msg->PacketSubType() << std::dec
<< " type name =" << typeid(*msg).name()
<< " , deleting!" << std::endl;
//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
<< " PacketSubType=" << std::hex << (int)msg->PacketSubType() << std::dec
<< " type name =" << typeid(*msg).name()
<< " , deleting!" << std::endl;
delete *vit;
}
}
}
}
}
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
@ -323,23 +356,25 @@ bool p3Posted::getBoardsInfo(
}
bool p3Posted::getBoardAllContent( const RsGxsGroupId& groupId,
std::vector<RsPostedPost>& posts,
std::vector<RsGxsComment>& comments )
std::vector<RsPostedPost>& posts,
std::vector<RsGxsComment>& comments,
std::vector<RsGxsVote>& votes )
{
uint32_t token;
RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
if( !requestMsgInfo(token, opts, std::list<RsGxsGroupId>({groupId})) || waitToken(token) != RsTokenService::COMPLETE )
return false;
if( !requestMsgInfo(token, opts, std::list<RsGxsGroupId>({groupId})) || waitToken(token) != RsTokenService::COMPLETE )
return false;
return getPostData(token, posts, comments);
return getPostData(token, posts, comments, votes);
}
bool p3Posted::getBoardContent( const RsGxsGroupId& groupId,
const std::set<RsGxsMessageId>& contentsIds,
std::vector<RsPostedPost>& posts,
std::vector<RsGxsComment>& comments )
const std::set<RsGxsMessageId>& contentsIds,
std::vector<RsPostedPost>& posts,
std::vector<RsGxsComment>& comments,
std::vector<RsGxsVote>& votes )
{
uint32_t token;
RsTokReqOptions opts;
@ -351,7 +386,7 @@ bool p3Posted::getBoardContent( const RsGxsGroupId& groupId,
if( !requestMsgInfo(token, opts, msgIds) ||
waitToken(token) != RsTokenService::COMPLETE ) return false;
return getPostData(token, posts, comments);
return getPostData(token, posts, comments, votes);
}
bool p3Posted::getBoardsSummaries(std::list<RsGroupMetaData>& boards )

View File

@ -64,13 +64,15 @@ virtual void receiveHelperChanges(std::vector<RsGxsNotify*>& changes)
std::vector<RsPostedGroup>& groupsInfo ) override;
bool getBoardAllContent(const RsGxsGroupId& groupId,
std::vector<RsPostedPost>& posts,
std::vector<RsGxsComment>& comments ) override;
std::vector<RsPostedPost>& posts,
std::vector<RsGxsComment>& comments,
std::vector<RsGxsVote>& votes ) override;
bool getBoardContent(const RsGxsGroupId& groupId,
const std::set<RsGxsMessageId>& contentsIds,
std::vector<RsPostedPost>& posts,
std::vector<RsGxsComment>& comments ) override;
const std::set<RsGxsMessageId>& contentsIds,
std::vector<RsPostedPost>& posts,
std::vector<RsGxsComment>& comments,
std::vector<RsGxsVote>& votes ) override;
bool getBoardsSummaries(std::list<RsGroupMetaData>& groupInfo) override;
@ -82,9 +84,10 @@ virtual void receiveHelperChanges(std::vector<RsGxsNotify*>& changes)
bool createBoard(RsPostedGroup& board) override;
virtual bool getGroupData(const uint32_t &token, std::vector<RsPostedGroup> &groups);
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; return getPostData( token, posts, cmts);}
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, std::vector<RsGxsVote> &vots) override;
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
//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<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;
mIsLoadingMessage = false;
@ -227,8 +228,9 @@ void BasePostedItem::loadComment()
std::vector<RsPostedPost> posts;
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;
mIsLoadingComment = false;

View File

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

View File

@ -319,8 +319,9 @@ void GxsChannelPostItem::loadMessage()
std::vector<RsGxsChannelPost> posts;
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;
return;

View File

@ -738,14 +738,15 @@ void CreateGxsChannelMsg::loadOriginalChannelPostInfo()
{
std::vector<RsGxsChannelPost> posts;
std::vector<RsGxsComment> comments;
std::vector<RsGxsVote> votes;
if( !rsGxsChannels->getChannelContent(mChannelId,std::set<RsGxsMessageId>({mOrigPostId}),posts,comments) || posts.size() != 1)
{
std::cerr << "Cannot get channel post data for channel " << mChannelId << " and post " << mOrigPostId << std::endl;
return;
}
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;
return;
}
RsQThreadUtils::postToObject( [posts,this]()
RsQThreadUtils::postToObject( [posts,this]()
{
/* Here it goes any code you want to be executed on the Qt Gui
* thread, for example to update the data model with new information

View File

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