MAINT-3187: Name list controls do not properly resolve avatar names

Work by Ansariel

For us, this is just to disconnect properly, we had this commented out because it was broken.
This commit is contained in:
Lirusaito
2014-06-17 12:54:26 -04:00
parent 811849fa23
commit ccfdcce5c1
2 changed files with 36 additions and 15 deletions

View File

@@ -53,8 +53,7 @@ LLNameListCtrl::LLNameListCtrl(const std::string& name, const LLRect& rect, BOOL
: LLScrollListCtrl(name, rect, NULL, allow_multiple_selection, draw_border,draw_heading),
mNameColumnIndex(name_column_index),
mAllowCallingCardDrop(false),
mNameSystem(name_system),
mAvatarNameCacheConnection()
mNameSystem(name_system)
{
setToolTip(tooltip);
}
@@ -194,17 +193,19 @@ LLScrollListItem* LLNameListCtrl::addNameItemRow(
else
{
// ...schedule a callback
// This is not correct and will likely lead to partially populated lists in cases where avatar names are not cached.
// *TODO : Change this to have 2 callbacks : one callback per list item and one for the whole list.
/* Singu Note: Indeed it does, for now let's not use it
if (mAvatarNameCacheConnection.connected())
avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(id);
if (it != mAvatarNameCacheConnections.end())
{
if (it->second.connected())
{
mAvatarNameCacheConnection.disconnect();
it->second.disconnect();
}
mAvatarNameCacheConnection =*/ LLAvatarNameCache::get(id,boost::bind(&LLNameListCtrl::onAvatarNameCache,this, _1, _2, item->getHandle()));
}
break;
mAvatarNameCacheConnections.erase(it);
}
mAvatarNameCacheConnections[id] = LLAvatarNameCache::get(id,boost::bind(&LLNameListCtrl::onAvatarNameCache,this, _1, _2, suffix, item->getHandle()));
}
break;
}
default:
break;
}
@@ -258,13 +259,28 @@ void LLNameListCtrl::removeNameItem(const LLUUID& agent_id)
void LLNameListCtrl::onAvatarNameCache(const LLUUID& agent_id,
const LLAvatarName& av_name,
std::string suffix,
LLHandle<LLNameListItem> item)
{
//mAvatarNameCacheConnection.disconnect();
avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(agent_id);
if (it != mAvatarNameCacheConnections.end())
{
if (it->second.connected())
{
it->second.disconnect();
}
mAvatarNameCacheConnections.erase(it);
}
std::string name;
LLAvatarNameCache::getPNSName(av_name, name, mNameSystem);
// Append optional suffix.
if (!suffix.empty())
{
name.append(suffix);
}
LLNameListItem* list_item = item.get();
if (list_item && list_item->getUUID() == agent_id)
{