mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-02 05:02:33 -04:00
webui: allow to set peer flags when adding friends (whitelist flag is set to false)
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8364 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
399340ef38
commit
aea5a77aeb
6 changed files with 69 additions and 5 deletions
|
@ -224,6 +224,7 @@ StreamBase& JsonStream::getStreamToMember(std::string name)
|
|||
mChild = new JsonStream();
|
||||
if(!serialise())
|
||||
{
|
||||
mChild->mSerialise = false;
|
||||
if(checkDeserialisation() && checkObjectMember(name))
|
||||
{
|
||||
mChild->mValue = mObject[name];
|
||||
|
|
|
@ -191,11 +191,32 @@ void PeersHandler::handleWildcard(Request &req, Response &resp)
|
|||
{
|
||||
std::string cert_string;
|
||||
req.mStream << makeKeyValueReference("cert_string", cert_string);
|
||||
|
||||
ServicePermissionFlags flags;
|
||||
StreamBase& flags_stream = req.mStream.getStreamToMember("flags");
|
||||
if(req.mStream.isOK())
|
||||
{
|
||||
bool direct_dl = RS_NODE_PERM_DEFAULT & RS_NODE_PERM_DIRECT_DL;
|
||||
flags_stream << makeKeyValueReference("allow_direct_download", direct_dl);
|
||||
if(direct_dl) flags |= RS_NODE_PERM_DIRECT_DL;
|
||||
|
||||
bool allow_push = RS_NODE_PERM_DEFAULT & RS_NODE_PERM_ALLOW_PUSH;
|
||||
flags_stream << makeKeyValueReference("allow_push", allow_push);
|
||||
if(allow_push) flags |= RS_NODE_PERM_ALLOW_PUSH;
|
||||
|
||||
bool require_whitelist = RS_NODE_PERM_DEFAULT & RS_NODE_PERM_REQUIRE_WL;
|
||||
flags_stream << makeKeyValueReference("require_whitelist", require_whitelist);
|
||||
if(require_whitelist) flags |= RS_NODE_PERM_REQUIRE_WL;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags = RS_NODE_PERM_DEFAULT;
|
||||
}
|
||||
RsPeerId peer_id;
|
||||
RsPgpId pgp_id;
|
||||
std::string error_string;
|
||||
if(mRsPeers->loadCertificateFromString(cert_string, peer_id, pgp_id, error_string)
|
||||
&& mRsPeers->addFriend(peer_id, pgp_id))
|
||||
&& mRsPeers->addFriend(peer_id, pgp_id, flags))
|
||||
{
|
||||
ok = true;
|
||||
resp.mDataStream << makeKeyValueReference("pgp_id", pgp_id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue