fixed RS link so as to send messages to GXS ids. Remaining issue: a link might need to be clicked several times before it works

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7351 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-05-08 07:52:28 +00:00
parent 2da8acd967
commit a946504bb5
3 changed files with 1833 additions and 1798 deletions

File diff suppressed because it is too large Load Diff

View File

@ -35,6 +35,10 @@ const QString PeerDefs::nameWithLocation(const RsPeerDetails &details)
return name;
}
const QString PeerDefs::nameWithLocation(const RsIdentityDetails &details)
{
return QString::fromUtf8(details.mNickname.c_str()) + " (" + QString::fromStdString(details.mId.toStdString()) + ")";
}
const QString PeerDefs::rsid(const std::string &name, const RsPgpId &id)
{
if (name.empty()) {
@ -64,6 +68,40 @@ const QString PeerDefs::rsid(const RsPeerDetails &details)
{
return rsid(details.name, details.id);
}
const QString PeerDefs::rsidFromId(const RsGxsId &id, QString *name /* = NULL*/)
{
QString rsid;
// Check own GXS ids.
//
std::list<RsGxsId> gxs_ids ;
rsIdentity->getOwnIds(gxs_ids) ;
for(std::list<RsGxsId>::const_iterator it(gxs_ids.begin());it!=gxs_ids.end();++it)
if(*it == id)
{
// not a real peer. Try from hash for distant messages
RsIdentityDetails details ;
if(!rsIdentity->getIdDetails(*it,details))
continue ;
std::string peerName = details.mNickname ;
rsid = PeerDefs::rsid(peerName, *it);
if(name)
*name = QString::fromUtf8(peerName.c_str());
return rsid ;
}
rsid = PeerDefs::rsid("", id);
if (name)
*name = qApp->translate("PeerDefs", "Unknown");
return rsid;
}
const QString PeerDefs::rsidFromId(const RsPeerId &id, QString *name /* = NULL*/)
{
QString rsid;

View File

@ -32,6 +32,7 @@ class PeerDefs
{
public:
static const QString nameWithLocation(const RsPeerDetails &details);
static const QString nameWithLocation(const RsIdentityDetails &details);
static const QString rsid(const RsPeerDetails &details);
static const QString rsid(const std::string &name, const RsPeerId &id);
@ -39,6 +40,7 @@ public:
static const QString rsid(const std::string &name, const RsGxsId &id);
static const QString rsidFromId(const RsPgpId &id, QString *name = NULL);
static const QString rsidFromId(const RsPeerId &id, QString *name = NULL);
static const QString rsidFromId(const RsGxsId &id, QString *name = NULL);
static RsPeerId idFromRsid(const QString &rsid, bool check);
};