mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-02 11:16:34 -04:00
Merge pull request #419 from PhenomRetroShare/Fix_ChannelNewsFeedWhenComment
Fix GxsChannelPostItem when received comment.
This commit is contained in:
commit
35da9cb193
16 changed files with 188 additions and 61 deletions
|
@ -321,7 +321,7 @@ bool p3GxsChannels::groupShareKeys(const RsGxsGroupId &groupId, std::set<RsPeerI
|
|||
* at the moment - fix it up later
|
||||
*/
|
||||
|
||||
bool p3GxsChannels::getPostData(const uint32_t &token, std::vector<RsGxsChannelPost> &msgs)
|
||||
bool p3GxsChannels::getPostData(const uint32_t &token, std::vector<RsGxsChannelPost> &msgs, std::vector<RsGxsComment> &cmts)
|
||||
{
|
||||
#ifdef GXSCHANNELS_DEBUG
|
||||
std::cerr << "p3GxsChannels::getPostData()";
|
||||
|
@ -342,19 +342,32 @@ bool p3GxsChannels::getPostData(const uint32_t &token, std::vector<RsGxsChannelP
|
|||
|
||||
for(; vit != msgItems.end(); ++vit)
|
||||
{
|
||||
RsGxsChannelPostItem* item = dynamic_cast<RsGxsChannelPostItem*>(*vit);
|
||||
RsGxsChannelPostItem* postItem = dynamic_cast<RsGxsChannelPostItem*>(*vit);
|
||||
|
||||
if(item)
|
||||
if(postItem)
|
||||
{
|
||||
RsGxsChannelPost msg;
|
||||
item->toChannelPost(msg, true);
|
||||
postItem->toChannelPost(msg, true);
|
||||
msgs.push_back(msg);
|
||||
delete item;
|
||||
delete postItem;
|
||||
}
|
||||
else
|
||||
{
|
||||
RsGxsCommentItem* cmt = dynamic_cast<RsGxsCommentItem*>(*vit);
|
||||
if(!cmt)
|
||||
RsGxsCommentItem* cmtItem = dynamic_cast<RsGxsCommentItem*>(*vit);
|
||||
if(cmtItem)
|
||||
{
|
||||
RsGxsComment cmt;
|
||||
RsGxsMsgItem *mi = (*vit);
|
||||
cmt = cmtItem->mMsg;
|
||||
cmt.mMeta = mi->meta;
|
||||
#ifdef GXSCOMMENT_DEBUG
|
||||
std::cerr << "p3GxsChannels::getPostData Found Comment:" << std::endl;
|
||||
cmt.print(std::cerr," ", "cmt");
|
||||
#endif
|
||||
cmts.push_back(cmt);
|
||||
delete cmtItem;
|
||||
}
|
||||
else
|
||||
{
|
||||
RsGxsMsgItem* msg = (*vit);
|
||||
//const uint16_t RS_SERVICE_GXS_TYPE_CHANNELS = 0x0217;
|
||||
|
@ -364,8 +377,8 @@ bool p3GxsChannels::getPostData(const uint32_t &token, std::vector<RsGxsChannelP
|
|||
<< " PacketService=" << std::hex << (int)msg->PacketService() << std::dec
|
||||
<< " PacketSubType=" << std::hex << (int)msg->PacketSubType() << std::dec
|
||||
<< " , deleting!" << std::endl;
|
||||
delete *vit;
|
||||
}
|
||||
delete *vit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -379,8 +392,8 @@ bool p3GxsChannels::getPostData(const uint32_t &token, std::vector<RsGxsChannelP
|
|||
return ok;
|
||||
}
|
||||
|
||||
|
||||
bool p3GxsChannels::getRelatedPosts(const uint32_t &token, std::vector<RsGxsChannelPost> &msgs)
|
||||
//Not currently used
|
||||
/*bool p3GxsChannels::getRelatedPosts(const uint32_t &token, std::vector<RsGxsChannelPost> &msgs)
|
||||
{
|
||||
#ifdef GXSCHANNELS_DEBUG
|
||||
std::cerr << "p3GxsChannels::getRelatedPosts()";
|
||||
|
@ -436,7 +449,7 @@ bool p3GxsChannels::getRelatedPosts(const uint32_t &token, std::vector<RsGxsChan
|
|||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
/********************************************************************************************/
|
||||
|
|
|
@ -79,9 +79,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);
|
||||
|
||||
virtual bool getRelatedPosts(const uint32_t &token, std::vector<RsGxsChannelPost> &posts);
|
||||
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; return getPostData( token, posts, cmts);}
|
||||
//Not currently used
|
||||
//virtual bool getRelatedPosts(const uint32_t &token, std::vector<RsGxsChannelPost> &posts);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -255,8 +255,8 @@ bool p3GxsForums::getMsgData(const uint32_t &token, std::vector<RsGxsForumMsg> &
|
|||
return ok;
|
||||
}
|
||||
|
||||
|
||||
bool p3GxsForums::getRelatedMessages(const uint32_t &token, std::vector<RsGxsForumMsg> &msgs)
|
||||
//Not currently used
|
||||
/*bool p3GxsForums::getRelatedMessages(const uint32_t &token, std::vector<RsGxsForumMsg> &msgs)
|
||||
{
|
||||
GxsMsgRelatedDataMap msgData;
|
||||
bool ok = RsGenExchange::getMsgRelatedData(token, msgData);
|
||||
|
@ -291,7 +291,7 @@ bool p3GxsForums::getRelatedMessages(const uint32_t &token, std::vector<RsGxsFor
|
|||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
}*/
|
||||
|
||||
/********************************************************************************************/
|
||||
|
||||
|
|
|
@ -62,7 +62,8 @@ virtual void handle_event(uint32_t event_type, const std::string &elabel);
|
|||
|
||||
virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsForumGroup> &groups);
|
||||
virtual bool getMsgData(const uint32_t &token, std::vector<RsGxsForumMsg> &msgs);
|
||||
virtual bool getRelatedMessages(const uint32_t &token, std::vector<RsGxsForumMsg> &msgs);
|
||||
//Not currently used
|
||||
//virtual bool getRelatedMessages(const uint32_t &token, std::vector<RsGxsForumMsg> &msgs);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read);
|
||||
|
|
|
@ -139,8 +139,8 @@ bool p3Posted::getPostData(const uint32_t &token, std::vector<RsPostedPost> &msg
|
|||
return ok;
|
||||
}
|
||||
|
||||
|
||||
bool p3Posted::getRelatedPosts(const uint32_t &token, std::vector<RsPostedPost> &msgs)
|
||||
//Not currently used
|
||||
/*bool p3Posted::getRelatedPosts(const uint32_t &token, std::vector<RsPostedPost> &msgs)
|
||||
{
|
||||
GxsMsgRelatedDataMap msgData;
|
||||
bool ok = RsGenExchange::getMsgRelatedData(token, msgData);
|
||||
|
@ -178,7 +178,7 @@ bool p3Posted::getRelatedPosts(const uint32_t &token, std::vector<RsPostedPost>
|
|||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
/********************************************************************************************/
|
||||
|
|
|
@ -64,7 +64,8 @@ virtual void receiveHelperChanges(std::vector<RsGxsNotify*>& changes)
|
|||
// Posted Specific DataTypes.
|
||||
virtual bool getGroupData(const uint32_t &token, std::vector<RsPostedGroup> &groups);
|
||||
virtual bool getPostData(const uint32_t &token, std::vector<RsPostedPost> &posts);
|
||||
virtual bool getRelatedPosts(const uint32_t &token, std::vector<RsPostedPost> &posts);
|
||||
//Not currently used
|
||||
//virtual bool getRelatedPosts(const uint32_t &token, std::vector<RsPostedPost> &posts);
|
||||
|
||||
virtual bool createGroup(uint32_t &token, RsPostedGroup &group);
|
||||
virtual bool createPost(uint32_t &token, RsPostedPost &post);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue