enabled webui to show own locations

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8182 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
electron128 2015-04-28 14:56:38 +00:00
parent 7ba6b24122
commit c908c81481

View File

@ -139,6 +139,8 @@ void PeersHandler::handleWildcard(Request &req, Response &resp)
ok = true;
std::list<RsPgpId> identities;
ok &= mRsPeers->getGPGAcceptedList(identities);
RsPgpId own_pgp = mRsPeers->getGPGOwnId();
identities.push_back(own_pgp);
std::list<RsPeerId> peers;
ok &= mRsPeers->getFriendList(peers);
std::list<RsGroupInfo> grpInfo;
@ -152,9 +154,22 @@ void PeersHandler::handleWildcard(Request &req, Response &resp)
}
for(std::list<RsPgpId>::iterator lit = identities.begin(); lit != identities.end(); ++lit)
{
// if no own ssl id is known, then hide the own id from the friendslist
if(*lit == own_pgp)
{
bool found = false;
for(std::vector<RsPeerDetails>::iterator vit = detailsVec.begin(); vit != detailsVec.end(); ++vit)
{
if(vit->gpg_id == *lit)
found = true;
}
if(!found)
continue;
}
StreamBase& itemStream = resp.mDataStream.getStreamToMember();
itemStream << makeKeyValueReference("pgp_id", *lit);
itemStream << makeKeyValue("name", mRsPeers->getGPGName(*lit));
itemStream << makeKeyValue("is_own", *lit == own_pgp);
StreamBase& locationStream = itemStream.getStreamToMember("locations");
// mark as list (in case list is empty)
locationStream.getStreamToMember();