diff options
Diffstat (limited to 'indra/newview/llfloaterchat.cpp')
-rw-r--r-- | indra/newview/llfloaterchat.cpp | 99 |
1 files changed, 32 insertions, 67 deletions
diff --git a/indra/newview/llfloaterchat.cpp b/indra/newview/llfloaterchat.cpp index 6d2e959352..cdb9b8edb8 100644 --- a/indra/newview/llfloaterchat.cpp +++ b/indra/newview/llfloaterchat.cpp @@ -37,10 +37,9 @@ #include "llviewerprecompiledheaders.h" -#include "llfloaterchat.h" - // project include #include "llagent.h" +#include "llappviewer.h" #include "llbutton.h" #include "llcheckboxctrl.h" #include "llcombobox.h" @@ -129,7 +128,7 @@ void LLFloaterChat::draw() BOOL LLFloaterChat::postBuild() { // Hide the chat overlay when our history is visible. - mVisibleSignal.connect(boost::bind(&LLFloaterChat::updateConsoleVisibility, this)); + setVisibleCallback(boost::bind(&LLFloaterChat::updateConsoleVisibility, this)); mPanel = (LLPanelActiveSpeakers*)getChild<LLPanel>("active_speakers_panel"); @@ -142,6 +141,10 @@ BOOL LLFloaterChat::postBuild() void LLFloaterChat::updateConsoleVisibility() { + if(gDisconnected) + { + return; + } // determine whether we should show console due to not being visible gConsole->setVisible( !isInVisibleChain() // are we not in part of UI being drawn? || isMinimized() // are we minimized? @@ -180,22 +183,19 @@ void add_timestamped_line(LLViewerTextEditor* edit, LLChat chat, const LLColor4& edit->blockUndo(); } -void log_chat_text(const LLChat& chat) -{ - std::string histstr; - if (gSavedPerAccountSettings.getBOOL("LogTimestamp")) - histstr = LLLogChat::timestamp(gSavedPerAccountSettings.getBOOL("LogTimestampDate")) + chat.mText; - else - histstr = chat.mText; - - LLLogChat::saveHistory(std::string("chat"),histstr); -} // static void LLFloaterChat::addChatHistory(const LLChat& chat, bool log_to_file) { - if ( (gSavedPerAccountSettings.getS32("IMLogOptions")!=LOG_IM) && log_to_file) + if (log_to_file && (gSavedPerAccountSettings.getBOOL("LogChat"))) { - log_chat_text(chat); + if (chat.mChatType != CHAT_TYPE_WHISPER && chat.mChatType != CHAT_TYPE_SHOUT) + { + LLLogChat::saveHistory("chat", chat.mFromName, chat.mFromID, chat.mText); + } + else + { + LLLogChat::saveHistory("chat", "", chat.mFromID, chat.mFromName + " " + chat.mText); + } } LLColor4 color = get_text_color(chat); @@ -204,12 +204,14 @@ void LLFloaterChat::addChatHistory(const LLChat& chat, bool log_to_file) if (chat.mChatType == CHAT_TYPE_DEBUG_MSG) { - LLFloaterScriptDebug::addScriptLine(chat.mText, - chat.mFromName, - color, - chat.mFromID); - if (!gSavedSettings.getBOOL("ScriptErrorsAsChat")) + if(gSavedSettings.getBOOL("ShowScriptErrors") == FALSE) + return; + if (gSavedSettings.getS32("ShowScriptErrorsLocation") == 1) { + LLFloaterScriptDebug::addScriptLine(chat.mText, + chat.mFromName, + color, + chat.mFromID); return; } } @@ -309,55 +311,17 @@ void LLFloaterChat::onClickToggleShowMute(LLUICtrl* caller, void *data) } // Put a line of chat in all the right places -void LLFloaterChat::addChat(const LLChat& chat, - BOOL from_instant_message, - BOOL local_agent) +void LLFloaterChat::addChat(const LLChat& chat, BOOL local_agent) { - LLColor4 text_color = get_text_color(chat); - - BOOL invisible_script_debug_chat = - chat.mChatType == CHAT_TYPE_DEBUG_MSG - && !gSavedSettings.getBOOL("ScriptErrorsAsChat"); - - if (!invisible_script_debug_chat - && !chat.mMuted - && gConsole - && !local_agent) - { - F32 size = CHAT_MSG_SIZE; - if (chat.mSourceType == CHAT_SOURCE_SYSTEM) - { - text_color = LLUIColorTable::instance().getColor("SystemChatColor"); - } - else if(from_instant_message) - { - text_color = LLUIColorTable::instance().getColor("IMChatColor"); - size = INSTANT_MSG_SIZE; - } - // Disabling the console for 2.0 - SJB -#if 0 - // We display anything if it's not an IM. If it's an IM, check pref... - if ( !from_instant_message || gSavedSettings.getBOOL("IMInChatConsole") ) - { - gConsole->addLine(chat.mText, size, text_color); - } -#endif - } - - if(from_instant_message && (gSavedPerAccountSettings.getS32("IMLogOptions")== LOG_BOTH_TOGETHER)) - log_chat_text(chat); - - if(from_instant_message && gSavedSettings.getBOOL("IMInChatHistory")) - addChatHistory(chat,false); - triggerAlerts(chat.mText); // Add the sender to the list of people with which we've recently interacted. - if(chat.mSourceType == CHAT_SOURCE_AGENT && chat.mFromID.notNull()) - LLRecentPeople::instance().add(chat.mFromID); - - if(!from_instant_message) - addChatHistory(chat); + // this is not the best place to add _all_ messages to recent list + // comment this for now, may remove later on code cleanup + //if(chat.mSourceType == CHAT_SOURCE_AGENT && chat.mFromID.notNull()) + // LLRecentPeople::instance().add(chat.mFromID); + + addChatHistory(chat, true); } // Moved from lltextparser.cpp to break llui/llaudio library dependency. @@ -474,7 +438,7 @@ void LLFloaterChat::loadHistory() } //static -void LLFloaterChat::chatFromLogFile(LLLogChat::ELogLineType type , std::string line, void* userdata) +void LLFloaterChat::chatFromLogFile(LLLogChat::ELogLineType type , const LLSD& line, void* userdata) { switch (type) { @@ -483,9 +447,10 @@ void LLFloaterChat::chatFromLogFile(LLLogChat::ELogLineType type , std::string l // *TODO: nice message from XML file here break; case LLLogChat::LOG_LINE: + case LLLogChat::LOG_LLSD: { LLChat chat; - chat.mText = line; + chat.mText = line["message"].asString(); get_text_color(chat); addChatHistory(chat, FALSE); } |