diff options
Diffstat (limited to 'indra/newview/llavatarlist.cpp')
-rw-r--r-- | indra/newview/llavatarlist.cpp | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp index 99156b9d9d..d9e52d295c 100644 --- a/indra/newview/llavatarlist.cpp +++ b/indra/newview/llavatarlist.cpp @@ -44,6 +44,7 @@ // newview #include "llagentdata.h" // for comparator #include "llavatariconctrl.h" +#include "llavatarnamecache.h" #include "llcallingcard.h" // for LLAvatarTracker #include "llcachename.h" #include "lllistcontextmenu.h" @@ -242,12 +243,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) { @@ -256,7 +260,11 @@ void LLAvatarList::refresh() } else { - addNewItem(buddy_id, name, LLAvatarTracker::instance().isBuddyOnline(buddy_id)); + // *NOTE: If you change the UI to show a different string, + // be sure to change the filter code below. + addNewItem(buddy_id, + av_name.mDisplayName.empty() ? waiting_str : av_name.mDisplayName, + LLAvatarTracker::instance().isBuddyOnline(buddy_id)); modified = true; nadded++; } @@ -278,10 +286,10 @@ void LLAvatarList::refresh() for (std::vector<LLSD>::const_iterator it=cur_values.begin(); it != cur_values.end(); it++) { - std::string name; const LLUUID& buddy_id = it->asUUID(); - have_names &= (bool)gCacheName->getFullName(buddy_id, name); - if (!findInsensitive(name, mNameFilter)) + LLAvatarName av_name; + have_names &= LLAvatarNameCache::get(buddy_id, &av_name); + if (!findInsensitive(av_name.mDisplayName, mNameFilter)) { removeItemByUUID(buddy_id); modified = true; @@ -333,14 +341,14 @@ bool LLAvatarList::filterHasMatches() for (uuid_vec_t::const_iterator it=values.begin(); it != values.end(); it++) { - std::string name; const LLUUID& buddy_id = *it; - BOOL have_name = gCacheName->getFullName(buddy_id, name); + LLAvatarName av_name; + bool have_name = LLAvatarNameCache::get(buddy_id, &av_name); // 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(name, mNameFilter)) + if (have_name && !findInsensitive(av_name.mDisplayName, mNameFilter)) { continue; } @@ -374,7 +382,7 @@ S32 LLAvatarList::notifyParent(const LLSD& info) void LLAvatarList::addNewItem(const LLUUID& id, const std::string& name, BOOL is_online, EAddPosition pos) { LLAvatarListItem* item = new LLAvatarListItem(); - item->setName(name); + // This sets the name as a side effect item->setAvatarId(id, mSessionID, mIgnoreOnlineStatus); item->setOnline(mIgnoreOnlineStatus ? true : is_online); item->showLastInteractionTime(mShowLastInteractionTime); @@ -384,7 +392,7 @@ void LLAvatarList::addNewItem(const LLUUID& id, const std::string& name, BOOL is item->setShowProfileBtn(mShowProfileBtn); item->showSpeakingIndicator(mShowSpeakingIndicator); - item->setDoubleClickCallback(boost::bind(&LLAvatarList::onItemDoucleClicked, this, _1, _2, _3, _4)); + item->setDoubleClickCallback(boost::bind(&LLAvatarList::onItemDoubleClicked, this, _1, _2, _3, _4)); addItem(item, id, pos); } @@ -447,7 +455,7 @@ void LLAvatarList::updateLastInteractionTimes() } } -void LLAvatarList::onItemDoucleClicked(LLUICtrl* ctrl, S32 x, S32 y, MASK mask) +void LLAvatarList::onItemDoubleClicked(LLUICtrl* ctrl, S32 x, S32 y, MASK mask) { mItemDoubleClickSignal(ctrl, x, y, mask); } @@ -540,11 +548,13 @@ void LLAvalineListItem::setName(const std::string& name) std::string hidden_name = LLTrans::getString("AvalineCaller", args); LL_DEBUGS("Avaline") << "Avaline caller: " << uuid << ", name: " << hidden_name << LL_ENDL; - LLAvatarListItem::setName(hidden_name); + LLAvatarListItem::setAvatarName(hidden_name); + LLAvatarListItem::setAvatarToolTip(hidden_name); } else { const std::string& formatted_phone = LLTextUtil::formatPhoneNumber(name); - LLAvatarListItem::setName(formatted_phone); + LLAvatarListItem::setAvatarName(formatted_phone); + LLAvatarListItem::setAvatarToolTip(formatted_phone); } } |