From b9cfd2fae5907702f430791814da0f2a4ced87b3 Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Tue, 4 Dec 2012 00:36:12 -0500 Subject: [PATCH] Replace the tricky copy-paste-everywhere Display Name system code with a unified function Only does that, dun believe me? Take a look, oh... it also corrects improper interpretations of the PhoenixNameSystem value: 1 is both, 2 is displays, 0 and anything else is Legacy. Also replaces a bit of the display name support code with new system... by definition this shouldn't change the log file, only the title of the session.. because of my bad connection during week days, I can not confirm this working 100%, but if it does end up changing the logs under certain unseen conditions, replace the new name check with gCacheName->getFullName(id, name) but this reallllly shouldn't happen! --- indra/llmessage/llavatarnamecache.cpp | 22 ++++- indra/llmessage/llavatarnamecache.h | 3 + indra/newview/llcallingcard.cpp | 70 ++++---------- indra/newview/llfloateractivespeakers.cpp | 39 ++------ indra/newview/llfloateractivespeakers.h | 5 - indra/newview/llfloateravatarlist.cpp | 38 ++------ indra/newview/llfloaterfriends.cpp | 107 ++-------------------- indra/newview/llhoverview.cpp | 45 +-------- indra/newview/llimpanel.cpp | 36 +------- indra/newview/llimpanel.h | 4 - indra/newview/llnetmap.cpp | 30 +----- indra/newview/llpanelavatar.cpp | 18 +--- indra/newview/llviewermessage.cpp | 45 +-------- indra/newview/llviewerstats.cpp | 2 +- indra/newview/llvoavatar.cpp | 4 +- indra/newview/rlvui.cpp | 2 +- 16 files changed, 88 insertions(+), 382 deletions(-) diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index ae04a8105..6e114c499 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -24,12 +24,12 @@ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ - #include "linden_common.h" #include "llavatarnamecache.h" #include "llcachename.h" // we wrap this system +#include "llcontrol.h" // For LLCachedControl #include "llframetimer.h" #include "llhttpclient.h" #include "llsd.h" @@ -619,7 +619,6 @@ bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name) // ...only do immediate lookups when cache is running if (useDisplayNames()) { - // ...use display names cache std::map::iterator it = sCache.find(agent_id); if (it != sCache.end()) @@ -664,6 +663,25 @@ bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name) return false; } +// Return true when name has been set to Phoenix Name System Name, if not return false. +bool LLAvatarNameCache::getPNSName(const LLUUID& agent_id, std::string& name) +{ + static LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); + LLAvatarName avatar_name; + if (LLAvatarNameCache::get(agent_id, &avatar_name)) + { + switch (phoenix_name_system) + { + case 0 : name = avatar_name.getLegacyName(); break; + case 1 : name = avatar_name.getCompleteName(); break; + case 2 : name = avatar_name.mDisplayName; break; + default : name = avatar_name.getLegacyName(); break; + } + return true; + } + return false; +} + void LLAvatarNameCache::fireSignal(const LLUUID& agent_id, const callback_slot_t& slot, const LLAvatarName& av_name) diff --git a/indra/llmessage/llavatarnamecache.h b/indra/llmessage/llavatarnamecache.h index 75f613e74..ffe692afa 100644 --- a/indra/llmessage/llavatarnamecache.h +++ b/indra/llmessage/llavatarnamecache.h @@ -65,6 +65,9 @@ namespace LLAvatarNameCache // If name is in cache, returns true and fills in provided LLAvatarName // otherwise returns false bool get(const LLUUID& agent_id, LLAvatarName *av_name); + // If get() succeeds, returns true and fills in name string according to Phoenix Name System + // otherwise returns false + bool getPNSName(const LLUUID& agent_id, std::string& name); // Callback types for get() below typedef boost::signals2::signal< diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index 12dd4a4b9..3aa786ff5 100644 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -99,11 +99,6 @@ const F32 OFFLINE_SECONDS = FIND_FREQUENCY + 8.0f; // static LLAvatarTracker LLAvatarTracker::sInstance; -static void on_avatar_name_cache_notify(const LLUUID& agent_id, - const LLAvatarName& av_name, - bool online, - LLSD payload); - ///---------------------------------------------------------------------------- /// Class LLAvatarTracker ///---------------------------------------------------------------------------- @@ -638,22 +633,11 @@ void LLAvatarTracker::processChange(LLMessageSystem* msg) { if((mBuddyInfo[agent_id]->getRightsGrantedFrom() ^ new_rights) & LLRelationship::GRANT_MODIFY_OBJECTS) { - std::string first, last; std::string fullname; LLSD args; - LLAvatarName avatar_name; - if (LLAvatarNameCache::get(agent_id, &avatar_name)) - { - switch (gSavedSettings.getS32("PhoenixNameSystem")) - { - case 0 : fullname = avatar_name.getLegacyName(); break; - case 1 : fullname = (avatar_name.mIsDisplayNameDefault ? avatar_name.mDisplayName : avatar_name.getCompleteName()); break; - case 2 : fullname = avatar_name.mDisplayName; break; - default : fullname = avatar_name.getCompleteName(); break; - } + if (LLAvatarNameCache::getPNSName(agent_id, fullname)) args["NAME"] = fullname; - } - + LLSD payload; payload["from_id"] = agent_id; if(LLRelationship::GRANT_MODIFY_OBJECTS & new_rights) @@ -722,9 +706,23 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) if(chat_notify) { // Look up the name of this agent for the notification - LLAvatarNameCache::get(agent_id, - boost::bind(&on_avatar_name_cache_notify, - _1, _2, online, payload)); + std::string name; + LLSD args; + if (LLAvatarNameCache::getPNSName(agent_id, name)) + args["NAME"] = name; + + // Popup a notify box with online status of this agent + LLNotificationPtr notification = LLNotificationsUtil::add(online ? "FriendOnline" : "FriendOffline", args, payload); + + // If there's an open IM session with this agent, send a notification there too. + LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, agent_id); + LLFloaterIMPanel *floater = gIMMgr->findFloaterBySession(session_id); + if (floater) + { + std::string notifyMsg = notification->getMessage(); + if (!notifyMsg.empty()) + floater->addHistoryLine(notifyMsg,gSavedSettings.getColor4("SystemChatColor")); + } } mModifyMask |= LLFriendObserver::ONLINE; @@ -733,36 +731,6 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) } } -static void on_avatar_name_cache_notify(const LLUUID& agent_id, - const LLAvatarName& av_name, - bool online, - LLSD payload) -{ - // Popup a notify box with online status of this agent - // Use display name only because this user is your friend - LLSD args; - switch (gSavedSettings.getS32("PhoenixNameSystem")) - { - case 0 : args["NAME"] = av_name.getLegacyName(); break; - case 1 : args["NAME"] = (av_name.mIsDisplayNameDefault ? av_name.mDisplayName : av_name.getCompleteName()); break; - case 2 : args["NAME"] = av_name.mDisplayName; break; - default : args["NAME"] = av_name.getCompleteName(); break; - } - - // Popup a notify box with online status of this agent - LLNotificationPtr notification = LLNotificationsUtil::add(online ? "FriendOnline" : "FriendOffline", args, payload); - - // If there's an open IM session with this agent, send a notification there too. - LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, agent_id); - LLFloaterIMPanel *floater = gIMMgr->findFloaterBySession(session_id); - if (floater) - { - std::string notifyMsg = notification->getMessage(); - if (!notifyMsg.empty()) - floater->addHistoryLine(notifyMsg,gSavedSettings.getColor4("SystemChatColor")); - } -} - void LLAvatarTracker::formFriendship(const LLUUID& id) { if(id.notNull()) diff --git a/indra/newview/llfloateractivespeakers.cpp b/indra/newview/llfloateractivespeakers.cpp index 9aa5a7adf..a43fa7e76 100644 --- a/indra/newview/llfloateractivespeakers.cpp +++ b/indra/newview/llfloateractivespeakers.cpp @@ -102,41 +102,18 @@ LLSpeaker::LLSpeaker(const LLUUID& id, const std::string& name, const ESpeakerTy void LLSpeaker::lookupName() { - // [Ansariel: Display name support] - LLAvatarNameCache::get(mID, boost::bind(&LLSpeaker::onAvatarNameLookup, _1, _2, new LLHandle(getHandle()))); - // [/Ansariel: Display name support] -} + LLAvatarNameCache::getPNSName(mID, mDisplayName); -//static -// [Ansariel: Display name support] -void LLSpeaker::onAvatarNameLookup(const LLUUID& id, const LLAvatarName& avatar_name, void* user_data) -// [/Ansariel: Display name support] -{ - LLSpeaker* speaker_ptr = ((LLHandle*)user_data)->get(); - delete (LLHandle*)user_data; - - if (speaker_ptr) - { - // [Ansariel: Display name support] - switch (gSavedSettings.getS32("PhoenixNameSystem")) - { - case 0 : speaker_ptr->mDisplayName = avatar_name.getLegacyName(); break; - case 1 : speaker_ptr->mDisplayName = (avatar_name.mIsDisplayNameDefault ? avatar_name.mDisplayName : avatar_name.getCompleteName()); break; - case 2 : speaker_ptr->mDisplayName = avatar_name.mDisplayName; break; - default : speaker_ptr->mDisplayName = avatar_name.getLegacyName(); break; - } - - // Also set the legacy name. We will need it to initiate a new - // IM session. - speaker_ptr->mLegacyName = LLCacheName::cleanFullName(avatar_name.getLegacyName()); - // [/Ansariel: Display name support] + // Also set the legacy name. We will need it to initiate a new + // IM session. + gCacheName->getFullName(mID, mLegacyName); + mLegacyName = LLCacheName::cleanFullName(mLegacyName); // [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Added: RLVa-1.0.0g - // TODO-RLVa: this seems to get called per frame which is very likely an LL bug that will eventuall get fixed - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) - speaker_ptr->mDisplayName = RlvStrings::getAnonym(speaker_ptr->mDisplayName); + // TODO-RLVa: this seems to get called per frame which is very likely an LL bug that will eventually get fixed + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + mDisplayName = RlvStrings::getAnonym(mDisplayName); // [/RLVa:KB] - } } LLSpeakerTextModerationEvent::LLSpeakerTextModerationEvent(LLSpeaker* source) diff --git a/indra/newview/llfloateractivespeakers.h b/indra/newview/llfloateractivespeakers.h index b8a9ece01..a2cf940a5 100644 --- a/indra/newview/llfloateractivespeakers.h +++ b/indra/newview/llfloateractivespeakers.h @@ -77,11 +77,6 @@ public: ~LLSpeaker() {}; void lookupName(); - // [Ansariel: Display name support] - //static void onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* user_data); - static void onAvatarNameLookup(const LLUUID& id, const LLAvatarName& avatar_name, void* user_data); - // [/Ansariel: Display name support] - ESpeakerStatus mStatus; // current activity status in speech group F32 mLastSpokeTime; // timestamp when this speaker last spoke F32 mSpeechVolume; // current speech amplitude (timea average rms amplitude?) diff --git a/indra/newview/llfloateravatarlist.cpp b/indra/newview/llfloateravatarlist.cpp index c214f3480..9f2e3c50c 100644 --- a/indra/newview/llfloateravatarlist.cpp +++ b/indra/newview/llfloateravatarlist.cpp @@ -457,8 +457,6 @@ void LLFloaterAvatarList::updateAvatarList() for (i = 0; i < count; ++i) { std::string name; - std::string first; - std::string last; const LLUUID &avid = avatar_ids[i]; LLVector3d position; @@ -478,24 +476,8 @@ void LLFloaterAvatarList::updateAvatarList() position = gAgent.getPosGlobalFromAgent(avatarp->getCharacterPosition()); name = avatarp->getFullname(); - // [Ansariel: Display name support] - LLAvatarName avatar_name; - if (LLAvatarNameCache::get(avatarp->getID(), &avatar_name)) - { - static LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); - switch (phoenix_name_system) - { - case 0 : name = avatar_name.getLegacyName(); break; - case 1 : name = (avatar_name.mIsDisplayNameDefault ? avatar_name.mDisplayName : avatar_name.getCompleteName()); break; - case 2 : name = avatar_name.mDisplayName; break; - default : name = avatar_name.getLegacyName(); break; - } - - first = avatar_name.mLegacyFirstName; - last = avatar_name.mLegacyLastName; - } - else continue; - // [/Ansariel: Display name support] + if (!LLAvatarNameCache::getPNSName(avatarp->getID(), name)) + continue; //duped for lower section if (name.empty() || (name.compare(" ") == 0))// || (name.compare(gCacheName->getDefaultName()) == 0)) @@ -966,14 +948,12 @@ void LLFloaterAvatarList::onClickIM(void* userdata) // Single avatar LLUUID agent_id = ids[0]; - // [Ansariel: Display name support] - LLAvatarName avatar_name; - if (LLAvatarNameCache::get(agent_id, &avatar_name)) + std::string avatar_name; + if (LLAvatarNameCache::getPNSName(agent_id, avatar_name)) { gIMMgr->setFloaterOpen(TRUE); - gIMMgr->addSession(LLCacheName::cleanFullName(avatar_name.getLegacyName()),IM_NOTHING_SPECIAL,agent_id); + gIMMgr->addSession(avatar_name,IM_NOTHING_SPECIAL,agent_id); } - // [Ansariel: Display name support] } else { @@ -1120,14 +1100,12 @@ BOOL LLFloaterAvatarList::handleKeyHere(KEY key, MASK mask) // Single avatar LLUUID agent_id = ids[0]; - // [Ansariel: Display name support] - LLAvatarName avatar_name; - if (LLAvatarNameCache::get(agent_id, &avatar_name)) + std::string avatar_name; + if (LLAvatarNameCache::getPNSName(agent_id, avatar_name)) { gIMMgr->setFloaterOpen(TRUE); - gIMMgr->addSession(LLCacheName::cleanFullName(avatar_name.getLegacyName()),IM_NOTHING_SPECIAL,agent_id); + gIMMgr->addSession(avatar_name,IM_NOTHING_SPECIAL,agent_id); } - // [Ansariel: Display name support] } else { diff --git a/indra/newview/llfloaterfriends.cpp b/indra/newview/llfloaterfriends.cpp index 2b09b57d4..c3b9826c6 100644 --- a/indra/newview/llfloaterfriends.cpp +++ b/indra/newview/llfloaterfriends.cpp @@ -44,10 +44,7 @@ #include "llagent.h" #include "llappviewer.h" // for gLastVersionChannel -// [Ansariel: Display name support] -#include "llavatarname.h" #include "llavatarnamecache.h" -// [/Ansariel: Display name support] #include "llfloateravatarpicker.h" #include "llviewerwindow.h" @@ -421,26 +418,8 @@ BOOL LLPanelFriends::addFriend(const LLUUID& agent_id) bool isOnline = relationInfo->isOnline(); std::string fullname; - // [Ansariel: Display name support] - //BOOL have_name = gCacheName->getFullName(agent_id, fullname); - LLAvatarName avatar_name; - BOOL have_name; - if (LLAvatarNameCache::get(agent_id, &avatar_name)) - { - static const LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); - switch (phoenix_name_system) - { - case 0 : fullname = avatar_name.getLegacyName(); break; - case 1 : fullname = (avatar_name.mIsDisplayNameDefault ? avatar_name.mDisplayName : avatar_name.getCompleteName()); break; - case 2 : fullname = avatar_name.mDisplayName; break; - default : fullname = avatar_name.getCompleteName(); break; - } + BOOL have_name = LLAvatarNameCache::getPNSName(agent_id, fullname); - have_name = TRUE; - } - else have_name = FALSE; - // [/Ansariel: Display name support] - LLSD element; element["id"] = agent_id; LLSD& friend_column = element["columns"][LIST_FRIEND_NAME]; @@ -520,26 +499,8 @@ BOOL LLPanelFriends::updateFriendItem(const LLUUID& agent_id, const LLRelationsh bool isOnlineSIP = LLVoiceClient::getInstance()->isOnlineSIP(itemp->getUUID()); bool isOnline = info->isOnline(); - std::string fullname; - // [Ansariel: Display name support] - //BOOL have_name = gCacheName->getFullName(agent_id, fullname); - LLAvatarName avatar_name; - BOOL have_name; - if (LLAvatarNameCache::get(agent_id, &avatar_name)) - { - static const LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); - switch (phoenix_name_system) - { - case 0 : fullname = avatar_name.getLegacyName(); break; - case 1 : fullname = (avatar_name.mIsDisplayNameDefault ? avatar_name.mDisplayName : avatar_name.getCompleteName()); break; - case 2 : fullname = avatar_name.mDisplayName; break; - default : fullname = avatar_name.getCompleteName(); break; - } - - have_name = TRUE; - } - else have_name = FALSE; - // [/Ansariel: Display name support] + std::string fullname; + BOOL have_name = LLAvatarNameCache::getPNSName(agent_id, fullname); // Name of the status icon to use std::string statusIcon; @@ -892,20 +853,12 @@ void LLPanelFriends::onClickIM(void* user_data) { LLUUID agent_id = ids[0]; const LLRelationship* info = LLAvatarTracker::instance().getBuddyInfo(agent_id); - // [Ansariel: Display name support] - //std::string fullname; - //if(info && gCacheName->getFullName(agent_id, fullname)) - //{ - // gIMMgr->setFloaterOpen(TRUE); - // gIMMgr->addSession(fullname, IM_NOTHING_SPECIAL, agent_id); - //} - LLAvatarName avatar_name; - if (info && LLAvatarNameCache::get(agent_id, &avatar_name)) + std::string fullname; + if(info && gCacheName->getFullName(agent_id, fullname)) { gIMMgr->setFloaterOpen(TRUE); - gIMMgr->addSession(LLCacheName::cleanFullName(avatar_name.getLegacyName()),IM_NOTHING_SPECIAL,agent_id); + gIMMgr->addSession(fullname, IM_NOTHING_SPECIAL, agent_id); } - // [/Ansariel: Display name support] } else { @@ -1022,30 +975,9 @@ void LLPanelFriends::onClickRemove(void* user_data) if(ids.size() == 1) { LLUUID agent_id = ids[0]; - // [Ansariel: Display name support] - //std::string first, last; - //if(gCacheName->getName(agent_id, first, last)) - //{ - // args["FIRST_NAME"] = first; - // args["LAST_NAME"] = last; - //} - - LLAvatarName avatar_name; - if (LLAvatarNameCache::get(agent_id, &avatar_name)) - { - std::string fullname; - static const LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); - switch (phoenix_name_system) - { - case 0 : fullname = avatar_name.getLegacyName(); break; - case 1 : fullname = (avatar_name.mIsDisplayNameDefault ? avatar_name.mDisplayName : avatar_name.getCompleteName()); break; - case 2 : fullname = avatar_name.mDisplayName; break; - default : fullname = avatar_name.getCompleteName(); break; - } - + std::string fullname; + if (LLAvatarNameCache::getPNSName(agent_id, fullname)) args["NAME"] = fullname; - } - // [/Ansariel: Display name support] } else { @@ -1289,28 +1221,9 @@ void LLPanelFriends::confirmModifyRights(rights_map_t& ids, EGrantRevoke command if(ids.size() == 1) { LLUUID agent_id = ids.begin()->first; - //std::string first, last; - //if(gCacheName->getName(agent_id, first, last)) - //{ - // args["FIRST_NAME"] = first; - // args["LAST_NAME"] = last; - //} - - LLAvatarName avatar_name; - if (LLAvatarNameCache::get(agent_id, &avatar_name)) - { - std::string fullname; - static const LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); - switch (phoenix_name_system) - { - case 0 : fullname = avatar_name.getLegacyName(); break; - case 1 : fullname = (avatar_name.mIsDisplayNameDefault ? avatar_name.mDisplayName : avatar_name.getCompleteName()); break; - case 2 : fullname = avatar_name.mDisplayName; break; - default : fullname = avatar_name.getCompleteName(); break; - } - + std::string fullname; + if (LLAvatarNameCache::getPNSName(agent_id, fullname)) args["NAME"] = fullname; - } if (command == GRANT) { diff --git a/indra/newview/llhoverview.cpp b/indra/newview/llhoverview.cpp index f6cff6f16..fa922a94b 100644 --- a/indra/newview/llhoverview.cpp +++ b/indra/newview/llhoverview.cpp @@ -262,39 +262,16 @@ void LLHoverView::updateText() else { // [/RLVa:KB] - - // [Ansariel: Display name support] - std::string complete_name = firstname->getString(); - complete_name += " "; - complete_name += lastname->getString(); - - if (LLAvatarNameCache::useDisplayNames()) - { - LLAvatarName avatar_name; - if (LLAvatarNameCache::get(hit_object->getID(), &avatar_name)) - { - static const LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); - if (phoenix_name_system == 2 || (phoenix_name_system == 1 && avatar_name.mIsDisplayNameDefault)) - { - complete_name = avatar_name.mDisplayName; - } - else - { - complete_name = avatar_name.getCompleteName(); - } - } - } - // [/Ansariel: Display name support] + std::string complete_name; + if (!LLAvatarNameCache::getPNSName(hit_object->getID(), complete_name)) + complete_name = firstname->getString() + std::string(" ") + lastname->getString(); if (title) { line.append(title->getString()); line.append(1, ' '); } - - // [Ansariel: Display name support] line += complete_name; - // [/Ansariel: Display name support] // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) } @@ -347,27 +324,13 @@ void LLHoverView::updateText() std::string name; if (!nodep->mPermissions->isGroupOwned()) { - // [Ansariel: Display name support] - LLAvatarName avatar_name; - // [/Ansariel: Display name support] owner = nodep->mPermissions->getOwner(); if (LLUUID::null == owner) { line.append(LLTrans::getString("TooltipPublic")); } - // [Ansariel: Display name support] - //else if(gCacheName->getFullName(owner, name)) - else if (LLAvatarNameCache::get(owner, &avatar_name)) + else if(LLAvatarNameCache::getPNSName(owner, name)) { - static const LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); - switch (phoenix_name_system) - { - case 0 : name = avatar_name.getCompleteName(); break; - case 1 : name = (avatar_name.mIsDisplayNameDefault ? avatar_name.mDisplayName : avatar_name.getCompleteName()); break; - case 2 : name = avatar_name.mDisplayName; break; - default : name = avatar_name.getCompleteName(); break; - } - // [/Ansariel: Display name support] // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) { diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index bd8ec64be..76e244e25 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -1297,28 +1297,13 @@ void LLFloaterIMPanel::init(const std::string& session_label) } } -// [Ansariel: Display name support] void LLFloaterIMPanel::lookupName() { - LLAvatarNameCache::get(mOtherParticipantUUID, boost::bind(&LLFloaterIMPanel::onAvatarNameLookup, _1, _2, this)); + std::string title; + if (LLAvatarNameCache::getPNSName(mOtherParticipantUUID, title)) + setTitle(title); } -//static -void LLFloaterIMPanel::onAvatarNameLookup(const LLUUID& id, const LLAvatarName& avatar_name, void* user_data) -{ - LLFloaterIMPanel* self = (LLFloaterIMPanel*)user_data; - - if (self && sFloaterIMPanels.count(self) != 0) - { - std::string title = avatar_name.getCompleteName(); - if (!title.empty()) - { - self->setTitle(title); - } - } -} -// [/Ansariel: Display name support] - LLFloaterIMPanel::~LLFloaterIMPanel() { // [Ansariel: Display name support] @@ -1676,19 +1661,8 @@ void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, LLColor4 incol else { std::string show_name = name; - LLAvatarName avatar_name; - if (source.notNull() && - LLAvatarNameCache::get(source, &avatar_name)) - { - static const LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); - switch (phoenix_name_system) - { - case 0 : show_name = avatar_name.getCompleteName(); break; - case 1 : show_name = (avatar_name.mIsDisplayNameDefault ? avatar_name.mDisplayName : avatar_name.getCompleteName()); break; - case 2 : show_name = avatar_name.mDisplayName; break; - default : show_name = avatar_name.getCompleteName(); break; - } - } + if (source.notNull()) + LLAvatarNameCache::getPNSName(source, show_name); // Convert the name to a hotlink and add to message. const LLStyleSP &source_style = LLStyleMap::instance().lookupAgent(source); mHistoryEditor->appendStyledText(show_name,false,prepend_newline,source_style); diff --git a/indra/newview/llimpanel.h b/indra/newview/llimpanel.h index 943bd37c1..b2a3b8e0e 100644 --- a/indra/newview/llimpanel.h +++ b/indra/newview/llimpanel.h @@ -196,10 +196,7 @@ public: EInstantMessage dialog); virtual ~LLFloaterIMPanel(); - // [Ansariel: Display name support] void lookupName(); - static void onAvatarNameLookup(const LLUUID& id, const LLAvatarName& avatar_name, void* user_data); - // [/Ansariel: Display name support] /*virtual*/ BOOL postBuild(); @@ -400,7 +397,6 @@ private: typedef std::map styleMap; static styleMap mStyleMap; - // [Ansariel: Display name support] static std::set sFloaterIMPanels; }; diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 86294d46b..8a09fa7b1 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -627,37 +627,11 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rec { msg.assign(""); std::string fullname; - if(mClosestAgentToCursor.notNull() && gCacheName->getFullName(mClosestAgentToCursor, fullname)) + if(mClosestAgentToCursor.notNull() && LLAvatarNameCache::getPNSName(mClosestAgentToCursor, fullname)) { //msg.append(fullname); // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.0b - // [Ansariel: Display name support] - // msg.append( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ? fullname : RlvStrings::getAnonym(fullname) ); - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) - { - msg.append(RlvStrings::getAnonym(fullname)); - } - else - { - if (LLAvatarNameCache::useDisplayNames()) - { - LLAvatarName avatar_name; - if (LLAvatarNameCache::get(mClosestAgentToCursor, &avatar_name)) - { - static const LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); - if (phoenix_name_system == 2 || (phoenix_name_system == 1 && avatar_name.mIsDisplayNameDefault)) - { - fullname = avatar_name.mDisplayName; - } - else - { - fullname = avatar_name.getCompleteName(true); - } - } - } - msg.append(fullname); - } - // [/Ansariel: Display name support] + msg.append( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ? fullname : RlvStrings::getAnonym(fullname) ); // [/RLVa:KB] msg.append("\n"); diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 14709805e..7f707e519 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -167,21 +167,9 @@ void LLPanelAvatarSecondLife::updatePartnerName() { if (mPartnerID.notNull()) { - // [Ansariel: Display name support] - LLAvatarName avatar_name; - if (LLAvatarNameCache::get(mPartnerID, &avatar_name)) - { - std::string name; - switch (gSavedSettings.getS32("PhoenixNameSystem")) - { - case 0 : name = avatar_name.getLegacyName(); break; - case 1 : name = (avatar_name.mIsDisplayNameDefault ? avatar_name.mDisplayName : avatar_name.getCompleteName()); break; - case 2 : name = avatar_name.mDisplayName; break; - default : name = avatar_name.getLegacyName(); break; - } + std::string name; + if (LLAvatarNameCache::getPNSName(mPartnerID, name)) childSetTextArg("partner_edit", "[NAME]", name); - } - // [/Ansariel: Display name support] childSetEnabled("partner_info", TRUE); } } @@ -202,9 +190,7 @@ void LLPanelAvatarSecondLife::clearControls() childSetValue("born", ""); childSetValue("acct", ""); - // [Ansariel: Display name support] childSetTextArg("partner_edit", "[NAME]", LLStringUtil::null); - // [/Ansariel: Display name support] mPartnerID = LLUUID::null; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 1bb0d72e2..70ee4f5bf 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3633,29 +3633,11 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) } } - - // [Ansariel/Henri: Display name support] if (chatter && chatter->isAvatar()) { - if (LLAvatarNameCache::useDisplayNames()) - { - LLAvatarName avatar_name; - if (LLAvatarNameCache::get(from_id, &avatar_name)) - { - static const LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); - if (phoenix_name_system == 2 || (phoenix_name_system == 1 && avatar_name.mIsDisplayNameDefault)) - { - from_name = avatar_name.mDisplayName; - } - else - { - from_name = avatar_name.getCompleteName(); - } - } + if (LLAvatarNameCache::getPNSName(from_id, from_name)) chat.mFromName = from_name; - } } - // [/Ansariel/Henri: Display name support] BOOL visible_in_chat_bubble = FALSE; std::string verb; @@ -5833,7 +5815,6 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg) return; } - static LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); std::string source_slurl; if (is_source_group) { @@ -5841,17 +5822,7 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg) } else { - LLAvatarName avatar_name; - if (LLAvatarNameCache::get(source_id, &avatar_name)) - { - switch (phoenix_name_system) - { - case 0 : source_slurl = avatar_name.getLegacyName(); break; - case 1 : source_slurl = avatar_name.getCompleteName(); break; - case 2 : source_slurl = avatar_name.mDisplayName; break; - default : source_slurl = avatar_name.getLegacyName(); break; - } - } + LLAvatarNameCache::getPNSName(source_id, source_slurl); } std::string dest_slurl; @@ -5861,17 +5832,7 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg) } else { - LLAvatarName avatar_name; - if (LLAvatarNameCache::get(dest_id, &avatar_name)) - { - switch (phoenix_name_system) - { - case 0 : dest_slurl = avatar_name.getLegacyName(); break; - case 1 : dest_slurl = avatar_name.getCompleteName(); break; - case 2 : dest_slurl = avatar_name.mDisplayName; break; - default : dest_slurl = avatar_name.getLegacyName(); break; - } - } + LLAvatarNameCache::getPNSName(dest_id, dest_slurl); } std::string reason = diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index 6013a47f2..8a2667555 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -873,7 +873,7 @@ void send_stats() llinfos << "Misc Stats: int_1: " << misc["int_1"] << " int_2: " << misc["int_2"] << llendl; llinfos << "Misc Stats: string_1: " << misc["string_1"] << " string_2: " << misc["string_2"] << llendl; - body["DisplayNamesEnabled"] = gSavedSettings.getS32("PhoenixNameSystem") > 0; + body["DisplayNamesEnabled"] = gSavedSettings.getS32("PhoenixNameSystem") == 1 || gSavedSettings.getS32("PhoenixNameSystem") == 2; body["DisplayNamesShowUsername"] = gSavedSettings.getS32("PhoenixNameSystem") == 1; body["MinimalSkin"] = false; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 19bd366b4..217f165f7 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3755,8 +3755,8 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) static const LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); - bool show_display_names = phoenix_name_system > 0; - bool show_usernames = phoenix_name_system < 2; + bool show_display_names = phoenix_name_system == 1 || phoenix_name_system == 2; + bool show_usernames = phoenix_name_system != 2; if (show_display_names && LLAvatarNameCache::useDisplayNames()) { LLAvatarName av_name; diff --git a/indra/newview/rlvui.cpp b/indra/newview/rlvui.cpp index 2f1d59091..405dc7909 100644 --- a/indra/newview/rlvui.cpp +++ b/indra/newview/rlvui.cpp @@ -265,7 +265,7 @@ void RlvUIEnabler::onToggleShowNames(bool fQuitting) else { LLAvatarNameCache::setForceDisplayNames(false); - LLAvatarNameCache::setUseDisplayNames(gSavedSettings.getS32("PhoenixNameSystem") != 0); + LLAvatarNameCache::setUseDisplayNames(gSavedSettings.getS32("PhoenixNameSystem") == 1 || gSavedSettings.getS32("PhoenixNameSystem") == 2); } LLVOAvatar::invalidateNameTags(); // See handleDisplayNamesOptionChanged() }