diff --git a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp index e47337cd6..a3c399753 100644 --- a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp +++ b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp @@ -86,6 +86,11 @@ GxsChannelPostItem::~GxsChannelPostItem() delete(ui); } +bool GxsChannelPostItem::isUnread() const +{ + return IS_MSG_UNREAD(mPost.mMeta.mMsgStatus) ; +} + void GxsChannelPostItem::setup() { /* Invoke the Qt Designer generated object setup routine */ diff --git a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h index 3ddb54d6f..e12d30dc3 100644 --- a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h +++ b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h @@ -58,6 +58,8 @@ public: /* FeedItem */ virtual void expand(bool open); + bool isUnread() const ; + protected: /* GxsGroupFeedItem */ virtual QString groupName(); diff --git a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp index d37a1f39d..08e85dcd8 100644 --- a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp +++ b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp @@ -411,10 +411,10 @@ void CreateGxsChannelMsg::addAttachment(const std::string &path) rsGxsChannels->ExtraFileHash(path, filename); -#warning: hash is used uninitialized below ?!? - - // only path and filename are valid. - // destroyed when fileFrame (this subfileitem) is destroyed + // Only path and filename are valid. + // Destroyed when fileFrame (this subfileitem) is destroyed + // Hash will be retrieved later when the file is finished hashing. + // //SubFileItem *file = new SubFileItem(hash, filename, path, size, flags, mChannelId); SubFileItem *file = new SubFileItem(hash, filename, path, size, flags, RsPeerId()); diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp index 2eb43f3d9..fcd7e8a08 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp @@ -505,15 +505,20 @@ void GxsChannelPostsWidget::insertRelatedPosts(const uint32_t &token) static void setAllMessagesReadCallback(FeedItem *feedItem, void *data) { - GxsChannelPostItem *channelPostItem = dynamic_cast(feedItem); - if (!channelPostItem) { - return; - } + GxsChannelPostItem *channelPostItem = dynamic_cast(feedItem); + if (!channelPostItem) { + return; + } - RsGxsGrpMsgIdPair msgPair = std::make_pair(channelPostItem->groupId(), channelPostItem->messageId()); + bool is_not_new = !channelPostItem->isUnread() ; - uint32_t token; - rsGxsChannels->setMessageReadStatus(token, msgPair, *((bool*) data)); + if(is_not_new == *(bool*)data) + return ; + + RsGxsGrpMsgIdPair msgPair = std::make_pair(channelPostItem->groupId(), channelPostItem->messageId()); + + uint32_t token; + rsGxsChannels->setMessageReadStatus(token, msgPair, *((bool*) data)); } void GxsChannelPostsWidget::setAllMessagesRead(bool read)