aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloaterchat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llfloaterchat.cpp')
-rw-r--r--linden/indra/newview/llfloaterchat.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/linden/indra/newview/llfloaterchat.cpp b/linden/indra/newview/llfloaterchat.cpp
index 0394cd1..d05b231 100644
--- a/linden/indra/newview/llfloaterchat.cpp
+++ b/linden/indra/newview/llfloaterchat.cpp
@@ -72,6 +72,7 @@
72#include "lltexteditor.h" 72#include "lltexteditor.h"
73#include "llfloaterhtml.h" 73#include "llfloaterhtml.h"
74#include "llweb.h" 74#include "llweb.h"
75#include "llstylemap.h"
75 76
76// Used for LCD display 77// Used for LCD display
77extern void AddNewIMToLCD(const LLString &newLine); 78extern void AddNewIMToLCD(const LLString &newLine);
@@ -188,14 +189,26 @@ void LLFloaterChat::updateConsoleVisibility()
188 || (getHost() && getHost()->isMinimized() )); // are we hosted in a minimized floater? 189 || (getHost() && getHost()->isMinimized() )); // are we hosted in a minimized floater?
189} 190}
190 191
191void add_timestamped_line(LLViewerTextEditor* edit, const LLString& line, const LLColor4& color) 192void add_timestamped_line(LLViewerTextEditor* edit, const LLChat &chat, const LLColor4& color)
192{ 193{
194 LLString line = chat.mText;
193 bool prepend_newline = true; 195 bool prepend_newline = true;
194 if (gSavedSettings.getBOOL("ChatShowTimestamps")) 196 if (gSavedSettings.getBOOL("ChatShowTimestamps"))
195 { 197 {
196 edit->appendTime(prepend_newline); 198 edit->appendTime(prepend_newline);
197 prepend_newline = false; 199 prepend_newline = false;
198 } 200 }
201
202 // If the msg is not from an agent (not yourself though),
203 // extract out the sender name and replace it with the hotlinked name.
204 if (chat.mSourceType == CHAT_SOURCE_AGENT &&
205 chat.mFromID != LLUUID::null &&
206 (line.length() > chat.mFromName.length() && line.find(chat.mFromName,0) == 0))
207 {
208 line = line.substr(chat.mFromName.length());
209 const LLStyleSP &sourceStyle = LLStyleMap::instance().lookup(chat.mFromID);
210 edit->appendStyledText(chat.mFromName, false, false, &sourceStyle);
211 }
199 edit->appendColoredText(line, false, prepend_newline, color); 212 edit->appendColoredText(line, false, prepend_newline, color);
200} 213}
201 214
@@ -243,14 +256,14 @@ void LLFloaterChat::addChatHistory(const LLChat& chat, bool log_to_file)
243 256
244 if (!chat.mMuted) 257 if (!chat.mMuted)
245 { 258 {
246 add_timestamped_line(history_editor, chat.mText, color); 259 add_timestamped_line(history_editor, chat, color);
247 add_timestamped_line(history_editor_with_mute, chat.mText, color); 260 add_timestamped_line(history_editor_with_mute, chat, color);
248 } 261 }
249 else 262 else
250 { 263 {
251 // desaturate muted chat 264 // desaturate muted chat
252 LLColor4 muted_color = lerp(color, LLColor4::grey, 0.5f); 265 LLColor4 muted_color = lerp(color, LLColor4::grey, 0.5f);
253 add_timestamped_line(history_editor_with_mute, chat.mText, color); 266 add_timestamped_line(history_editor_with_mute, chat, color);
254 } 267 }
255 268
256 // add objects as transient speakers that can be muted 269 // add objects as transient speakers that can be muted