improved name support for distant peers in messages

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6653 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2013-08-30 20:40:28 +00:00
parent 8aaa4db85c
commit abd8c1e32f
3 changed files with 47 additions and 8 deletions

View file

@ -1914,6 +1914,10 @@ bool p3MsgService::decryptMessage(const std::string& mId)
std::cerr << " Decrypted message was succesfully deserialized. New message:" << std::endl;
item->print(std::cerr,0) ;
#endif
std::string own_hash ;
std::string own_pgp_id = AuthGPG::getAuthGPG()->getGPGOwnId();
getDistantMessageHash(own_pgp_id,own_hash) ;
{
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
@ -1925,6 +1929,10 @@ bool p3MsgService::decryptMessage(const std::string& mId)
msgi.msgFlags &= ~RS_MSG_FLAGS_ENCRYPTED ; // just in case.
msgi.PeerId(senders_id.toStdString()) ;
for(std::list<std::string>::iterator it(msgi.msgto.ids.begin());it!=msgi.msgto.ids.end();++it) if(*it == own_hash) *it = own_pgp_id ;
for(std::list<std::string>::iterator it(msgi.msgcc.ids.begin());it!=msgi.msgcc.ids.end();++it) if(*it == own_hash) *it = own_pgp_id ;
for(std::list<std::string>::iterator it(msgi.msgbcc.ids.begin());it!=msgi.msgbcc.ids.end();++it) if(*it == own_hash) *it = own_pgp_id ;
if(signature_present)
{
msgi.msgFlags |= RS_MSG_FLAGS_SIGNED ;