From 731e832734fb8e90920cd029bfc190a519b11e98 Mon Sep 17 00:00:00 2001 From: csoler Date: Fri, 30 Aug 2013 21:06:23 +0000 Subject: [PATCH] added proper memory for sources of distant messages git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6654 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/services/p3msgservice.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libretroshare/src/services/p3msgservice.cc b/libretroshare/src/services/p3msgservice.cc index d685c5bac..a860c6b2b 100644 --- a/libretroshare/src/services/p3msgservice.cc +++ b/libretroshare/src/services/p3msgservice.cc @@ -1942,6 +1942,24 @@ bool p3MsgService::decryptMessage(const std::string& mId) else msgi.msgFlags &= ~RS_MSG_FLAGS_SIGNATURE_CHECKS ; // just in case. } + + std::map::iterator it = mSrcIds.find(msgi.msgId) ; + + if(it == mSrcIds.end()) + { + std::cerr << "Warning: could not find message source for id " << msgi.msgId << ". Weird." << std::endl; + + RsMsgSrcId* msi = new RsMsgSrcId(); + msi->msgId = msgi.msgId; + msi->srcId = senders_id.toStdString() ; + + mSrcIds.insert(std::pair(msi->msgId, msi)); + } + else + { + std::cerr << "Substituting source name for message id " << msgi.msgId << ": " << it->second->srcId << " -> " << senders_id.toStdString() << std::endl; + it->second->srcId = senders_id.toStdString() ; + } } delete item ;