diff options
author | Leyla Farazha <leyla@lindenlab.com> | 2010-05-13 17:26:06 -0700 |
---|---|---|
committer | Leyla Farazha <leyla@lindenlab.com> | 2010-05-13 17:26:06 -0700 |
commit | 2af4875309450fa3d3e266426ada12330489a8c9 (patch) | |
tree | 384bf62c1b4e14d4abbe92359675f67a94837cbc | |
parent | b95d1142a0a9c91388d4674951c319fff0785c0c (diff) |
DEV-50013 Friends in sidebar now correctly displaying names
reviewed by James
-rw-r--r-- | indra/llmessage/llavatarnamecache.cpp | 21 | ||||
-rw-r--r-- | indra/newview/llavatarlist.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llavatarlistitem.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llavatarlistitem.h | 3 |
4 files changed, 38 insertions, 8 deletions
diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index fdbc28656e..2fc92ff36f 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -214,6 +214,27 @@ public: // cache it and fire signals LLAvatarNameCache::processName(agent_id, av_name, true); } + + // Same logic as error response case + LLSD unresolved_agents = content["bad_ids"]; + if (unresolved_agents.size() > 0) + { + const std::string DUMMY_NAME("\?\?\?"); + LLAvatarName av_name; + av_name.mSLID = DUMMY_NAME; + av_name.mDisplayName = DUMMY_NAME; + av_name.mIsDisplayNameDefault = false; + av_name.mIsDummy = true; + av_name.mExpires = expires; + + it = unresolved_agents.beginArray(); + for ( ; it != unresolved_agents.endArray(); ++it) + { + const LLUUID& agent_id = *it; + // cache it and fire signals + LLAvatarNameCache::processName(agent_id, av_name, true); + } + } } /*virtual*/ void error(U32 status, const std::string& reason) diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp index dfb213716c..8801903df7 100644 --- a/indra/newview/llavatarlist.cpp +++ b/indra/newview/llavatarlist.cpp @@ -41,6 +41,7 @@ // newview #include "llavatariconctrl.h" +#include "llavatarnamecache.h" #include "llcallingcard.h" // for LLAvatarTracker #include "llcachename.h" #include "llrecentpeople.h" @@ -239,12 +240,15 @@ void LLAvatarList::refresh() // Handle added items. unsigned nadded = 0; + const std::string waiting_str = LLTrans::getString("AvatarNameWaiting"); + for (uuid_vec_t::const_iterator it=added.begin(); it != added.end(); it++) { - std::string name; const LLUUID& buddy_id = *it; - have_names &= (bool)gCacheName->getFullName(buddy_id, name); - if (!have_filter || findInsensitive(name, mNameFilter)) + LLAvatarName av_name; + have_names &= LLAvatarNameCache::get(buddy_id, &av_name); + + if (!have_filter || findInsensitive(av_name.mDisplayName, mNameFilter)) { if (nadded >= ADD_LIMIT) { @@ -253,7 +257,9 @@ void LLAvatarList::refresh() } else { - addNewItem(buddy_id, name, LLAvatarTracker::instance().isBuddyOnline(buddy_id)); + addNewItem(buddy_id, + av_name.mDisplayName.empty() ? waiting_str : av_name.mDisplayName, + LLAvatarTracker::instance().isBuddyOnline(buddy_id)); modified = true; nadded++; } diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index fc5453c2dd..fcfc05af02 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -38,6 +38,7 @@ #include "llfloaterreg.h" #include "llagent.h" +#include "llavatarnamecache.h" #include "lloutputmonitorctrl.h" #include "llavatariconctrl.h" #include "lltextutil.h" @@ -229,7 +230,8 @@ void LLAvatarListItem::setAvatarId(const LLUUID& id, const LLUUID& session_id, b mAvatarIcon->setValue(id); // Set avatar name. - gCacheName->get(id, FALSE, boost::bind(&LLAvatarListItem::onNameCache, this, _2)); + LLAvatarNameCache::get(id, + boost::bind(&LLAvatarListItem::onAvatarNameCache, this, _2)); } } @@ -335,9 +337,9 @@ void LLAvatarListItem::setNameInternal(const std::string& name, const std::strin mAvatarName->setToolTip(name); } -void LLAvatarListItem::onNameCache(const std::string& fullname) +void LLAvatarListItem::onAvatarNameCache(const LLAvatarName& av_name) { - setName(fullname); + setName(av_name.mDisplayName); //requesting the list to resort notifyParent(LLSD().with("sort", LLSD())); diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h index 1e3b67b094..bad8aa9d5c 100644 --- a/indra/newview/llavatarlistitem.h +++ b/indra/newview/llavatarlistitem.h @@ -42,6 +42,7 @@ #include "llcallingcard.h" // for LLFriendObserver class LLAvatarIconCtrl; +class LLAvatarName; class LLAvatarListItem : public LLPanel, public LLFriendObserver { @@ -151,7 +152,7 @@ private: } EAvatarListItemChildIndex; void setNameInternal(const std::string& name, const std::string& highlight); - void onNameCache(const std::string& fullname); + void onAvatarNameCache(const LLAvatarName& av_name); std::string formatSeconds(U32 secs); |