From 4d4c4c0a473ffde310cbec8c798aaf83759ff659 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Thu, 12 May 2011 19:37:13 +0000 Subject: [PATCH] Fixed recommend friend. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4197 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/RetroShareLink.cpp | 12 +++++++++--- retroshare-gui/src/gui/RetroShareLink.h | 2 +- retroshare-gui/src/gui/msgs/MessageComposer.cpp | 11 ++--------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/retroshare-gui/src/gui/RetroShareLink.cpp b/retroshare-gui/src/gui/RetroShareLink.cpp index 548cbd015..151a7bcc4 100644 --- a/retroshare-gui/src/gui/RetroShareLink.cpp +++ b/retroshare-gui/src/gui/RetroShareLink.cpp @@ -234,12 +234,18 @@ bool RetroShareLink::createFile(const QString& name, uint64_t size, const QStrin return valid(); } -bool RetroShareLink::createPerson(const QString& name, const QString& hash) +bool RetroShareLink::createPerson(const std::string& id) { clear(); - _name = name; - _hash = hash; + RsPeerDetails detail; + if (rsPeers->getPeerDetails(id, detail) == false) { + std::cerr << "RetroShareLink::createPerson() Couldn't find peer id " << id << std::endl; + return false; + } + + _hash = QString::fromStdString(id); + _name = QString::fromUtf8(detail.name.c_str()); _type = TYPE_PERSON; diff --git a/retroshare-gui/src/gui/RetroShareLink.h b/retroshare-gui/src/gui/RetroShareLink.h index d49a6e3d3..43ee107de 100644 --- a/retroshare-gui/src/gui/RetroShareLink.h +++ b/retroshare-gui/src/gui/RetroShareLink.h @@ -55,7 +55,7 @@ class RetroShareLink RetroShareLink(const QString& url); bool createFile(const QString& name, uint64_t size, const QString& hash); - bool createPerson(const QString& name, const QString& hash); + bool createPerson(const std::string& id); bool createForum(const std::string& id, const std::string& msgId); bool createChannel(const std::string& id, const std::string& msgId); bool createSearch(const QString& keywords); diff --git a/retroshare-gui/src/gui/msgs/MessageComposer.cpp b/retroshare-gui/src/gui/msgs/MessageComposer.cpp index 973328ea0..73409f625 100644 --- a/retroshare-gui/src/gui/msgs/MessageComposer.cpp +++ b/retroshare-gui/src/gui/msgs/MessageComposer.cpp @@ -377,17 +377,10 @@ static QString BuildRecommendHtml(std::list &peerids) /* process peer ids */ std::list ::iterator peerid; for (peerid = peerids.begin(); peerid != peerids.end(); peerid++) { - RsPeerDetails detail; - if (rsPeers->getPeerDetails(*peerid, detail) == false) { - std::cerr << "MessageComposer::recommendFriend() Couldn't find peer id " << *peerid << std::endl; - continue; - } - RetroShareLink link; - if (link.createPerson(QString::fromUtf8(detail.name.c_str()), QString::fromStdString(detail.id))) { - continue; + if (link.createPerson(*peerid)) { + text += link.toHtml() + "
"; } - text += link.toHtmlFull() + "
"; } return text;