diff options
-rw-r--r-- | indra/newview/llchatitemscontainerctrl.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llnearbychat.cpp | 36 | ||||
-rw-r--r-- | indra/newview/llnearbychathandler.cpp | 32 |
3 files changed, 35 insertions, 35 deletions
diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp index efdaff3f6a..92df281307 100644 --- a/indra/newview/llchatitemscontainerctrl.cpp +++ b/indra/newview/llchatitemscontainerctrl.cpp @@ -122,7 +122,6 @@ void LLNearbyChatToastPanel::addMessage(LLSD& notification) if(notification["chat_style"].asInteger()== CHAT_STYLE_IRC) { - messageText = messageText.substr(3); style_params.font.style = "ITALIC"; } else if( chat_type == CHAT_TYPE_SHOUT) @@ -208,7 +207,6 @@ void LLNearbyChatToastPanel::init(LLSD& notification) if(notification["chat_style"].asInteger()== CHAT_STYLE_IRC) { - messageText = messageText.substr(3); style_params.font.style = "ITALIC"; } else if( chat_type == CHAT_TYPE_SHOUT) diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index ee3be0a5e3..fda3df43ae 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -54,7 +54,7 @@ #include "llstylemap.h" #include "lldraghandle.h" -#include "lltrans.h" + #include "llbottomtray.h" #include "llnearbychatbar.h" #include "llfloaterreg.h" @@ -131,20 +131,6 @@ void LLNearbyChat::applySavedVariables() } } -std::string appendTime() -{ - time_t utc_time; - utc_time = time_corrected(); - std::string timeStr ="["+ LLTrans::getString("TimeHour")+"]:[" - +LLTrans::getString("TimeMin")+"] "; - - LLSD substitution; - - substitution["datetime"] = (S32) utc_time; - LLStringUtil::format (timeStr, substitution); - - return timeStr; -} void LLNearbyChat::addMessage(const LLChat& chat,bool archive) { @@ -171,14 +157,6 @@ void LLNearbyChat::addMessage(const LLChat& chat,bool archive) if (!chat.mMuted) { - std::string message = chat.mText; - - - LLChat& tmp_chat = const_cast<LLChat&>(chat); - - if(tmp_chat.mTimeStr.empty()) - tmp_chat.mTimeStr = appendTime(); - if (chat.mChatStyle == CHAT_STYLE_IRC) { LLColor4 txt_color = LLUIColorTable::instance().getColor("White"); @@ -191,17 +169,9 @@ void LLNearbyChat::addMessage(const LLChat& chat,bool archive) append_style_params.readonly_color(txt_color); append_style_params.font.name(font_name); append_style_params.font.size(font_size); - if (chat.mFromName.size() > 0) - { - append_style_params.font.style = "ITALIC"; - LLChat add_chat=chat; - add_chat.mText = chat.mFromName + " "; - mChatHistory->appendMessage(add_chat, use_plain_text_chat_history, append_style_params); - } - - message = message.substr(3); append_style_params.font.style = "ITALIC"; - mChatHistory->appendText(message, FALSE, append_style_params); + + mChatHistory->appendMessage(chat, use_plain_text_chat_history, append_style_params); } else { diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp index b0b6db682c..04e206fb99 100644 --- a/indra/newview/llnearbychathandler.cpp +++ b/indra/newview/llnearbychathandler.cpp @@ -42,6 +42,7 @@ #include "llfloaterreg.h"//for LLFloaterReg::getTypedInstance #include "llviewerwindow.h"//for screen channel position +#include "lltrans.h" //add LLNearbyChatHandler to LLNotificationsUI namespace using namespace LLNotificationsUI; @@ -318,6 +319,22 @@ void LLNearbyChatHandler::initChannel() mChannel->init(channel_right_bound - channel_width, channel_right_bound); } +std::string appendTime() +{ + time_t utc_time; + utc_time = time_corrected(); + std::string timeStr ="["+ LLTrans::getString("TimeHour")+"]:[" + +LLTrans::getString("TimeMin")+"] "; + + LLSD substitution; + + substitution["datetime"] = (S32) utc_time; + LLStringUtil::format (timeStr, substitution); + + return timeStr; +} + + void LLNearbyChatHandler::processChat(const LLChat& chat_msg) { if(chat_msg.mMuted == TRUE) @@ -327,6 +344,21 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg) if(chat_msg.mText.empty()) return;//don't process empty messages + + LLChat& tmp_chat = const_cast<LLChat&>(chat_msg); + + if(tmp_chat.mTimeStr.empty()) + tmp_chat.mTimeStr = appendTime(); + + if (tmp_chat.mChatStyle == CHAT_STYLE_IRC) + { + tmp_chat.mText = tmp_chat.mFromName + " " + tmp_chat.mText.substr(3); + } + + { + if(tmp_chat.mFromName.empty() && tmp_chat.mFromID!= LLUUID::null) + tmp_chat.mFromName = tmp_chat.mFromID.asString(); + } LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD()); nearby_chat->addMessage(chat_msg); |