From f5ff6ba43cd8042a47a0a1ffd86e294d7456b4f2 Mon Sep 17 00:00:00 2001 From: ziree Date: Thu, 5 Apr 2012 16:47:12 +0200 Subject: [PATCH] Removed old display name lookup hack. --- indra/newview/llchathistory.cpp | 48 +++++++-------------------------- indra/newview/llchathistory.h | 5 +--- 2 files changed, 10 insertions(+), 43 deletions(-) diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index d5993be734..94864edd0b 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -775,22 +775,6 @@ void LLChatHistory::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName mDisplayName_Username = av_name.getCompleteName(); } -//-TT Display names timing in chat -void LLChatHistory::lookupDisplayNames(const LLChat& chat) -{ - // resolve display names if necessary - if (gSavedSettings.getBOOL("UseDisplayNames")) - { - if (chat.mSourceType == CHAT_SOURCE_AGENT) - { - mDisplayName=chat.mFromName; - mDisplayName_Username=chat.mFromName; - LLAvatarNameCache::get(chat.mFromID,boost::bind(&LLChatHistory::onAvatarNameCache, this, _1, _2)); - } - } -} -//-TT - void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LLStyle::Params& input_append_params) { bool use_plain_text_chat_history = args["use_plain_text_chat_history"].asBoolean(); @@ -799,15 +783,15 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL //time to get an answer back before it's needed. if (use_plain_text_chat_history) { - lookupDisplayNames(chat); - //ms_sleep(250); - //// resolve display names if necessary - //if (gSavedSettings.getBOOL("UseDisplayNames")) - //{ - // mDisplayName=chat.mFromName; - // mDisplayName_Username=chat.mFromName; - // LLAvatarNameCache::get(chat.mFromID,boost::bind(&LLChatHistory::onAvatarNameCache, this, _1, _2)); - //} + // make sure objects and agents always have at least something we can display as a name + mDisplayName=chat.mFromName; + mDisplayName_Username=chat.mFromName; + + // resolve display names if necessary + if (chat.mSourceType == CHAT_SOURCE_AGENT && gSavedSettings.getBOOL("UseDisplayNames")) + { + LLAvatarNameCache::get(chat.mFromID,boost::bind(&LLChatHistory::onAvatarNameCache, this, _1, _2)); + } } llassert(mEditor); @@ -991,12 +975,10 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL if ((gSavedSettings.getBOOL("NameTagShowUsernames")) && (gSavedSettings.getBOOL("UseDisplayNames"))) { - checkDisplayName(); mEditor->appendText(mDisplayName_Username, false, link_params); } else if (gSavedSettings.getBOOL("UseDisplayNames")) { - checkDisplayName(); mEditor->appendText(mDisplayName, false, link_params); } else @@ -1168,18 +1150,6 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL } } -bool LLChatHistory::checkDisplayName() -{ - for (int i = 0; i <=20; i++) - { - if (mDisplayName.empty()) - ms_sleep(50); - else - return true; - } - return false; -} - void LLChatHistory::draw() { if (mEditor->scrolledToEnd()) diff --git a/indra/newview/llchathistory.h b/indra/newview/llchathistory.h index 4b82e11a58..e85d091de8 100644 --- a/indra/newview/llchathistory.h +++ b/indra/newview/llchathistory.h @@ -119,10 +119,7 @@ class LLChatHistory : public LLUICtrl */ void appendMessage(const LLChat& chat, const LLSD &args = LLSD(), const LLStyle::Params& input_append_params = LLStyle::Params()); /*virtual*/ void clear(); -//-TT Display names timing in chat - void lookupDisplayNames(const LLChat& chat); - bool checkDisplayName(); -//-TT + private: std::string mLastFromName; LLUUID mLastFromID;