diff --git a/retroshare-gui/src/gui/common/FriendList.cpp b/retroshare-gui/src/gui/common/FriendList.cpp index d323d100f..b5e460707 100644 --- a/retroshare-gui/src/gui/common/FriendList.cpp +++ b/retroshare-gui/src/gui/common/FriendList.cpp @@ -376,7 +376,7 @@ void FriendList::peerTreeWidgetCostumPopupMenu() // contextMnu.addAction(QIcon(IMAGE_PEERINFO), tr("Profile View"), this, SLOT(viewprofile())); // action = contextMnu.addAction(QIcon(IMAGE_EXPORTFRIEND), tr("Export Friend"), this, SLOT(exportfriend())); - if (type == TYPE_GPG) { + if (type == TYPE_GPG || type == TYPE_SSL) { contextMnu.addAction(QIcon(IMAGE_EXPORTFRIEND), tr("Recommend this Friend to..."), this, SLOT(recommendfriend())); } @@ -1247,8 +1247,20 @@ void FriendList::recommendfriend() if (!peer) return; + std::string peerId = getRsId(peer); std::list ids; - ids.push_back(getRsId(peer)); + + switch (peer->type()) { + case TYPE_SSL: + ids.push_back(peerId); + break; + case TYPE_GPG: + rsPeers->getAssociatedSSLIds(peerId, ids); + break; + default: + return; + } + MessageComposer::recommendFriend(ids); } diff --git a/retroshare-gui/src/gui/msgs/MessageComposer.cpp b/retroshare-gui/src/gui/msgs/MessageComposer.cpp index 1a63ff7dc..d9ac40818 100644 --- a/retroshare-gui/src/gui/msgs/MessageComposer.cpp +++ b/retroshare-gui/src/gui/msgs/MessageComposer.cpp @@ -388,15 +388,15 @@ void MessageComposer::processSettings(bool bLoad) /* window will destroy itself! */ } -static QString BuildRecommendHtml(std::list &peerids) +static QString buildRecommendHtml(std::list &sslIds) { QString text; - /* process peer ids */ - std::list ::iterator peerid; - for (peerid = peerids.begin(); peerid != peerids.end(); peerid++) { + /* process ssl ids */ + std::list ::iterator sslIt; + for (sslIt = sslIds.begin(); sslIt != sslIds.end(); sslIt++) { RetroShareLink link; - if (link.createPerson(*peerid)) { + if (link.createCertificate(*sslIt)) { text += link.toHtml() + "
"; } } @@ -404,11 +404,11 @@ static QString BuildRecommendHtml(std::list &peerids) return text; } -void MessageComposer::recommendFriend(std::list &peerids) +void MessageComposer::recommendFriend(std::list &sslIds) { // std::cerr << "MessageComposer::recommendFriend()" << std::endl; - if (peerids.size() == 0) { + if (sslIds.size() == 0) { return; } @@ -419,11 +419,11 @@ void MessageComposer::recommendFriend(std::list &peerids) QString sMsgText = tr("I recommend a good friend of me, you can trust him too when you trust me.
Copy friend link and paste to Friends list"); sMsgText += "

"; - sMsgText += BuildRecommendHtml(peerids); + sMsgText += buildRecommendHtml(sslIds); pMsgDialog->insertMsgText(sMsgText); std::list ::iterator peerIt; - for (peerIt = peerids.begin(); peerIt != peerids.end(); peerIt++) { + for (peerIt = sslIds.begin(); peerIt != sslIds.end(); peerIt++) { pMsgDialog->addRecipient(CC, *peerIt, false); } @@ -2355,7 +2355,7 @@ void MessageComposer::addBcc() void MessageComposer::addRecommend() { - std::list gpgIds; + std::list sslIds; QTreeWidgetItemIterator itemIterator(ui.msgSendList); QTreeWidgetItem *item; @@ -2372,35 +2372,36 @@ void MessageComposer::addRecommend() continue; } - std::list::iterator it; - for (it = groupInfo.peerIds.begin(); it != groupInfo.peerIds.end(); it++) { - if (std::find(gpgIds.begin(), gpgIds.end(), *it) == gpgIds.end()) { - gpgIds.push_back(*it); + std::list::iterator gpgIt; + for (gpgIt = groupInfo.peerIds.begin(); gpgIt != groupInfo.peerIds.end(); gpgIt++) { + std::list groupSslIds; + rsPeers->getAssociatedSSLIds(*gpgIt, groupSslIds); + + std::list::iterator sslIt; + for (sslIt = groupSslIds.begin(); sslIt != groupSslIds.end(); sslIt++) { + if (std::find(sslIds.begin(), sslIds.end(), *sslIt) == sslIds.end()) { + sslIds.push_back(*sslIt); + } } } } else { - RsPeerDetails detail; - if (rsPeers->getPeerDetails(id, detail) == false) { - continue; - } - - if (std::find(gpgIds.begin(), gpgIds.end(), detail.gpg_id) == gpgIds.end()) { - gpgIds.push_back(detail.gpg_id); + if (std::find(sslIds.begin(), sslIds.end(), id) == sslIds.end()) { + sslIds.push_back(id); } } } } - if (gpgIds.empty()) { + if (sslIds.empty()) { return; } std::list ::iterator it; - for (it = gpgIds.begin(); it != gpgIds.end(); it++) { + for (it = sslIds.begin(); it != sslIds.end(); it++) { addRecipient(CC, *it, false); } - QString text = BuildRecommendHtml(gpgIds); + QString text = buildRecommendHtml(sslIds); ui.msgText->textCursor().insertHtml(text); ui.msgText->setFocus(Qt::OtherFocusReason); } diff --git a/retroshare-gui/src/gui/msgs/MessageComposer.h b/retroshare-gui/src/gui/msgs/MessageComposer.h index 3e342c472..0f428e782 100644 --- a/retroshare-gui/src/gui/msgs/MessageComposer.h +++ b/retroshare-gui/src/gui/msgs/MessageComposer.h @@ -48,7 +48,7 @@ public: ~MessageComposer(); static void msgFriend(std::string id, bool group); - static void recommendFriend(std::list &peerids); + static void recommendFriend(std::list &sslIds); static MessageComposer *newMsg(const std::string &msgId = ""); static MessageComposer *replyMsg(const std::string &msgId, bool all);