diff --git a/libretroshare/src/retroshare/rsgxschannels.h b/libretroshare/src/retroshare/rsgxschannels.h index b5d46bc3b..c55d46a72 100644 --- a/libretroshare/src/retroshare/rsgxschannels.h +++ b/libretroshare/src/retroshare/rsgxschannels.h @@ -60,6 +60,8 @@ public: public: RsMsgMetaData mMeta; + + std::set mOlderVersions ; std::string mMsg; // UTF8 encoded. std::list mFiles; diff --git a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp index 40b0dfe6d..5e36a8da9 100644 --- a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp +++ b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp @@ -64,6 +64,21 @@ GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, std::cerr << std::endl; #endif + QVector v; + bool self = false; + + for(std::set::const_iterator it(post.mOlderVersions.begin());it!=post.mOlderVersions.end();++it) + { + if(*it == post.mMeta.mMsgId) + self = true ; + + v.push_back(*it) ; + } + if(!self) + v.push_back(post.mMeta.mMsgId); + + setMessageVersions(v) ; + setup(); //setGroup(group, false); diff --git a/retroshare-gui/src/gui/gxs/GxsFeedItem.cpp b/retroshare-gui/src/gui/gxs/GxsFeedItem.cpp index 328ae8bae..6752d388c 100644 --- a/retroshare-gui/src/gui/gxs/GxsFeedItem.cpp +++ b/retroshare-gui/src/gui/gxs/GxsFeedItem.cpp @@ -64,7 +64,10 @@ void GxsFeedItem::comments(const QString &title) if (mFeedHolder) { - mFeedHolder->openComments(feedId(), groupId(), messageId(), title); + if(mMessageVersions.empty()) + mFeedHolder->openComments(feedId(), groupId(),QVector(1,messageId()), messageId(), title); + else + mFeedHolder->openComments(feedId(), groupId(),mMessageVersions, messageId(), title); } } diff --git a/retroshare-gui/src/gui/gxs/GxsFeedItem.h b/retroshare-gui/src/gui/gxs/GxsFeedItem.h index 9f62ada2a..e2b4e5b1a 100644 --- a/retroshare-gui/src/gui/gxs/GxsFeedItem.h +++ b/retroshare-gui/src/gui/gxs/GxsFeedItem.h @@ -35,9 +35,12 @@ public: GxsFeedItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, RsGxsIfaceHelper *iface, bool autoUpdate); virtual ~GxsFeedItem(); - RsGxsMessageId messageId() { return mMessageId; } + RsGxsMessageId messageId() const { return mMessageId; } + const QVector& messageVersions() const { return mMessageVersions ; } + //To be able to update with thread message when comment is received. void setMessageId( RsGxsMessageId id) {mMessageId = id;} + void setMessageVersions( const QVector& v) { mMessageVersions = v;} protected: /* load message data */ @@ -61,6 +64,7 @@ protected slots: private: RsGxsMessageId mMessageId; + QVector mMessageVersions ; uint32_t mTokenTypeMessage; uint32_t mTokenTypeComment; }; diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFeedItem.h b/retroshare-gui/src/gui/gxs/GxsGroupFeedItem.h index bfedd3111..9217c20a7 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFeedItem.h +++ b/retroshare-gui/src/gui/gxs/GxsGroupFeedItem.h @@ -45,8 +45,8 @@ public: GxsGroupFeedItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, bool isHome, RsGxsIfaceHelper *iface, bool autoUpdate); virtual ~GxsGroupFeedItem(); - RsGxsGroupId groupId() { return mGroupId; } - uint32_t feedId() { return mFeedId; } + RsGxsGroupId groupId() const { return mGroupId; } + uint32_t feedId() const { return mFeedId; } protected: uint32_t nextTokenType() { return ++mNextTokenType; } diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp index c3e6fe731..58c4fef88 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp @@ -543,6 +543,10 @@ void GxsChannelPostsWidget::insertChannelPosts(std::vector &po #ifdef DEBUG_CHANNEL std::cerr << " and is more recent => following" << std::endl; #endif + for(std::set::const_iterator itt(posts[current_index].mOlderVersions.begin());itt!=posts[current_index].mOlderVersions.end();++itt) + posts[source_index].mOlderVersions.insert(*itt); + + posts[source_index].mOlderVersions.insert(posts[current_index].mMeta.mMsgId); posts[current_index].mMeta.mMsgId.clear(); // clear the msg Id so the post will be ignored } #ifdef DEBUG_CHANNEL