- internal : RlvUtil::filterNames() will filter both display names and legacy names of nearby agents

--HG--
branch : RLVa
meow-7.2.2
Kitty Barnett 2010-11-01 02:18:50 +01:00
parent 9caae12457
commit fa1ff81980
2 changed files with 19 additions and 12 deletions

View File

@ -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<LLUUID> 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);
}
}
}

View File

@ -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
};
// ============================================================================