diff --git a/libretroshare/src/gxs/rsgenexchange.cc b/libretroshare/src/gxs/rsgenexchange.cc index e7ae496f9..bdf1e2021 100644 --- a/libretroshare/src/gxs/rsgenexchange.cc +++ b/libretroshare/src/gxs/rsgenexchange.cc @@ -1135,7 +1135,6 @@ bool RsGenExchange::getGroupMeta(const uint32_t &token, std::list& metaV = mit->second; - msgInfo[mit->first] = std::vector(); std::vector& msgInfoV = msgInfo[mit->first]; std::vector::iterator vit = metaV.begin(); @@ -1181,7 +1179,6 @@ bool RsGenExchange::getMsgRelatedMeta(const uint32_t &token, GxsMsgRelatedMetaMa { std::vector& metaV = mit->second; - msgMeta[mit->first] = std::vector(); std::vector& msgInfoV = msgMeta[mit->first]; std::vector::iterator vit = metaV.begin(); @@ -1265,14 +1262,14 @@ bool RsGenExchange::getMsgData(const uint32_t &token, GxsMsgDataMap &msgItems) RS_STACK_MUTEX(mGenMtx) ; NxsMsgDataResult msgResult; bool ok = mDataAccess->getMsgData(token, msgResult); - NxsMsgDataResult::iterator mit = msgResult.begin(); if(ok) { + NxsMsgDataResult::iterator mit = msgResult.begin(); for(; mit != msgResult.end(); ++mit) { - std::vector gxsMsgItems; const RsGxsGroupId& grpId = mit->first; + std::vector& gxsMsgItems = msgItems[grpId]; std::vector& nxsMsgsV = mit->second; std::vector::iterator vit = nxsMsgsV.begin(); for(; vit != nxsMsgsV.end(); ++vit) @@ -1305,7 +1302,6 @@ bool RsGenExchange::getMsgData(const uint32_t &token, GxsMsgDataMap &msgItems) } delete msg; } - msgItems[grpId] = gxsMsgItems; } } return ok; @@ -1317,17 +1313,15 @@ bool RsGenExchange::getMsgRelatedData(const uint32_t &token, GxsMsgRelatedDataMa NxsMsgRelatedDataResult msgResult; bool ok = mDataAccess->getMsgRelatedData(token, msgResult); - if(ok) { NxsMsgRelatedDataResult::iterator mit = msgResult.begin(); for(; mit != msgResult.end(); ++mit) { - std::vector gxsMsgItems; const RsGxsGrpMsgIdPair& msgId = mit->first; + std::vector &gxsMsgItems = msgItems[msgId]; std::vector& nxsMsgsV = mit->second; - std::vector::iterator vit - = nxsMsgsV.begin(); + std::vector::iterator vit = nxsMsgsV.begin(); for(; vit != nxsMsgsV.end(); ++vit) { RsNxsMsg*& msg = *vit; @@ -1360,15 +1354,11 @@ bool RsGenExchange::getMsgRelatedData(const uint32_t &token, GxsMsgRelatedDataMa delete msg; } - msgItems[msgId] = gxsMsgItems; } } return ok; } - - - RsTokenService* RsGenExchange::getTokenService() { return mDataAccess; diff --git a/libretroshare/src/gxs/rsgxsdataaccess.cc b/libretroshare/src/gxs/rsgxsdataaccess.cc index 21d697428..c9033c9c0 100644 --- a/libretroshare/src/gxs/rsgxsdataaccess.cc +++ b/libretroshare/src/gxs/rsgxsdataaccess.cc @@ -448,7 +448,7 @@ bool RsGxsDataAccess::getGroupData(const uint32_t& token, std::list& if(gmreq) { - grpData = gmreq->mGroupData; + grpData.swap(gmreq->mGroupData); gmreq->mGroupData.clear(); locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE); }else{ @@ -480,7 +480,7 @@ bool RsGxsDataAccess::getMsgData(const uint32_t& token, NxsMsgDataResult& msgDat if(mdreq) { - msgData = mdreq->mMsgData; + msgData.swap(mdreq->mMsgData); mdreq->mMsgData.clear(); locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE); } @@ -517,7 +517,7 @@ bool RsGxsDataAccess::getMsgRelatedData(const uint32_t &token, NxsMsgRelatedData if(mrireq) { - msgData = mrireq->mMsgDataResult; + msgData.swap(mrireq->mMsgDataResult); mrireq->mMsgDataResult.clear(); locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE); } @@ -551,7 +551,7 @@ bool RsGxsDataAccess::getMsgSummary(const uint32_t& token, GxsMsgMetaResult& msg if(mmreq) { - msgInfo = mmreq->mMsgMetaData; + msgInfo.swap(mmreq->mMsgMetaData); mmreq->mMsgMetaData.clear(); locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE); @@ -591,7 +591,7 @@ bool RsGxsDataAccess::getMsgRelatedSummary(const uint32_t &token, MsgRelatedMeta if(mrireq) { - msgMeta = mrireq->mMsgMetaResult; + msgMeta.swap(mrireq->mMsgMetaResult); mrireq->mMsgMetaResult.clear(); locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE); } @@ -630,7 +630,7 @@ bool RsGxsDataAccess::getMsgRelatedList(const uint32_t &token, MsgRelatedIdResul if(mrireq) { - msgIds = mrireq->mMsgIdResult; + msgIds.swap(mrireq->mMsgIdResult); mrireq->mMsgIdResult.clear(); locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE); } @@ -664,7 +664,7 @@ bool RsGxsDataAccess::getMsgList(const uint32_t& token, GxsMsgIdResult& msgIds) if(mireq) { - msgIds = mireq->mMsgIdResult; + msgIds.swap(mireq->mMsgIdResult); mireq->mMsgIdResult.clear(); locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE); } @@ -697,7 +697,7 @@ bool RsGxsDataAccess::getGroupList(const uint32_t& token, std::listmGroupIdResult; + groupIds.swap(gireq->mGroupIdResult); gireq->mGroupIdResult.clear(); locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE); diff --git a/libretroshare/src/services/p3gxschannels.cc b/libretroshare/src/services/p3gxschannels.cc index afd4c1ef6..bac137bc8 100644 --- a/libretroshare/src/services/p3gxschannels.cc +++ b/libretroshare/src/services/p3gxschannels.cc @@ -337,7 +337,6 @@ bool p3GxsChannels::getPostData(const uint32_t &token, std::vectorfirst; std::vector& msgItems = mit->second; std::vector::iterator vit = msgItems.begin(); diff --git a/libretroshare/src/services/p3gxsforums.cc b/libretroshare/src/services/p3gxsforums.cc index 731b968e7..ac9276f15 100644 --- a/libretroshare/src/services/p3gxsforums.cc +++ b/libretroshare/src/services/p3gxsforums.cc @@ -199,8 +199,7 @@ bool p3GxsForums::getGroupData(const uint32_t &token, std::vectormGroup; - item->mGroup.mMeta = item->meta; - grp.mMeta = item->mGroup.mMeta; + grp.mMeta = item->meta; delete item; groups.push_back(grp); } @@ -230,7 +229,6 @@ bool p3GxsForums::getMsgData(const uint32_t &token, std::vector & for(; mit != msgData.end(); ++mit) { - RsGxsGroupId grpId = mit->first; std::vector& msgItems = mit->second; std::vector::iterator vit = msgItems.begin();