diff options
Diffstat (limited to 'linden/indra/newview/llfloaterchat.cpp')
-rw-r--r-- | linden/indra/newview/llfloaterchat.cpp | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/linden/indra/newview/llfloaterchat.cpp b/linden/indra/newview/llfloaterchat.cpp index 5117b8d..703811b 100644 --- a/linden/indra/newview/llfloaterchat.cpp +++ b/linden/indra/newview/llfloaterchat.cpp | |||
@@ -17,7 +17,8 @@ | |||
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | 20 | * online at |
21 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
21 | * | 22 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 23 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 24 | * that you have read and understood your obligations described above, |
@@ -70,6 +71,8 @@ | |||
70 | #include "llchatbar.h" | 71 | #include "llchatbar.h" |
71 | #include "lllogchat.h" | 72 | #include "lllogchat.h" |
72 | #include "lltexteditor.h" | 73 | #include "lltexteditor.h" |
74 | #include "lltextparser.h" | ||
75 | #include "llfloaterhtml.h" | ||
73 | #include "llweb.h" | 76 | #include "llweb.h" |
74 | #include "llstylemap.h" | 77 | #include "llstylemap.h" |
75 | 78 | ||
@@ -188,7 +191,7 @@ void LLFloaterChat::updateConsoleVisibility() | |||
188 | || (getHost() && getHost()->isMinimized() )); // are we hosted in a minimized floater? | 191 | || (getHost() && getHost()->isMinimized() )); // are we hosted in a minimized floater? |
189 | } | 192 | } |
190 | 193 | ||
191 | void add_timestamped_line(LLViewerTextEditor* edit, const LLChat &chat, const LLColor4& color) | 194 | void add_timestamped_line(LLViewerTextEditor* edit, LLChat chat, const LLColor4& color) |
192 | { | 195 | { |
193 | std::string line = chat.mText; | 196 | std::string line = chat.mText; |
194 | bool prepend_newline = true; | 197 | bool prepend_newline = true; |
@@ -198,16 +201,22 @@ void add_timestamped_line(LLViewerTextEditor* edit, const LLChat &chat, const LL | |||
198 | prepend_newline = false; | 201 | prepend_newline = false; |
199 | } | 202 | } |
200 | 203 | ||
201 | // If the msg is not from an agent (not yourself though), | 204 | // If the msg is from an agent (not yourself though), |
202 | // extract out the sender name and replace it with the hotlinked name. | 205 | // extract out the sender name and replace it with the hotlinked name. |
203 | if (chat.mSourceType == CHAT_SOURCE_AGENT && | 206 | if (chat.mSourceType == CHAT_SOURCE_AGENT && |
204 | chat.mFromID != LLUUID::null && | 207 | chat.mFromID != LLUUID::null) |
205 | (line.length() > chat.mFromName.length() && line.find(chat.mFromName,0) == 0)) | 208 | { |
209 | chat.mURL = llformat("secondlife:///app/agent/%s/about",chat.mFromID.asString().c_str()); | ||
210 | } | ||
211 | |||
212 | // If the chat line has an associated url, link it up to the name. | ||
213 | if (!chat.mURL.empty() | ||
214 | && (line.length() > chat.mFromName.length() && line.find(chat.mFromName,0) == 0)) | ||
206 | { | 215 | { |
207 | std::string start_line = line.substr(0, chat.mFromName.length() + 1); | 216 | std::string start_line = line.substr(0, chat.mFromName.length() + 1); |
208 | line = line.substr(chat.mFromName.length() + 1); | 217 | line = line.substr(chat.mFromName.length() + 1); |
209 | const LLStyleSP &sourceStyle = LLStyleMap::instance().lookup(chat.mFromID); | 218 | const LLStyleSP &sourceStyle = LLStyleMap::instance().lookup(chat.mFromID,chat.mURL); |
210 | edit->appendStyledText(start_line, false, prepend_newline, &sourceStyle); | 219 | edit->appendStyledText(start_line, false, prepend_newline, sourceStyle); |
211 | prepend_newline = false; | 220 | prepend_newline = false; |
212 | } | 221 | } |
213 | edit->appendColoredText(line, false, prepend_newline, color); | 222 | edit->appendColoredText(line, false, prepend_newline, color); |
@@ -255,6 +264,9 @@ void LLFloaterChat::addChatHistory(const LLChat& chat, bool log_to_file) | |||
255 | history_editor->setParseHTML(TRUE); | 264 | history_editor->setParseHTML(TRUE); |
256 | history_editor_with_mute->setParseHTML(TRUE); | 265 | history_editor_with_mute->setParseHTML(TRUE); |
257 | 266 | ||
267 | history_editor->setParseHighlights(TRUE); | ||
268 | history_editor_with_mute->setParseHighlights(TRUE); | ||
269 | |||
258 | if (!chat.mMuted) | 270 | if (!chat.mMuted) |
259 | { | 271 | { |
260 | add_timestamped_line(history_editor, chat, color); | 272 | add_timestamped_line(history_editor, chat, color); |
@@ -395,9 +407,12 @@ void LLFloaterChat::addChat(const LLChat& chat, | |||
395 | if(from_instant_message && gSavedPerAccountSettings.getBOOL("LogChatIM")) | 407 | if(from_instant_message && gSavedPerAccountSettings.getBOOL("LogChatIM")) |
396 | log_chat_text(chat); | 408 | log_chat_text(chat); |
397 | 409 | ||
398 | if(from_instant_message && gSavedSettings.getBOOL("IMInChatHistory")) | 410 | if(from_instant_message && gSavedSettings.getBOOL("IMInChatHistory")) |
399 | addChatHistory(chat,false); | 411 | addChatHistory(chat,false); |
400 | 412 | ||
413 | LLTextParser* highlight = LLTextParser::getInstance(); | ||
414 | highlight->triggerAlerts(gAgent.getID(), gAgent.getPositionGlobal(), chat.mText, gViewerWindow->getWindow()); | ||
415 | |||
401 | if(!from_instant_message) | 416 | if(!from_instant_message) |
402 | addChatHistory(chat); | 417 | addChatHistory(chat); |
403 | } | 418 | } |