diff options
author | Jacek Antonelli | 2009-04-30 13:04:20 -0500 |
---|---|---|
committer | Jacek Antonelli | 2009-04-30 13:07:16 -0500 |
commit | ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch) | |
tree | 8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/newview/llfloaterchat.cpp | |
parent | Second Life viewer sources 1.22.11 (diff) | |
download | meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2 meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz |
Second Life viewer sources 1.23.0-RC
Diffstat (limited to 'linden/indra/newview/llfloaterchat.cpp')
-rw-r--r-- | linden/indra/newview/llfloaterchat.cpp | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/linden/indra/newview/llfloaterchat.cpp b/linden/indra/newview/llfloaterchat.cpp index f83ce6c..682ed8e 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,7 @@ | |||
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" | ||
73 | #include "llfloaterhtml.h" | 75 | #include "llfloaterhtml.h" |
74 | #include "llweb.h" | 76 | #include "llweb.h" |
75 | #include "llstylemap.h" | 77 | #include "llstylemap.h" |
@@ -189,7 +191,7 @@ void LLFloaterChat::updateConsoleVisibility() | |||
189 | || (getHost() && getHost()->isMinimized() )); // are we hosted in a minimized floater? | 191 | || (getHost() && getHost()->isMinimized() )); // are we hosted in a minimized floater? |
190 | } | 192 | } |
191 | 193 | ||
192 | void add_timestamped_line(LLViewerTextEditor* edit, const LLChat &chat, const LLColor4& color) | 194 | void add_timestamped_line(LLViewerTextEditor* edit, LLChat chat, const LLColor4& color) |
193 | { | 195 | { |
194 | std::string line = chat.mText; | 196 | std::string line = chat.mText; |
195 | bool prepend_newline = true; | 197 | bool prepend_newline = true; |
@@ -199,16 +201,22 @@ void add_timestamped_line(LLViewerTextEditor* edit, const LLChat &chat, const LL | |||
199 | prepend_newline = false; | 201 | prepend_newline = false; |
200 | } | 202 | } |
201 | 203 | ||
202 | // If the msg is not from an agent (not yourself though), | 204 | // If the msg is from an agent (not yourself though), |
203 | // 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. |
204 | if (chat.mSourceType == CHAT_SOURCE_AGENT && | 206 | if (chat.mSourceType == CHAT_SOURCE_AGENT && |
205 | chat.mFromID != LLUUID::null && | 207 | chat.mFromID != LLUUID::null) |
206 | (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)) | ||
207 | { | 215 | { |
208 | std::string start_line = line.substr(0, chat.mFromName.length() + 1); | 216 | std::string start_line = line.substr(0, chat.mFromName.length() + 1); |
209 | line = line.substr(chat.mFromName.length() + 1); | 217 | line = line.substr(chat.mFromName.length() + 1); |
210 | const LLStyleSP &sourceStyle = LLStyleMap::instance().lookup(chat.mFromID); | 218 | const LLStyleSP &sourceStyle = LLStyleMap::instance().lookup(chat.mFromID,chat.mURL); |
211 | edit->appendStyledText(start_line, false, prepend_newline, &sourceStyle); | 219 | edit->appendStyledText(start_line, false, prepend_newline, sourceStyle); |
212 | prepend_newline = false; | 220 | prepend_newline = false; |
213 | } | 221 | } |
214 | edit->appendColoredText(line, false, prepend_newline, color); | 222 | edit->appendColoredText(line, false, prepend_newline, color); |
@@ -256,6 +264,9 @@ void LLFloaterChat::addChatHistory(const LLChat& chat, bool log_to_file) | |||
256 | history_editor->setParseHTML(TRUE); | 264 | history_editor->setParseHTML(TRUE); |
257 | history_editor_with_mute->setParseHTML(TRUE); | 265 | history_editor_with_mute->setParseHTML(TRUE); |
258 | 266 | ||
267 | history_editor->setParseHighlights(TRUE); | ||
268 | history_editor_with_mute->setParseHighlights(TRUE); | ||
269 | |||
259 | if (!chat.mMuted) | 270 | if (!chat.mMuted) |
260 | { | 271 | { |
261 | add_timestamped_line(history_editor, chat, color); | 272 | add_timestamped_line(history_editor, chat, color); |
@@ -386,7 +397,11 @@ void LLFloaterChat::addChat(const LLChat& chat, | |||
386 | text_color = gSavedSettings.getColor("IMChatColor"); | 397 | text_color = gSavedSettings.getColor("IMChatColor"); |
387 | size = INSTANT_MSG_SIZE; | 398 | size = INSTANT_MSG_SIZE; |
388 | } | 399 | } |
389 | gConsole->addLine(chat.mText, size, text_color); | 400 | // We display anything if it's not an IM. If it's an IM, check pref... |
401 | if ( !from_instant_message || gSavedSettings.getBOOL("IMInChatHistory") ) | ||
402 | { | ||
403 | gConsole->addLine(chat.mText, size, text_color); | ||
404 | } | ||
390 | } | 405 | } |
391 | 406 | ||
392 | if(from_instant_message && gSavedPerAccountSettings.getBOOL("LogChatIM")) | 407 | if(from_instant_message && gSavedPerAccountSettings.getBOOL("LogChatIM")) |
@@ -394,7 +409,10 @@ void LLFloaterChat::addChat(const LLChat& chat, | |||
394 | 409 | ||
395 | if(from_instant_message && gSavedSettings.getBOOL("IMInChatHistory")) | 410 | if(from_instant_message && gSavedSettings.getBOOL("IMInChatHistory")) |
396 | addChatHistory(chat,false); | 411 | addChatHistory(chat,false); |
397 | 412 | ||
413 | LLTextParser* highlight = LLTextParser::getInstance(); | ||
414 | highlight->triggerAlerts(gAgent.getID(), gAgent.getPositionGlobal(), chat.mText, gViewerWindow->getWindow()); | ||
415 | |||
398 | if(!from_instant_message) | 416 | if(!from_instant_message) |
399 | addChatHistory(chat); | 417 | addChatHistory(chat); |
400 | } | 418 | } |