mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-24 08:41:26 -04:00
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:
parent
8aaa4db85c
commit
abd8c1e32f
3 changed files with 47 additions and 8 deletions
|
@ -1914,6 +1914,10 @@ bool p3MsgService::decryptMessage(const std::string& mId)
|
||||||
std::cerr << " Decrypted message was succesfully deserialized. New message:" << std::endl;
|
std::cerr << " Decrypted message was succesfully deserialized. New message:" << std::endl;
|
||||||
item->print(std::cerr,0) ;
|
item->print(std::cerr,0) ;
|
||||||
#endif
|
#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 ******/
|
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.msgFlags &= ~RS_MSG_FLAGS_ENCRYPTED ; // just in case.
|
||||||
msgi.PeerId(senders_id.toStdString()) ;
|
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)
|
if(signature_present)
|
||||||
{
|
{
|
||||||
msgi.msgFlags |= RS_MSG_FLAGS_SIGNED ;
|
msgi.msgFlags |= RS_MSG_FLAGS_SIGNED ;
|
||||||
|
|
|
@ -1481,7 +1481,10 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
||||||
std::cerr << " RetroShareLink::process MessageRequest : id : " << link.hash().toStdString() << ", subject : " << link.name().toStdString() << std::endl;
|
std::cerr << " RetroShareLink::process MessageRequest : id : " << link.hash().toStdString() << ", subject : " << link.name().toStdString() << std::endl;
|
||||||
#endif
|
#endif
|
||||||
RsPeerDetails detail;
|
RsPeerDetails detail;
|
||||||
if (rsPeers->getPeerDetails(link.hash().toStdString(), detail)) {
|
std::string dm_hash ;
|
||||||
|
|
||||||
|
if (rsPeers->getPeerDetails(link.hash().toStdString(), detail))
|
||||||
|
{
|
||||||
if (detail.accept_connection || detail.id == rsPeers->getOwnId() || detail.id == rsPeers->getGPGOwnId()) {
|
if (detail.accept_connection || detail.id == rsPeers->getOwnId() || detail.id == rsPeers->getGPGOwnId()) {
|
||||||
MessageComposer *msg = MessageComposer::newMsg();
|
MessageComposer *msg = MessageComposer::newMsg();
|
||||||
msg->addRecipient(MessageComposer::TO, detail.id, false);
|
msg->addRecipient(MessageComposer::TO, detail.id, false);
|
||||||
|
@ -1490,7 +1493,21 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
||||||
}
|
}
|
||||||
msg->show();
|
msg->show();
|
||||||
messageStarted.append(PeerDefs::nameWithLocation(detail));
|
messageStarted.append(PeerDefs::nameWithLocation(detail));
|
||||||
} else {
|
}
|
||||||
|
else if(rsMsgs->getDistantMessageHash(detail.gpg_id,dm_hash))
|
||||||
|
{
|
||||||
|
MessageComposer *msg = MessageComposer::newMsg();
|
||||||
|
msg->addRecipient(MessageComposer::TO, dm_hash,detail.gpg_id) ;
|
||||||
|
|
||||||
|
if (link.subject().isEmpty() == false) {
|
||||||
|
msg->setTitleText(link.subject());
|
||||||
|
}
|
||||||
|
msg->show();
|
||||||
|
messageStarted.append(PeerDefs::nameWithLocation(detail));
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
messageReceipientNotAccepted.append(PeerDefs::nameWithLocation(detail));
|
messageReceipientNotAccepted.append(PeerDefs::nameWithLocation(detail));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
|
#include <retroshare/rsmsgs.h>
|
||||||
|
|
||||||
#include "PeerDefs.h"
|
#include "PeerDefs.h"
|
||||||
|
|
||||||
|
@ -53,19 +54,32 @@ const QString PeerDefs::rsidFromId(const std::string &id, QString *name /* = NUL
|
||||||
QString rsid;
|
QString rsid;
|
||||||
|
|
||||||
std::string peerName = rsPeers->getPeerName(id);
|
std::string peerName = rsPeers->getPeerName(id);
|
||||||
if (peerName.empty()) {
|
std::string hash ;
|
||||||
rsid = PeerDefs::rsid("", id);
|
|
||||||
|
|
||||||
if (name) {
|
if(!peerName.empty())
|
||||||
*name = qApp->translate("PeerDefs", "Unknown");
|
{
|
||||||
}
|
|
||||||
} else {
|
|
||||||
rsid = PeerDefs::rsid(peerName, id);
|
rsid = PeerDefs::rsid(peerName, id);
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
*name = QString::fromUtf8(peerName.c_str());
|
*name = QString::fromUtf8(peerName.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(rsMsgs->getDistantMessageHash(rsPeers->getGPGOwnId(),hash) && hash == id)
|
||||||
|
{
|
||||||
|
// not a real peer. Try from hash for distant messages
|
||||||
|
|
||||||
|
peerName = rsPeers->getGPGName(rsPeers->getGPGOwnId()) ;
|
||||||
|
rsid = PeerDefs::rsid(peerName, rsPeers->getGPGOwnId());
|
||||||
|
if(name)
|
||||||
|
*name = QString::fromUtf8(peerName.c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rsid = PeerDefs::rsid("", id);
|
||||||
|
|
||||||
|
if (name)
|
||||||
|
*name = qApp->translate("PeerDefs", "Unknown");
|
||||||
|
}
|
||||||
|
|
||||||
return rsid;
|
return rsid;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue