summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Todd Stinson <stinson@lindenlab.com>2012-12-10 10:32:33 -0800
committerWilliam Todd Stinson <stinson@lindenlab.com>2012-12-10 10:32:33 -0800
commit3c591c1a929ddc8447620e5062401b6586ebc718 (patch)
tree90ada0c932fce7c715ffab7be906c57a40948ebe
parent9da625d439a9a911733564177e32facc3669dc58 (diff)
parent08a7f4193b18ca5c0bbaf144232eeb2678205eae (diff)
Pull and merge from ssh://stinson@hg.lindenlab.com/richard/viewer-chui/.
-rw-r--r--indra/llcommon/llavatarname.cpp128
-rw-r--r--indra/llcommon/llavatarname.h64
-rw-r--r--indra/llmessage/llavatarnamecache.cpp245
-rw-r--r--indra/llmessage/llavatarnamecache.h32
-rw-r--r--indra/llmessage/llcachename.cpp6
-rw-r--r--indra/llmessage/llcachename.h2
-rw-r--r--indra/llui/llscrolllistctrl.cpp2
-rw-r--r--indra/llui/llurlentry.cpp4
-rw-r--r--indra/llui/tests/llurlentry_stub.cpp5
-rwxr-xr-xindra/newview/app_settings/settings.xml11
-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.cpp5
-rwxr-xr-xindra/newview/llconversationview.cpp3
-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/llfloaterimcontainer.cpp20
-rw-r--r--indra/newview/llfloaterimcontainer.h2
-rw-r--r--indra/newview/llfloaterimnearbychat.cpp2
-rw-r--r--indra/newview/llfloaterimnearbychathandler.cpp5
-rw-r--r--indra/newview/llfloaterimsessiontab.cpp10
-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.cpp104
-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/llpanelmarketplaceinboxinventory.cpp10
-rw-r--r--indra/newview/llpanelobjectinventory.cpp11
-rw-r--r--indra/newview/llparticipantlist.cpp2
-rwxr-xr-xindra/newview/llstartup.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
-rw-r--r--indra/newview/skins/default/xui/en/floater_im_container.xml17
51 files changed, 506 insertions, 398 deletions
diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp
index 3206843bf4..95ecce509b 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,14 @@ 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;
+
+// Minimum time-to-live (in seconds) for a name entry.
+// Avatar name should always guarantee to expire reasonably soon by default
+// so if the failure to get a valid expiration time was due to something temporary
+// we will eventually request and get the right data.
+const F64 MIN_ENTRY_LIFETIME = 60.0;
+
LLAvatarName::LLAvatarName()
: mUsername(),
mDisplayName(),
@@ -61,6 +70,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,36 +105,120 @@ 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;
+ }
+}
+
+// Transform a string (typically provided by the legacy service) into a decent
+// avatar name instance.
+void LLAvatarName::fromString(const std::string& full_name)
+{
+ mDisplayName = full_name;
+ std::string::size_type index = full_name.find(' ');
+ if (index != std::string::npos)
+ {
+ // The name is in 2 parts (first last)
+ mLegacyFirstName = full_name.substr(0, index);
+ mLegacyLastName = full_name.substr(index+1);
+ if (mLegacyLastName != "Resident")
+ {
+ mUsername = mLegacyFirstName + "." + mLegacyLastName;
+ mDisplayName = full_name;
+ LLStringUtil::toLower(mUsername);
+ }
+ else
+ {
+ // Very old names do have a dummy "Resident" last name
+ // that we choose to hide from users.
+ mUsername = mLegacyFirstName;
+ mDisplayName = mLegacyFirstName;
+ }
+ }
+ else
+ {
+ mLegacyFirstName = full_name;
+ mLegacyLastName = "";
+ mUsername = full_name;
+ mDisplayName = full_name;
+ }
+ mIsDisplayNameDefault = true;
+ mIsTemporaryName = true;
+ setExpires(MIN_ENTRY_LIFETIME);
+}
+
+void LLAvatarName::setExpires(F64 expires)
+{
+ mExpires = LLFrameTimer::getTotalSeconds() + expires;
}
std::string LLAvatarName::getCompleteName() const
{
std::string name;
- if (mUsername.empty() || mIsDisplayNameDefault)
- // If the display name feature is off
- // OR this particular display name is defaulted (i.e. based on user name),
- // then display only the easier to read instance of the person's name.
+ if (sUseDisplayNames)
{
- name = mDisplayName;
+ if (mUsername.empty() || mIsDisplayNameDefault)
+ {
+ // If this particular display name is defaulted (i.e. based on user name),
+ // then display only the easier to read instance of the person's name.
+ name = mDisplayName;
+ }
+ else
+ {
+ name = mDisplayName + " (" + mUsername + ")";
+ }
}
else
{
- name = mDisplayName + " (" + mUsername + ")";
+ name = getUserName();
}
return name;
}
-std::string LLAvatarName::getLegacyName() const
+std::string LLAvatarName::getDisplayName() const
{
- if (mLegacyFirstName.empty() && mLegacyLastName.empty()) // display names disabled?
+ if (sUseDisplayNames)
{
return mDisplayName;
}
+ else
+ {
+ return getUserName();
+ }
+}
+std::string LLAvatarName::getUserName() const
+{
std::string name;
- name.reserve( mLegacyFirstName.size() + 1 + mLegacyLastName.size() );
- name = mLegacyFirstName;
- name += " ";
- name += mLegacyLastName;
+ if (mLegacyLastName.empty() || (mLegacyLastName == "Resident"))
+ {
+ if (mLegacyFirstName.empty())
+ {
+ // If we cannot create a user name from the legacy strings, use the display name
+ name = mDisplayName;
+ }
+ else
+ {
+ // The last name might be empty if it defaulted to "Resident"
+ name = mLegacyFirstName;
+ }
+ }
+ else
+ {
+ name = mLegacyFirstName + " " + mLegacyLastName;
+ }
return name;
}
+
+void LLAvatarName::dump() const
+{
+ 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..2f8c534974 100644
--- a/indra/llcommon/llavatarname.h
+++ b/indra/llcommon/llavatarname.h
@@ -39,23 +39,59 @@ public:
bool operator<(const LLAvatarName& rhs) const;
+ // Conversion to and from LLSD (cache file or server response)
LLSD asLLSD() const;
-
void fromLLSD(const LLSD& sd);
+ // Used only in legacy mode when the display name capability is not provided server side
+ // or to otherwise create a temporary valid item.
+ void fromString(const std::string& full_name);
+
+ // Set the name object to become invalid in "expires" seconds from now
+ void setExpires(F64 expires);
+
+ // Set and get the display name flag set by the user in preferences.
+ static void setUseDisplayNames(bool use);
+ static bool useDisplayNames();
+
+ // A name object is valid if not temporary and not yet expired (default is expiration not checked)
+ bool isValidName(F64 max_unrefreshed = 0.0f) const { return !mIsTemporaryName && (mExpires >= max_unrefreshed); }
+
+ // Return true if the name is made up from legacy or temporary data
+ 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 +117,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..9d6aa15ed1 100644
--- a/indra/llmessage/llavatarnamecache.cpp
+++ b/indra/llmessage/llavatarnamecache.cpp
@@ -43,26 +43,26 @@ 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;
+ // Use the People API (modern) for fetching name if true. Use the old legacy protocol if false.
+ // For testing, there's a UsePeopleAPI setting that can be flipped (must restart viewer).
+ bool sUsePeopleAPI = true;
+
// Base lookup URL for name service.
// On simulator, loaded from indra.xml
// On viewer, usually a simulator capability (at People API team's request)
// Includes the trailing slash, like "http://pdp60.lindenlab.com:8000/agents/"
std::string sNameLookupURL;
- // accumulated agent IDs for next query against service
+ // Accumulated agent IDs for next query against service
typedef std::set<LLUUID> ask_queue_t;
ask_queue_t sAskQueue;
- // agent IDs that have been requested, but with no reply
- // maps agent ID to frame time request was made
+ // Agent IDs that have been requested, but with no reply.
+ // Maps agent ID to frame time request was made.
typedef std::map<LLUUID, F64> pending_queue_t;
pending_queue_t sPendingQueue;
@@ -73,21 +73,21 @@ namespace LLAvatarNameCache
typedef std::map<LLUUID, callback_signal_t*> signal_map_t;
signal_map_t sSignalMap;
- // names we know about
+ // The cache at last, i.e. avatar names we know about.
typedef std::map<LLUUID, LLAvatarName> cache_t;
cache_t sCache;
- // Send bulk lookup requests a few times a second at most
- // only need per-frame timing resolution
+ // Send bulk lookup requests a few times a second at most.
+ // Only need per-frame timing resolution.
LLFrameTimer sRequestTimer;
- /// Maximum time an unrefreshed cache entry is allowed
+ // Maximum time an unrefreshed cache entry is allowed.
const F64 MAX_UNREFRESHED_TIME = 20.0 * 60.0;
- /// Time when unrefreshed cached names were checked last
+ // Time when unrefreshed cached names were checked last.
static F64 sLastExpireCheck;
- /// Time-to-live for a temp cache entry.
+ // Time-to-live for a temp cache entry.
const F64 TEMP_CACHE_ENTRY_LIFETIME = 60.0;
//-----------------------------------------------------------------------
@@ -95,26 +95,21 @@ namespace LLAvatarNameCache
//-----------------------------------------------------------------------
// Handle name response off network.
- // Optionally skip adding to cache, used when this is a fallback to the
- // legacy name system.
void processName(const LLUUID& agent_id,
- const LLAvatarName& av_name,
- bool add_to_cache);
+ const LLAvatarName& av_name);
void requestNamesViaCapability();
- // Legacy name system callback
+ // Legacy name system callbacks
void legacyNameCallback(const LLUUID& agent_id,
const std::string& full_name,
- bool is_group
- );
-
+ bool is_group);
+ void legacyNameFetch(const LLUUID& agent_id,
+ const std::string& full_name,
+ bool is_group);
+
void requestNamesViaLegacy();
- // Fill in an LLAvatarName with the legacy name data
- void buildLegacyName(const std::string& full_name,
- LLAvatarName* av_name);
-
// Do a single callback to a given slot
void fireSignal(const LLUUID& agent_id,
const callback_slot_t& slot,
@@ -209,20 +204,11 @@ 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);
+ LLAvatarNameCache::processName(agent_id, av_name);
}
// Same logic as error response case
@@ -279,40 +265,34 @@ void LLAvatarNameCache::handleAgentError(const LLUUID& agent_id)
LL_WARNS("AvNameCache") << "LLAvatarNameCache get legacy for agent "
<< agent_id << LL_ENDL;
gCacheName->get(agent_id, false, // legacy compatibility
- boost::bind(&LLAvatarNameCache::legacyNameCallback,
- _1, _2, _3));
+ boost::bind(&LLAvatarNameCache::legacyNameFetch, _1, _2, _3));
}
else
{
- // we have a chached (but probably expired) entry - since that would have
+ // we have a cached (but probably expired) entry - since that would have
// been returned by the get method, there is no need to signal anyone
// Clear this agent from the pending list
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;
- av_name.mExpires = LLFrameTimer::getTotalSeconds() + TEMP_CACHE_ENTRY_LIFETIME; // reset expiry time so we don't constantly rerequest.
+ LL_DEBUGS("AvNameCache") << "LLAvatarNameCache use cache for agent " << agent_id << LL_ENDL;
+ av_name.dump();
+
+ // Reset expiry time so we don't constantly rerequest.
+ av_name.setExpires(TEMP_CACHE_ENTRY_LIFETIME);
}
}
-void LLAvatarNameCache::processName(const LLUUID& agent_id,
- const LLAvatarName& av_name,
- bool add_to_cache)
+void LLAvatarNameCache::processName(const LLUUID& agent_id, const LLAvatarName& av_name)
{
- if (add_to_cache)
- {
- sCache[agent_id] = av_name;
- }
+ // Add to the cache
+ sCache[agent_id] = av_name;
+ // Suppress request from the queue
sPendingQueue.erase(agent_id);
- // signal everyone waiting on this name
+ // Signal everyone waiting on this name
signal_map_t::iterator sig_it = sSignalMap.find(agent_id);
if (sig_it != sSignalMap.end())
{
@@ -389,22 +369,33 @@ void LLAvatarNameCache::legacyNameCallback(const LLUUID& agent_id,
const std::string& full_name,
bool is_group)
{
- // Construct a dummy record for this name. By convention, SLID is blank
- // Never expires, but not written to disk, so lasts until end of session.
- LLAvatarName av_name;
- LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::legacyNameCallback "
- << "agent " << agent_id << " "
+ // Put the received data in the cache
+ legacyNameFetch(agent_id, full_name, is_group);
+
+ // Retrieve the name and set it to never (or almost never...) expire: when we are using the legacy
+ // protocol, we do not get an expiration date for each name and there's no reason to ask the
+ // data again and again so we set the expiration time to the largest value admissible.
+ std::map<LLUUID,LLAvatarName>::iterator av_record = sCache.find(agent_id);
+ LLAvatarName& av_name = av_record->second;
+ av_name.setExpires(MAX_UNREFRESHED_TIME);
+}
+
+void LLAvatarNameCache::legacyNameFetch(const LLUUID& agent_id,
+ const std::string& full_name,
+ bool is_group)
+{
+ LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::legacyNameFetch "
+ << "agent " << agent_id << " "
<< "full name '" << full_name << "'"
- << ( is_group ? " [group]" : "" )
- << LL_ENDL;
- buildLegacyName(full_name, &av_name);
-
- // Add to cache, because if we don't we'll keep rerequesting the
- // same record forever. buildLegacyName should always guarantee
- // that these records expire reasonably soon
- // (in TEMP_CACHE_ENTRY_LIFETIME seconds), so if the failure was due
- // to something temporary we will eventually request and get the right data.
- processName(agent_id, av_name, true);
+ << ( is_group ? " [group]" : "" )
+ << LL_ENDL;
+
+ // Construct an av_name record from this name.
+ LLAvatarName av_name;
+ av_name.fromString(full_name);
+
+ // Add to cache: we're still using the new cache even if we're using the old (legacy) protocol.
+ processName(agent_id, av_name);
}
void LLAvatarNameCache::requestNamesViaLegacy()
@@ -426,18 +417,19 @@ void LLAvatarNameCache::requestNamesViaLegacy()
LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::requestNamesViaLegacy agent " << agent_id << LL_ENDL;
gCacheName->get(agent_id, false, // legacy compatibility
- boost::bind(&LLAvatarNameCache::legacyNameCallback,
- _1, _2, _3));
+ boost::bind(&LLAvatarNameCache::legacyNameCallback, _1, _2, _3));
}
}
-void LLAvatarNameCache::initClass(bool running)
+void LLAvatarNameCache::initClass(bool running, bool usePeopleAPI)
{
sRunning = running;
+ sUsePeopleAPI = usePeopleAPI;
}
void LLAvatarNameCache::cleanupClass()
{
+ sCache.clear();
}
void LLAvatarNameCache::importFile(std::istream& istr)
@@ -476,7 +468,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();
@@ -497,6 +489,11 @@ bool LLAvatarNameCache::hasNameLookupURL()
return !sNameLookupURL.empty();
}
+bool LLAvatarNameCache::usePeopleAPI()
+{
+ return hasNameLookupURL() && sUsePeopleAPI;
+}
+
void LLAvatarNameCache::idle()
{
// By convention, start running at first idle() call
@@ -513,13 +510,12 @@ void LLAvatarNameCache::idle()
if (!sAskQueue.empty())
{
- if (useDisplayNames())
+ if (usePeopleAPI())
{
requestNamesViaCapability();
}
else
{
- // ...fall back to legacy name cache system
requestNamesViaLegacy();
}
}
@@ -565,7 +561,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++);
@@ -579,20 +575,6 @@ void LLAvatarNameCache::eraseUnrefreshed()
}
}
-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;
- LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::buildLegacyName "
- << full_name
- << LL_ENDL;
-}
-
// fills in av_name if it has it in the cache, even if expired (can check expiry time)
// returns bool specifying if av_name was filled, false otherwise
bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name)
@@ -600,38 +582,24 @@ bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name)
if (sRunning)
{
// ...only do immediate lookups when cache is running
- if (useDisplayNames())
+ std::map<LLUUID,LLAvatarName>::iterator it = sCache.find(agent_id);
+ if (it != sCache.end())
{
- // ...use display names cache
- std::map<LLUUID,LLAvatarName>::iterator it = sCache.find(agent_id);
- if (it != sCache.end())
- {
- *av_name = it->second;
+ *av_name = it->second;
- // re-request name if entry is expired
- if (av_name->mExpires < LLFrameTimer::getTotalSeconds())
+ // re-request name if entry is expired
+ if (av_name->mExpires < LLFrameTimer::getTotalSeconds())
+ {
+ if (!isRequestPending(agent_id))
{
- if (!isRequestPending(agent_id))
- {
- LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::get "
- << "refresh agent " << agent_id
- << LL_ENDL;
- sAskQueue.insert(agent_id);
- }
+ LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::get "
+ << "refresh agent " << agent_id
+ << LL_ENDL;
+ sAskQueue.insert(agent_id);
}
-
- return true;
- }
- }
- else
- {
- // ...use legacy names cache
- std::string full_name;
- if (gCacheName->getFullName(agent_id, full_name))
- {
- buildLegacyName(full_name, av_name);
- return true;
}
+
+ return true;
}
}
@@ -662,30 +630,14 @@ LLAvatarNameCache::callback_connection_t LLAvatarNameCache::get(const LLUUID& ag
if (sRunning)
{
// ...only do immediate lookups when cache is running
- if (useDisplayNames())
+ std::map<LLUUID,LLAvatarName>::iterator it = sCache.find(agent_id);
+ if (it != sCache.end())
{
- // ...use new cache
- std::map<LLUUID,LLAvatarName>::iterator it = sCache.find(agent_id);
- if (it != sCache.end())
- {
- const LLAvatarName& av_name = it->second;
-
- if (av_name.mExpires > LLFrameTimer::getTotalSeconds())
- {
- // ...name already exists in cache, fire callback now
- fireSignal(agent_id, slot, av_name);
- return connection;
- }
- }
- }
- else
- {
- // ...use old name system
- std::string full_name;
- if (gCacheName->getFullName(agent_id, full_name))
+ const LLAvatarName& av_name = it->second;
+
+ if (av_name.mExpires > LLFrameTimer::getTotalSeconds())
{
- LLAvatarName av_name;
- buildLegacyName(full_name, &av_name);
+ // ...name already exists in cache, fire callback now
fireSignal(agent_id, slot, av_name);
return connection;
}
@@ -720,22 +672,13 @@ 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()
-{
- // Must be both manually set on and able to look up names.
- return sUseDisplayNames && !sNameLookupURL.empty();
-}
-
void LLAvatarNameCache::erase(const LLUUID& agent_id)
{
sCache.erase(agent_id);
diff --git a/indra/llmessage/llavatarnamecache.h b/indra/llmessage/llavatarnamecache.h
index 79f170f7c8..2a8eb46187 100644
--- a/indra/llmessage/llavatarnamecache.h
+++ b/indra/llmessage/llavatarnamecache.h
@@ -37,33 +37,33 @@ class LLUUID;
namespace LLAvatarNameCache
{
-
typedef boost::signals2::signal<void (void)> use_display_name_signal_t;
// Until the cache is set running, immediate lookups will fail and
// async lookups will be queued. This allows us to block requests
// until we know if the first region supports display names.
- void initClass(bool running);
+ void initClass(bool running, bool usePeopleAPI);
void cleanupClass();
+ // Import/export the name cache to file.
void importFile(std::istream& istr);
void exportFile(std::ostream& ostr);
- // On the viewer, usually a simulator capabilitity
- // If empty, name cache will fall back to using legacy name
- // lookup system
+ // On the viewer, usually a simulator capabilitity.
+ // If empty, name cache will fall back to using legacy name lookup system.
void setNameLookupURL(const std::string& name_lookup_url);
- // Do we have a valid lookup URL, hence are we trying to use the
- // new display name lookup system?
+ // Do we have a valid lookup URL, i.e. are we trying to use the
+ // more recent display name lookup system?
bool hasNameLookupURL();
+ bool usePeopleAPI();
// Periodically makes a batch request for display names not already in
- // cache. Call once per frame.
+ // cache. Called once per frame.
void idle();
// If name is in cache, returns true and fills in provided LLAvatarName
- // otherwise returns false
+ // otherwise returns false.
bool get(const LLUUID& agent_id, LLAvatarName *av_name);
// Callback types for get() below
@@ -73,21 +73,19 @@ namespace LLAvatarNameCache
typedef callback_signal_t::slot_type callback_slot_t;
typedef boost::signals2::connection callback_connection_t;
- // Fetches name information and calls callback.
- // If name information is in cache, callback will be called immediately.
+ // Fetches name information and calls callbacks.
+ // If name information is in cache, callbacks will be called immediately.
callback_connection_t get(const LLUUID& agent_id, callback_slot_t slot);
- // Allow display names to be explicitly disabled for testing.
+ // Set display name: flips the switch and triggers the callbacks.
void setUseDisplayNames(bool use);
- bool useDisplayNames();
-
+
+ void insert(const LLUUID& agent_id, const LLAvatarName& av_name);
void erase(const LLUUID& agent_id);
- /// Provide some fallback for agents that return errors
+ /// Provide some fallback for agents that return errors.
void handleAgentError(const LLUUID& agent_id);
- void insert(const LLUUID& agent_id, const LLAvatarName& av_name);
-
// Compute name expiration time from HTTP Cache-Control header,
// or return default value, in seconds from epoch.
F64 nameExpirationFromHeaders(LLSD headers);
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/llmessage/llcachename.h b/indra/llmessage/llcachename.h
index b108e37157..d238c3a247 100644
--- a/indra/llmessage/llcachename.h
+++ b/indra/llmessage/llcachename.h
@@ -40,7 +40,7 @@ typedef boost::signals2::signal<void (const LLUUID& id,
bool is_group)> LLCacheNameSignal;
typedef LLCacheNameSignal::slot_type LLCacheNameCallback;
-// Old callback with user data for compatability
+// Old callback with user data for compatibility
typedef void (*old_callback_t)(const LLUUID&, const std::string&, bool, void*);
// Here's the theory:
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/llui/tests/llurlentry_stub.cpp b/indra/llui/tests/llurlentry_stub.cpp
index f8797fd257..5d3f9ac327 100644
--- a/indra/llui/tests/llurlentry_stub.cpp
+++ b/indra/llui/tests/llurlentry_stub.cpp
@@ -46,11 +46,6 @@ LLAvatarNameCache::callback_connection_t LLAvatarNameCache::get(const LLUUID& ag
return connection;
}
-bool LLAvatarNameCache::useDisplayNames()
-{
- return false;
-}
-
//
// Stub implementation for LLCacheName
//
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index ece711a128..423e5a00df 100755
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -12648,6 +12648,17 @@
<key>Value</key>
<integer>1</integer>
</map>
+ <key>UsePeopleAPI</key>
+ <map>
+ <key>Comment</key>
+ <string>Use the people API cap for avatar name fetching, use old legacy protocol if false. Requires restart.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>1</integer>
+ </map>
<key>UseStartScreen</key>
<map>
<key>Comment</key>
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 4328c60b1a..99dd35a9e8 100644
--- a/indra/newview/llconversationmodel.cpp
+++ b/indra/newview/llconversationmodel.cpp
@@ -393,6 +393,7 @@ LLConversationItemParticipant::LLConversationItemParticipant(std::string display
mDistToAgent(-1.0),
mAvatarNameCacheConnection()
{
+ mDisplayName = display_name;
mConvType = CONV_PARTICIPANT;
}
@@ -444,8 +445,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/llconversationview.cpp b/indra/newview/llconversationview.cpp
index b964cee09f..f088a8c084 100755
--- a/indra/newview/llconversationview.cpp
+++ b/indra/newview/llconversationview.cpp
@@ -472,6 +472,9 @@ S32 LLConversationViewParticipant::arrange(S32* width, S32* height)
mAvatarIcon->getRect().mBottom);
mAvatarIcon->setShape(avatarRect);
+ //Since dimensions changed, adjust the children (info button, speaker indicator)
+ updateChildren();
+
return arranged;
}
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/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp
index b8a37da3fa..9e13875d20 100644
--- a/indra/newview/llfloaterimcontainer.cpp
+++ b/indra/newview/llfloaterimcontainer.cpp
@@ -206,6 +206,7 @@ BOOL LLFloaterIMContainer::postBuild()
mExpandCollapseBtn->setClickedCallback(boost::bind(&LLFloaterIMContainer::onExpandCollapseButtonClicked, this));
mStubCollapseBtn = getChild<LLButton>("stub_collapse_btn");
mStubCollapseBtn->setClickedCallback(boost::bind(&LLFloaterIMContainer::onStubCollapseButtonClicked, this));
+ getChild<LLButton>("speak_btn")->setClickedCallback(boost::bind(&LLFloaterIMContainer::onSpeakButtonClicked, this));
childSetAction("add_btn", boost::bind(&LLFloaterIMContainer::onAddButtonClicked, this));
@@ -341,6 +342,11 @@ void LLFloaterIMContainer::onStubCollapseButtonClicked()
collapseMessagesPane(true);
}
+void LLFloaterIMContainer::onSpeakButtonClicked()
+{
+ LLAgent::toggleMicrophone("speak");
+ updateSpeakBtnState();
+}
void LLFloaterIMContainer::onExpandCollapseButtonClicked()
{
if (mConversationsPane->isCollapsed() && mMessagesPane->isCollapsed()
@@ -913,7 +919,10 @@ void LLFloaterIMContainer::doToParticipants(const std::string& command, uuid_vec
}
else if ("im" == command)
{
- LLAvatarActions::startIM(userID);
+ if (gAgent.getID() != userID)
+ {
+ LLAvatarActions::startIM(userID);
+ }
}
else if ("offer_teleport" == command)
{
@@ -1650,7 +1659,7 @@ void LLFloaterIMContainer::openNearbyChat()
LLConversationViewSession* nearby_chat = dynamic_cast<LLConversationViewSession*>(get_ptr_in_map(mConversationsWidgets,LLUUID()));
if (nearby_chat)
{
- selectConversation(LLUUID());
+ reSelectConversation();
nearby_chat->setOpen(TRUE);
}
}
@@ -1672,6 +1681,13 @@ void LLFloaterIMContainer::reSelectConversation()
}
}
+void LLFloaterIMContainer::updateSpeakBtnState()
+{
+ LLButton* mSpeakBtn = getChild<LLButton>("speak_btn");
+ mSpeakBtn->setToggleState(LLVoiceClient::getInstance()->getUserPTTState());
+ mSpeakBtn->setEnabled(LLAgent::isActionAllowed("speak"));
+}
+
void LLFloaterIMContainer::flashConversationItemWidget(const LLUUID& session_id, bool is_flashes)
{
//Finds the conversation line item to flash using the session_id
diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h
index c9987bffe8..92985c036a 100644
--- a/indra/newview/llfloaterimcontainer.h
+++ b/indra/newview/llfloaterimcontainer.h
@@ -117,6 +117,7 @@ private:
void onExpandCollapseButtonClicked();
void onStubCollapseButtonClicked();
void processParticipantsStyleUpdate();
+ void onSpeakButtonClicked();
void collapseConversationsPane(bool collapse);
@@ -172,6 +173,7 @@ public:
void setTimeNow(const LLUUID& session_id, const LLUUID& participant_id);
void setNearbyDistances();
void reSelectConversation();
+ void updateSpeakBtnState();
void flashConversationItemWidget(const LLUUID& session_id, bool is_flashes);
private:
diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp
index 80a41e2f37..a9a3611970 100644
--- a/indra/newview/llfloaterimnearbychat.cpp
+++ b/indra/newview/llfloaterimnearbychat.cpp
@@ -544,7 +544,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/llfloaterimnearbychathandler.cpp b/indra/newview/llfloaterimnearbychathandler.cpp
index 903c903381..f64cfd0245 100644
--- a/indra/newview/llfloaterimnearbychathandler.cpp
+++ b/indra/newview/llfloaterimnearbychathandler.cpp
@@ -557,7 +557,10 @@ void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg,
// Send event on to LLEventStream
sChatWatcher->post(chat);
- if( nearby_chat->isInVisibleChain()
+ LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
+
+ if( nearby_chat->hasFocus()
+ || im_box->hasFocus()
|| ( chat_msg.mSourceType == CHAT_SOURCE_AGENT
&& gSavedSettings.getBOOL("UseChatBubbles") )
|| mChannel.isDead()
diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp
index b50b8c2d32..4c6d8fa5a0 100644
--- a/indra/newview/llfloaterimsessiontab.cpp
+++ b/indra/newview/llfloaterimsessiontab.cpp
@@ -167,12 +167,7 @@ void LLFloaterIMSessionTab::addToHost(const LLUUID& session_id)
if (!conversp->isNearbyChat()
|| gSavedSettings.getBOOL("NearbyChatIsNotTornOff"))
{
- floater_container->addFloater(conversp, FALSE, LLTabContainer::END);
-
- if (!floater_container->getVisible())
- {
- LLFloaterReg::toggleInstanceOrBringToFront("im_container");
- }
+ floater_container->addFloater(conversp, !floater_container->getVisible(), LLTabContainer::RIGHT_OF_CURRENT);
}
else
{
@@ -698,7 +693,8 @@ void LLFloaterIMSessionTab::updateCallBtnState(bool callIsActive)
voiceButton->setToolTip(
callIsActive? getString("end_call_button_tooltip") : getString("start_call_button_tooltip"));
- enableDisableCallBtn();
+ LLFloaterIMContainer::getInstance()->updateSpeakBtnState();
+ enableDisableCallBtn();
}
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 821e62c4e6..4e2ac09dd8 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -30,6 +30,7 @@
#include "llavatarnamecache.h" // IDEVO
#include "llavataractions.h"
+#include "llfloaterconversationlog.h"
#include "llfloaterreg.h"
#include "llfontgl.h"
#include "llgl.h"
@@ -155,57 +156,74 @@ void on_new_message(const LLSD& msg)
// execution of the action
+ LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
+ LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(session_id);
+
+ //session floater not focused (visible or not)
+ bool sessionFloaterNotFocused = session_floater && !session_floater->hasFocus();
+
+ //conversation floater not focused (visible or not)
+ bool conversationFloaterNotFocused = im_box && !im_box->hasFocus();
+
if ("toast" == action)
{
// Skip toasting if we have open window of IM with this session id
- LLFloaterIMSession* open_im_floater = LLFloaterIMSession::findInstance(session_id);
if (
- open_im_floater
- && open_im_floater->isInVisibleChain()
- && open_im_floater->hasFocus()
- && !open_im_floater->isMinimized()
- && !(open_im_floater->getHost()
- && open_im_floater->getHost()->isMinimized())
+ session_floater
+ && session_floater->isInVisibleChain()
+ && session_floater->hasFocus()
+ && !session_floater->isMinimized()
+ && !(session_floater->getHost()
+ && session_floater->getHost()->isMinimized())
)
{
return;
}
// Skip toasting for system messages and for nearby chat
- if (participant_id.isNull() || session_id.isNull())
+ if (participant_id.isNull())
{
return;
}
- //Show toast
- LLAvatarNameCache::get(participant_id, boost::bind(&on_avatar_name_cache_toast, _1, _2, msg));
+ //User is not focused on conversation containing the message
+ if(sessionFloaterNotFocused)
+ {
+ im_box->flashConversationItemWidget(session_id, true);
+
+ //The conversation floater isn't focused/open
+ if(conversationFloaterNotFocused)
+ {
+ gToolBarView->flashCommand(LLCommandId("chat"), true);
+
+ //Show IM toasts (upper right toasts)
+ if(session_id.notNull())
+ {
+ LLAvatarNameCache::get(participant_id, boost::bind(&on_avatar_name_cache_toast, _1, _2, msg));
+ }
+ }
+ }
}
else if ("flash" == action)
{
- LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
- if (im_box)
+ //User is not focused on conversation containing the message
+ if(sessionFloaterNotFocused && conversationFloaterNotFocused)
+ {
+ gToolBarView->flashCommand(LLCommandId("chat"), true);
+ }
+ //conversation floater is open but a different conversation is focused
+ else if(sessionFloaterNotFocused)
{
- im_box->flashConversationItemWidget(session_id, true); // flashing of the conversation's item
+ im_box->flashConversationItemWidget(session_id, true);
}
- gToolBarView->flashCommand(LLCommandId("chat"), true); // flashing of the FUI button "Chat"
}
else if("openconversations" == action)
{
- LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
- LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(session_id);
-
- //Don't flash and show conversation floater when conversation already active (has focus)
- if(session_floater
- && (!session_floater->isInVisibleChain()) //conversation floater not displayed
- ||
- (session_floater->isInVisibleChain() && session_floater->hasFocus() == false)) //conversation floater is displayed but doesn't have focus
-
+ //User is not focused on conversation containing the message
+ if(sessionFloaterNotFocused)
{
//Flash line item
- if (im_box)
- {
- im_box->flashConversationItemWidget(session_id, true); // flashing of the conversation's item
- }
+ im_box->flashConversationItemWidget(session_id, true);
//Surface conversations floater
LLFloaterReg::showInstance("im_container");
@@ -324,7 +342,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);
@@ -644,15 +662,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
{
@@ -854,7 +864,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();
}
@@ -1944,7 +1954,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();
}
}
@@ -2467,6 +2477,18 @@ void LLIMMgr::addMessage(
new_session_id = computeSessionID(dialog, other_participant_id);
}
+ // Open conversation log if offline messages are present
+ if (is_offline_msg)
+ {
+ LLFloaterConversationLog* floater_log =
+ LLFloaterReg::getTypedInstance<LLFloaterConversationLog>("conversation");
+ if (floater_log && !(floater_log->isFrontmost()))
+ {
+ floater_log->openFloater();
+ floater_log->setFrontmost(TRUE);
+ }
+ }
+
//*NOTE session_name is empty in case of incoming P2P sessions
std::string fixed_session_name = from;
bool name_is_setted = false;
@@ -2482,7 +2504,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);
@@ -3128,7 +3150,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 cf8253ca4d..1e60b10a68 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -4717,10 +4717,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/llpanelmarketplaceinboxinventory.cpp b/indra/newview/llpanelmarketplaceinboxinventory.cpp
index 68aefa7fb7..adfb2dee86 100644
--- a/indra/newview/llpanelmarketplaceinboxinventory.cpp
+++ b/indra/newview/llpanelmarketplaceinboxinventory.cpp
@@ -40,6 +40,8 @@
#define DEBUGGING_FRESHNESS 0
+const LLColor4U DEFAULT_WHITE(255, 255, 255);
+
//
// statics
//
@@ -62,18 +64,24 @@ LLInboxInventoryPanel::~LLInboxInventoryPanel()
LLFolderViewFolder * LLInboxInventoryPanel::createFolderViewFolder(LLInvFVBridge * bridge)
{
+ LLUIColor item_color = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
+
LLInboxFolderViewFolder::Params params;
params.name = bridge->getDisplayName();
params.root = mFolderRoot;
params.listener = bridge;
params.tool_tip = params.name;
+ params.font_color = item_color;
+ params.font_highlight_color = item_color;
return LLUICtrlFactory::create<LLInboxFolderViewFolder>(params);
}
LLFolderViewItem * LLInboxInventoryPanel::createFolderViewItem(LLInvFVBridge * bridge)
{
+ LLUIColor item_color = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
+
LLInboxFolderViewItem::Params params;
params.name = bridge->getDisplayName();
@@ -82,6 +90,8 @@ LLFolderViewItem * LLInboxInventoryPanel::createFolderViewItem(LLInvFVBridge * b
params.listener = bridge;
params.rect = LLRect (0, 0, 0, 0);
params.tool_tip = params.name;
+ params.font_color = item_color;
+ params.font_highlight_color = item_color;
return LLUICtrlFactory::create<LLInboxFolderViewItem>(params);
}
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index de12826452..a2aabb50b5 100644
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -66,6 +66,7 @@
#include "llviewerobjectlist.h"
#include "llviewermessage.h"
+const LLColor4U DEFAULT_WHITE(255, 255, 255);
///----------------------------------------------------------------------------
/// Class LLTaskInvFVBridge
@@ -1719,11 +1720,15 @@ void LLPanelObjectInventory::createFolderViews(LLInventoryObject* inventory_root
bridge = LLTaskInvFVBridge::createObjectBridge(this, inventory_root);
if(bridge)
{
+ LLUIColor item_color = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
+
LLFolderViewFolder::Params p;
p.name = inventory_root->getName();
p.tool_tip = p.name;
p.root = mFolders;
p.listener = bridge;
+ p.font_color = item_color;
+ p.font_highlight_color = item_color;
LLFolderViewFolder* new_folder = LLUICtrlFactory::create<LLFolderViewFolder>(p);
new_folder->addToFolder(mFolders);
@@ -1742,6 +1747,8 @@ void LLPanelObjectInventory::createViewsForCategory(LLInventoryObject::object_li
LLInventoryObject* parent,
LLFolderViewFolder* folder)
{
+ LLUIColor item_color = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
+
// Find all in the first pass
LLDynamicArray<obj_folder_pair*> child_categories;
LLTaskInvFVBridge* bridge;
@@ -1767,6 +1774,8 @@ void LLPanelObjectInventory::createViewsForCategory(LLInventoryObject::object_li
p.root = mFolders;
p.listener = bridge;
p.tool_tip = p.name;
+ p.font_color = item_color;
+ p.font_highlight_color = item_color;
view = LLUICtrlFactory::create<LLFolderViewFolder>(p);
child_categories.put(new obj_folder_pair(obj,
(LLFolderViewFolder*)view));
@@ -1780,6 +1789,8 @@ void LLPanelObjectInventory::createViewsForCategory(LLInventoryObject::object_li
params.listener(bridge);
params.rect(LLRect());
params.tool_tip = params.name;
+ params.font_color = item_color;
+ params.font_highlight_color = item_color;
view = LLUICtrlFactory::create<LLFolderViewItem> (params);
}
view->addToFolder(folder);
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/llstartup.cpp b/indra/newview/llstartup.cpp
index 34259658ea..66a2e6dbda 100755
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -2806,7 +2806,7 @@ void LLStartUp::initNameCache()
// Start cache in not-running state until we figure out if we have
// capabilities for display name lookup
- LLAvatarNameCache::initClass(false);
+ LLAvatarNameCache::initClass(false,gSavedSettings.getBOOL("UsePeopleAPI"));
LLAvatarNameCache::setUseDisplayNames(gSavedSettings.getBOOL("UseDisplayNames"));
}
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..7ae717cb42 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::cleanupClass();
if (gCacheName) gCacheName->clear();
}
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index ea804508c8..5bb7db5c0d 100755
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -2246,16 +2246,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;
@@ -2269,7 +2260,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);
}
@@ -3455,7 +3446,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);
}
diff --git a/indra/newview/skins/default/xui/en/floater_im_container.xml b/indra/newview/skins/default/xui/en/floater_im_container.xml
index 152c897120..9f6503d799 100644
--- a/indra/newview/skins/default/xui/en/floater_im_container.xml
+++ b/indra/newview/skins/default/xui/en/floater_im_container.xml
@@ -32,7 +32,7 @@
top="0"
width="450">
<layout_panel
- auto_resize="true"
+ auto_resize="false"
user_resize="true"
height="430"
name="conversations_layout_panel"
@@ -73,13 +73,26 @@
image_hover_unselected="Toolbar_Middle_Over"
image_overlay="Conv_toolbar_plus"
image_selected="Toolbar_Middle_Selected"
- image_unselected="Toolbar_Middle_Off"
+ image_unselected="Toolbar_Middle_Off"
layout="topleft"
top="5"
left_pad="4"
name="add_btn"
tool_tip="Start a new conversation"
width="31"/>
+ <button
+ follows="top|left"
+ height="25"
+ image_hover_unselected="Toolbar_Middle_Over"
+ image_overlay="Command_Speak_Icon"
+ image_selected="Toolbar_Middle_Selected"
+ image_unselected="Toolbar_Middle_Off"
+ layout="topleft"
+ top="5"
+ left_pad="4"
+ name="speak_btn"
+ tool_tip="Speak with people using your microphone"
+ width="31"/>
</layout_panel>
<layout_panel
auto_resize="false"