From fa1ff81980f2b57863bfed88b552a4f18ba65ac2 Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Mon, 1 Nov 2010 02:18:50 +0100 Subject: [PATCH] - internal : RlvUtil::filterNames() will filter both display names and legacy names of nearby agents --HG-- branch : RLVa --- indra/newview/rlvcommon.cpp | 19 +++++++++++++------ indra/newview/rlvcommon.h | 12 ++++++------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/indra/newview/rlvcommon.cpp b/indra/newview/rlvcommon.cpp index 8e0a8364cf..6077ef65e2 100644 --- a/indra/newview/rlvcommon.cpp +++ b/indra/newview/rlvcommon.cpp @@ -18,6 +18,7 @@ #include "llagent.h" #include "llagentui.h" #include "llappviewer.h" +#include "llavatarnamecache.h" #include "llinstantmessage.h" #include "llnotificationsutil.h" #include "lluictrlfactory.h" @@ -340,18 +341,24 @@ void RlvUtil::filterLocation(std::string& strUTF8Text) rlvStringReplace(strUTF8Text, pParcelMgr->getAgentParcelName(), RlvStrings::getString(RLV_STRING_HIDDEN_PARCEL)); } -// Checked: 2010-04-22 (RLVa-1.2.0f) | Modified: RLVa-1.2.0f -void RlvUtil::filterNames(std::string& strUTF8Text) +// Checked: 2010-10-31 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a +void RlvUtil::filterNames(std::string& strUTF8Text, bool fFilterLegacy) { std::vector idAgents; LLWorld::getInstance()->getAvatars(&idAgents, NULL); - std::string strFullName; + std::string strAnonym; for (int idxAgent = 0, cntAgent = idAgents.size(); idxAgent < cntAgent; idxAgent++) { - // LLCacheName::getFullName() will add the UUID to the lookup queue if we don't know it yet - if (gCacheName->getFullName(idAgents[idxAgent], strFullName)) - rlvStringReplace(strUTF8Text, strFullName, RlvStrings::getAnonym(strFullName)); + LLAvatarName avName; + if (LLAvatarNameCache::get(idAgents[idxAgent], &avName)) + { + strAnonym = RlvStrings::getAnonym(avName.mDisplayName); + + rlvStringReplace(strUTF8Text, avName.mDisplayName, strAnonym); + if ( (fFilterLegacy) && (!avName.mIsDisplayNameDefault) ) + rlvStringReplace(strUTF8Text, avName.getLegacyName(), strAnonym); + } } } diff --git a/indra/newview/rlvcommon.h b/indra/newview/rlvcommon.h index 6d73dac0ab..278cd710e8 100644 --- a/indra/newview/rlvcommon.h +++ b/indra/newview/rlvcommon.h @@ -123,14 +123,14 @@ class RlvUtil { public: static bool isEmote(const std::string& strUTF8Text); - static bool isNearbyAgent(const LLUUID& idAgent); // @shownames - static bool isNearbyRegion(const std::string& strRegion); // @showloc + static bool isNearbyAgent(const LLUUID& idAgent); // @shownames + static bool isNearbyRegion(const std::string& strRegion); // @showloc - static void filterLocation(std::string& strUTF8Text); // @showloc - static void filterNames(std::string& strUTF8Text); // @shownames + static void filterLocation(std::string& strUTF8Text); // @showloc + static void filterNames(std::string& strUTF8Text, bool fFilterLegacy = true); // @shownames static bool isForceTp() { return m_fForceTp; } - static void forceTp(const LLVector3d& posDest); // Ignores restrictions that might otherwise prevent tp'ing + static void forceTp(const LLVector3d& posDest); // Ignores restrictions that might otherwise prevent tp'ing static void notifyFailedAssertion(const char* pstrAssert, const char* pstrFile, int nLine); @@ -140,7 +140,7 @@ public: static bool sendChatReply(const std::string& strChannel, const std::string& strUTF8Text); protected: - static bool m_fForceTp; // @standtp + static bool m_fForceTp; // @standtp }; // ============================================================================