Fixed missing notify of changed message ids to the gui.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8011 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2015-03-11 13:39:58 +00:00
parent 78160d729f
commit b26c55126c

View File

@ -1014,6 +1014,27 @@ void RsGenExchange::receiveChanges(std::vector<RsGxsNotify*>& changes)
}
static void addMessageChanged(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgs, const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgChanged)
{
if (msgs.empty()) {
msgs = msgChanged;
} else {
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::const_iterator mapIt;
for (mapIt = msgChanged.begin(); mapIt != msgChanged.end(); ++mapIt) {
const RsGxsGroupId &grpId = mapIt->first;
const std::vector<RsGxsMessageId> &srcMsgIds = mapIt->second;
std::vector<RsGxsMessageId> &destMsgIds = msgs[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 RsGenExchange::msgsChanged(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgs, std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgsMeta)
{
if(mGenMtx.trylock())
@ -1023,11 +1044,11 @@ void RsGenExchange::msgsChanged(std::map<RsGxsGroupId, std::vector<RsGxsMessageI
RsGxsMsgChange* mc = mMsgChange.back();
if (mc->metaChange())
{
msgsMeta = mc->msgChangeMap;
addMessageChanged(msgsMeta, mc->msgChangeMap);
}
else
{
msgs = mc->msgChangeMap;
addMessageChanged(msgs, mc->msgChangeMap);
}
mMsgChange.pop_back();
delete mc;