summaryrefslogtreecommitdiff
path: root/indra/newview/llnearbychathandler.cpp
diff options
context:
space:
mode:
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);