diff --git a/indra/newview/llnamebox.cpp b/indra/newview/llnamebox.cpp index 930f62f6a..cb59b6e32 100644 --- a/indra/newview/llnamebox.cpp +++ b/indra/newview/llnamebox.cpp @@ -79,6 +79,7 @@ void LLNameBox::initFromXML(LLXMLNodePtr node, LLView* parent) LLTextBox::initFromXML(node, parent); node->getAttributeString("initial_value", mInitialValue); setText(mInitialValue); + node->getAttribute_bool("rlv_sensitive", mRLVSensitive); } // static diff --git a/indra/newview/llnameeditor.cpp b/indra/newview/llnameeditor.cpp index d023d6f49..a82a34dd8 100644 --- a/indra/newview/llnameeditor.cpp +++ b/indra/newview/llnameeditor.cpp @@ -43,9 +43,10 @@ LLNameEditor::LLNameEditor(const std::string& name, const LLRect& rect, const LLUUID& name_id, bool is_group, const std::string& loading, + bool rlv_sensitive, const LLFontGL* glfont, S32 max_text_length) -: LLNameUI(loading, name_id, is_group) +: LLNameUI(loading, rlv_sensitive, name_id, is_group) , LLLineEditor(name, rect, LLStringUtil::null, glfont, max_text_length) { if (!name_id.isNull()) @@ -115,10 +116,12 @@ LLView* LLNameEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory node->getAttributeUUID("id", id); std::string loading; node->getAttributeString("label", loading); + bool rlv_sensitive = false; + node->getAttribute_bool("rlv_sensitive", rlv_sensitive); LLNameEditor* line_editor = new LLNameEditor("name_editor", rect, - id, is_group, loading, + id, is_group, loading, rlv_sensitive, LLView::selectFont(node), max_text_length); diff --git a/indra/newview/llnameeditor.h b/indra/newview/llnameeditor.h index 2a66daa20..e7812927d 100644 --- a/indra/newview/llnameeditor.h +++ b/indra/newview/llnameeditor.h @@ -45,6 +45,7 @@ public: const LLUUID& name_id = LLUUID::null, bool is_group = false, const std::string& loading = LLStringUtil::null, + bool rlv_sensitive = false, const LLFontGL* glfont = nullptr, S32 max_text_length = 254); diff --git a/indra/newview/llnameui.cpp b/indra/newview/llnameui.cpp index cd9ff731f..8a05d0d2c 100644 --- a/indra/newview/llnameui.cpp +++ b/indra/newview/llnameui.cpp @@ -33,13 +33,16 @@ #include "llviewerprecompiledheaders.h" #include "llnameui.h" +#include "llagentdata.h" #include "lltrans.h" +#include "rlvhandler.h" + // statics std::set LLNameUI::sInstances; -LLNameUI::LLNameUI(const std::string& loading, const LLUUID& id, bool is_group) -: mNameID(id), mIsGroup(is_group), mAllowInteract(false) +LLNameUI::LLNameUI(const std::string& loading, bool rlv_sensitive, const LLUUID& id, bool is_group) +: mNameID(id), mRLVSensitive(rlv_sensitive), mIsGroup(is_group), mAllowInteract(false) , mInitialValue(!loading.empty() ? loading : LLTrans::getString("LoadingData")) { sInstances.insert(this); @@ -69,6 +72,16 @@ void LLNameUI::setNameText() got_name = gCacheName->getFullName(mNameID, name); } + if (!mIsGroup && got_name && mRLVSensitive) // Filter if needed + { + if ((gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES) || gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMETAGS)) + && mNameID.notNull() && mNameID != gAgentID && RlvUtil::isNearbyAgent(mNameID)) + { + mAllowInteract = false; + name = RlvStrings::getAnonym(name); + } + else mAllowInteract = true; + } // Got the name already? Set it. // Otherwise it will be set later in refresh(). diff --git a/indra/newview/llnameui.h b/indra/newview/llnameui.h index e10814f23..599a31b8f 100644 --- a/indra/newview/llnameui.h +++ b/indra/newview/llnameui.h @@ -38,7 +38,7 @@ struct LLNameUI : public LFIDBearer { - LLNameUI(const std::string& loading = LLStringUtil::null, const LLUUID& id = LLUUID::null, bool is_group = false); + LLNameUI(const std::string& loading = LLStringUtil::null, bool rlv_sensitive = false, const LLUUID& id = LLUUID::null, bool is_group = false); virtual ~LLNameUI() { sInstances.erase(this); } LLUUID getStringUUIDSelectedItem() const override final { return mNameID; } @@ -57,6 +57,7 @@ private: protected: LLUUID mNameID; + bool mRLVSensitive; // Whether or not we're doing RLV filtering bool mIsGroup; bool mAllowInteract; std::string mInitialValue;