From 537957a2eadfd7a5e1a5705566677b5521488dd2 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 24 Jan 2021 22:17:02 +0100 Subject: [PATCH] added missing acknowledge token in channels and fasten up markAllRead by using async on each post --- libretroshare/src/services/p3gxschannels.cc | 13 +++++++++---- .../src/gui/gxschannels/GxsChannelPostsModel.cpp | 12 ++++++------ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/libretroshare/src/services/p3gxschannels.cc b/libretroshare/src/services/p3gxschannels.cc index 9176aafab..9045b96f3 100644 --- a/libretroshare/src/services/p3gxschannels.cc +++ b/libretroshare/src/services/p3gxschannels.cc @@ -1777,12 +1777,13 @@ bool p3GxsChannels::createComment(RsGxsComment& comment) // deprecated return true; } -bool p3GxsChannels::subscribeToChannel( - const RsGxsGroupId& groupId, bool subscribe ) +bool p3GxsChannels::subscribeToChannel( const RsGxsGroupId& groupId, bool subscribe ) { uint32_t token; - if( !subscribeToGroup(token, groupId, subscribe) - || waitToken(token) != RsTokenService::COMPLETE ) return false; + if( !subscribeToGroup(token, groupId, subscribe) || waitToken(token) != RsTokenService::COMPLETE ) return false; + + RsGxsGroupId grpId; + acknowledgeGrp(token,grpId); return true; } @@ -1791,6 +1792,10 @@ bool p3GxsChannels::markRead(const RsGxsGrpMsgIdPair& msgId, bool read) uint32_t token; setMessageReadStatus(token, msgId, read); if(waitToken(token) != RsTokenService::COMPLETE ) return false; + + RsGxsGrpMsgIdPair p; + acknowledgeMsg(token,p); + return true; } diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.cpp index 28c66db59..7350479e4 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.cpp @@ -795,12 +795,12 @@ void RsGxsChannelPostsModel::setAllMsgReadStatus(bool read_status) // 2 - then call the async methods - RsThread::async([pairs, read_status]() - { - for(uint32_t i=0;imarkRead(pairs[i],read_status)) - RsErr() << "setAllMsgReadStatus: failed to change status of msg " << pairs[i].first << " in group " << pairs[i].second << " to status " << read_status << std::endl; - }); + for(uint32_t i=0;imarkRead(p,read_status)) + RsErr() << "setAllMsgReadStatus: failed to change status of msg " << p.first << " in group " << p.second << " to status " << read_status << std::endl; + }); } void RsGxsChannelPostsModel::setMsgReadStatus(const QModelIndex& i,bool read_status)