fixed direct calls to setMsgReadStatus in forums. Made them async to gain GUI speed

This commit is contained in:
csoler 2021-01-24 22:06:58 +01:00
parent 202ce3327d
commit a7de50d4c8
4 changed files with 22 additions and 12 deletions

View file

@ -70,7 +70,7 @@ static const uint32_t INTEGRITY_CHECK_PERIOD = 60*31; // 31 minutes
#define GEN_EXCH_DEBUG 1
#if defined(GEN_EXCH_DEBUG)
static const uint32_t service_to_print = RS_SERVICE_GXS_TYPE_GXSCIRCLE;// use this to allow to this service id only, or 0 for all services
static const uint32_t service_to_print = RS_SERVICE_GXS_TYPE_FORUMS;// use this to allow to this service id only, or 0 for all services
// warning. Numbers should be SERVICE IDS (see serialiser/rsserviceids.h. E.g. 0x0215 for forums)
class nullstream: public std::ostream {};

View file

@ -34,7 +34,7 @@
// Debug system to allow to print only for some services (group, Peer, etc)
#if defined(DATA_DEBUG)
static const uint32_t service_to_print = RS_SERVICE_GXS_TYPE_GXSCIRCLE;// use this to allow to this service id only, or 0 for all services
static const uint32_t service_to_print = RS_SERVICE_GXS_TYPE_FORUMS;// use this to allow to this service id only, or 0 for all services
// warning. Numbers should be SERVICE IDS (see serialiser/rsserviceids.h. E.g. 0x0215 for forums)
class nullstream: public std::ostream {};

View file

@ -804,8 +804,7 @@ bool p3GxsForums::getForumContent(
GxsMsgReq msgIds;
msgIds[forumId] = msgs_to_request;
if( !requestMsgInfo(token, opts, msgIds) ||
waitToken(token,std::chrono::seconds(5)) != RsTokenService::COMPLETE )
if( !requestMsgInfo(token, opts, msgIds) || waitToken(token,std::chrono::seconds(5)) != RsTokenService::COMPLETE )
return false;
return getMsgData(token, msgs);
@ -836,15 +835,21 @@ bool p3GxsForums::markRead(const RsGxsGrpMsgIdPair& msgId, bool read)
uint32_t token;
setMessageReadStatus(token, msgId, read);
if(waitToken(token,std::chrono::milliseconds(5000)) != RsTokenService::COMPLETE ) return false;
RsGxsGrpMsgIdPair p;
acknowledgeMsg(token,p);
return true;
}
bool p3GxsForums::subscribeToForum(
const RsGxsGroupId& groupId, bool subscribe )
bool p3GxsForums::subscribeToForum(const RsGxsGroupId& groupId, bool subscribe )
{
uint32_t token;
if( !RsGenExchange::subscribeToGroup(token, groupId, subscribe)
|| waitToken(token) != RsTokenService::COMPLETE ) return false;
if( !RsGenExchange::subscribeToGroup(token, groupId, subscribe) || waitToken(token) != RsTokenService::COMPLETE ) return false;
RsGxsGroupId grp;
acknowledgeGrp(token,grp);
return true;
}