summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2012-12-05 20:25:46 -0800
committerMerov Linden <merov@lindenlab.com>2012-12-05 20:25:46 -0800
commit3a49beed0e96a797a6d663bcae5e932437ca3661 (patch)
treee2d779e70cd9c1566c465a8215dbd99ad6f52cd2 /indra
parentd48357f54765f84a35b73bbf28e88b978bcb5013 (diff)
CHUI-580 : WIP : Change the display name cache system, deprecating the old protocol and using the cap (People API) whenever available. Still has occurence of Resident as last name to clean up.
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/llavatarname.cpp69
-rw-r--r--indra/llcommon/llavatarname.h57
-rw-r--r--indra/llmessage/llavatarnamecache.cpp56
-rw-r--r--indra/llmessage/llavatarnamecache.h2
-rw-r--r--indra/llmessage/llcachename.cpp6
-rw-r--r--indra/llui/llscrolllistctrl.cpp2
-rw-r--r--indra/llui/llurlentry.cpp4
-rwxr-xr-xindra/newview/llavataractions.cpp16
-rwxr-xr-xindra/newview/llavatariconctrl.cpp2
-rw-r--r--indra/newview/llavatarlist.cpp9
-rw-r--r--indra/newview/llavatarlistitem.cpp4
-rw-r--r--indra/newview/llcallingcard.cpp6
-rw-r--r--indra/newview/llchathistory.cpp14
-rw-r--r--indra/newview/llconversationmodel.cpp4
-rw-r--r--indra/newview/llfavoritesbar.cpp10
-rw-r--r--indra/newview/llfloateravatarpicker.cpp12
-rw-r--r--indra/newview/llfloaterdisplayname.cpp10
-rw-r--r--indra/newview/llfloaterimnearbychat.cpp2
-rw-r--r--indra/newview/llfloaterscriptlimits.cpp15
-rw-r--r--indra/newview/llfloatersellland.cpp2
-rw-r--r--indra/newview/llfloatertopobjects.cpp14
-rw-r--r--indra/newview/llfloatervoicevolume.cpp2
-rw-r--r--indra/newview/llfriendcard.cpp2
-rw-r--r--indra/newview/llimview.cpp20
-rw-r--r--indra/newview/llinspectavatar.cpp6
-rw-r--r--indra/newview/llinventorybridge.cpp5
-rw-r--r--indra/newview/llnamelistctrl.cpp4
-rw-r--r--indra/newview/llpanelblockedlist.cpp2
-rw-r--r--indra/newview/llpanelgroupinvite.cpp4
-rw-r--r--indra/newview/llpanelgroupnotices.cpp5
-rw-r--r--indra/newview/llpanelgrouproles.cpp4
-rw-r--r--indra/newview/llparticipantlist.cpp2
-rw-r--r--indra/newview/lltoastgroupnotifypanel.cpp6
-rw-r--r--indra/newview/lltoolpie.cpp3
-rw-r--r--indra/newview/llviewerdisplayname.cpp6
-rw-r--r--indra/newview/llviewermenu.cpp6
-rwxr-xr-xindra/newview/llviewermessage.cpp15
-rwxr-xr-xindra/newview/llvoavatar.cpp24
-rw-r--r--indra/newview/llvoicevivox.cpp4
39 files changed, 224 insertions, 212 deletions
diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp
index 3206843bf4..b49e6a7aac 100644
--- a/indra/llcommon/llavatarname.cpp
+++ b/indra/llcommon/llavatarname.cpp
@@ -30,6 +30,7 @@
#include "llavatarname.h"
#include "lldate.h"
+#include "llframetimer.h"
#include "llsd.h"
// Store these in pre-built std::strings to avoid memory allocations in
@@ -42,6 +43,8 @@ static const std::string IS_DISPLAY_NAME_DEFAULT("is_display_name_default");
static const std::string DISPLAY_NAME_EXPIRES("display_name_expires");
static const std::string DISPLAY_NAME_NEXT_UPDATE("display_name_next_update");
+bool LLAvatarName::sUseDisplayNames = true;
+
LLAvatarName::LLAvatarName()
: mUsername(),
mDisplayName(),
@@ -61,6 +64,17 @@ bool LLAvatarName::operator<(const LLAvatarName& rhs) const
return mUsername < rhs.mUsername;
}
+//static
+void LLAvatarName::setUseDisplayNames(bool use)
+{
+ sUseDisplayNames = use;
+}
+//static
+bool LLAvatarName::useDisplayNames()
+{
+ return sUseDisplayNames;
+}
+
LLSD LLAvatarName::asLLSD() const
{
LLSD sd;
@@ -85,6 +99,33 @@ void LLAvatarName::fromLLSD(const LLSD& sd)
mExpires = expires.secondsSinceEpoch();
LLDate next_update = sd[DISPLAY_NAME_NEXT_UPDATE];
mNextUpdate = next_update.secondsSinceEpoch();
+
+ // Some avatars don't have explicit display names set. Force a legible display name here.
+ if (mDisplayName.empty())
+ {
+ mDisplayName = mUsername;
+ }
+}
+
+void LLAvatarName::fromString(const std::string& full_name, F64 expires)
+{
+ mDisplayName = full_name;
+ std::string::size_type index = full_name.find(' ');
+ if (index != std::string::npos)
+ {
+ mLegacyFirstName = full_name.substr(0, index);
+ mLegacyLastName = full_name.substr(index+1);
+ mUsername = mLegacyFirstName + " " + mLegacyLastName;
+ }
+ else
+ {
+ mLegacyFirstName = full_name;
+ mLegacyLastName = "";
+ mUsername = full_name;
+ }
+ mIsDisplayNameDefault = true;
+ mIsTemporaryName = true;
+ mExpires = LLFrameTimer::getTotalSeconds() + expires;
}
std::string LLAvatarName::getCompleteName() const
@@ -104,9 +145,22 @@ std::string LLAvatarName::getCompleteName() const
return name;
}
-std::string LLAvatarName::getLegacyName() const
+std::string LLAvatarName::getDisplayName() const
+{
+ if (sUseDisplayNames)
+ {
+ return mDisplayName;
+ }
+ else
+ {
+ return getUserName();
+ }
+}
+
+std::string LLAvatarName::getUserName() const
{
- if (mLegacyFirstName.empty() && mLegacyLastName.empty()) // display names disabled?
+ // If we cannot create a user name from the legacy strings, use the display name
+ if (mLegacyFirstName.empty() && mLegacyLastName.empty())
{
return mDisplayName;
}
@@ -118,3 +172,14 @@ std::string LLAvatarName::getLegacyName() const
name += mLegacyLastName;
return name;
}
+
+void LLAvatarName::dump() const
+{
+ llinfos << "Merov debug : display = " << mDisplayName << ", user = " << mUsername << ", complete = " << getCompleteName() << ", legacy = " << getUserName() << " first = " << mLegacyFirstName << " last = " << mLegacyLastName << llendl;
+ LL_DEBUGS("AvNameCache") << "LLAvatarName: "
+ << "user '" << mUsername << "' "
+ << "display '" << mDisplayName << "' "
+ << "expires in " << mExpires - LLFrameTimer::getTotalSeconds() << " seconds"
+ << LL_ENDL;
+}
+
diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h
index ba258d6d52..cf9eb27b03 100644
--- a/indra/llcommon/llavatarname.h
+++ b/indra/llcommon/llavatarname.h
@@ -43,19 +43,50 @@ public:
void fromLLSD(const LLSD& sd);
+ // Used only in legacy mode when the display name capability is not provided server side
+ void fromString(const std::string& full_name, F64 expires = 0.0f);
+
+ static void setUseDisplayNames(bool use);
+ static bool useDisplayNames();
+
+ // Name is valid if not temporary and not yet expired
+ bool isValidName(F64 max_unrefreshed = 0.0f) const { return !mIsTemporaryName && (mExpires >= max_unrefreshed); }
+
+ //
+ bool isDisplayNameDefault() const { return mIsDisplayNameDefault; }
+
// For normal names, returns "James Linden (james.linden)"
// When display names are disabled returns just "James Linden"
std::string getCompleteName() const;
-
- // Returns "James Linden" or "bobsmith123 Resident" for backwards
- // compatibility with systems like voice and muting
- // *TODO: Eliminate this in favor of username only
- std::string getLegacyName() const;
-
+
+ // "José Sanchez" or "James Linden", UTF-8 encoded Unicode
+ // Takes the display name preference into account. This is truly the name that should
+ // be used for all UI where an avatar name has to be used unless we truly want something else (rare)
+ std::string getDisplayName() const;
+
+ // Returns "James Linden" or "bobsmith123 Resident"
+ // Used where we explicitely prefer or need a non UTF-8 legacy (ASCII) name
+ // Also used for backwards compatibility with systems like voice and muting
+ std::string getUserName() const;
+
+ // Debug print of the object
+ void dump() const;
+
+ // Names can change, so need to keep track of when name was
+ // last checked.
+ // Unix time-from-epoch seconds for efficiency
+ F64 mExpires;
+
+ // You can only change your name every N hours, so record
+ // when the next update is allowed
+ // Unix time-from-epoch seconds
+ F64 mNextUpdate;
+
+private:
// "bobsmith123" or "james.linden", US-ASCII only
std::string mUsername;
- // "Jose' Sanchez" or "James Linden", UTF-8 encoded Unicode
+ // "José Sanchez" or "James Linden", UTF-8 encoded Unicode
// Contains data whether or not user has explicitly set
// a display name; may duplicate their username.
std::string mDisplayName;
@@ -81,15 +112,9 @@ public:
// shown in UI, but are not serialized.
bool mIsTemporaryName;
- // Names can change, so need to keep track of when name was
- // last checked.
- // Unix time-from-epoch seconds for efficiency
- F64 mExpires;
-
- // You can only change your name every N hours, so record
- // when the next update is allowed
- // Unix time-from-epoch seconds
- F64 mNextUpdate;
+ // Global flag indicating if display name should be used or not
+ // This will affect the output of the high level "get" methods
+ static bool sUseDisplayNames;
};
#endif
diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp
index 700525e1fa..329871d8eb 100644
--- a/indra/llmessage/llavatarnamecache.cpp
+++ b/indra/llmessage/llavatarnamecache.cpp
@@ -43,10 +43,6 @@ namespace LLAvatarNameCache
{
use_display_name_signal_t mUseDisplayNamesSignal;
- // Manual override for display names - can disable even if the region
- // supports it.
- bool sUseDisplayNames = true;
-
// Cache starts in a paused state until we can determine if the
// current region supports display names.
bool sRunning = false;
@@ -209,17 +205,8 @@ public:
// Use expiration time from header
av_name.mExpires = expires;
- // Some avatars don't have explicit display names set
- if (av_name.mDisplayName.empty())
- {
- av_name.mDisplayName = av_name.mUsername;
- }
-
- LL_DEBUGS("AvNameCache") << "LLAvatarNameResponder::result for " << agent_id << " "
- << "user '" << av_name.mUsername << "' "
- << "display '" << av_name.mDisplayName << "' "
- << "expires in " << expires - now << " seconds"
- << LL_ENDL;
+ LL_DEBUGS("AvNameCache") << "LLAvatarNameResponder::result for " << agent_id << LL_ENDL;
+ av_name.dump();
// cache it and fire signals
LLAvatarNameCache::processName(agent_id, av_name, true);
@@ -291,12 +278,9 @@ void LLAvatarNameCache::handleAgentError(const LLUUID& agent_id)
LLAvatarNameCache::sPendingQueue.erase(agent_id);
LLAvatarName& av_name = existing->second;
- LL_DEBUGS("AvNameCache") << "LLAvatarNameCache use cache for agent "
- << agent_id
- << "user '" << av_name.mUsername << "' "
- << "display '" << av_name.mDisplayName << "' "
- << "expires in " << av_name.mExpires - LLFrameTimer::getTotalSeconds() << " seconds"
- << LL_ENDL;
+ LL_DEBUGS("AvNameCache") << "LLAvatarNameCache use cache for agent " << agent_id << LL_ENDL;
+ av_name.dump();
+
av_name.mExpires = LLFrameTimer::getTotalSeconds() + TEMP_CACHE_ENTRY_LIFETIME; // reset expiry time so we don't constantly rerequest.
}
}
@@ -476,7 +460,7 @@ void LLAvatarNameCache::exportFile(std::ostream& ostr)
const LLUUID& agent_id = it->first;
const LLAvatarName& av_name = it->second;
// Do not write temporary or expired entries to the stored cache
- if (!av_name.mIsTemporaryName && av_name.mExpires >= max_unrefreshed)
+ if (av_name.isValidName(max_unrefreshed))
{
// key must be a string
agents[agent_id.asString()] = av_name.asLLSD();
@@ -513,7 +497,7 @@ void LLAvatarNameCache::idle()
if (!sAskQueue.empty())
{
- if (useDisplayNames())
+ if (hasNameLookupURL())
{
requestNamesViaCapability();
}
@@ -565,7 +549,7 @@ void LLAvatarNameCache::eraseUnrefreshed()
{
const LLUUID& agent_id = it->first;
LL_DEBUGS("AvNameCache") << agent_id
- << " user '" << av_name.mUsername << "' "
+ << " user '" << av_name.getUserName() << "' "
<< "expired " << now - av_name.mExpires << " secs ago"
<< LL_ENDL;
sCache.erase(it++);
@@ -583,14 +567,12 @@ void LLAvatarNameCache::buildLegacyName(const std::string& full_name,
LLAvatarName* av_name)
{
llassert(av_name);
- av_name->mUsername = "";
- av_name->mDisplayName = full_name;
- av_name->mIsDisplayNameDefault = true;
- av_name->mIsTemporaryName = true;
- av_name->mExpires = LLFrameTimer::getTotalSeconds() + TEMP_CACHE_ENTRY_LIFETIME;
+ av_name->fromString(full_name,TEMP_CACHE_ENTRY_LIFETIME);
LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::buildLegacyName "
<< full_name
<< LL_ENDL;
+ // DEBUG ONLY!!! DO NOT COMMIT!!!
+ av_name->dump();
}
// fills in av_name if it has it in the cache, even if expired (can check expiry time)
@@ -600,7 +582,7 @@ bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name)
if (sRunning)
{
// ...only do immediate lookups when cache is running
- if (useDisplayNames())
+ if (hasNameLookupURL())
{
// ...use display names cache
std::map<LLUUID,LLAvatarName>::iterator it = sCache.find(agent_id);
@@ -662,7 +644,7 @@ LLAvatarNameCache::callback_connection_t LLAvatarNameCache::get(const LLUUID& ag
if (sRunning)
{
// ...only do immediate lookups when cache is running
- if (useDisplayNames())
+ if (hasNameLookupURL())
{
// ...use new cache
std::map<LLUUID,LLAvatarName>::iterator it = sCache.find(agent_id);
@@ -720,20 +702,16 @@ LLAvatarNameCache::callback_connection_t LLAvatarNameCache::get(const LLUUID& ag
void LLAvatarNameCache::setUseDisplayNames(bool use)
{
- if (use != sUseDisplayNames)
+ if (use != LLAvatarName::useDisplayNames())
{
- sUseDisplayNames = use;
- // flush our cache
- sCache.clear();
-
+ LLAvatarName::setUseDisplayNames(use);
mUseDisplayNamesSignal();
}
}
-bool LLAvatarNameCache::useDisplayNames()
+void LLAvatarNameCache::flushCache()
{
- // Must be both manually set on and able to look up names.
- return sUseDisplayNames && !sNameLookupURL.empty();
+ sCache.clear();
}
void LLAvatarNameCache::erase(const LLUUID& agent_id)
diff --git a/indra/llmessage/llavatarnamecache.h b/indra/llmessage/llavatarnamecache.h
index 79f170f7c8..e172601432 100644
--- a/indra/llmessage/llavatarnamecache.h
+++ b/indra/llmessage/llavatarnamecache.h
@@ -81,6 +81,8 @@ namespace LLAvatarNameCache
void setUseDisplayNames(bool use);
bool useDisplayNames();
+ void flushCache();
+
void erase(const LLUUID& agent_id);
/// Provide some fallback for agents that return errors
diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp
index 479efabb5f..da07c9ae42 100644
--- a/indra/llmessage/llcachename.cpp
+++ b/indra/llmessage/llcachename.cpp
@@ -524,6 +524,7 @@ std::string LLCacheName::cleanFullName(const std::string& full_name)
}
//static
+// Transform hard-coded name provided by server to a more legible username
std::string LLCacheName::buildUsername(const std::string& full_name)
{
// rare, but handle hard-coded error names returned from server
@@ -549,8 +550,9 @@ std::string LLCacheName::buildUsername(const std::string& full_name)
return username;
}
- // if the input wasn't a correctly formatted legacy name just return it unchanged
- return full_name;
+ // if the input wasn't a correctly formatted legacy name, just return it
+ // cleaned up from a potential terminal "Resident"
+ return cleanFullName(full_name);
}
//static
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index 3e0653e9a4..7ed7042aff 100644
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -1832,7 +1832,7 @@ void LLScrollListCtrl::copyNameToClipboard(std::string id, bool is_group)
{
LLAvatarName av_name;
LLAvatarNameCache::get(LLUUID(id), &av_name);
- name = av_name.getLegacyName();
+ name = av_name.getUserName();
}
LLUrlAction::copyURLToClipboard(name);
}
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index a9e8fbb4e4..fd2635c73a 100644
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -597,7 +597,7 @@ LLUrlEntryAgentDisplayName::LLUrlEntryAgentDisplayName()
std::string LLUrlEntryAgentDisplayName::getName(const LLAvatarName& avatar_name)
{
- return avatar_name.mDisplayName;
+ return avatar_name.getDisplayName();
}
//
@@ -613,7 +613,7 @@ LLUrlEntryAgentUserName::LLUrlEntryAgentUserName()
std::string LLUrlEntryAgentUserName::getName(const LLAvatarName& avatar_name)
{
- return avatar_name.mUsername.empty() ? avatar_name.getLegacyName() : avatar_name.mUsername;
+ return avatar_name.getUserName();
}
//
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp
index 1969a0bc5f..59b862503c 100755
--- a/indra/newview/llavataractions.cpp
+++ b/indra/newview/llavataractions.cpp
@@ -135,7 +135,7 @@ void LLAvatarActions::removeFriendsDialog(const uuid_vec_t& ids)
LLAvatarName av_name;
if(LLAvatarNameCache::get(agent_id, &av_name))
{
- args["NAME"] = av_name.mDisplayName;
+ args["NAME"] = av_name.getDisplayName();
}
msgType = "RemoveFromFriends";
@@ -180,7 +180,7 @@ void LLAvatarActions::offerTeleport(const uuid_vec_t& ids)
static void on_avatar_name_cache_start_im(const LLUUID& agent_id,
const LLAvatarName& av_name)
{
- std::string name = av_name.mDisplayName;
+ std::string name = av_name.getDisplayName();
LLUUID session_id = gIMMgr->addSession(name, IM_NOTHING_SPECIAL, agent_id);
if (session_id != LLUUID::null)
{
@@ -215,7 +215,7 @@ void LLAvatarActions::endIM(const LLUUID& id)
static void on_avatar_name_cache_start_call(const LLUUID& agent_id,
const LLAvatarName& av_name)
{
- std::string name = av_name.mDisplayName;
+ std::string name = av_name.getDisplayName();
LLUUID session_id = gIMMgr->addSession(name, IM_NOTHING_SPECIAL, agent_id, true);
if (session_id != LLUUID::null)
{
@@ -315,11 +315,7 @@ static const char* get_profile_floater_name(const LLUUID& avatar_id)
static void on_avatar_name_show_profile(const LLUUID& agent_id, const LLAvatarName& av_name)
{
- std::string username = av_name.mUsername;
- if (username.empty())
- {
- username = LLCacheName::buildUsername(av_name.mDisplayName);
- }
+ std::string username = av_name.getUserName();
llinfos << "opening web profile for " << username << llendl;
std::string url = getProfileURL(username);
@@ -379,7 +375,7 @@ void LLAvatarActions::showOnMap(const LLUUID& id)
return;
}
- gFloaterWorldMap->trackAvatar(id, av_name.mDisplayName);
+ gFloaterWorldMap->trackAvatar(id, av_name.getDisplayName());
LLFloaterReg::showInstance("world_map");
}
@@ -709,7 +705,7 @@ void LLAvatarActions::buildResidentsString(std::vector<LLAvatarName> avatar_name
const std::string& separator = LLTrans::getString("words_separator");
for (std::vector<LLAvatarName>::const_iterator it = avatar_names.begin(); ; )
{
- residents_string.append((*it).mDisplayName);
+ residents_string.append((*it).getDisplayName());
if (++it == avatar_names.end())
{
break;
diff --git a/indra/newview/llavatariconctrl.cpp b/indra/newview/llavatariconctrl.cpp
index b7278d4a3a..0db38c947c 100755
--- a/indra/newview/llavatariconctrl.cpp
+++ b/indra/newview/llavatariconctrl.cpp
@@ -318,7 +318,7 @@ void LLAvatarIconCtrl::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarN
{
// Most avatar icon controls are next to a UI element that shows
// a display name, so only show username.
- mFullName = av_name.mUsername;
+ mFullName = av_name.getUserName();
if (mDrawTooltip)
{
diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp
index 771419f60a..e54e47180f 100644
--- a/indra/newview/llavatarlist.cpp
+++ b/indra/newview/llavatarlist.cpp
@@ -278,7 +278,7 @@ void LLAvatarList::refresh()
LLAvatarName av_name;
have_names &= LLAvatarNameCache::get(buddy_id, &av_name);
- if (!have_filter || findInsensitive(av_name.mDisplayName, mNameFilter))
+ if (!have_filter || findInsensitive(av_name.getDisplayName(), mNameFilter))
{
if (nadded >= ADD_LIMIT)
{
@@ -296,8 +296,9 @@ void LLAvatarList::refresh()
}
else
{
+ std::string display_name = av_name.getDisplayName();
addNewItem(buddy_id,
- av_name.mDisplayName.empty() ? waiting_str : av_name.mDisplayName,
+ display_name.empty() ? waiting_str : display_name,
LLAvatarTracker::instance().isBuddyOnline(buddy_id));
}
@@ -325,7 +326,7 @@ void LLAvatarList::refresh()
const LLUUID& buddy_id = it->asUUID();
LLAvatarName av_name;
have_names &= LLAvatarNameCache::get(buddy_id, &av_name);
- if (!findInsensitive(av_name.mDisplayName, mNameFilter))
+ if (!findInsensitive(av_name.getDisplayName(), mNameFilter))
{
removeItemByUUID(buddy_id);
modified = true;
@@ -398,7 +399,7 @@ bool LLAvatarList::filterHasMatches()
// If name has not been loaded yet we consider it as a match.
// When the name will be loaded the filter will be applied again(in refresh()).
- if (have_name && !findInsensitive(av_name.mDisplayName, mNameFilter))
+ if (have_name && !findInsensitive(av_name.getDisplayName(), mNameFilter))
{
continue;
}
diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp
index 7ff1b39573..84e177d4a4 100644
--- a/indra/newview/llavatarlistitem.cpp
+++ b/indra/newview/llavatarlistitem.cpp
@@ -449,8 +449,8 @@ void LLAvatarListItem::setNameInternal(const std::string& name, const std::strin
void LLAvatarListItem::onAvatarNameCache(const LLAvatarName& av_name)
{
- setAvatarName(av_name.mDisplayName);
- setAvatarToolTip(av_name.mUsername);
+ setAvatarName(av_name.getDisplayName());
+ setAvatarToolTip(av_name.getUserName());
//requesting the list to resort
notifyParent(LLSD().with("sort", LLSD()));
diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp
index 60d60abd45..9a295faa73 100644
--- a/indra/newview/llcallingcard.cpp
+++ b/indra/newview/llcallingcard.cpp
@@ -723,7 +723,7 @@ static void on_avatar_name_cache_notify(const LLUUID& agent_id,
// Popup a notify box with online status of this agent
// Use display name only because this user is your friend
LLSD args;
- args["NAME"] = av_name.mDisplayName;
+ args["NAME"] = av_name.getDisplayName();
args["STATUS"] = online ? LLTrans::getString("OnlineStatus") : LLTrans::getString("OfflineStatus");
LLNotificationPtr notification;
@@ -869,7 +869,7 @@ bool LLCollectMappableBuddies::operator()(const LLUUID& buddy_id, LLRelationship
{
LLAvatarName av_name;
LLAvatarNameCache::get( buddy_id, &av_name);
- buddy_map_t::value_type value(av_name.mDisplayName, buddy_id);
+ buddy_map_t::value_type value(av_name.getDisplayName(), buddy_id);
if(buddy->isOnline() && buddy->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION))
{
mMappable.insert(value);
@@ -892,7 +892,7 @@ bool LLCollectAllBuddies::operator()(const LLUUID& buddy_id, LLRelationship* bud
{
LLAvatarName av_name;
LLAvatarNameCache::get(buddy_id, &av_name);
- mFullName = av_name.mDisplayName;
+ mFullName = av_name.getDisplayName();
buddy_map_t::value_type value(mFullName, buddy_id);
if(buddy->isOnline())
{
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index a33bd88273..3e25d9c457 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -553,15 +553,15 @@ private:
void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name)
{
- mFrom = av_name.mDisplayName;
+ mFrom = av_name.getDisplayName();
LLTextBox* user_name = getChild<LLTextBox>("user_name");
- user_name->setValue( LLSD(av_name.mDisplayName ) );
- user_name->setToolTip( av_name.mUsername );
+ user_name->setValue( LLSD(av_name.getDisplayName() ) );
+ user_name->setToolTip( av_name.getUserName() );
if (gSavedSettings.getBOOL("NameTagShowUsernames") &&
- LLAvatarNameCache::useDisplayNames() &&
- !av_name.mIsDisplayNameDefault)
+ av_name.useDisplayNames() &&
+ !av_name.isDisplayNameDefault())
{
LLStyle::Params style_params_name;
LLColor4 userNameColor = LLUIColorTable::instance().getColor("EmphasisColor");
@@ -569,9 +569,9 @@ private:
style_params_name.font.name("SansSerifSmall");
style_params_name.font.style("NORMAL");
style_params_name.readonly_color(userNameColor);
- user_name->appendText(" - " + av_name.mUsername, FALSE, style_params_name);
+ user_name->appendText(" - " + av_name.getUserName(), FALSE, style_params_name);
}
- setToolTip( av_name.mUsername );
+ setToolTip( av_name.getUserName() );
// name might have changed, update width
updateMinUserNameWidth();
}
diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp
index 728b1a3f4c..76c422f34d 100644
--- a/indra/newview/llconversationmodel.cpp
+++ b/indra/newview/llconversationmodel.cpp
@@ -443,8 +443,8 @@ void LLConversationItemParticipant::buildContextMenu(LLMenuGL& menu, U32 flags)
void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_name)
{
- mName = (av_name.mUsername.empty() ? av_name.mDisplayName : av_name.mUsername);
- mDisplayName = (av_name.mDisplayName.empty() ? av_name.mUsername : av_name.mDisplayName);
+ mName = av_name.getUserName();
+ mDisplayName = av_name.getDisplayName();
mNeedsRefresh = true;
if(mParent != NULL)
{
diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp
index c68577db75..ff0e01a200 100644
--- a/indra/newview/llfavoritesbar.cpp
+++ b/indra/newview/llfavoritesbar.cpp
@@ -1520,8 +1520,8 @@ void LLFavoritesOrderStorage::saveFavoritesSLURLs()
LLAvatarName av_name;
LLAvatarNameCache::get( gAgentID, &av_name );
- lldebugs << "Saved favorites for " << av_name.getLegacyName() << llendl;
- fav_llsd[av_name.getLegacyName()] = user_llsd;
+ lldebugs << "Saved favorites for " << av_name.getUserName() << llendl;
+ fav_llsd[av_name.getUserName()] = user_llsd;
llofstream file;
file.open(filename);
@@ -1539,10 +1539,10 @@ void LLFavoritesOrderStorage::removeFavoritesRecordOfUser()
LLAvatarName av_name;
LLAvatarNameCache::get( gAgentID, &av_name );
- lldebugs << "Removed favorites for " << av_name.getLegacyName() << llendl;
- if (fav_llsd.has(av_name.getLegacyName()))
+ lldebugs << "Removed favorites for " << av_name.getUserName() << llendl;
+ if (fav_llsd.has(av_name.getUserName()))
{
- fav_llsd.erase(av_name.getLegacyName());
+ fav_llsd.erase(av_name.getUserName());
}
llofstream out_file;
diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp
index 6ada809cdb..f7dd4a4a6b 100644
--- a/indra/newview/llfloateravatarpicker.cpp
+++ b/indra/newview/llfloateravatarpicker.cpp
@@ -307,9 +307,9 @@ void LLFloaterAvatarPicker::populateNearMe()
else
{
element["columns"][0]["column"] = "name";
- element["columns"][0]["value"] = av_name.mDisplayName;
+ element["columns"][0]["value"] = av_name.getDisplayName();
element["columns"][1]["column"] = "username";
- element["columns"][1]["value"] = av_name.mUsername;
+ element["columns"][1]["value"] = av_name.getUserName();
sAvatarNameMap[av] = av_name;
}
@@ -505,9 +505,7 @@ void LLFloaterAvatarPicker::find()
LLViewerRegion* region = gAgent.getRegion();
url = region->getCapability("AvatarPickerSearch");
// Prefer use of capabilities to search on both SLID and display name
- // but allow display name search to be manually turned off for test
- if (!url.empty()
- && LLAvatarNameCache::useDisplayNames())
+ if (!url.empty())
{
// capability urls don't end in '/', but we need one to parse
// query parameters correctly
@@ -679,9 +677,7 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void*
found_one = TRUE;
LLAvatarName av_name;
- av_name.mLegacyFirstName = first_name;
- av_name.mLegacyLastName = last_name;
- av_name.mDisplayName = avatar_name;
+ av_name.fromString(avatar_name);
const LLUUID& agent_id = avatar_id;
sAvatarNameMap[agent_id] = av_name;
diff --git a/indra/newview/llfloaterdisplayname.cpp b/indra/newview/llfloaterdisplayname.cpp
index ac8f107928..be1ee77152 100644
--- a/indra/newview/llfloaterdisplayname.cpp
+++ b/indra/newview/llfloaterdisplayname.cpp
@@ -164,10 +164,9 @@ void LLFloaterDisplayName::onCancel()
void LLFloaterDisplayName::onReset()
{
- if (LLAvatarNameCache::useDisplayNames())
+ if (LLAvatarNameCache::hasNameLookupURL())
{
- LLViewerDisplayName::set("",
- boost::bind(&LLFloaterDisplayName::onCacheSetName, this, _1, _2, _3));
+ LLViewerDisplayName::set("",boost::bind(&LLFloaterDisplayName::onCacheSetName, this, _1, _2, _3));
}
else
{
@@ -199,10 +198,9 @@ void LLFloaterDisplayName::onSave()
return;
}
- if (LLAvatarNameCache::useDisplayNames())
+ if (LLAvatarNameCache::hasNameLookupURL())
{
- LLViewerDisplayName::set(display_name_utf8,
- boost::bind(&LLFloaterDisplayName::onCacheSetName, this, _1, _2, _3));
+ LLViewerDisplayName::set(display_name_utf8,boost::bind(&LLFloaterDisplayName::onCacheSetName, this, _1, _2, _3));
}
else
{
diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp
index a20fce876c..24b0355fca 100644
--- a/indra/newview/llfloaterimnearbychat.cpp
+++ b/indra/newview/llfloaterimnearbychat.cpp
@@ -545,7 +545,7 @@ void LLFloaterIMNearbyChat::addMessage(const LLChat& chat,bool archive,const LLS
LLAvatarName av_name;
LLAvatarNameCache::get(chat.mFromID, &av_name);
- if (!av_name.mIsDisplayNameDefault)
+ if (!av_name.isDisplayNameDefault())
{
from_name = av_name.getCompleteName();
}
diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp
index a50907601c..8d8bba7b17 100644
--- a/indra/newview/llfloaterscriptlimits.cpp
+++ b/indra/newview/llfloaterscriptlimits.cpp
@@ -602,15 +602,7 @@ void LLPanelScriptLimitsRegionMemory::onNameCache(
return;
}
- std::string name;
- if (LLAvatarNameCache::useDisplayNames())
- {
- name = LLCacheName::buildUsername(full_name);
- }
- else
- {
- name = full_name;
- }
+ std::string name = LLCacheName::buildUsername(full_name);
std::vector<LLSD>::iterator id_itor;
for (id_itor = mObjectListItems.begin(); id_itor != mObjectListItems.end(); ++id_itor)
@@ -713,10 +705,7 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content)
else
{
name_is_cached = gCacheName->getFullName(owner_id, owner_buf); // username
- if (LLAvatarNameCache::useDisplayNames())
- {
- owner_buf = LLCacheName::buildUsername(owner_buf);
- }
+ owner_buf = LLCacheName::buildUsername(owner_buf);
}
if(!name_is_cached)
{
diff --git a/indra/newview/llfloatersellland.cpp b/indra/newview/llfloatersellland.cpp
index 484ecbcd04..c97a6792f3 100644
--- a/indra/newview/llfloatersellland.cpp
+++ b/indra/newview/llfloatersellland.cpp
@@ -238,7 +238,7 @@ void LLFloaterSellLandUI::updateParcelInfo()
void LLFloaterSellLandUI::onBuyerNameCache(const LLAvatarName& av_name)
{
getChild<LLUICtrl>("sell_to_agent")->setValue(av_name.getCompleteName());
- getChild<LLUICtrl>("sell_to_agent")->setToolTip(av_name.mUsername);
+ getChild<LLUICtrl>("sell_to_agent")->setToolTip(av_name.getUserName());
}
void LLFloaterSellLandUI::setBadge(const char* id, Badge badge)
diff --git a/indra/newview/llfloatertopobjects.cpp b/indra/newview/llfloatertopobjects.cpp
index 2d91a61b54..7530c72dd2 100644
--- a/indra/newview/llfloatertopobjects.cpp
+++ b/indra/newview/llfloatertopobjects.cpp
@@ -199,17 +199,9 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data)
// Owner names can have trailing spaces sent from server
LLStringUtil::trim(owner_buf);
- if (LLAvatarNameCache::useDisplayNames())
- {
- // ...convert hard-coded name from server to a username
- // *TODO: Send owner_id from server and look up display name
- owner_buf = LLCacheName::buildUsername(owner_buf);
- }
- else
- {
- // ...just strip out legacy "Resident" name
- owner_buf = LLCacheName::cleanFullName(owner_buf);
- }
+ // *TODO: Send owner_id from server and look up display name
+ owner_buf = LLCacheName::buildUsername(owner_buf);
+
columns[column_num]["column"] = "owner";
columns[column_num]["value"] = owner_buf;
columns[column_num++]["font"] = "SANSSERIF";
diff --git a/indra/newview/llfloatervoicevolume.cpp b/indra/newview/llfloatervoicevolume.cpp
index 87b388b30a..a1df73a065 100644
--- a/indra/newview/llfloatervoicevolume.cpp
+++ b/indra/newview/llfloatervoicevolume.cpp
@@ -151,7 +151,7 @@ void LLFloaterVoiceVolume::updateVolumeControls()
// By convention, we only display and toggle voice mutes, not all mutes
bool is_muted = LLAvatarActions::isVoiceMuted(mAvatarID);
- bool is_linden = LLStringUtil::endsWith(mAvatarName.getLegacyName(), " Linden");
+ bool is_linden = LLStringUtil::endsWith(mAvatarName.getUserName(), " Linden");
mute_btn->setEnabled(!is_linden);
mute_btn->setValue(is_muted);
diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp
index a64ddd185d..0e72fab32c 100644
--- a/indra/newview/llfriendcard.cpp
+++ b/indra/newview/llfriendcard.cpp
@@ -533,7 +533,7 @@ void LLFriendCardsManager::addFriendCardToInventory(const LLUUID& avatarID)
bool shouldBeAdded = true;
LLAvatarName av_name;
LLAvatarNameCache::get(avatarID, &av_name);
- const std::string& name = av_name.mUsername;
+ const std::string& name = av_name.getUserName();
lldebugs << "Processing buddy name: " << name
<< ", id: " << avatarID
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index e5dda7e8d8..0de8f124ee 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -306,7 +306,7 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string&
void LLIMModel::LLIMSession::onAdHocNameCache(const LLAvatarName& av_name)
{
- if (av_name.mIsTemporaryName)
+ if (!av_name.isValidName())
{
S32 separator_index = mName.rfind(" ");
std::string name = mName.substr(0, separator_index);
@@ -626,15 +626,7 @@ void LLIMModel::LLIMSession::buildHistoryFileName()
// so no need for a callback in LLAvatarNameCache::get()
if (LLAvatarNameCache::get(mOtherParticipantID, &av_name))
{
- if (av_name.mUsername.empty())
- {
- // Display names are off, use mDisplayName which will be the legacy name
- mHistoryFileName = LLCacheName::buildUsername(av_name.mDisplayName);
- }
- else
- {
- mHistoryFileName = av_name.mUsername;
- }
+ mHistoryFileName = LLCacheName::buildUsername(av_name.getUserName());
}
else
{
@@ -836,7 +828,7 @@ bool LLIMModel::logToFile(const std::string& file_name, const std::string& from,
LLAvatarName av_name;
if (!from_id.isNull() &&
LLAvatarNameCache::get(from_id, &av_name) &&
- !av_name.mIsDisplayNameDefault)
+ !av_name.isDisplayNameDefault())
{
from_name = av_name.getCompleteName();
}
@@ -1926,7 +1918,7 @@ void LLOutgoingCallDialog::show(const LLSD& key)
LLAvatarName av_name;
if (LLAvatarNameCache::get(callee_id, &av_name))
{
- final_callee_name = av_name.mDisplayName;
+ final_callee_name = av_name.getDisplayName();
title = av_name.getCompleteName();
}
}
@@ -2464,7 +2456,7 @@ void LLIMMgr::addMessage(
LLAvatarName av_name;
if (LLAvatarNameCache::get(other_participant_id, &av_name) && !name_is_setted)
{
- fixed_session_name = (av_name.mDisplayName.empty() ? av_name.mUsername : av_name.mDisplayName);
+ fixed_session_name = av_name.getDisplayName();
}
LLIMModel::getInstance()->newSession(new_session_id, fixed_session_name, dialog, other_participant_id, false, is_offline_msg);
@@ -3110,7 +3102,7 @@ void LLIMMgr::noteOfflineUsers(
{
LLUIString offline = LLTrans::getString("offline_message");
// Use display name only because this user is your friend
- offline.setArg("[NAME]", av_name.mDisplayName);
+ offline.setArg("[NAME]", av_name.getDisplayName());
im_model.proccessOnlineOfflineNotification(session_id, offline);
}
}
diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp
index 8a15cd279f..3507b729be 100644
--- a/indra/newview/llinspectavatar.cpp
+++ b/indra/newview/llinspectavatar.cpp
@@ -263,9 +263,9 @@ void LLInspectAvatar::onAvatarNameCache(
{
if (agent_id == mAvatarID)
{
- getChild<LLUICtrl>("user_name")->setValue(av_name.mDisplayName);
- getChild<LLUICtrl>("user_name_small")->setValue(av_name.mDisplayName);
- getChild<LLUICtrl>("user_slid")->setValue(av_name.mUsername);
+ getChild<LLUICtrl>("user_name")->setValue(av_name.getDisplayName());
+ getChild<LLUICtrl>("user_name_small")->setValue(av_name.getDisplayName());
+ getChild<LLUICtrl>("user_slid")->setValue(av_name.getUserName());
mAvatarName = av_name;
// show smaller display name if too long to display in regular size
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 73631f4ba8..bad4e8c231 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -4712,10 +4712,9 @@ void LLCallingCardBridge::performAction(LLInventoryModel* model, std::string act
gCacheName->getFullName(item->getCreatorUUID(), callingcard_name);
// IDEVO
LLAvatarName av_name;
- if (LLAvatarNameCache::useDisplayNames()
- && LLAvatarNameCache::get(item->getCreatorUUID(), &av_name))
+ if (LLAvatarNameCache::get(item->getCreatorUUID(), &av_name))
{
- callingcard_name = av_name.mDisplayName + " (" + av_name.mUsername + ")";
+ callingcard_name = av_name.getCompleteName();
}
LLUUID session_id = gIMMgr->addSession(callingcard_name, IM_NOTHING_SPECIAL, item->getCreatorUUID());
if (session_id != LLUUID::null)
diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp
index b0fbad33b0..855007e403 100644
--- a/indra/newview/llnamelistctrl.cpp
+++ b/indra/newview/llnamelistctrl.cpp
@@ -320,7 +320,7 @@ LLScrollListItem* LLNameListCtrl::addNameItemRow(
else if (LLAvatarNameCache::get(id, &av_name))
{
if (mShortNames)
- fullname = av_name.mDisplayName;
+ fullname = av_name.getDisplayName();
else
fullname = av_name.getCompleteName();
}
@@ -390,7 +390,7 @@ void LLNameListCtrl::onAvatarNameCache(const LLUUID& agent_id,
{
std::string name;
if (mShortNames)
- name = av_name.mDisplayName;
+ name = av_name.getDisplayName();
else
name = av_name.getCompleteName();
diff --git a/indra/newview/llpanelblockedlist.cpp b/indra/newview/llpanelblockedlist.cpp
index 7612af8f5e..b4deb7a920 100644
--- a/indra/newview/llpanelblockedlist.cpp
+++ b/indra/newview/llpanelblockedlist.cpp
@@ -224,7 +224,7 @@ void LLPanelBlockedList::onFilterEdit(const std::string& search_string)
void LLPanelBlockedList::callbackBlockPicked(const uuid_vec_t& ids, const std::vector<LLAvatarName> names)
{
if (names.empty() || ids.empty()) return;
- LLMute mute(ids[0], names[0].getLegacyName(), LLMute::AGENT);
+ LLMute mute(ids[0], names[0].getUserName(), LLMute::AGENT);
LLMuteList::getInstance()->add(mute);
showPanelAndSelect(mute.mID);
}
diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp
index 7efeb77e23..a2bbc5400c 100644
--- a/indra/newview/llpanelgroupinvite.cpp
+++ b/indra/newview/llpanelgroupinvite.cpp
@@ -482,7 +482,7 @@ void LLPanelGroupInvite::addUsers(uuid_vec_t& agent_ids)
}
else
{
- names.push_back(av_name.getLegacyName());
+ names.push_back(av_name.getUserName());
}
}
}
@@ -495,7 +495,7 @@ void LLPanelGroupInvite::addUserCallback(const LLUUID& id, const LLAvatarName& a
std::vector<std::string> names;
uuid_vec_t agent_ids;
agent_ids.push_back(id);
- names.push_back(av_name.getLegacyName());
+ names.push_back(av_name.getUserName());
mImplementation->addUsers(names, agent_ids);
}
diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp
index 31c0e3d01a..93b108efcc 100644
--- a/indra/newview/llpanelgroupnotices.cpp
+++ b/indra/newview/llpanelgroupnotices.cpp
@@ -543,10 +543,7 @@ void LLPanelGroupNotices::processNotices(LLMessageSystem* msg)
msg->getU32("Data","Timestamp",timestamp,i);
// we only have the legacy name here, convert it to a username
- if (LLAvatarNameCache::useDisplayNames())
- {
- name = LLCacheName::buildUsername(name);
- }
+ name = LLCacheName::buildUsername(name);
LLSD row;
row["id"] = id;
diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp
index 5720168f81..7ad7e7149b 100644
--- a/indra/newview/llpanelgrouproles.cpp
+++ b/indra/newview/llpanelgrouproles.cpp
@@ -1616,7 +1616,7 @@ void LLPanelGroupMembersSubTab::onNameCache(const LLUUID& update_id, LLGroupMemb
}
// trying to avoid unnecessary hash lookups
- if (matchesSearchFilter(av_name.getLegacyName()))
+ if (matchesSearchFilter(av_name.getUserName()))
{
addMemberToList(id, member);
if(!mMembersList->getEnabled())
@@ -1670,7 +1670,7 @@ void LLPanelGroupMembersSubTab::updateMembers()
LLAvatarName av_name;
if (LLAvatarNameCache::get(mMemberProgress->first, &av_name))
{
- if (matchesSearchFilter(av_name.getLegacyName()))
+ if (matchesSearchFilter(av_name.getUserName()))
{
addMemberToList(mMemberProgress->first, mMemberProgress->second);
}
diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp
index 6c838f8a45..c53760bca1 100644
--- a/indra/newview/llparticipantlist.cpp
+++ b/indra/newview/llparticipantlist.cpp
@@ -381,7 +381,7 @@ void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id)
// Create a participant view model instance
LLAvatarName avatar_name;
bool has_name = LLAvatarNameCache::get(avatar_id, &avatar_name);
- participant = new LLConversationItemParticipant(!has_name ? LLTrans::getString("AvatarNameWaiting") : avatar_name.mDisplayName , avatar_id, mRootViewModel);
+ participant = new LLConversationItemParticipant(!has_name ? LLTrans::getString("AvatarNameWaiting") : avatar_name.getDisplayName() , avatar_id, mRootViewModel);
participant->fetchAvatarName();
}
else
diff --git a/indra/newview/lltoastgroupnotifypanel.cpp b/indra/newview/lltoastgroupnotifypanel.cpp
index ed350ea144..4dc0d424ac 100644
--- a/indra/newview/lltoastgroupnotifypanel.cpp
+++ b/indra/newview/lltoastgroupnotifypanel.cpp
@@ -69,10 +69,8 @@ LLToastGroupNotifyPanel::LLToastGroupNotifyPanel(const LLNotificationPtr& notifi
//header title
std::string from_name = payload["sender_name"].asString();
- if (LLAvatarNameCache::useDisplayNames())
- {
- from_name = LLCacheName::buildUsername(from_name);
- }
+ from_name = LLCacheName::buildUsername(from_name);
+
std::stringstream from;
from << from_name << "/" << groupData.mName;
LLTextBox* pTitleText = getChild<LLTextBox>("title");
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index 3cd761b73b..c81f6ace70 100644
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -991,8 +991,7 @@ BOOL LLToolPie::handleTooltipObject( LLViewerObject* hover_object, std::string l
}
LLAvatarName av_name;
- if (LLAvatarNameCache::useDisplayNames() &&
- LLAvatarNameCache::get(hover_object->getID(), &av_name))
+ if (LLAvatarNameCache::get(hover_object->getID(), &av_name))
{
final_name = av_name.getCompleteName();
}
diff --git a/indra/newview/llviewerdisplayname.cpp b/indra/newview/llviewerdisplayname.cpp
index 5741fab29a..4bd38562bc 100644
--- a/indra/newview/llviewerdisplayname.cpp
+++ b/indra/newview/llviewerdisplayname.cpp
@@ -97,7 +97,7 @@ void LLViewerDisplayName::set(const std::string& display_name, const set_name_sl
// People API expects array of [ "old value", "new value" ]
LLSD change_array = LLSD::emptyArray();
- change_array.append(av_name.mDisplayName);
+ change_array.append(av_name.getDisplayName());
change_array.append(display_name);
llinfos << "Set name POST to " << cap_url << llendl;
@@ -189,8 +189,8 @@ class LLDisplayNameUpdate : public LLHTTPNode
LLSD args;
args["OLD_NAME"] = old_display_name;
- args["SLID"] = av_name.mUsername;
- args["NEW_NAME"] = av_name.mDisplayName;
+ args["SLID"] = av_name.getUserName();
+ args["NEW_NAME"] = av_name.getDisplayName();
LLNotificationsUtil::add("DisplayNameUpdate", args);
if (agent_id == gAgent.getID())
{
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 511807ec2f..5284d2650e 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -8080,11 +8080,7 @@ class LLWorldPostProcess : public view_listener_t
void handle_flush_name_caches()
{
- // Toggle display names on and off to flush
- bool use_display_names = LLAvatarNameCache::useDisplayNames();
- LLAvatarNameCache::setUseDisplayNames(!use_display_names);
- LLAvatarNameCache::setUseDisplayNames(use_display_names);
-
+ LLAvatarNameCache::flushCache();
if (gCacheName) gCacheName->clear();
}
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index dc8192105f..6397ef7961 100755
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -2245,16 +2245,7 @@ static std::string clean_name_from_task_im(const std::string& msg,
// Don't try to clean up group names
if (!from_group)
{
- if (LLAvatarNameCache::useDisplayNames())
- {
- // ...just convert to username
- final += LLCacheName::buildUsername(name);
- }
- else
- {
- // ...strip out legacy "Resident" name
- final += LLCacheName::cleanFullName(name);
- }
+ final += LLCacheName::buildUsername(name);
}
final += match[3].str();
return final;
@@ -2268,7 +2259,7 @@ void notification_display_name_callback(const LLUUID& id,
LLSD& substitutions,
const LLSD& payload)
{
- substitutions["NAME"] = av_name.mDisplayName;
+ substitutions["NAME"] = av_name.getDisplayName();
LLNotificationsUtil::add(name, substitutions, payload);
}
@@ -3452,7 +3443,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
LLAvatarName av_name;
if (LLAvatarNameCache::get(from_id, &av_name))
{
- chat.mFromName = av_name.mDisplayName;
+ chat.mFromName = av_name.getDisplayName();
}
else
{
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 220c4ef59a..7cc4e3ed04 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -3188,29 +3188,27 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name)
static LLUICachedControl<bool> show_display_names("NameTagShowDisplayNames");
static LLUICachedControl<bool> show_usernames("NameTagShowUsernames");
- if (LLAvatarNameCache::useDisplayNames())
+ if (LLAvatarName::useDisplayNames())
{
LLAvatarName av_name;
if (!LLAvatarNameCache::get(getID(), &av_name))
{
- // ...call this function back when the name arrives
- // and force a rebuild
- LLAvatarNameCache::get(getID(),
- boost::bind(&LLVOAvatar::clearNameTag, this));
+ // ...call this function back when the name arrives and force a rebuild
+ LLAvatarNameCache::get(getID(),boost::bind(&LLVOAvatar::clearNameTag, this));
}
// Might be blank if name not available yet, that's OK
if (show_display_names)
{
- addNameTagLine(av_name.mDisplayName, name_tag_color, LLFontGL::NORMAL,
+ addNameTagLine(av_name.getDisplayName(), name_tag_color, LLFontGL::NORMAL,
LLFontGL::getFontSansSerif());
}
// Suppress SLID display if display name matches exactly (ugh)
- if (show_usernames && !av_name.mIsDisplayNameDefault)
+ if (show_usernames && !av_name.isDisplayNameDefault())
{
// *HACK: Desaturate the color
LLColor4 username_color = name_tag_color * 0.83f;
- addNameTagLine(av_name.mUsername, username_color, LLFontGL::NORMAL,
+ addNameTagLine(av_name.getUserName(), username_color, LLFontGL::NORMAL,
LLFontGL::getFontSansSerifSmall());
}
}
@@ -3421,20 +3419,18 @@ LLColor4 LLVOAvatar::getNameTagColor(bool is_friend)
{
color_name = "NameTagFriend";
}
- else if (LLAvatarNameCache::useDisplayNames())
+ else if (LLAvatarName::useDisplayNames())
{
- // ...color based on whether username "matches" a computed display
- // name
+ // ...color based on whether username "matches" a computed display name
LLAvatarName av_name;
- if (LLAvatarNameCache::get(getID(), &av_name)
- && av_name.mIsDisplayNameDefault)
+ if (LLAvatarNameCache::get(getID(), &av_name) && av_name.isDisplayNameDefault())
{
color_name = "NameTagMatch";
}
else
{
color_name = "NameTagMismatch";
- }
+ }
}
else
{
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 37491e5b58..6fdda12a1c 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -2668,7 +2668,7 @@ void LLVivoxVoiceClient::checkFriend(const LLUUID& id)
// *NOTE: For now, we feed legacy names to Vivox because I don't know
// if their service can support a mix of new and old clients with
// different sorts of names.
- std::string name = av_name.getLegacyName();
+ std::string name = av_name.getUserName();
const LLRelationship* relationInfo = LLAvatarTracker::instance().getBuddyInfo(id);
bool canSeeMeOnline = false;
@@ -6200,7 +6200,7 @@ void LLVivoxVoiceClient::lookupName(const LLUUID &id)
void LLVivoxVoiceClient::onAvatarNameCache(const LLUUID& agent_id,
const LLAvatarName& av_name)
{
- std::string display_name = av_name.mDisplayName;
+ std::string display_name = av_name.getDisplayName();
avatarNameResolved(agent_id, display_name);
}