diff --git a/libretroshare/src/gxstrans/p3gxstrans.cc b/libretroshare/src/gxstrans/p3gxstrans.cc index d6d6069b4..44ecccbd1 100644 --- a/libretroshare/src/gxstrans/p3gxstrans.cc +++ b/libretroshare/src/gxstrans/p3gxstrans.cc @@ -656,8 +656,7 @@ void p3GxsTrans::notifyChanges(std::vector& changes) #ifdef DEBUG_GXSTRANS std::cout << "p3GxsTrans::notifyChanges(...)" << std::endl; #endif - for( std::vector::const_iterator it = changes.begin(); - it != changes.end(); ++it ) + for( auto it = changes.begin(); it != changes.end(); ++it ) { RsGxsGroupChange* grpChange = dynamic_cast(*it); RsGxsMsgChange* msgChange = dynamic_cast(*it); @@ -697,8 +696,8 @@ void p3GxsTrans::notifyChanges(std::vector& changes) } #endif } + delete *it; } - RsGxsIfaceHelper::receiveChanges(changes); } uint32_t p3GxsTrans::AuthenPolicy() diff --git a/libretroshare/src/retroshare/rsgxsforums.h b/libretroshare/src/retroshare/rsgxsforums.h index 1ce658ab3..becddb329 100644 --- a/libretroshare/src/retroshare/rsgxsforums.h +++ b/libretroshare/src/retroshare/rsgxsforums.h @@ -110,15 +110,10 @@ enum class RsForumEventCode: uint8_t UNKNOWN = 0x00, NEW_FORUM = 0x01, /// emitted when new forum is received UPDATED_FORUM = 0x02, /// emitted when existing forum is updated - - /// new message reeived in a particular forum - NEW_MESSAGE = 0x03, - - /// existing message has been updated in a particular forum - UPDATED_MESSAGE = 0x04, - - /// forum was subscribed or unsubscribed - SUBSCRIBE_STATUS_CHANGED = 0x05, + NEW_MESSAGE = 0x03, /// new message reeived in a particular forum + UPDATED_MESSAGE = 0x04, /// existing message has been updated in a particular forum + SUBSCRIBE_STATUS_CHANGED = 0x05, /// forum was subscribed or unsubscribed + READ_STATUS_CHANGED = 0x06, /// msg was read or marked unread }; struct RsGxsForumEvent: RsEvent diff --git a/libretroshare/src/retroshare/rsposted.h b/libretroshare/src/retroshare/rsposted.h index c8f3a313a..a1dbdf83c 100644 --- a/libretroshare/src/retroshare/rsposted.h +++ b/libretroshare/src/retroshare/rsposted.h @@ -76,6 +76,7 @@ enum class RsPostedEventCode: uint8_t SUBSCRIBE_STATUS_CHANGED = 0x03, UPDATED_POSTED_GROUP = 0x04, UPDATED_MESSAGE = 0x05, + READ_STATUS_CHANGED = 0x06, }; diff --git a/libretroshare/src/services/p3gxschannels.cc b/libretroshare/src/services/p3gxschannels.cc index e97c2389c..0ccdafc03 100644 --- a/libretroshare/src/services/p3gxschannels.cc +++ b/libretroshare/src/services/p3gxschannels.cc @@ -364,13 +364,11 @@ void p3GxsChannels::notifyChanges(std::vector &changes) } /* shouldn't need to worry about groups - as they need to be subscribed to */ + delete *it; } if(!unprocessedGroups.empty()) request_SpecificSubscribedGroups(unprocessedGroups); - -// // the call below deletes changes and its content. -// RsGxsIfaceHelper::receiveChanges(changes); } void p3GxsChannels::service_tick() diff --git a/libretroshare/src/services/p3gxscircles.cc b/libretroshare/src/services/p3gxscircles.cc index b5b7ae9ad..3cdf50147 100644 --- a/libretroshare/src/services/p3gxscircles.cc +++ b/libretroshare/src/services/p3gxscircles.cc @@ -477,8 +477,8 @@ void p3GxsCircles::notifyChanges(std::vector &changes) #endif p3Notify *notify = RsServer::notify(); - std::vector::iterator it; - for(it = changes.begin(); it != changes.end(); ++it) + + for(auto it = changes.begin(); it != changes.end(); ++it) { RsGxsGroupChange *groupChange = dynamic_cast(*it); RsGxsMsgChange *msgChange = dynamic_cast(*it); @@ -605,8 +605,8 @@ void p3GxsCircles::notifyChanges(std::vector &changes) } } + delete *it; } - RsGxsIfaceHelper::receiveChanges(changes); // this clear up the vector and delete its elements } /********************************************************************************/ diff --git a/libretroshare/src/services/p3gxsforums.cc b/libretroshare/src/services/p3gxsforums.cc index 6ef0dae34..b8c414df0 100644 --- a/libretroshare/src/services/p3gxsforums.cc +++ b/libretroshare/src/services/p3gxsforums.cc @@ -315,9 +315,9 @@ void p3GxsForums::notifyChanges(std::vector &changes) } /* shouldn't need to worry about groups - as they need to be subscribed to */ - } - RsGxsIfaceHelper::receiveChanges(changes); + delete *it; + } } void p3GxsForums::service_tick() @@ -861,12 +861,19 @@ void p3GxsForums::setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& uint32_t mask = GXS_SERV::GXS_MSG_STATUS_GUI_NEW | GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD; uint32_t status = GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD; if (read) - { status = 0; - } setMsgStatusFlags(token, msgId, status, mask); + if (rsEvents) + { + auto ev = std::make_shared(); + + ev->mForumMsgId = msgId.second; + ev->mForumGroupId = msgId.first; + ev->mForumEventCode = RsForumEventCode::READ_STATUS_CHANGED; + rsEvents->postEvent(ev); + } } /********************************************************************************************/ diff --git a/libretroshare/src/services/p3idservice.cc b/libretroshare/src/services/p3idservice.cc index 85de0abcb..c75f8ee72 100644 --- a/libretroshare/src/services/p3idservice.cc +++ b/libretroshare/src/services/p3idservice.cc @@ -661,9 +661,9 @@ void p3IdService::notifyChanges(std::vector &changes) changes[i] = NULL ; } } - } - RsGxsIfaceHelper::receiveChanges(changes); + delete changes[i]; + } } /********************************************************************************/ diff --git a/libretroshare/src/services/p3postbase.cc b/libretroshare/src/services/p3postbase.cc index a7e4cd476..309c3ee16 100644 --- a/libretroshare/src/services/p3postbase.cc +++ b/libretroshare/src/services/p3postbase.cc @@ -87,9 +87,7 @@ void p3PostBase::notifyChanges(std::vector &changes) std::cerr << std::endl; #endif - std::vector::iterator it; - - for(it = changes.begin(); it != changes.end(); ++it) + for(auto it = changes.begin(); it != changes.end(); ++it) { RsGxsMsgChange *msgChange = dynamic_cast(*it); @@ -173,8 +171,9 @@ void p3PostBase::notifyChanges(std::vector &changes) break; } } + + delete *it; } - receiveHelperChanges(changes); #ifdef POSTBASE_DEBUG std::cerr << "p3PostBase::notifyChanges() -> receiveChanges()"; @@ -206,6 +205,15 @@ void p3PostBase::setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& setMsgStatusFlags(token, msgId, status, mask); + if (rsEvents) + { + auto ev = std::make_shared(); + + ev->mPostedMsgId = msgId.second; + ev->mPostedGroupId = msgId.first; + ev->mPostedEventCode = RsPostedEventCode::READ_STATUS_CHANGED; + rsEvents->postEvent(ev); + } } diff --git a/retroshare-gui/src/gui/Posted/PostedDialog.cpp b/retroshare-gui/src/gui/Posted/PostedDialog.cpp index f4a59ad03..5e743b957 100644 --- a/retroshare-gui/src/gui/Posted/PostedDialog.cpp +++ b/retroshare-gui/src/gui/Posted/PostedDialog.cpp @@ -60,14 +60,21 @@ void PostedDialog::handleEvent_main_thread(std::shared_ptr event) switch(e->mPostedEventCode) { case RsPostedEventCode::NEW_MESSAGE: - case RsPostedEventCode::NEW_POSTED_GROUP: // [[fallthrough]]; + updateMessageSummaryList(e->mPostedGroupId); + break; + case RsPostedEventCode::UPDATED_MESSAGE: // [[fallthrough]]; updateDisplay(false); break; + case RsPostedEventCode::READ_STATUS_CHANGED: // [[fallthrough]]; + updateMessageSummaryList(e->mPostedGroupId); + break; + + case RsPostedEventCode::NEW_POSTED_GROUP: // [[fallthrough]]; case RsPostedEventCode::SUBSCRIBE_STATUS_CHANGED: // [[fallthrough]]; - updateDisplay(true); - break; + updateDisplay(true); + break; default: break; } } diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp index c54f6171f..d2aa30ce3 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp @@ -32,6 +32,7 @@ #include "gui/common/RSTreeWidget.h" #include "gui/notifyqt.h" #include "gui/common/UIStateHelper.h" +#include "gui/common/UserNotify.h" #include "GxsCommentDialog.h" //#define DEBUG_GROUPFRAMEDIALOG diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp index 67bbce334..f031772b3 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp @@ -64,12 +64,23 @@ void GxsChannelDialog::handleEvent_main_thread(std::shared_ptr ev switch(e->mChannelEventCode) { - case RsChannelEventCode::READ_STATUS_CHANGED: + case RsChannelEventCode::NEW_MESSAGE: updateMessageSummaryList(e->mChannelGroupId); break; + + case RsChannelEventCode::UPDATED_MESSAGE: // [[fallthrough]]; + updateDisplay(false); + break; + + case RsChannelEventCode::READ_STATUS_CHANGED: + updateMessageSummaryList(e->mChannelGroupId); + break; + + case RsChannelEventCode::NEW_CHANNEL: // [[fallthrough]]; case RsChannelEventCode::SUBSCRIBE_STATUS_CHANGED: updateDisplay(true); break; + default: break; } diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp index 839908ba0..7d5889e4d 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp @@ -59,7 +59,21 @@ void GxsForumsDialog::handleEvent_main_thread(std::shared_ptr eve switch(e->mForumEventCode) { - case RsForumEventCode::SUBSCRIBE_STATUS_CHANGED: updateDisplay(true); + case RsForumEventCode::NEW_MESSAGE: + updateMessageSummaryList(e->mForumGroupId); + break; + + case RsForumEventCode::UPDATED_MESSAGE: // [[fallthrough]]; + updateDisplay(false); + break; + + case RsForumEventCode::READ_STATUS_CHANGED: + updateMessageSummaryList(e->mForumGroupId); + break; + + case RsForumEventCode::NEW_FORUM: // [[fallthrough]]; + case RsForumEventCode::SUBSCRIBE_STATUS_CHANGED: + updateDisplay(true); break; default: break;