summaryrefslogtreecommitdiff
path: root/indra/newview/llnearbychathandler.cpp
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 /indra/newview/llnearbychathandler.cpp
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
Diffstat (limited to 'indra/newview/llnearbychathandler.cpp')
-rw-r--r--indra/newview/llnearbychathandler.cpp32
1 files changed, 32 insertions, 0 deletions
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);