summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Chebotarev <ychebotarev@productengine.com>2009-12-03 10:31:00 +0200
committerYuri Chebotarev <ychebotarev@productengine.com>2009-12-03 10:31:00 +0200
commit62feea50c2f430f65ad7ab16cfa5e66b2b2e2b63 (patch)
tree2889a350301c63848d13b8816bf784cd05ad5fd6
parent003b6f19506e5934b052f81d9ef1b88bf5ad486d (diff)
fix for normal EXT-3077 [BSI] Object chat of objects without a name bork nearby chat toasts and log
for information - since I think that messages from nowhere is bad practice for user - if object that send message has no name I use object id as name --HG-- branch : product-engine
-rw-r--r--indra/newview/llchatitemscontainerctrl.cpp2
-rw-r--r--indra/newview/llnearbychat.cpp36
-rw-r--r--indra/newview/llnearbychathandler.cpp32
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);