From e8421572d01640f1fac0d8a0f04c85db35fe3b51 Mon Sep 17 00:00:00 2001 From: Yuri Chebotarev Date: Fri, 27 Nov 2009 11:42:17 +0200 Subject: fix for major task EXT-2894 Add support for the viewer 1.23 chat history style (widget-less) - Nearby Chat --HG-- branch : product-engine --- indra/newview/llnearbychat.cpp | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 80a6cc343f..d1e3713471 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -130,6 +130,21 @@ 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) { if (chat.mChatType == CHAT_TYPE_DEBUG_MSG) @@ -150,11 +165,18 @@ void LLNearbyChat::addMessage(const LLChat& chat) return; } } + + bool use_plain_text_chat_history = gSavedSettings.getBOOL("PlainTextChatHistory"); if (!chat.mMuted) { std::string message = chat.mText; - std::string prefix = message.substr(0, 4); + + + LLChat& tmp_chat = const_cast(chat); + + if(tmp_chat.mTimeStr.empty()) + tmp_chat.mTimeStr = appendTime(); if (chat.mChatStyle == CHAT_STYLE_IRC) { @@ -173,7 +195,7 @@ void LLNearbyChat::addMessage(const LLChat& chat) append_style_params.font.style = "ITALIC"; LLChat add_chat=chat; add_chat.mText = chat.mFromName + " "; - mChatHistory->appendMessage(add_chat, false, append_style_params); + mChatHistory->appendMessage(add_chat, use_plain_text_chat_history, append_style_params); } message = message.substr(3); @@ -182,7 +204,7 @@ void LLNearbyChat::addMessage(const LLChat& chat) } else { - mChatHistory->appendMessage(chat); + mChatHistory->appendMessage(chat,use_plain_text_chat_history); } } } -- cgit v1.2.3