mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 08:29:26 -05:00
changed std::vector into std::set in notification system, hence removing lots of std::find(std::vector::begin(),std::vector::end(),T), causing quadratic costs in multiple places.
This commit is contained in:
parent
6139632378
commit
84699db744
@ -1217,7 +1217,7 @@ int RsDataService::retrieveNxsMsgs(const GxsMsgReq &reqIds, GxsMsgResult &msg, b
|
|||||||
const RsGxsGroupId& grpId = mit->first;
|
const RsGxsGroupId& grpId = mit->first;
|
||||||
|
|
||||||
// if vector empty then request all messages
|
// if vector empty then request all messages
|
||||||
const std::vector<RsGxsMessageId>& msgIdV = mit->second;
|
const std::set<RsGxsMessageId>& msgIdV = mit->second;
|
||||||
std::vector<RsNxsMsg*> msgSet;
|
std::vector<RsNxsMsg*> msgSet;
|
||||||
|
|
||||||
if(msgIdV.empty()){
|
if(msgIdV.empty()){
|
||||||
@ -1235,7 +1235,7 @@ int RsDataService::retrieveNxsMsgs(const GxsMsgReq &reqIds, GxsMsgResult &msg, b
|
|||||||
}else{
|
}else{
|
||||||
|
|
||||||
// request each grp
|
// request each grp
|
||||||
std::vector<RsGxsMessageId>::const_iterator sit = msgIdV.begin();
|
std::set<RsGxsMessageId>::const_iterator sit = msgIdV.begin();
|
||||||
|
|
||||||
for(; sit!=msgIdV.end();++sit){
|
for(; sit!=msgIdV.end();++sit){
|
||||||
const RsGxsMessageId& msgId = *sit;
|
const RsGxsMessageId& msgId = *sit;
|
||||||
@ -1305,7 +1305,7 @@ int RsDataService::retrieveGxsMsgMetaData(const GxsMsgReq& reqIds, GxsMsgMetaRes
|
|||||||
const RsGxsGroupId& grpId = mit->first;
|
const RsGxsGroupId& grpId = mit->first;
|
||||||
|
|
||||||
// if vector empty then request all messages
|
// if vector empty then request all messages
|
||||||
const std::vector<RsGxsMessageId>& msgIdV = mit->second;
|
const std::set<RsGxsMessageId>& msgIdV = mit->second;
|
||||||
std::vector<RsGxsMsgMetaData*> metaSet;
|
std::vector<RsGxsMsgMetaData*> metaSet;
|
||||||
|
|
||||||
if(msgIdV.empty()){
|
if(msgIdV.empty()){
|
||||||
@ -1321,7 +1321,7 @@ int RsDataService::retrieveGxsMsgMetaData(const GxsMsgReq& reqIds, GxsMsgMetaRes
|
|||||||
}else{
|
}else{
|
||||||
|
|
||||||
// request each grp
|
// request each grp
|
||||||
std::vector<RsGxsMessageId>::const_iterator sit = msgIdV.begin();
|
std::set<RsGxsMessageId>::const_iterator sit = msgIdV.begin();
|
||||||
|
|
||||||
for(; sit!=msgIdV.end(); ++sit){
|
for(; sit!=msgIdV.end(); ++sit){
|
||||||
const RsGxsMessageId& msgId = *sit;
|
const RsGxsMessageId& msgId = *sit;
|
||||||
@ -1561,7 +1561,7 @@ int RsDataService::removeMsgs(const GxsMsgReq& msgIds)
|
|||||||
|
|
||||||
for(; mit != msgIds.end(); ++mit)
|
for(; mit != msgIds.end(); ++mit)
|
||||||
{
|
{
|
||||||
const std::vector<RsGxsMessageId>& msgIdV = mit->second;
|
const std::set<RsGxsMessageId>& msgIdV = mit->second;
|
||||||
const RsGxsGroupId& grpId = mit->first;
|
const RsGxsGroupId& grpId = mit->first;
|
||||||
|
|
||||||
// delete messages
|
// delete messages
|
||||||
@ -1622,7 +1622,7 @@ int RsDataService::retrieveGroupIds(std::vector<RsGxsGroupId> &grpIds)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RsDataService::retrieveMsgIds(const RsGxsGroupId& grpId, RsGxsMessageId::std_vector& msgIds)
|
int RsDataService::retrieveMsgIds(const RsGxsGroupId& grpId, RsGxsMessageId::std_set& msgIds)
|
||||||
{
|
{
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
||||||
rstime::RsScopeTimer timer("");
|
rstime::RsScopeTimer timer("");
|
||||||
@ -1643,7 +1643,7 @@ int RsDataService::retrieveMsgIds(const RsGxsGroupId& grpId, RsGxsMessageId::std
|
|||||||
if(c->columnCount() != 1)
|
if(c->columnCount() != 1)
|
||||||
std::cerr << "(EE) ********* not retrieving all columns!!" << std::endl;
|
std::cerr << "(EE) ********* not retrieving all columns!!" << std::endl;
|
||||||
|
|
||||||
msgIds.push_back(RsGxsMessageId(msgId));
|
msgIds.insert(RsGxsMessageId(msgId));
|
||||||
valid = c->moveToNext();
|
valid = c->moveToNext();
|
||||||
|
|
||||||
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
||||||
@ -1674,8 +1674,8 @@ bool RsDataService::locked_removeMessageEntries(const GxsMsgReq& msgIds)
|
|||||||
for(; mit != msgIds.end(); ++mit)
|
for(; mit != msgIds.end(); ++mit)
|
||||||
{
|
{
|
||||||
const RsGxsGroupId& grpId = mit->first;
|
const RsGxsGroupId& grpId = mit->first;
|
||||||
const std::vector<RsGxsMessageId>& msgsV = mit->second;
|
const std::set<RsGxsMessageId>& msgsV = mit->second;
|
||||||
std::vector<RsGxsMessageId>::const_iterator vit = msgsV.begin();
|
std::set<RsGxsMessageId>::const_iterator vit = msgsV.begin();
|
||||||
|
|
||||||
for(; vit != msgsV.end(); ++vit)
|
for(; vit != msgsV.end(); ++vit)
|
||||||
{
|
{
|
||||||
|
@ -110,7 +110,7 @@ public:
|
|||||||
* @param msgId msgsids retrieved
|
* @param msgId msgsids retrieved
|
||||||
* @return error code
|
* @return error code
|
||||||
*/
|
*/
|
||||||
int retrieveMsgIds(const RsGxsGroupId& grpId, RsGxsMessageId::std_vector& msgId);
|
int retrieveMsgIds(const RsGxsGroupId& grpId, RsGxsMessageId::std_set& msgId);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @return the cache size set for this RsGeneralDataService in bytes
|
* @return the cache size set for this RsGeneralDataService in bytes
|
||||||
|
@ -208,7 +208,7 @@ public:
|
|||||||
* @param msgId msgsids retrieved
|
* @param msgId msgsids retrieved
|
||||||
* @return error code
|
* @return error code
|
||||||
*/
|
*/
|
||||||
virtual int retrieveMsgIds(const RsGxsGroupId& grpId, RsGxsMessageId::std_vector& msgId) = 0;
|
virtual int retrieveMsgIds(const RsGxsGroupId& grpId, RsGxsMessageId::std_set& msgId) = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @return the cache size set for this RsGeneralDataService in bytes
|
* @return the cache size set for this RsGeneralDataService in bytes
|
||||||
|
@ -217,7 +217,7 @@ void RsGenExchange::tick()
|
|||||||
RS_STACK_MUTEX(mGenMtx) ;
|
RS_STACK_MUTEX(mGenMtx) ;
|
||||||
|
|
||||||
std::list<RsGxsGroupId> grpIds;
|
std::list<RsGxsGroupId> grpIds;
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgIds;
|
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > msgIds;
|
||||||
mIntegrityCheck->getDeletedIds(grpIds, msgIds);
|
mIntegrityCheck->getDeletedIds(grpIds, msgIds);
|
||||||
|
|
||||||
if (!grpIds.empty())
|
if (!grpIds.empty())
|
||||||
@ -1078,23 +1078,19 @@ bool RsGenExchange::checkAuthenFlag(const PrivacyBitPos& pos, const uint8_t& fla
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addMessageChanged(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgs, const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgChanged)
|
static void addMessageChanged(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgs, const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgChanged)
|
||||||
{
|
{
|
||||||
if (msgs.empty()) {
|
if (msgs.empty()) {
|
||||||
msgs = msgChanged;
|
msgs = msgChanged;
|
||||||
} else {
|
} else {
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::const_iterator mapIt;
|
for (auto mapIt = msgChanged.begin(); mapIt != msgChanged.end(); ++mapIt)
|
||||||
for (mapIt = msgChanged.begin(); mapIt != msgChanged.end(); ++mapIt) {
|
{
|
||||||
const RsGxsGroupId &grpId = mapIt->first;
|
const RsGxsGroupId &grpId = mapIt->first;
|
||||||
const std::vector<RsGxsMessageId> &srcMsgIds = mapIt->second;
|
const std::set<RsGxsMessageId> &srcMsgIds = mapIt->second;
|
||||||
std::vector<RsGxsMessageId> &destMsgIds = msgs[grpId];
|
std::set<RsGxsMessageId> &destMsgIds = msgs[grpId];
|
||||||
|
|
||||||
std::vector<RsGxsMessageId>::const_iterator msgIt;
|
for (auto msgIt = srcMsgIds.begin(); msgIt != srcMsgIds.end(); ++msgIt)
|
||||||
for (msgIt = srcMsgIds.begin(); msgIt != srcMsgIds.end(); ++msgIt) {
|
destMsgIds.insert(*msgIt) ;
|
||||||
if (std::find(destMsgIds.begin(), destMsgIds.end(), *msgIt) == destMsgIds.end()) {
|
|
||||||
destMsgIds.push_back(*msgIt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1789,8 +1785,8 @@ void RsGenExchange::deleteMsgs(uint32_t& token, const GxsMsgReq& msgs)
|
|||||||
|
|
||||||
if(mNetService != NULL)
|
if(mNetService != NULL)
|
||||||
for(GxsMsgReq::const_iterator it(msgs.begin());it!=msgs.end();++it)
|
for(GxsMsgReq::const_iterator it(msgs.begin());it!=msgs.end();++it)
|
||||||
for(uint32_t i=0;i<it->second.size();++i)
|
for(auto it2(it->second.begin());it2!=it->second.end();++it2)
|
||||||
mNetService->rejectMessage(it->second[i]) ;
|
mNetService->rejectMessage(*it2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsGenExchange::publishMsg(uint32_t& token, RsGxsMsgItem *msgItem)
|
void RsGenExchange::publishMsg(uint32_t& token, RsGxsMsgItem *msgItem)
|
||||||
@ -1961,8 +1957,8 @@ void RsGenExchange::processMsgMetaChanges()
|
|||||||
if(m.val.getAsInt32(RsGeneralDataService::MSG_META_STATUS+GXS_MASK, mask))
|
if(m.val.getAsInt32(RsGeneralDataService::MSG_META_STATUS+GXS_MASK, mask))
|
||||||
{
|
{
|
||||||
GxsMsgReq req;
|
GxsMsgReq req;
|
||||||
std::vector<RsGxsMessageId> msgIdV;
|
std::set<RsGxsMessageId> msgIdV;
|
||||||
msgIdV.push_back(m.msgId.second);
|
msgIdV.insert(m.msgId.second);
|
||||||
req.insert(std::make_pair(m.msgId.first, msgIdV));
|
req.insert(std::make_pair(m.msgId.first, msgIdV));
|
||||||
GxsMsgMetaResult result;
|
GxsMsgMetaResult result;
|
||||||
mDataStore->retrieveGxsMsgMetaData(req, result);
|
mDataStore->retrieveGxsMsgMetaData(req, result);
|
||||||
@ -1994,7 +1990,7 @@ void RsGenExchange::processMsgMetaChanges()
|
|||||||
mDataAccess->updatePublicRequestStatus(token, RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE);
|
mDataAccess->updatePublicRequestStatus(token, RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE);
|
||||||
if (changed)
|
if (changed)
|
||||||
{
|
{
|
||||||
msgIds[m.msgId.first].push_back(m.msgId.second);
|
msgIds[m.msgId.first].insert(m.msgId.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2145,7 +2141,7 @@ void RsGenExchange::publishMsgs()
|
|||||||
mMsgsToPublish.insert(std::make_pair(sign_it->first, item.mItem));
|
mMsgsToPublish.insert(std::make_pair(sign_it->first, item.mItem));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgChangeMap;
|
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > msgChangeMap;
|
||||||
std::map<uint32_t, RsGxsMsgItem*>::iterator mit = mMsgsToPublish.begin();
|
std::map<uint32_t, RsGxsMsgItem*>::iterator mit = mMsgsToPublish.begin();
|
||||||
|
|
||||||
for(; mit != mMsgsToPublish.end(); ++mit)
|
for(; mit != mMsgsToPublish.end(); ++mit)
|
||||||
@ -2273,7 +2269,7 @@ void RsGenExchange::publishMsgs()
|
|||||||
mDataAccess->addMsgData(msg);
|
mDataAccess->addMsgData(msg);
|
||||||
delete msg ;
|
delete msg ;
|
||||||
|
|
||||||
msgChangeMap[grpId].push_back(msgId);
|
msgChangeMap[grpId].insert(msgId);
|
||||||
|
|
||||||
delete[] metaDataBuff;
|
delete[] metaDataBuff;
|
||||||
|
|
||||||
@ -2972,10 +2968,10 @@ void RsGenExchange::processRecvdMessages()
|
|||||||
msg->metaData->mMsgStatus = GXS_SERV::GXS_MSG_STATUS_UNPROCESSED | GXS_SERV::GXS_MSG_STATUS_GUI_NEW | GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD;
|
msg->metaData->mMsgStatus = GXS_SERV::GXS_MSG_STATUS_UNPROCESSED | GXS_SERV::GXS_MSG_STATUS_GUI_NEW | GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD;
|
||||||
msgs_to_store.push_back(msg);
|
msgs_to_store.push_back(msg);
|
||||||
|
|
||||||
std::vector<RsGxsMessageId> &msgv = msgIds[msg->grpId];
|
msgIds[msg->grpId].insert(msg->msgId);
|
||||||
|
// std::vector<RsGxsMessageId> &msgv = msgIds[msg->grpId];
|
||||||
if (std::find(msgv.begin(), msgv.end(), msg->msgId) == msgv.end())
|
// if (std::find(msgv.begin(), msgv.end(), msg->msgId) == msgv.end())
|
||||||
msgv.push_back(msg->msgId);
|
// msgv.push_back(msg->msgId);
|
||||||
|
|
||||||
computeHash(msg->msg, msg->metaData->mHash);
|
computeHash(msg->msg, msg->metaData->mHash);
|
||||||
msg->metaData->recvTS = time(NULL);
|
msg->metaData->recvTS = time(NULL);
|
||||||
@ -3330,7 +3326,7 @@ void RsGenExchange::removeDeleteExistingMessages( std::list<RsNxsMsg*>& msgs, Gx
|
|||||||
|
|
||||||
//RsGxsGroupId::std_list grpIds(mGrpIdsUnique.begin(), mGrpIdsUnique.end());
|
//RsGxsGroupId::std_list grpIds(mGrpIdsUnique.begin(), mGrpIdsUnique.end());
|
||||||
//RsGxsGroupId::std_list::const_iterator it = grpIds.begin();
|
//RsGxsGroupId::std_list::const_iterator it = grpIds.begin();
|
||||||
typedef std::map<RsGxsGroupId, RsGxsMessageId::std_vector> MsgIdReq;
|
typedef std::map<RsGxsGroupId, RsGxsMessageId::std_set> MsgIdReq;
|
||||||
MsgIdReq msgIdReq;
|
MsgIdReq msgIdReq;
|
||||||
|
|
||||||
// now get a list of all msgs ids for each group
|
// now get a list of all msgs ids for each group
|
||||||
@ -3350,7 +3346,7 @@ void RsGenExchange::removeDeleteExistingMessages( std::list<RsNxsMsg*>& msgs, Gx
|
|||||||
// now for each msg to be stored that exist in the retrieved msg/grp "index" delete and erase from map
|
// now for each msg to be stored that exist in the retrieved msg/grp "index" delete and erase from map
|
||||||
for(std::list<RsNxsMsg*>::iterator cit2 = msgs.begin(); cit2 != msgs.end();)
|
for(std::list<RsNxsMsg*>::iterator cit2 = msgs.begin(); cit2 != msgs.end();)
|
||||||
{
|
{
|
||||||
const RsGxsMessageId::std_vector& msgIds = msgIdReq[(*cit2)->metaData->mGroupId];
|
const RsGxsMessageId::std_set& msgIds = msgIdReq[(*cit2)->metaData->mGroupId];
|
||||||
|
|
||||||
#ifdef GEN_EXCH_DEBUG
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << " grpid=" << (*cit2)->grpId << ", msgid=" << (*cit2)->msgId ;
|
std::cerr << " grpid=" << (*cit2)->grpId << ", msgid=" << (*cit2)->msgId ;
|
||||||
@ -3358,12 +3354,13 @@ void RsGenExchange::removeDeleteExistingMessages( std::list<RsNxsMsg*>& msgs, Gx
|
|||||||
|
|
||||||
// Avoid storing messages that are already in the database, as well as messages that are too old (or generally do not pass the database storage test)
|
// Avoid storing messages that are already in the database, as well as messages that are too old (or generally do not pass the database storage test)
|
||||||
//
|
//
|
||||||
if(std::find(msgIds.begin(), msgIds.end(), (*cit2)->metaData->mMsgId) != msgIds.end() || !messagePublicationTest( *(*cit2)->metaData))
|
if(msgIds.find((*cit2)->metaData->mMsgId) != msgIds.end() || !messagePublicationTest( *(*cit2)->metaData))
|
||||||
{
|
{
|
||||||
// msg exist in retrieved index. We should use a std::set here instead of a vector.
|
// msg exist in retrieved index. We should use a std::set here instead of a vector.
|
||||||
|
|
||||||
RsGxsMessageId::std_vector& notifyIds = msgIdsNotify[ (*cit2)->metaData->mGroupId];
|
RsGxsMessageId::std_set& notifyIds = msgIdsNotify[ (*cit2)->metaData->mGroupId];
|
||||||
RsGxsMessageId::std_vector::iterator it2 = std::find(notifyIds.begin(), notifyIds.end(), (*cit2)->metaData->mMsgId);
|
RsGxsMessageId::std_set::iterator it2 = notifyIds.find((*cit2)->metaData->mMsgId);
|
||||||
|
|
||||||
if(it2 != notifyIds.end())
|
if(it2 != notifyIds.end())
|
||||||
{
|
{
|
||||||
notifyIds.erase(it2);
|
notifyIds.erase(it2);
|
||||||
|
@ -225,7 +225,7 @@ bool RsGxsDataAccess::requestMsgInfo(uint32_t &token, uint32_t ansType,
|
|||||||
MsgMetaReq* mmr = new MsgMetaReq();
|
MsgMetaReq* mmr = new MsgMetaReq();
|
||||||
|
|
||||||
for(; lit != grpIds.end(); ++lit)
|
for(; lit != grpIds.end(); ++lit)
|
||||||
mmr->mMsgIds[*lit] = std::vector<RsGxsMessageId>();
|
mmr->mMsgIds[*lit] = std::set<RsGxsMessageId>();
|
||||||
|
|
||||||
req = mmr;
|
req = mmr;
|
||||||
}else if(reqType & GXS_REQUEST_TYPE_MSG_DATA)
|
}else if(reqType & GXS_REQUEST_TYPE_MSG_DATA)
|
||||||
@ -233,7 +233,7 @@ bool RsGxsDataAccess::requestMsgInfo(uint32_t &token, uint32_t ansType,
|
|||||||
MsgDataReq* mdr = new MsgDataReq();
|
MsgDataReq* mdr = new MsgDataReq();
|
||||||
|
|
||||||
for(; lit != grpIds.end(); ++lit)
|
for(; lit != grpIds.end(); ++lit)
|
||||||
mdr->mMsgIds[*lit] = std::vector<RsGxsMessageId>();
|
mdr->mMsgIds[*lit] = std::set<RsGxsMessageId>();
|
||||||
|
|
||||||
req = mdr;
|
req = mdr;
|
||||||
}else if(reqType & GXS_REQUEST_TYPE_MSG_IDS)
|
}else if(reqType & GXS_REQUEST_TYPE_MSG_IDS)
|
||||||
@ -241,7 +241,7 @@ bool RsGxsDataAccess::requestMsgInfo(uint32_t &token, uint32_t ansType,
|
|||||||
MsgIdReq* mir = new MsgIdReq();
|
MsgIdReq* mir = new MsgIdReq();
|
||||||
|
|
||||||
for(; lit != grpIds.end(); ++lit)
|
for(; lit != grpIds.end(); ++lit)
|
||||||
mir->mMsgIds[*lit] = std::vector<RsGxsMessageId>();
|
mir->mMsgIds[*lit] = std::set<RsGxsMessageId>();
|
||||||
|
|
||||||
req = mir;
|
req = mir;
|
||||||
}
|
}
|
||||||
@ -1191,7 +1191,7 @@ bool RsGxsDataAccess::getMsgList(const GxsMsgReq& msgIds, const RsTokReqOptions&
|
|||||||
// Add the discovered Latest Msgs.
|
// Add the discovered Latest Msgs.
|
||||||
for(oit = origMsgTs.begin(); oit != origMsgTs.end(); ++oit)
|
for(oit = origMsgTs.begin(); oit != origMsgTs.end(); ++oit)
|
||||||
{
|
{
|
||||||
msgIdsOut[grpId].push_back(oit->second.first);
|
msgIdsOut[grpId].insert(oit->second.first);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1228,7 +1228,7 @@ bool RsGxsDataAccess::getMsgList(const GxsMsgReq& msgIds, const RsTokReqOptions&
|
|||||||
|
|
||||||
if (add)
|
if (add)
|
||||||
{
|
{
|
||||||
msgIdsOut[grpId].push_back(msgMeta->mMsgId);
|
msgIdsOut[grpId].insert(msgMeta->mMsgId);
|
||||||
metaFilter[grpId].insert(std::make_pair(msgMeta->mMsgId, msgMeta));
|
metaFilter[grpId].insert(std::make_pair(msgMeta->mMsgId, msgMeta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1373,7 +1373,7 @@ bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq *req)
|
|||||||
// get meta data for all in group
|
// get meta data for all in group
|
||||||
GxsMsgMetaResult result;
|
GxsMsgMetaResult result;
|
||||||
GxsMsgReq msgIds;
|
GxsMsgReq msgIds;
|
||||||
msgIds.insert(std::make_pair(grpMsgIdPair.first, std::vector<RsGxsMessageId>()));
|
msgIds.insert(std::make_pair(grpMsgIdPair.first, std::set<RsGxsMessageId>()));
|
||||||
mDataStore->retrieveGxsMsgMetaData(msgIds, result);
|
mDataStore->retrieveGxsMsgMetaData(msgIds, result);
|
||||||
std::vector<RsGxsMsgMetaData*>& metaV = result[grpMsgIdPair.first];
|
std::vector<RsGxsMsgMetaData*>& metaV = result[grpMsgIdPair.first];
|
||||||
std::vector<RsGxsMsgMetaData*>::iterator vit_meta;
|
std::vector<RsGxsMsgMetaData*>::iterator vit_meta;
|
||||||
@ -1382,7 +1382,7 @@ bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq *req)
|
|||||||
const RsGxsMessageId& msgId = grpMsgIdPair.second;
|
const RsGxsMessageId& msgId = grpMsgIdPair.second;
|
||||||
const RsGxsGroupId& grpId = grpMsgIdPair.first;
|
const RsGxsGroupId& grpId = grpMsgIdPair.first;
|
||||||
|
|
||||||
std::vector<RsGxsMessageId> outMsgIds;
|
std::set<RsGxsMessageId> outMsgIds;
|
||||||
|
|
||||||
RsGxsMsgMetaData* origMeta = NULL;
|
RsGxsMsgMetaData* origMeta = NULL;
|
||||||
for(vit_meta = metaV.begin(); vit_meta != metaV.end(); ++vit_meta)
|
for(vit_meta = metaV.begin(); vit_meta != metaV.end(); ++vit_meta)
|
||||||
@ -1477,7 +1477,7 @@ bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq *req)
|
|||||||
// Add the discovered Latest Msgs.
|
// Add the discovered Latest Msgs.
|
||||||
for(oit = origMsgTs.begin(); oit != origMsgTs.end(); ++oit)
|
for(oit = origMsgTs.begin(); oit != origMsgTs.end(); ++oit)
|
||||||
{
|
{
|
||||||
outMsgIds.push_back(oit->second.first);
|
outMsgIds.insert(oit->second.first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1502,7 +1502,7 @@ bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq *req)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
outMsgIds.push_back(latestMsgId);
|
outMsgIds.insert(latestMsgId);
|
||||||
metaMap.insert(std::make_pair(latestMsgId, latestMeta));
|
metaMap.insert(std::make_pair(latestMsgId, latestMeta));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1514,7 +1514,7 @@ bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq *req)
|
|||||||
|
|
||||||
if (meta->mOrigMsgId == origMsgId)
|
if (meta->mOrigMsgId == origMsgId)
|
||||||
{
|
{
|
||||||
outMsgIds.push_back(meta->mMsgId);
|
outMsgIds.insert(meta->mMsgId);
|
||||||
metaMap.insert(std::make_pair(meta->mMsgId, meta));
|
metaMap.insert(std::make_pair(meta->mMsgId, meta));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1556,7 +1556,7 @@ bool RsGxsDataAccess::getGroupStatistic(GroupStatisticRequest *req)
|
|||||||
{
|
{
|
||||||
// filter based on options
|
// filter based on options
|
||||||
GxsMsgIdResult metaReq;
|
GxsMsgIdResult metaReq;
|
||||||
metaReq[req->mGrpId] = std::vector<RsGxsMessageId>();
|
metaReq[req->mGrpId] = std::set<RsGxsMessageId>();
|
||||||
GxsMsgMetaResult metaResult;
|
GxsMsgMetaResult metaResult;
|
||||||
mDataStore->retrieveGxsMsgMetaData(metaReq, metaResult);
|
mDataStore->retrieveGxsMsgMetaData(metaReq, metaResult);
|
||||||
|
|
||||||
@ -1672,7 +1672,7 @@ bool RsGxsDataAccess::getMsgList(MsgIdReq* req)
|
|||||||
for(; vit != vit_end; ++vit)
|
for(; vit != vit_end; ++vit)
|
||||||
{
|
{
|
||||||
RsGxsMsgMetaData* meta = *vit;
|
RsGxsMsgMetaData* meta = *vit;
|
||||||
req->mMsgIdResult[grpId].push_back(meta->mMsgId);
|
req->mMsgIdResult[grpId].insert(meta->mMsgId);
|
||||||
delete meta; // discard meta data mem
|
delete meta; // discard meta data mem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1718,8 +1718,8 @@ void RsGxsDataAccess::filterMsgList(GxsMsgIdResult& msgIds, const RsTokReqOption
|
|||||||
if(cit == msgMetas.end())
|
if(cit == msgMetas.end())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
std::vector<RsGxsMessageId>& msgs = mit->second;
|
std::set<RsGxsMessageId>& msgs = mit->second;
|
||||||
std::vector<RsGxsMessageId>::iterator vit = msgs.begin();
|
std::set<RsGxsMessageId>::iterator vit = msgs.begin();
|
||||||
const std::map<RsGxsMessageId, RsGxsMsgMetaData*>& meta = cit->second;
|
const std::map<RsGxsMessageId, RsGxsMsgMetaData*>& meta = cit->second;
|
||||||
std::map<RsGxsMessageId, RsGxsMsgMetaData*>::const_iterator cit2;
|
std::map<RsGxsMessageId, RsGxsMsgMetaData*>::const_iterator cit2;
|
||||||
|
|
||||||
|
@ -784,7 +784,7 @@ void RsGxsNetService::handleRecvSyncGrpStatistics(RsNxsSyncGrpStatsItem *grs)
|
|||||||
// now count available messages
|
// now count available messages
|
||||||
|
|
||||||
GxsMsgReq reqIds;
|
GxsMsgReq reqIds;
|
||||||
reqIds[grs->grpId] = std::vector<RsGxsMessageId>();
|
reqIds[grs->grpId] = std::set<RsGxsMessageId>();
|
||||||
GxsMsgMetaResult result;
|
GxsMsgMetaResult result;
|
||||||
|
|
||||||
#ifdef NXS_NET_DEBUG_6
|
#ifdef NXS_NET_DEBUG_6
|
||||||
@ -2757,7 +2757,7 @@ void RsGxsNetService::locked_genReqMsgTransaction(NxsTransaction* tr)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
GxsMsgReq reqIds;
|
GxsMsgReq reqIds;
|
||||||
reqIds[grpId] = std::vector<RsGxsMessageId>();
|
reqIds[grpId] = std::set<RsGxsMessageId>();
|
||||||
GxsMsgMetaResult result;
|
GxsMsgMetaResult result;
|
||||||
mDataStore->retrieveGxsMsgMetaData(reqIds, result);
|
mDataStore->retrieveGxsMsgMetaData(reqIds, result);
|
||||||
std::vector<RsGxsMsgMetaData*> &msgMetaV = result[grpId];
|
std::vector<RsGxsMsgMetaData*> &msgMetaV = result[grpId];
|
||||||
@ -3296,7 +3296,7 @@ void RsGxsNetService::locked_genSendMsgsTransaction(NxsTransaction* tr)
|
|||||||
RsNxsSyncMsgItem* item = dynamic_cast<RsNxsSyncMsgItem*>(*lit);
|
RsNxsSyncMsgItem* item = dynamic_cast<RsNxsSyncMsgItem*>(*lit);
|
||||||
if (item)
|
if (item)
|
||||||
{
|
{
|
||||||
msgIds[item->grpId].push_back(item->msgId);
|
msgIds[item->grpId].insert(item->msgId);
|
||||||
|
|
||||||
if(grpId.isNull())
|
if(grpId.isNull())
|
||||||
grpId = item->grpId;
|
grpId = item->grpId;
|
||||||
@ -4127,7 +4127,7 @@ void RsGxsNetService::handleRecvSyncMessage(RsNxsSyncMsgReqItem *item,bool item_
|
|||||||
}
|
}
|
||||||
|
|
||||||
GxsMsgReq req;
|
GxsMsgReq req;
|
||||||
req[item->grpId] = std::vector<RsGxsMessageId>();
|
req[item->grpId] = std::set<RsGxsMessageId>();
|
||||||
|
|
||||||
GxsMsgMetaResult metaResult;
|
GxsMsgMetaResult metaResult;
|
||||||
mDataStore->retrieveGxsMsgMetaData(req, metaResult);
|
mDataStore->retrieveGxsMsgMetaData(req, metaResult);
|
||||||
|
@ -67,7 +67,7 @@ bool RsGxsMessageCleanUp::clean()
|
|||||||
GxsMsgReq req;
|
GxsMsgReq req;
|
||||||
GxsMsgMetaResult result;
|
GxsMsgMetaResult result;
|
||||||
|
|
||||||
req[grpId] = std::vector<RsGxsMessageId>();
|
req[grpId] = std::set<RsGxsMessageId>();
|
||||||
mDs->retrieveGxsMsgMetaData(req, result);
|
mDs->retrieveGxsMsgMetaData(req, result);
|
||||||
|
|
||||||
GxsMsgMetaResult::iterator mit = result.begin();
|
GxsMsgMetaResult::iterator mit = result.begin();
|
||||||
@ -117,7 +117,7 @@ bool RsGxsMessageCleanUp::clean()
|
|||||||
|
|
||||||
if( remove )
|
if( remove )
|
||||||
{
|
{
|
||||||
req[grpId].push_back(meta->mMsgId);
|
req[grpId].insert(meta->mMsgId);
|
||||||
|
|
||||||
#ifdef DEBUG_GXSUTIL
|
#ifdef DEBUG_GXSUTIL
|
||||||
std::cerr << " Scheduling for removal." << std::endl;
|
std::cerr << " Scheduling for removal." << std::endl;
|
||||||
@ -241,9 +241,9 @@ bool RsGxsIntegrityCheck::check()
|
|||||||
for (msgIdsIt = msgIds.begin(); msgIdsIt != msgIds.end(); ++msgIdsIt)
|
for (msgIdsIt = msgIds.begin(); msgIdsIt != msgIds.end(); ++msgIdsIt)
|
||||||
{
|
{
|
||||||
const RsGxsGroupId& grpId = msgIdsIt->first;
|
const RsGxsGroupId& grpId = msgIdsIt->first;
|
||||||
std::vector<RsGxsMessageId> &msgIdV = msgIdsIt->second;
|
std::set<RsGxsMessageId> &msgIdV = msgIdsIt->second;
|
||||||
|
|
||||||
std::vector<RsGxsMessageId>::iterator msgIdIt;
|
std::set<RsGxsMessageId>::iterator msgIdIt;
|
||||||
for (msgIdIt = msgIdV.begin(); msgIdIt != msgIdV.end(); ++msgIdIt)
|
for (msgIdIt = msgIdV.begin(); msgIdIt != msgIdV.end(); ++msgIdIt)
|
||||||
{
|
{
|
||||||
const RsGxsMessageId& msgId = *msgIdIt;
|
const RsGxsMessageId& msgId = *msgIdIt;
|
||||||
@ -261,7 +261,7 @@ bool RsGxsIntegrityCheck::check()
|
|||||||
|
|
||||||
if (nxsMsgIt == nxsMsgV.end())
|
if (nxsMsgIt == nxsMsgV.end())
|
||||||
{
|
{
|
||||||
msgsToDel[grpId].push_back(msgId);
|
msgsToDel[grpId].insert(msgId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -284,7 +284,7 @@ bool RsGxsIntegrityCheck::check()
|
|||||||
if(msg->metaData == NULL || currHash != msg->metaData->mHash)
|
if(msg->metaData == NULL || currHash != msg->metaData->mHash)
|
||||||
{
|
{
|
||||||
std::cerr << "(EE) deleting message data with wrong hash or null meta data. meta=" << (void*)msg->metaData << std::endl;
|
std::cerr << "(EE) deleting message data with wrong hash or null meta data. meta=" << (void*)msg->metaData << std::endl;
|
||||||
msgsToDel[msg->grpId].push_back(msg->msgId);
|
msgsToDel[msg->grpId].insert(msg->msgId);
|
||||||
}
|
}
|
||||||
else if(!msg->metaData->mAuthorId.isNull() && subscribed_groups.find(msg->metaData->mGroupId)!=subscribed_groups.end())
|
else if(!msg->metaData->mAuthorId.isNull() && subscribed_groups.find(msg->metaData->mGroupId)!=subscribed_groups.end())
|
||||||
{
|
{
|
||||||
@ -377,7 +377,7 @@ bool RsGxsIntegrityCheck::isDone()
|
|||||||
return mDone;
|
return mDone;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsGxsIntegrityCheck::getDeletedIds(std::list<RsGxsGroupId>& grpIds, std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgIds)
|
void RsGxsIntegrityCheck::getDeletedIds(std::list<RsGxsGroupId>& grpIds, std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIds)
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mIntegrityMutex);
|
RsStackMutex stack(mIntegrityMutex);
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ public:
|
|||||||
|
|
||||||
void run();
|
void run();
|
||||||
|
|
||||||
void getDeletedIds(std::list<RsGxsGroupId>& grpIds, std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgIds);
|
void getDeletedIds(std::list<RsGxsGroupId>& grpIds, std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -217,7 +217,7 @@ private:
|
|||||||
bool mDone;
|
bool mDone;
|
||||||
RsMutex mIntegrityMutex;
|
RsMutex mIntegrityMutex;
|
||||||
std::list<RsGxsGroupId> mDeletedGrps;
|
std::list<RsGxsGroupId> mDeletedGrps;
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > mDeletedMsgs;
|
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mDeletedMsgs;
|
||||||
|
|
||||||
RsGixs *mGixs ;
|
RsGixs *mGixs ;
|
||||||
};
|
};
|
||||||
|
@ -455,7 +455,7 @@ void p3GxsTrans::GxsTransIntegrityCleanupThread::run()
|
|||||||
|
|
||||||
if(stored_msgs.end() != it2)
|
if(stored_msgs.end() != it2)
|
||||||
{
|
{
|
||||||
msgsToDel[it2->second.first].push_back(it2->second.second);
|
msgsToDel[it2->second.first].insert(it2->second.second);
|
||||||
|
|
||||||
#ifdef DEBUG_GXSTRANS
|
#ifdef DEBUG_GXSTRANS
|
||||||
std::cerr << " scheduling msg " << std::hex << it2->second.first << "," << it2->second.second << " for deletion." << std::endl;
|
std::cerr << " scheduling msg " << std::hex << it2->second.first << "," << it2->second.second << " for deletion." << std::endl;
|
||||||
|
@ -40,8 +40,8 @@ class RsGxsChanges
|
|||||||
public:
|
public:
|
||||||
RsGxsChanges(): mService(0){}
|
RsGxsChanges(): mService(0){}
|
||||||
RsTokenService *mService;
|
RsTokenService *mService;
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > mMsgs;
|
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgs;
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > mMsgsMeta;
|
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgsMeta;
|
||||||
std::list<RsGxsGroupId> mGrps;
|
std::list<RsGxsGroupId> mGrps;
|
||||||
std::list<RsGxsGroupId> mGrpsMeta;
|
std::list<RsGxsGroupId> mGrpsMeta;
|
||||||
};
|
};
|
||||||
|
@ -43,10 +43,10 @@ typedef Sha1CheckSum RsGxsMessageId;
|
|||||||
typedef GXSId RsGxsId;
|
typedef GXSId RsGxsId;
|
||||||
typedef GXSCircleId RsGxsCircleId;
|
typedef GXSCircleId RsGxsCircleId;
|
||||||
|
|
||||||
typedef std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > GxsMsgIdResult;
|
typedef std::map<RsGxsGroupId, std::set<RsGxsMessageId> > GxsMsgIdResult;
|
||||||
typedef std::pair<RsGxsGroupId, RsGxsMessageId> RsGxsGrpMsgIdPair;
|
typedef std::pair<RsGxsGroupId, RsGxsMessageId> RsGxsGrpMsgIdPair;
|
||||||
typedef std::map<RsGxsGrpMsgIdPair, std::vector<RsGxsMessageId> > MsgRelatedIdResult;
|
typedef std::map<RsGxsGrpMsgIdPair, std::set<RsGxsMessageId> > MsgRelatedIdResult;
|
||||||
typedef std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > GxsMsgReq;
|
typedef std::map<RsGxsGroupId, std::set<RsGxsMessageId> > GxsMsgReq;
|
||||||
|
|
||||||
struct RsMsgMetaData;
|
struct RsMsgMetaData;
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ class RsGxsMsgChange : public RsGxsNotify
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RsGxsMsgChange(NotifyType type, bool metaChange) : NOTIFY_TYPE(type), mMetaChange(metaChange) {}
|
RsGxsMsgChange(NotifyType type, bool metaChange) : NOTIFY_TYPE(type), mMetaChange(metaChange) {}
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgChangeMap;
|
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > msgChangeMap;
|
||||||
NotifyType getType(){ return NOTIFY_TYPE;}
|
NotifyType getType(){ return NOTIFY_TYPE;}
|
||||||
bool metaChange() { return mMetaChange; }
|
bool metaChange() { return mMetaChange; }
|
||||||
private:
|
private:
|
||||||
|
@ -241,16 +241,12 @@ void p3GxsChannels::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
|||||||
/* message received */
|
/* message received */
|
||||||
if (notify)
|
if (notify)
|
||||||
{
|
{
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgChangeMap = msgChange->msgChangeMap;
|
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgChangeMap = msgChange->msgChangeMap;
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator mit;
|
for (auto mit = msgChangeMap.begin(); mit != msgChangeMap.end(); ++mit)
|
||||||
for (mit = msgChangeMap.begin(); mit != msgChangeMap.end(); ++mit)
|
for (auto mit1 = mit->second.begin(); mit1 != mit->second.end(); ++mit1)
|
||||||
{
|
|
||||||
std::vector<RsGxsMessageId>::iterator mit1;
|
|
||||||
for (mit1 = mit->second.begin(); mit1 != mit->second.end(); ++mit1)
|
|
||||||
{
|
{
|
||||||
notify->AddFeedItem(RS_FEED_ITEM_CHANNEL_MSG, mit->first.toStdString(), mit1->toStdString());
|
notify->AddFeedItem(RS_FEED_ITEM_CHANNEL_MSG, mit->first.toStdString(), mit1->toStdString());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,9 +257,8 @@ void p3GxsChannels::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgChangeMap = msgChange->msgChangeMap;
|
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgChangeMap = msgChange->msgChangeMap;
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator mit;
|
for(auto mit = msgChangeMap.begin(); mit != msgChangeMap.end(); ++mit)
|
||||||
for(mit = msgChangeMap.begin(); mit != msgChangeMap.end(); ++mit)
|
|
||||||
{
|
{
|
||||||
#ifdef GXSCHANNELS_DEBUG
|
#ifdef GXSCHANNELS_DEBUG
|
||||||
std::cerr << "p3GxsChannels::notifyChanges() Msgs for Group: " << mit->first;
|
std::cerr << "p3GxsChannels::notifyChanges() Msgs for Group: " << mit->first;
|
||||||
@ -807,10 +802,7 @@ void p3GxsChannels::request_SpecificUnprocessedPosts(std::list<std::pair<RsGxsGr
|
|||||||
GxsMsgReq msgIds;
|
GxsMsgReq msgIds;
|
||||||
std::list<std::pair<RsGxsGroupId, RsGxsMessageId> >::iterator it;
|
std::list<std::pair<RsGxsGroupId, RsGxsMessageId> >::iterator it;
|
||||||
for(it = ids.begin(); it != ids.end(); ++it)
|
for(it = ids.begin(); it != ids.end(); ++it)
|
||||||
{
|
msgIds[it->first].insert(it->second);
|
||||||
std::vector<RsGxsMessageId> &vect_msgIds = msgIds[it->first];
|
|
||||||
vect_msgIds.push_back(it->second);
|
|
||||||
}
|
|
||||||
|
|
||||||
RsGenExchange::getTokenService()->requestMsgInfo(token, ansType, opts, msgIds);
|
RsGenExchange::getTokenService()->requestMsgInfo(token, ansType, opts, msgIds);
|
||||||
GxsTokenQueue::queueRequest(token, GXSCHANNELS_UNPROCESSED_SPECIFIC);
|
GxsTokenQueue::queueRequest(token, GXSCHANNELS_UNPROCESSED_SPECIFIC);
|
||||||
|
@ -212,14 +212,14 @@ void p3GxsCircles::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
|||||||
#ifdef DEBUG_CIRCLES
|
#ifdef DEBUG_CIRCLES
|
||||||
std::cerr << " Found circle Message Change Notification" << std::endl;
|
std::cerr << " Found circle Message Change Notification" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
for(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator mit = msgChange->msgChangeMap.begin(); mit != msgChange->msgChangeMap.end(); ++mit)
|
for(auto mit = msgChange->msgChangeMap.begin(); mit != msgChange->msgChangeMap.end(); ++mit)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_CIRCLES
|
#ifdef DEBUG_CIRCLES
|
||||||
std::cerr << " Msgs for Group: " << mit->first << std::endl;
|
std::cerr << " Msgs for Group: " << mit->first << std::endl;
|
||||||
#endif
|
#endif
|
||||||
force_cache_reload(RsGxsCircleId(mit->first));
|
force_cache_reload(RsGxsCircleId(mit->first));
|
||||||
if (notify && (c->getType() == RsGxsNotify::TYPE_RECEIVE) )
|
if (notify && (c->getType() == RsGxsNotify::TYPE_RECEIVE) )
|
||||||
for (std::vector<RsGxsMessageId>::const_iterator msgIdIt(mit->second.begin()), end(mit->second.end()); msgIdIt != end; ++msgIdIt)
|
for (auto msgIdIt(mit->second.begin()), end(mit->second.end()); msgIdIt != end; ++msgIdIt)
|
||||||
{
|
{
|
||||||
const RsGxsMessageId& msgId = *msgIdIt;
|
const RsGxsMessageId& msgId = *msgIdIt;
|
||||||
notify->AddFeedItem(RS_FEED_ITEM_CIRCLE_MEMB_REQ,RsGxsCircleId(mit->first).toStdString(),msgId.toStdString());
|
notify->AddFeedItem(RS_FEED_ITEM_CIRCLE_MEMB_REQ,RsGxsCircleId(mit->first).toStdString(),msgId.toStdString());
|
||||||
@ -2120,7 +2120,7 @@ bool p3GxsCircles::processMembershipRequests(uint32_t token)
|
|||||||
#ifdef DEBUG_CIRCLES
|
#ifdef DEBUG_CIRCLES
|
||||||
std::cerr << " Older than last known (" << time(NULL)-info.last_subscription_TS << " seconds ago): deleting." << std::endl;
|
std::cerr << " Older than last known (" << time(NULL)-info.last_subscription_TS << " seconds ago): deleting." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
messages_to_delete[RsGxsGroupId(cid)].push_back(it->second[i]->meta.mMsgId) ;
|
messages_to_delete[RsGxsGroupId(cid)].insert(it->second[i]->meta.mMsgId) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -502,8 +502,8 @@ bool p3GxsCommentService::createGxsVote(uint32_t &token, RsGxsVote &vote)
|
|||||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_META;
|
opts.mReqType = GXS_REQUEST_TYPE_MSG_META;
|
||||||
|
|
||||||
GxsMsgReq msgIds;
|
GxsMsgReq msgIds;
|
||||||
std::vector<RsGxsMessageId> &vect_msgIds = msgIds[parentId.first];
|
std::set<RsGxsMessageId> &vect_msgIds = msgIds[parentId.first];
|
||||||
vect_msgIds.push_back(parentId.second);
|
vect_msgIds.insert(parentId.second);
|
||||||
|
|
||||||
uint32_t int_token;
|
uint32_t int_token;
|
||||||
mExchange->getTokenService()->requestMsgInfo(int_token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, msgIds);
|
mExchange->getTokenService()->requestMsgInfo(int_token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, msgIds);
|
||||||
|
@ -205,15 +205,12 @@ void p3GxsForums::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
|||||||
RsGxsMsgChange *msgChange = dynamic_cast<RsGxsMsgChange*>(c);
|
RsGxsMsgChange *msgChange = dynamic_cast<RsGxsMsgChange*>(c);
|
||||||
if (msgChange)
|
if (msgChange)
|
||||||
{
|
{
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgChangeMap = msgChange->msgChangeMap;
|
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgChangeMap = msgChange->msgChangeMap;
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator mit;
|
|
||||||
for (mit = msgChangeMap.begin(); mit != msgChangeMap.end(); ++mit)
|
for (auto mit = msgChangeMap.begin(); mit != msgChangeMap.end(); ++mit)
|
||||||
{
|
{
|
||||||
std::vector<RsGxsMessageId>::iterator mit1;
|
for (auto mit1 = mit->second.begin(); mit1 != mit->second.end(); ++mit1)
|
||||||
for (mit1 = mit->second.begin(); mit1 != mit->second.end(); ++mit1)
|
|
||||||
{
|
|
||||||
notify->AddFeedItem(RS_FEED_ITEM_FORUM_MSG, mit->first.toStdString(), mit1->toStdString());
|
notify->AddFeedItem(RS_FEED_ITEM_FORUM_MSG, mit->first.toStdString(), mit1->toStdString());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -562,8 +562,8 @@ void p3IdService::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgChangeMap = msgChange->msgChangeMap;
|
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgChangeMap = msgChange->msgChangeMap;
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator mit;
|
std::map<RsGxsGroupId, std::set<RsGxsMessageId> >::iterator mit;
|
||||||
for(mit = msgChangeMap.begin(); mit != msgChangeMap.end(); ++mit)
|
for(mit = msgChangeMap.begin(); mit != msgChangeMap.end(); ++mit)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_IDS
|
#ifdef DEBUG_IDS
|
||||||
|
@ -110,9 +110,8 @@ void p3PostBase::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgChangeMap = msgChange->msgChangeMap;
|
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgChangeMap = msgChange->msgChangeMap;
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator mit;
|
for(auto mit = msgChangeMap.begin(); mit != msgChangeMap.end(); ++mit)
|
||||||
for(mit = msgChangeMap.begin(); mit != msgChangeMap.end(); ++mit)
|
|
||||||
{
|
{
|
||||||
#ifdef POSTBASE_DEBUG
|
#ifdef POSTBASE_DEBUG
|
||||||
std::cerr << "p3PostBase::notifyChanges() Msgs for Group: " << mit->first;
|
std::cerr << "p3PostBase::notifyChanges() Msgs for Group: " << mit->first;
|
||||||
@ -125,8 +124,7 @@ void p3PostBase::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
|||||||
|
|
||||||
if (notify && msgChange->getType() == RsGxsNotify::TYPE_RECEIVE)
|
if (notify && msgChange->getType() == RsGxsNotify::TYPE_RECEIVE)
|
||||||
{
|
{
|
||||||
std::vector<RsGxsMessageId>::iterator mit1;
|
for (auto mit1 = mit->second.begin(); mit1 != mit->second.end(); ++mit1)
|
||||||
for (mit1 = mit->second.begin(); mit1 != mit->second.end(); ++mit1)
|
|
||||||
{
|
{
|
||||||
notify->AddFeedItem(RS_FEED_ITEM_POSTED_MSG, mit->first.toStdString(), mit1->toStdString());
|
notify->AddFeedItem(RS_FEED_ITEM_POSTED_MSG, mit->first.toStdString(), mit1->toStdString());
|
||||||
}
|
}
|
||||||
@ -431,7 +429,7 @@ void p3PostBase::background_loadMsgs(const uint32_t &token, bool unprocessed)
|
|||||||
mBgIncremental = unprocessed;
|
mBgIncremental = unprocessed;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > postMap;
|
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > postMap;
|
||||||
|
|
||||||
// generate vector of changes to push to the GUI.
|
// generate vector of changes to push to the GUI.
|
||||||
std::vector<RsGxsNotify *> changes;
|
std::vector<RsGxsNotify *> changes;
|
||||||
@ -487,7 +485,7 @@ void p3PostBase::background_loadMsgs(const uint32_t &token, bool unprocessed)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* but we need to notify GUI about them */
|
/* but we need to notify GUI about them */
|
||||||
msgChanges->msgChangeMap[mit->first].push_back((*vit)->meta.mMsgId);
|
msgChanges->msgChangeMap[mit->first].insert((*vit)->meta.mMsgId);
|
||||||
}
|
}
|
||||||
else if (NULL != (commentItem = dynamic_cast<RsGxsCommentItem *>(*vit)))
|
else if (NULL != (commentItem = dynamic_cast<RsGxsCommentItem *>(*vit)))
|
||||||
{
|
{
|
||||||
@ -546,7 +544,7 @@ void p3PostBase::background_loadMsgs(const uint32_t &token, bool unprocessed)
|
|||||||
if (sit == mBgStatsMap.end())
|
if (sit == mBgStatsMap.end())
|
||||||
{
|
{
|
||||||
// add to map of ones to update.
|
// add to map of ones to update.
|
||||||
postMap[groupId].push_back(threadId);
|
postMap[groupId].insert(threadId);
|
||||||
|
|
||||||
mBgStatsMap[threadId] = PostStats(0,0,0);
|
mBgStatsMap[threadId] = PostStats(0,0,0);
|
||||||
sit = mBgStatsMap.find(threadId);
|
sit = mBgStatsMap.find(threadId);
|
||||||
@ -704,7 +702,7 @@ void p3PostBase::background_updateVoteCounts(const uint32_t &token)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
stats.increment(it->second);
|
stats.increment(it->second);
|
||||||
msgChanges->msgChangeMap[mit->first].push_back(vit->mMsgId);
|
msgChanges->msgChangeMap[mit->first].insert(vit->mMsgId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2132,12 +2132,12 @@ void IdDialog::updateDisplay(bool complete)
|
|||||||
}
|
}
|
||||||
requestCircleGroupMeta();
|
requestCircleGroupMeta();
|
||||||
|
|
||||||
std::list<RsGxsGroupId> grpIds;
|
std::set<RsGxsGroupId> grpIds;
|
||||||
getAllGrpIds(grpIds);
|
getAllGrpIds(grpIds);
|
||||||
if (!getGrpIds().empty()) {
|
if (!getGrpIds().empty()) {
|
||||||
requestIdList();
|
requestIdList();
|
||||||
|
|
||||||
if (!mId.isNull() && std::find(grpIds.begin(), grpIds.end(), mId) != grpIds.end()) {
|
if (!mId.isNull() && grpIds.find(mId)!=grpIds.end()) {
|
||||||
requestIdDetails();
|
requestIdDetails();
|
||||||
requestRepList();
|
requestRepList();
|
||||||
}
|
}
|
||||||
|
@ -366,8 +366,8 @@ void NewsFeed::updateDisplay()
|
|||||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||||
|
|
||||||
GxsMsgReq msgIds;
|
GxsMsgReq msgIds;
|
||||||
std::vector<RsGxsMessageId> &vect_msgIds = msgIds[grpId];
|
std::set<RsGxsMessageId> &vect_msgIds = msgIds[grpId];
|
||||||
vect_msgIds.push_back(msgId);
|
vect_msgIds.insert(msgId);
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mTokenQueueCircle->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, TOKEN_TYPE_MESSAGE);
|
mTokenQueueCircle->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, TOKEN_TYPE_MESSAGE);
|
||||||
|
@ -438,8 +438,8 @@ void GxsForumMsgItem::requestParentMessage(const RsGxsMessageId &msgId)
|
|||||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||||
|
|
||||||
GxsMsgReq msgIds;
|
GxsMsgReq msgIds;
|
||||||
std::vector<RsGxsMessageId> &vect_msgIds = msgIds[groupId()];
|
std::set<RsGxsMessageId> &vect_msgIds = msgIds[groupId()];
|
||||||
vect_msgIds.push_back(msgId);
|
vect_msgIds.insert(msgId);
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mLoadQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeParentMessage);
|
mLoadQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeParentMessage);
|
||||||
|
@ -93,19 +93,15 @@ void GxsFeedItem::fillDisplay(RsGxsUpdateBroadcastBase *updateBroadcastBase, boo
|
|||||||
{
|
{
|
||||||
GxsGroupFeedItem::fillDisplay(updateBroadcastBase, complete);
|
GxsGroupFeedItem::fillDisplay(updateBroadcastBase, complete);
|
||||||
|
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgs;
|
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > msgs;
|
||||||
updateBroadcastBase->getAllMsgIds(msgs);
|
updateBroadcastBase->getAllMsgIds(msgs);
|
||||||
|
|
||||||
if (!msgs.empty())
|
if (!msgs.empty())
|
||||||
{
|
{
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::const_iterator mit = msgs.find(groupId());
|
std::map<RsGxsGroupId, std::set<RsGxsMessageId> >::const_iterator mit = msgs.find(groupId());
|
||||||
if (mit != msgs.end())
|
|
||||||
{
|
if (mit != msgs.end() && mit->second.find(messageId()) != mit->second.end())
|
||||||
const std::vector<RsGxsMessageId> &msgIds = mit->second;
|
|
||||||
if (std::find(msgIds.begin(), msgIds.end(), messageId()) != msgIds.end()) {
|
|
||||||
requestMessage();
|
requestMessage();
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,8 +125,8 @@ void GxsFeedItem::requestMessage()
|
|||||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||||
|
|
||||||
GxsMsgReq msgIds;
|
GxsMsgReq msgIds;
|
||||||
std::vector<RsGxsMessageId> &vect_msgIds = msgIds[groupId()];
|
std::set<RsGxsMessageId> &vect_msgIds = msgIds[groupId()];
|
||||||
vect_msgIds.push_back(mMessageId);
|
vect_msgIds.insert(mMessageId);
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mLoadQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeMessage);
|
mLoadQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeMessage);
|
||||||
|
@ -170,12 +170,11 @@ void GxsGroupFeedItem::fillDisplaySlot(bool complete)
|
|||||||
|
|
||||||
void GxsGroupFeedItem::fillDisplay(RsGxsUpdateBroadcastBase *updateBroadcastBase, bool /*complete*/)
|
void GxsGroupFeedItem::fillDisplay(RsGxsUpdateBroadcastBase *updateBroadcastBase, bool /*complete*/)
|
||||||
{
|
{
|
||||||
std::list<RsGxsGroupId> grpIds;
|
std::set<RsGxsGroupId> grpIds;
|
||||||
updateBroadcastBase->getAllGrpIds(grpIds);
|
updateBroadcastBase->getAllGrpIds(grpIds);
|
||||||
|
|
||||||
if (std::find(grpIds.begin(), grpIds.end(), groupId()) != grpIds.end()) {
|
if (grpIds.find(groupId()) != grpIds.end())
|
||||||
requestGroup();
|
requestGroup();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
|
@ -236,11 +236,10 @@ void GxsGroupFrameDialog::updateDisplay(bool complete)
|
|||||||
requestGroupSummary();
|
requestGroupSummary();
|
||||||
} else {
|
} else {
|
||||||
/* Update all groups of changed messages */
|
/* Update all groups of changed messages */
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgIds;
|
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > msgIds;
|
||||||
getAllMsgIds(msgIds);
|
getAllMsgIds(msgIds);
|
||||||
|
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator msgIt;
|
for (auto msgIt = msgIds.begin(); msgIt != msgIds.end(); ++msgIt) {
|
||||||
for (msgIt = msgIds.begin(); msgIt != msgIds.end(); ++msgIt) {
|
|
||||||
updateMessageSummaryList(msgIt->first);
|
updateMessageSummaryList(msgIt->first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,21 +109,22 @@ void GxsMessageFramePostWidget::updateDisplay(bool complete)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool updateGroup = false;
|
bool updateGroup = false;
|
||||||
const std::list<RsGxsGroupId> &grpIdsMeta = getGrpIdsMeta();
|
const std::set<RsGxsGroupId> &grpIdsMeta = getGrpIdsMeta();
|
||||||
if (std::find(grpIdsMeta.begin(), grpIdsMeta.end(), groupId()) != grpIdsMeta.end()) {
|
|
||||||
updateGroup = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::list<RsGxsGroupId> &grpIds = getGrpIds();
|
if(grpIdsMeta.find(groupId())!=grpIdsMeta.end())
|
||||||
if (!groupId().isNull() && std::find(grpIds.begin(), grpIds.end(), groupId()) != grpIds.end()) {
|
updateGroup = true;
|
||||||
|
|
||||||
|
const std::set<RsGxsGroupId> &grpIds = getGrpIds();
|
||||||
|
if (!groupId().isNull() && grpIds.find(groupId())!=grpIds.end())
|
||||||
|
{
|
||||||
updateGroup = true;
|
updateGroup = true;
|
||||||
/* Do we need to fill all posts? */
|
/* Do we need to fill all posts? */
|
||||||
requestAllPosts();
|
requestAllPosts();
|
||||||
} else {
|
} else {
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgs;
|
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > msgs;
|
||||||
getAllMsgIds(msgs);
|
getAllMsgIds(msgs);
|
||||||
if (!msgs.empty()) {
|
if (!msgs.empty()) {
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::const_iterator mit = msgs.find(groupId());
|
auto mit = msgs.find(groupId());
|
||||||
if (mit != msgs.end()) {
|
if (mit != msgs.end()) {
|
||||||
requestPosts(mit->second);
|
requestPosts(mit->second);
|
||||||
}
|
}
|
||||||
@ -341,7 +342,7 @@ void GxsMessageFramePostWidget::loadAllPosts(const uint32_t &token)
|
|||||||
emit groupChanged(this);
|
emit groupChanged(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsMessageFramePostWidget::requestPosts(const std::vector<RsGxsMessageId> &msgIds)
|
void GxsMessageFramePostWidget::requestPosts(const std::set<RsGxsMessageId> &msgIds)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_DEBUG
|
#ifdef ENABLE_DEBUG
|
||||||
std::cerr << "GxsMessageFramePostWidget::requestPosts()";
|
std::cerr << "GxsMessageFramePostWidget::requestPosts()";
|
||||||
|
@ -72,7 +72,7 @@ protected:
|
|||||||
void loadAllPosts(const uint32_t &token);
|
void loadAllPosts(const uint32_t &token);
|
||||||
virtual void insertAllPosts(const uint32_t &token, GxsMessageFramePostThread *thread) = 0;
|
virtual void insertAllPosts(const uint32_t &token, GxsMessageFramePostThread *thread) = 0;
|
||||||
|
|
||||||
void requestPosts(const std::vector<RsGxsMessageId> &msgIds);
|
void requestPosts(const std::set<RsGxsMessageId> &msgIds);
|
||||||
void loadPosts(const uint32_t &token);
|
void loadPosts(const uint32_t &token);
|
||||||
virtual void insertPosts(const uint32_t &token) = 0;
|
virtual void insertPosts(const uint32_t &token) = 0;
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ RsGxsUpdateBroadcastBase::RsGxsUpdateBroadcastBase(RsGxsIfaceHelper *ifaceImpl,
|
|||||||
mUpdateBroadcast = RsGxsUpdateBroadcast::get(ifaceImpl);
|
mUpdateBroadcast = RsGxsUpdateBroadcast::get(ifaceImpl);
|
||||||
connect(mUpdateBroadcast, SIGNAL(changed()), this, SLOT(updateBroadcastChanged()));
|
connect(mUpdateBroadcast, SIGNAL(changed()), this, SLOT(updateBroadcastChanged()));
|
||||||
connect(mUpdateBroadcast, SIGNAL(grpsChanged(std::list<RsGxsGroupId>, std::list<RsGxsGroupId>)), this, SLOT(updateBroadcastGrpsChanged(std::list<RsGxsGroupId>,std::list<RsGxsGroupId>)));
|
connect(mUpdateBroadcast, SIGNAL(grpsChanged(std::list<RsGxsGroupId>, std::list<RsGxsGroupId>)), this, SLOT(updateBroadcastGrpsChanged(std::list<RsGxsGroupId>,std::list<RsGxsGroupId>)));
|
||||||
connect(mUpdateBroadcast, SIGNAL(msgsChanged(std::map<RsGxsGroupId,std::vector<RsGxsMessageId> >, std::map<RsGxsGroupId,std::vector<RsGxsMessageId> >)), this, SLOT(updateBroadcastMsgsChanged(std::map<RsGxsGroupId,std::vector<RsGxsMessageId> >,std::map<RsGxsGroupId,std::vector<RsGxsMessageId> >)));
|
connect(mUpdateBroadcast, SIGNAL(msgsChanged(std::map<RsGxsGroupId,std::set<RsGxsMessageId> >, std::map<RsGxsGroupId,std::set<RsGxsMessageId> >)), this, SLOT(updateBroadcastMsgsChanged(std::map<RsGxsGroupId,std::set<RsGxsMessageId> >,std::map<RsGxsGroupId,std::set<RsGxsMessageId> >)));
|
||||||
}
|
}
|
||||||
|
|
||||||
RsGxsUpdateBroadcastBase::~RsGxsUpdateBroadcastBase()
|
RsGxsUpdateBroadcastBase::~RsGxsUpdateBroadcastBase()
|
||||||
@ -84,79 +84,36 @@ void RsGxsUpdateBroadcastBase::updateBroadcastChanged()
|
|||||||
void RsGxsUpdateBroadcastBase::updateBroadcastGrpsChanged(const std::list<RsGxsGroupId> &grpIds, const std::list<RsGxsGroupId> &grpIdsMeta)
|
void RsGxsUpdateBroadcastBase::updateBroadcastGrpsChanged(const std::list<RsGxsGroupId> &grpIds, const std::list<RsGxsGroupId> &grpIdsMeta)
|
||||||
{
|
{
|
||||||
std::list<RsGxsGroupId>::const_iterator it;
|
std::list<RsGxsGroupId>::const_iterator it;
|
||||||
for (it = grpIds.begin(); it != grpIds.end(); ++it) {
|
for (it = grpIds.begin(); it != grpIds.end(); ++it)
|
||||||
if (std::find(mGrpIds.begin(), mGrpIds.end(), *it) == mGrpIds.end()) {
|
mGrpIds.insert(*it) ;
|
||||||
mGrpIds.push_back(*it);
|
|
||||||
}
|
for (it = grpIdsMeta.begin(); it != grpIdsMeta.end(); ++it)
|
||||||
}
|
mGrpIdsMeta.insert(*it);
|
||||||
for (it = grpIdsMeta.begin(); it != grpIdsMeta.end(); ++it) {
|
|
||||||
if (std::find(mGrpIdsMeta.begin(), mGrpIdsMeta.end(), *it) == mGrpIdsMeta.end()) {
|
|
||||||
mGrpIdsMeta.push_back(*it);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsGxsUpdateBroadcastBase::updateBroadcastMsgsChanged(const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIds, const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIdsMeta)
|
template<class U> void merge(std::set<U>& dst,const std::set<U>& src) { for(auto it(src.begin());it!=src.end();++it) dst.insert(*it) ; }
|
||||||
|
|
||||||
|
void RsGxsUpdateBroadcastBase::updateBroadcastMsgsChanged(const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds, const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIdsMeta)
|
||||||
{
|
{
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::const_iterator mapIt;
|
for (auto mapIt = msgIds.begin(); mapIt != msgIds.end(); ++mapIt)
|
||||||
for (mapIt = msgIds.begin(); mapIt != msgIds.end(); ++mapIt) {
|
merge(mMsgIds[mapIt->first],mapIt->second) ;
|
||||||
const RsGxsGroupId &grpId = mapIt->first;
|
|
||||||
const std::vector<RsGxsMessageId> &srcMsgIds = mapIt->second;
|
|
||||||
std::vector<RsGxsMessageId> &destMsgIds = mMsgIds[grpId];
|
|
||||||
|
|
||||||
std::vector<RsGxsMessageId>::const_iterator msgIt;
|
for (auto mapIt = msgIdsMeta.begin(); mapIt != msgIdsMeta.end(); ++mapIt)
|
||||||
for (msgIt = srcMsgIds.begin(); msgIt != srcMsgIds.end(); ++msgIt) {
|
merge(mMsgIdsMeta[mapIt->first],mapIt->second) ;
|
||||||
if (std::find(destMsgIds.begin(), destMsgIds.end(), *msgIt) == destMsgIds.end()) {
|
|
||||||
destMsgIds.push_back(*msgIt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (mapIt = msgIdsMeta.begin(); mapIt != msgIdsMeta.end(); ++mapIt) {
|
|
||||||
const RsGxsGroupId &grpId = mapIt->first;
|
|
||||||
const std::vector<RsGxsMessageId> &srcMsgIds = mapIt->second;
|
|
||||||
std::vector<RsGxsMessageId> &destMsgIds = mMsgIdsMeta[grpId];
|
|
||||||
|
|
||||||
std::vector<RsGxsMessageId>::const_iterator msgIt;
|
|
||||||
for (msgIt = srcMsgIds.begin(); msgIt != srcMsgIds.end(); ++msgIt) {
|
|
||||||
if (std::find(destMsgIds.begin(), destMsgIds.end(), *msgIt) == destMsgIds.end()) {
|
|
||||||
destMsgIds.push_back(*msgIt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsGxsUpdateBroadcastBase::getAllGrpIds(std::list<RsGxsGroupId> &grpIds)
|
void RsGxsUpdateBroadcastBase::getAllGrpIds(std::set<RsGxsGroupId> &grpIds)
|
||||||
{
|
{
|
||||||
std::list<RsGxsGroupId>::const_iterator it;
|
grpIds = mGrpIds;
|
||||||
for (it = mGrpIds.begin(); it != mGrpIds.end(); ++it) {
|
merge(grpIds,mGrpIdsMeta) ;
|
||||||
if (std::find(grpIds.begin(), grpIds.end(), *it) == grpIds.end()) {
|
|
||||||
grpIds.push_back(*it);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (it = mGrpIdsMeta.begin(); it != mGrpIdsMeta.end(); ++it) {
|
|
||||||
if (std::find(grpIds.begin(), grpIds.end(), *it) == grpIds.end()) {
|
|
||||||
grpIds.push_back(*it);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsGxsUpdateBroadcastBase::getAllMsgIds(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIds)
|
void RsGxsUpdateBroadcastBase::getAllMsgIds(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds)
|
||||||
{
|
{
|
||||||
/* Copy first map */
|
/* Copy first map */
|
||||||
msgIds = mMsgIds;
|
msgIds = mMsgIds;
|
||||||
|
|
||||||
/* Append second map */
|
/* Append second map */
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::const_iterator mapIt;
|
for (auto mapIt = mMsgIdsMeta.begin(); mapIt != mMsgIdsMeta.end(); ++mapIt)
|
||||||
for (mapIt = mMsgIdsMeta.begin(); mapIt != mMsgIdsMeta.end(); ++mapIt) {
|
merge(msgIds[mapIt->first],mapIt->second);
|
||||||
const RsGxsGroupId &grpId = mapIt->first;
|
|
||||||
const std::vector<RsGxsMessageId> &srcMsgIds = mapIt->second;
|
|
||||||
std::vector<RsGxsMessageId> &destMsgIds = msgIds[grpId];
|
|
||||||
|
|
||||||
std::vector<RsGxsMessageId>::const_iterator msgIt;
|
|
||||||
for (msgIt = srcMsgIds.begin(); msgIt != srcMsgIds.end(); ++msgIt) {
|
|
||||||
if (std::find(destMsgIds.begin(), destMsgIds.end(), *msgIt) == destMsgIds.end()) {
|
|
||||||
destMsgIds.push_back(*msgIt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -19,12 +19,12 @@ public:
|
|||||||
RsGxsUpdateBroadcastBase(RsGxsIfaceHelper* ifaceImpl, QWidget *parent = NULL);
|
RsGxsUpdateBroadcastBase(RsGxsIfaceHelper* ifaceImpl, QWidget *parent = NULL);
|
||||||
virtual ~RsGxsUpdateBroadcastBase();
|
virtual ~RsGxsUpdateBroadcastBase();
|
||||||
|
|
||||||
const std::list<RsGxsGroupId> &getGrpIds() { return mGrpIds; }
|
const std::set<RsGxsGroupId> &getGrpIds() { return mGrpIds; }
|
||||||
const std::list<RsGxsGroupId> &getGrpIdsMeta() { return mGrpIdsMeta; }
|
const std::set<RsGxsGroupId> &getGrpIdsMeta() { return mGrpIdsMeta; }
|
||||||
void getAllGrpIds(std::list<RsGxsGroupId> &grpIds);
|
void getAllGrpIds(std::set<RsGxsGroupId> &grpIds);
|
||||||
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIds() { return mMsgIds; }
|
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIds() { return mMsgIds; }
|
||||||
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIdsMeta() { return mMsgIdsMeta; }
|
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIdsMeta() { return mMsgIdsMeta; }
|
||||||
void getAllMsgIds(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIds);
|
void getAllMsgIds(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void fillComplete();
|
void fillComplete();
|
||||||
@ -38,15 +38,15 @@ signals:
|
|||||||
private slots:
|
private slots:
|
||||||
void updateBroadcastChanged();
|
void updateBroadcastChanged();
|
||||||
void updateBroadcastGrpsChanged(const std::list<RsGxsGroupId>& grpIds, const std::list<RsGxsGroupId> &grpIdsMeta);
|
void updateBroadcastGrpsChanged(const std::list<RsGxsGroupId>& grpIds, const std::list<RsGxsGroupId> &grpIdsMeta);
|
||||||
void updateBroadcastMsgsChanged(const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgIds, const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgIdsMeta);
|
void updateBroadcastMsgsChanged(const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIds, const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIdsMeta);
|
||||||
void securedUpdateDisplay();
|
void securedUpdateDisplay();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RsGxsUpdateBroadcast *mUpdateBroadcast;
|
RsGxsUpdateBroadcast *mUpdateBroadcast;
|
||||||
bool mFillComplete;
|
bool mFillComplete;
|
||||||
bool mUpdateWhenInvisible; // Update also when not visible
|
bool mUpdateWhenInvisible; // Update also when not visible
|
||||||
std::list<RsGxsGroupId> mGrpIds;
|
std::set<RsGxsGroupId> mGrpIds;
|
||||||
std::list<RsGxsGroupId> mGrpIdsMeta;
|
std::set<RsGxsGroupId> mGrpIdsMeta;
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > mMsgIds;
|
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgIds;
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > mMsgIdsMeta;
|
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgIdsMeta;
|
||||||
};
|
};
|
||||||
|
@ -22,32 +22,32 @@ void RsGxsUpdateBroadcastPage::setUpdateWhenInvisible(bool update)
|
|||||||
mBase->setUpdateWhenInvisible(update);
|
mBase->setUpdateWhenInvisible(update);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::list<RsGxsGroupId> &RsGxsUpdateBroadcastPage::getGrpIdsMeta()
|
const std::set<RsGxsGroupId> &RsGxsUpdateBroadcastPage::getGrpIdsMeta()
|
||||||
{
|
{
|
||||||
return mBase->getGrpIdsMeta();
|
return mBase->getGrpIdsMeta();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsGxsUpdateBroadcastPage::getAllGrpIds(std::list<RsGxsGroupId> &grpIds)
|
void RsGxsUpdateBroadcastPage::getAllGrpIds(std::set<RsGxsGroupId> &grpIds)
|
||||||
{
|
{
|
||||||
mBase->getAllGrpIds(grpIds);
|
mBase->getAllGrpIds(grpIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::list<RsGxsGroupId> &RsGxsUpdateBroadcastPage::getGrpIds()
|
const std::set<RsGxsGroupId> &RsGxsUpdateBroadcastPage::getGrpIds()
|
||||||
{
|
{
|
||||||
return mBase->getGrpIds();
|
return mBase->getGrpIds();
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &RsGxsUpdateBroadcastPage::getMsgIdsMeta()
|
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &RsGxsUpdateBroadcastPage::getMsgIdsMeta()
|
||||||
{
|
{
|
||||||
return mBase->getMsgIdsMeta();
|
return mBase->getMsgIdsMeta();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsGxsUpdateBroadcastPage::getAllMsgIds(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIds)
|
void RsGxsUpdateBroadcastPage::getAllMsgIds(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds)
|
||||||
{
|
{
|
||||||
mBase->getAllMsgIds(msgIds);
|
mBase->getAllMsgIds(msgIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &RsGxsUpdateBroadcastPage::getMsgIds()
|
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &RsGxsUpdateBroadcastPage::getMsgIds()
|
||||||
{
|
{
|
||||||
return mBase->getMsgIds();
|
return mBase->getMsgIds();
|
||||||
}
|
}
|
||||||
|
@ -24,12 +24,12 @@ public:
|
|||||||
|
|
||||||
void fillComplete();
|
void fillComplete();
|
||||||
void setUpdateWhenInvisible(bool update);
|
void setUpdateWhenInvisible(bool update);
|
||||||
const std::list<RsGxsGroupId> &getGrpIds();
|
const std::set<RsGxsGroupId> &getGrpIds();
|
||||||
const std::list<RsGxsGroupId> &getGrpIdsMeta();
|
const std::set<RsGxsGroupId> &getGrpIdsMeta();
|
||||||
void getAllGrpIds(std::list<RsGxsGroupId> &grpIds);
|
void getAllGrpIds(std::set<RsGxsGroupId> &grpIds);
|
||||||
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIds();
|
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIds();
|
||||||
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIdsMeta();
|
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIdsMeta();
|
||||||
void getAllMsgIds(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIds);
|
void getAllMsgIds(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void showEvent(QShowEvent *event);
|
virtual void showEvent(QShowEvent *event);
|
||||||
|
@ -24,32 +24,32 @@ void RsGxsUpdateBroadcastWidget::setUpdateWhenInvisible(bool update)
|
|||||||
mBase->setUpdateWhenInvisible(update);
|
mBase->setUpdateWhenInvisible(update);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::list<RsGxsGroupId> &RsGxsUpdateBroadcastWidget::getGrpIds()
|
const std::set<RsGxsGroupId> &RsGxsUpdateBroadcastWidget::getGrpIds()
|
||||||
{
|
{
|
||||||
return mBase->getGrpIds();
|
return mBase->getGrpIds();
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::list<RsGxsGroupId> &RsGxsUpdateBroadcastWidget::getGrpIdsMeta()
|
const std::set<RsGxsGroupId> &RsGxsUpdateBroadcastWidget::getGrpIdsMeta()
|
||||||
{
|
{
|
||||||
return mBase->getGrpIdsMeta();
|
return mBase->getGrpIdsMeta();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsGxsUpdateBroadcastWidget::getAllGrpIds(std::list<RsGxsGroupId> &grpIds)
|
void RsGxsUpdateBroadcastWidget::getAllGrpIds(std::set<RsGxsGroupId> &grpIds)
|
||||||
{
|
{
|
||||||
mBase->getAllGrpIds(grpIds);
|
mBase->getAllGrpIds(grpIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &RsGxsUpdateBroadcastWidget::getMsgIds()
|
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &RsGxsUpdateBroadcastWidget::getMsgIds()
|
||||||
{
|
{
|
||||||
return mBase->getMsgIds();
|
return mBase->getMsgIds();
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &RsGxsUpdateBroadcastWidget::getMsgIdsMeta()
|
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &RsGxsUpdateBroadcastWidget::getMsgIdsMeta()
|
||||||
{
|
{
|
||||||
return mBase->getMsgIdsMeta();
|
return mBase->getMsgIdsMeta();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsGxsUpdateBroadcastWidget::getAllMsgIds(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIds)
|
void RsGxsUpdateBroadcastWidget::getAllMsgIds(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds)
|
||||||
{
|
{
|
||||||
mBase->getAllMsgIds(msgIds);
|
mBase->getAllMsgIds(msgIds);
|
||||||
}
|
}
|
||||||
|
@ -24,12 +24,12 @@ public:
|
|||||||
|
|
||||||
void fillComplete();
|
void fillComplete();
|
||||||
void setUpdateWhenInvisible(bool update);
|
void setUpdateWhenInvisible(bool update);
|
||||||
const std::list<RsGxsGroupId> &getGrpIds();
|
const std::set<RsGxsGroupId> &getGrpIds();
|
||||||
const std::list<RsGxsGroupId> &getGrpIdsMeta();
|
const std::set<RsGxsGroupId> &getGrpIdsMeta();
|
||||||
void getAllGrpIds(std::list<RsGxsGroupId> &grpIds);
|
void getAllGrpIds(std::set<RsGxsGroupId> &grpIds);
|
||||||
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIds();
|
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIds();
|
||||||
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIdsMeta();
|
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIdsMeta();
|
||||||
void getAllMsgIds(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIds);
|
void getAllMsgIds(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds);
|
||||||
|
|
||||||
RsGxsIfaceHelper *interfaceHelper() { return mInterfaceHelper; }
|
RsGxsIfaceHelper *interfaceHelper() { return mInterfaceHelper; }
|
||||||
|
|
||||||
|
@ -604,7 +604,7 @@ void CreateGxsChannelMsg::newChannelMsg()
|
|||||||
GxsMsgReq message_ids;
|
GxsMsgReq message_ids;
|
||||||
|
|
||||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||||
message_ids[mChannelId].push_back(mOrigPostId);
|
message_ids[mChannelId].insert(mOrigPostId);
|
||||||
mChannelQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, message_ids, CREATEMSG_CHANNEL_POST_INFO);
|
mChannelQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, message_ids, CREATEMSG_CHANNEL_POST_INFO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,8 +185,8 @@ void CreateGxsForumMsg::newMsg()
|
|||||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||||
|
|
||||||
GxsMsgReq msgIds;
|
GxsMsgReq msgIds;
|
||||||
std::vector<RsGxsMessageId> &vect = msgIds[mForumId];
|
std::set<RsGxsMessageId> &vect = msgIds[mForumId];
|
||||||
vect.push_back(mParentId);
|
vect.insert(mParentId);
|
||||||
|
|
||||||
//std::cerr << "ForumsV2Dialog::newMsg() Requesting Parent Summary(" << mParentId << ")";
|
//std::cerr << "ForumsV2Dialog::newMsg() Requesting Parent Summary(" << mParentId << ")";
|
||||||
//std::cerr << std::endl;
|
//std::cerr << std::endl;
|
||||||
@ -205,8 +205,8 @@ void CreateGxsForumMsg::newMsg()
|
|||||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||||
|
|
||||||
GxsMsgReq msgIds;
|
GxsMsgReq msgIds;
|
||||||
std::vector<RsGxsMessageId> &vect = msgIds[mForumId];
|
std::set<RsGxsMessageId> &vect = msgIds[mForumId];
|
||||||
vect.push_back(mOrigMsgId);
|
vect.insert(mOrigMsgId);
|
||||||
|
|
||||||
//std::cerr << "ForumsV2Dialog::newMsg() Requesting Parent Summary(" << mParentId << ")";
|
//std::cerr << "ForumsV2Dialog::newMsg() Requesting Parent Summary(" << mParentId << ")";
|
||||||
//std::cerr << std::endl;
|
//std::cerr << std::endl;
|
||||||
|
@ -404,25 +404,25 @@ void GxsForumThreadWidget::changeEvent(QEvent *e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void removeMessages(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIds, QList<RsGxsMessageId> &removeMsgId)
|
static void removeMessages(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds, QList<RsGxsMessageId> &removeMsgId)
|
||||||
{
|
{
|
||||||
QList<RsGxsMessageId> removedMsgId;
|
QList<RsGxsMessageId> removedMsgId;
|
||||||
|
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator grpIt;
|
for (auto grpIt = msgIds.begin(); grpIt != msgIds.end(); )
|
||||||
for (grpIt = msgIds.begin(); grpIt != msgIds.end(); ) {
|
{
|
||||||
std::vector<RsGxsMessageId> &msgs = grpIt->second;
|
std::set<RsGxsMessageId> &msgs = grpIt->second;
|
||||||
|
|
||||||
QList<RsGxsMessageId>::const_iterator removeMsgIt;
|
QList<RsGxsMessageId>::const_iterator removeMsgIt;
|
||||||
for (removeMsgIt = removeMsgId.begin(); removeMsgIt != removeMsgId.end(); ++removeMsgIt) {
|
for (removeMsgIt = removeMsgId.begin(); removeMsgIt != removeMsgId.end(); ++removeMsgIt) {
|
||||||
std::vector<RsGxsMessageId>::iterator msgIt = std::find(msgs.begin(), msgs.end(), *removeMsgIt);
|
if(msgs.find(*removeMsgIt) != msgs.end())
|
||||||
if (msgIt != msgs.end()) {
|
{
|
||||||
removedMsgId.push_back(*removeMsgIt);
|
removedMsgId.push_back(*removeMsgIt);
|
||||||
msgs.erase(msgIt);
|
msgs.erase(*removeMsgIt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msgs.empty()) {
|
if (msgs.empty()) {
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator grpItErase = grpIt++;
|
std::map<RsGxsGroupId, std::set<RsGxsMessageId> >::iterator grpItErase = grpIt++;
|
||||||
msgIds.erase(grpItErase);
|
msgIds.erase(grpItErase);
|
||||||
} else {
|
} else {
|
||||||
++grpIt;
|
++grpIt;
|
||||||
@ -452,18 +452,18 @@ void GxsForumThreadWidget::updateDisplay(bool complete)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool updateGroup = false;
|
bool updateGroup = false;
|
||||||
const std::list<RsGxsGroupId> &grpIdsMeta = getGrpIdsMeta();
|
const std::set<RsGxsGroupId> &grpIdsMeta = getGrpIdsMeta();
|
||||||
if (std::find(grpIdsMeta.begin(), grpIdsMeta.end(), groupId()) != grpIdsMeta.end()) {
|
|
||||||
updateGroup = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::list<RsGxsGroupId> &grpIds = getGrpIds();
|
if(grpIdsMeta.find(groupId())!=grpIdsMeta.end())
|
||||||
if (std::find(grpIds.begin(), grpIds.end(), groupId()) != grpIds.end()) {
|
updateGroup = true;
|
||||||
|
|
||||||
|
const std::set<RsGxsGroupId> &grpIds = getGrpIds();
|
||||||
|
if (grpIds.find(groupId())!=grpIds.end()){
|
||||||
updateGroup = true;
|
updateGroup = true;
|
||||||
/* Update threads */
|
/* Update threads */
|
||||||
insertThreads();
|
insertThreads();
|
||||||
} else {
|
} else {
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgIds;
|
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > msgIds;
|
||||||
getAllMsgIds(msgIds);
|
getAllMsgIds(msgIds);
|
||||||
|
|
||||||
if (!mIgnoredMsgId.empty()) {
|
if (!mIgnoredMsgId.empty()) {
|
||||||
@ -2111,8 +2111,8 @@ void GxsForumThreadWidget::flagperson()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
GxsMsgReq msgIds;
|
GxsMsgReq msgIds;
|
||||||
std::vector<RsGxsMessageId> &vect = msgIds[postId.first];
|
std::set<RsGxsMessageId> &vect = msgIds[postId.first];
|
||||||
vect.push_back(postId.second);
|
vect.insert(postId.second);
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mTokenQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, token_type);
|
mTokenQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, token_type);
|
||||||
@ -2413,8 +2413,8 @@ void GxsForumThreadWidget::requestMessageData(const RsGxsGrpMsgIdPair &msgId)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
GxsMsgReq msgIds;
|
GxsMsgReq msgIds;
|
||||||
std::vector<RsGxsMessageId> &vect = msgIds[msgId.first];
|
std::set<RsGxsMessageId> &vect = msgIds[msgId.first];
|
||||||
vect.push_back(msgId.second);
|
vect.insert(msgId.second);
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mTokenQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeMessageData);
|
mTokenQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeMessageData);
|
||||||
@ -2464,8 +2464,8 @@ void GxsForumThreadWidget::requestMsgData_ReplyWithPrivateMessage(const RsGxsGrp
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
GxsMsgReq msgIds;
|
GxsMsgReq msgIds;
|
||||||
std::vector<RsGxsMessageId> &vect = msgIds[msgId.first];
|
std::set<RsGxsMessageId> &vect = msgIds[msgId.first];
|
||||||
vect.push_back(msgId.second);
|
vect.insert(msgId.second);
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mTokenQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeReplyMessage);
|
mTokenQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeReplyMessage);
|
||||||
@ -2482,8 +2482,8 @@ void GxsForumThreadWidget::requestMsgData_ShowAuthorInPeople(const RsGxsGrpMsgId
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
GxsMsgReq msgIds;
|
GxsMsgReq msgIds;
|
||||||
std::vector<RsGxsMessageId> &vect = msgIds[msgId.first];
|
std::set<RsGxsMessageId> &vect = msgIds[msgId.first];
|
||||||
vect.push_back(msgId.second);
|
vect.insert(msgId.second);
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mTokenQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeShowAuthorInPeople);
|
mTokenQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeShowAuthorInPeople);
|
||||||
@ -2499,8 +2499,8 @@ void GxsForumThreadWidget::requestMsgData_EditForumMessage(const RsGxsGrpMsgIdPa
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
GxsMsgReq msgIds;
|
GxsMsgReq msgIds;
|
||||||
std::vector<RsGxsMessageId> &vect = msgIds[msgId.first];
|
std::set<RsGxsMessageId> &vect = msgIds[msgId.first];
|
||||||
vect.push_back(msgId.second);
|
vect.insert(msgId.second);
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mTokenQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeEditForumMessage);
|
mTokenQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeEditForumMessage);
|
||||||
@ -2516,8 +2516,8 @@ void GxsForumThreadWidget::requestMsgData_ReplyForumMessage(const RsGxsGrpMsgIdP
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
GxsMsgReq msgIds;
|
GxsMsgReq msgIds;
|
||||||
std::vector<RsGxsMessageId> &vect = msgIds[msgId.first];
|
std::set<RsGxsMessageId> &vect = msgIds[msgId.first];
|
||||||
vect.push_back(msgId.second);
|
vect.insert(msgId.second);
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mTokenQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeReplyForumMessage);
|
mTokenQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeReplyForumMessage);
|
||||||
|
@ -19,7 +19,7 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void changed();
|
void changed();
|
||||||
void msgsChanged(const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgIds, const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgIdsMeta);
|
void msgsChanged(const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIds, const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIdsMeta);
|
||||||
void grpsChanged(const std::list<RsGxsGroupId>& grpIds, const std::list<RsGxsGroupId>& grpIdsMeta);
|
void grpsChanged(const std::list<RsGxsGroupId>& grpIds, const std::list<RsGxsGroupId>& grpIdsMeta);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
Loading…
Reference in New Issue
Block a user