mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 23:49:35 -05:00
fixed direct calls to setMsgReadStatus in forums. Made them async to gain GUI speed
This commit is contained in:
parent
202ce3327d
commit
a7de50d4c8
@ -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 {};
|
||||
|
||||
|
@ -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 {};
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -1256,17 +1256,22 @@ void RsGxsForumModel::recursSetMsgReadStatus(ForumModelIndex i,bool read_status,
|
||||
if (bChanged)
|
||||
{
|
||||
//Don't recurs post versions as this should be done before, if no change.
|
||||
uint32_t token;
|
||||
auto s = getPostVersions(mPosts[i].mMsgId) ;
|
||||
|
||||
if(!s.empty())
|
||||
for(auto it(s.begin());it!=s.end();++it)
|
||||
{
|
||||
rsGxsForums->setMessageReadStatus(token,std::make_pair( mForumGroup.mMeta.mGroupId, it->second ), read_status);
|
||||
std::cerr << "Setting version " << it->second << " of post " << mPosts[i].mMsgId << " as read." << std::endl;
|
||||
RsThread::async( [grpId=mForumGroup.mMeta.mGroupId,msgId=it->second,original_msg_id=mPosts[i].mMsgId,read_status]()
|
||||
{
|
||||
rsGxsForums->markRead(std::make_pair( grpId, msgId ), read_status);
|
||||
std::cerr << "Setting version " << msgId << " of post " << original_msg_id << " as read." << std::endl;
|
||||
});
|
||||
}
|
||||
else
|
||||
rsGxsForums->setMessageReadStatus(token,std::make_pair( mForumGroup.mMeta.mGroupId, mPosts[i].mMsgId ), read_status);
|
||||
RsThread::async( [grpId=mForumGroup.mMeta.mGroupId,original_msg_id=mPosts[i].mMsgId,read_status]()
|
||||
{
|
||||
rsGxsForums->markRead(std::make_pair( grpId, original_msg_id), read_status);
|
||||
});
|
||||
|
||||
void *ref ;
|
||||
convertTabEntryToRefPointer(i,ref); // we dont use i+1 here because i is not a row, but an index in the mPosts tab
|
||||
|
Loading…
Reference in New Issue
Block a user