mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 00:19:25 -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
|
#define GEN_EXCH_DEBUG 1
|
||||||
|
|
||||||
#if defined(GEN_EXCH_DEBUG)
|
#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)
|
// warning. Numbers should be SERVICE IDS (see serialiser/rsserviceids.h. E.g. 0x0215 for forums)
|
||||||
class nullstream: public std::ostream {};
|
class nullstream: public std::ostream {};
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
// Debug system to allow to print only for some services (group, Peer, etc)
|
// Debug system to allow to print only for some services (group, Peer, etc)
|
||||||
|
|
||||||
#if defined(DATA_DEBUG)
|
#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)
|
// warning. Numbers should be SERVICE IDS (see serialiser/rsserviceids.h. E.g. 0x0215 for forums)
|
||||||
|
|
||||||
class nullstream: public std::ostream {};
|
class nullstream: public std::ostream {};
|
||||||
|
@ -804,8 +804,7 @@ bool p3GxsForums::getForumContent(
|
|||||||
GxsMsgReq msgIds;
|
GxsMsgReq msgIds;
|
||||||
msgIds[forumId] = msgs_to_request;
|
msgIds[forumId] = msgs_to_request;
|
||||||
|
|
||||||
if( !requestMsgInfo(token, opts, msgIds) ||
|
if( !requestMsgInfo(token, opts, msgIds) || waitToken(token,std::chrono::seconds(5)) != RsTokenService::COMPLETE )
|
||||||
waitToken(token,std::chrono::seconds(5)) != RsTokenService::COMPLETE )
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return getMsgData(token, msgs);
|
return getMsgData(token, msgs);
|
||||||
@ -836,15 +835,21 @@ bool p3GxsForums::markRead(const RsGxsGrpMsgIdPair& msgId, bool read)
|
|||||||
uint32_t token;
|
uint32_t token;
|
||||||
setMessageReadStatus(token, msgId, read);
|
setMessageReadStatus(token, msgId, read);
|
||||||
if(waitToken(token,std::chrono::milliseconds(5000)) != RsTokenService::COMPLETE ) return false;
|
if(waitToken(token,std::chrono::milliseconds(5000)) != RsTokenService::COMPLETE ) return false;
|
||||||
|
|
||||||
|
RsGxsGrpMsgIdPair p;
|
||||||
|
acknowledgeMsg(token,p);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3GxsForums::subscribeToForum(
|
bool p3GxsForums::subscribeToForum(const RsGxsGroupId& groupId, bool subscribe )
|
||||||
const RsGxsGroupId& groupId, bool subscribe )
|
|
||||||
{
|
{
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
if( !RsGenExchange::subscribeToGroup(token, groupId, subscribe)
|
if( !RsGenExchange::subscribeToGroup(token, groupId, subscribe) || waitToken(token) != RsTokenService::COMPLETE ) return false;
|
||||||
|| waitToken(token) != RsTokenService::COMPLETE ) return false;
|
|
||||||
|
RsGxsGroupId grp;
|
||||||
|
acknowledgeGrp(token,grp);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1256,17 +1256,22 @@ void RsGxsForumModel::recursSetMsgReadStatus(ForumModelIndex i,bool read_status,
|
|||||||
if (bChanged)
|
if (bChanged)
|
||||||
{
|
{
|
||||||
//Don't recurs post versions as this should be done before, if no change.
|
//Don't recurs post versions as this should be done before, if no change.
|
||||||
uint32_t token;
|
|
||||||
auto s = getPostVersions(mPosts[i].mMsgId) ;
|
auto s = getPostVersions(mPosts[i].mMsgId) ;
|
||||||
|
|
||||||
if(!s.empty())
|
if(!s.empty())
|
||||||
for(auto it(s.begin());it!=s.end();++it)
|
for(auto it(s.begin());it!=s.end();++it)
|
||||||
{
|
{
|
||||||
rsGxsForums->setMessageReadStatus(token,std::make_pair( mForumGroup.mMeta.mGroupId, it->second ), read_status);
|
RsThread::async( [grpId=mForumGroup.mMeta.mGroupId,msgId=it->second,original_msg_id=mPosts[i].mMsgId,read_status]()
|
||||||
std::cerr << "Setting version " << it->second << " of post " << mPosts[i].mMsgId << " as read." << std::endl;
|
{
|
||||||
|
rsGxsForums->markRead(std::make_pair( grpId, msgId ), read_status);
|
||||||
|
std::cerr << "Setting version " << msgId << " of post " << original_msg_id << " as read." << std::endl;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else
|
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 ;
|
void *ref ;
|
||||||
convertTabEntryToRefPointer(i,ref); // we dont use i+1 here because i is not a row, but an index in the mPosts tab
|
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