From 5be98205d489729667e3dd508acf2ae1d5133195 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Mon, 25 May 2015 14:27:50 -0400 Subject: [PATCH] [RLVa] Allow offering calling card when name restricted. Also cleanup dumb old code around this area --- indra/newview/llviewermenu.cpp | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 7bb79090e..25a44ec65 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -3279,29 +3279,33 @@ class LLAvatarGiveCard : public view_listener_t { llinfos << "handle_give_card()" << llendl; LLViewerObject* dest = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); -// if(dest && dest->isAvatar()) -// [RLVa:KB] - Checked: 2010-06-04 (RLVa-1.2.0d) | Modified: RLVa-1.2.0d | OK - if ( (dest && dest->isAvatar()) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES) && !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMETAGS)) ) -// [/RLVa:KB] + if (dest && dest->isAvatar()) { bool found_name = false; LLSD args; - LLSD old_args; - LLNameValue* nvfirst = dest->getNVPair("FirstName"); - LLNameValue* nvlast = dest->getNVPair("LastName"); - if(nvfirst && nvlast) +// [RLVa:KB] - Checked: 2010-06-04 (RLVa-1.2.0d) | Modified: RLVa-1.2.0d | OK + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES) || gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMETAGS)) { - args["NAME"] = std::string(nvfirst->getString()) + " " + nvlast->getString(); - old_args["NAME"] = std::string(nvfirst->getString()) + " " + nvlast->getString(); + args["NAME"] = RlvStrings::getString(RLV_STRING_HIDDEN); found_name = true; } - LLViewerRegion* region = dest->getRegion(); + else +// [/RLVa:KB] + { + LLNameValue* nvfirst = dest->getNVPair("FirstName"); + LLNameValue* nvlast = dest->getNVPair("LastName"); + if (nvfirst && nvlast) + { + args["NAME"] = std::string(nvfirst->getString()) + " " + nvlast->getString(); + found_name = true; + } + } LLHost dest_host; - if(region) + if (LLViewerRegion* region = dest->getRegion()) { dest_host = region->getHost(); } - if(found_name && dest_host.isOk()) + if (found_name && dest_host.isOk()) { LLMessageSystem* msg = gMessageSystem; msg->newMessage("OfferCallingCard"); @@ -3318,7 +3322,7 @@ class LLAvatarGiveCard : public view_listener_t } else { - LLNotificationsUtil::add("CantOfferCallingCard", old_args); + LLNotificationsUtil::add("CantOfferCallingCard", args); } } return true;