for each channel msg post download request is now only called once.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4136 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2011-04-08 21:58:03 +00:00
parent 05ed2bec88
commit bff095198c

View file

@ -740,18 +740,26 @@ bool p3Channels::locked_eventDuplicateMsg(GroupInfo *grp, RsDistribMsg *msg, std
return true; return true;
} }
// check if msg has done download already // return if msg has d download already
chanStatMap::iterator cit = mMsgReadStatus.find(grpId);
statMap MsgMap; statMap MsgMap;
statMap::iterator mit1, mit2; statMap::iterator mit1, mit2;
std::list<RsChannelReadStatus*>::iterator lit = mReadStatus.begin();
if(cit != mMsgReadStatus.end()){ for(;lit != mReadStatus.end();lit++){
mit1 = cit->second.find(msgId);
if(mit1 != cit->second.end()){ if((*lit)->channelId == grpId)
break;
}
if(lit != mReadStatus.end()){
if(( mit1=(*lit)->msgReadStatus.find(msgId)) != (*lit)->msgReadStatus.end()){
if(mit1->second & CHANNEL_MSG_STATUS_DOWLOADED) if(mit1->second & CHANNEL_MSG_STATUS_DOWLOADED)
return false; return false;
}else{
// create an entry for msg id
(*lit)->msgReadStatus[msgId] = ~CHANNEL_MSG_STATUS_MASK;
} }
} }
@ -850,13 +858,15 @@ bool p3Channels::locked_eventDuplicateMsg(GroupInfo *grp, RsDistribMsg *msg, std
localpath, flags, srcIds); localpath, flags, srcIds);
} }
if(cit != mMsgReadStatus.end()){ if(lit != mReadStatus.end()){
if(mit1 != cit->second.end()) (*lit)->msgReadStatus[msgId] |= (CHANNEL_MSG_STATUS_MASK &
mit1->second |= (CHANNEL_MSG_STATUS_MASK &
CHANNEL_MSG_STATUS_DOWLOADED); CHANNEL_MSG_STATUS_DOWLOADED);
} }
IndicateConfigChanged();
return true; return true;
} }