diff options
Diffstat (limited to 'indra/newview/llchathistory.cpp')
-rw-r--r-- | indra/newview/llchathistory.cpp | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 5e17770314..96b5ae5908 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -43,6 +43,7 @@ #include "lltrans.h" #include "llfloaterreg.h" #include "llmutelist.h" +#include "llstylemap.h" #include "llsidetray.h"//for blocked objects panel @@ -355,6 +356,7 @@ void LLChatHistory::clear() { mLastFromName.clear(); LLTextEditor::clear(); + mLastFromID = LLUUID::null; } void LLChatHistory::appendMessage(const LLChat& chat, const bool use_plain_text_chat_history, const LLStyle::Params& input_append_params) @@ -371,13 +373,25 @@ void LLChatHistory::appendMessage(const LLChat& chat, const bool use_plain_text_ style_params.font.size(font_size); style_params.font.style(input_append_params.font.style); - std::string header_text = "[" + chat.mTimeStr + "] "; - if (utf8str_trim(chat.mFromName).size() != 0 && chat.mFromName != SYSTEM_FROM) - header_text += chat.mFromName + ": "; - if (use_plain_text_chat_history) { - appendText(header_text, getText().size() != 0, style_params); + appendText("[" + chat.mTimeStr + "] ", getText().size() != 0, style_params); + + if (utf8str_trim(chat.mFromName).size() != 0) + { + // Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text. + if ( chat.mFromName != SYSTEM_FROM && chat.mFromID.notNull() ) + { + LLStyle::Params link_params(style_params); + link_params.fillFrom(LLStyleMap::instance().lookupAgent(chat.mFromID)); + // Convert the name to a hotlink and add to message. + appendText(chat.mFromName + ": ", false, link_params); + } + else + { + appendText(chat.mFromName + ": ", false, style_params); + } + } } else { @@ -389,9 +403,11 @@ void LLChatHistory::appendMessage(const LLChat& chat, const bool use_plain_text_ LLDate new_message_time = LLDate::now(); - if (mLastFromName == chat.mFromName && - mLastMessageTime.notNull() && - (new_message_time.secondsSinceEpoch() - mLastMessageTime.secondsSinceEpoch()) < 60.0 ) + if (mLastFromName == chat.mFromName + && mLastFromID == chat.mFromID + && mLastMessageTime.notNull() + && (new_message_time.secondsSinceEpoch() - mLastMessageTime.secondsSinceEpoch()) < 60.0 + ) { view = getSeparator(); p.top_pad = mTopSeparatorPad; @@ -417,8 +433,13 @@ void LLChatHistory::appendMessage(const LLChat& chat, const bool use_plain_text_ view->reshape(target_rect.getWidth(), view->getRect().getHeight()); view->setOrigin(target_rect.mLeft, view->getRect().mBottom); + std::string header_text = "[" + chat.mTimeStr + "] "; + if (utf8str_trim(chat.mFromName).size() != 0 && chat.mFromName != SYSTEM_FROM) + header_text += chat.mFromName + ": "; + appendWidget(p, header_text, false); mLastFromName = chat.mFromName; + mLastFromID = chat.mFromID; mLastMessageTime = new_message_time; } //Handle IRC styled /me messages. |