From 7930251bb7bc0f0603cab16054dacb5f8da05f2b Mon Sep 17 00:00:00 2001 From: Arrehn Date: Thu, 11 Aug 2011 13:24:18 -0400 Subject: [PATCH] FIRE-1641, Option to avoid timestamps in nearby chat, Initial patch by Selo Jacobus --- indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/llchathistory.cpp | 10 +++++++++- indra/newview/llnearbychat.cpp | 15 ++++++++++----- .../default/xui/en/panel_preferences_privacy.xml | 9 +++++++++ 4 files changed, 39 insertions(+), 6 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 455e995ed2..3f90bdb362 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -594,6 +594,17 @@ Value 0 + FSTimestampsInNearbyChat + + Comment + Show timestamps in nearby chat + Persist + 1 + Type + Boolean + Value + 1 + FSSecondsinChatTimestamps Comment diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index ea3c21fe27..f5ef077d23 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -779,6 +779,7 @@ void LLChatHistory::lookupDisplayNames(const LLChat& chat) void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LLStyle::Params& input_append_params) { bool use_plain_text_chat_history = args["use_plain_text_chat_history"].asBoolean(); + bool show_timestamps_in_nearby_chat = args["show_timestamps_in_nearby_chat"].asBoolean(); // AO: Do any display name lookups in plaintext chat headers as early as possible to give the cache maximal //time to get an answer back before it's needed. if (use_plain_text_chat_history) @@ -901,7 +902,14 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL timestamp_style.color(timestamp_color); timestamp_style.readonly_color(timestamp_color); } - mEditor->appendText("[" + chat.mTimeStr + "] ", mEditor->getText().size() != 0, timestamp_style); + if (show_timestamps_in_nearby_chat) + { + mEditor->appendText("[" + chat.mTimeStr + "] ", mEditor->getText().size() != 0, timestamp_style); + } + else + { + mEditor->appendLineBreakSegment(timestamp_style); + } if (utf8str_trim(chat.mFromName).size() != 0) { diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index b4154ca3d0..98cb0f349b 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -222,10 +222,11 @@ std::string appendTime() utc_time = time_corrected(); std::string timeStr ="["+ LLTrans::getString("TimeHour")+"]:[" +LLTrans::getString("TimeMin")+"]"; + if (gSavedSettings.getBOOL("FSSecondsinChatTimestamps")) { - timeStr += ":[" - +LLTrans::getString("TimeSec")+"]"; + timeStr += ":[" + +LLTrans::getString("TimeSec")+"]"; } LLSD substitution; @@ -241,16 +242,20 @@ void LLNearbyChat::addMessage(const LLChat& chat,bool archive,const LLSD &args) { LLChat& tmp_chat = const_cast(chat); bool use_plain_text_chat_history = gSavedSettings.getBOOL("PlainTextChatHistory"); + bool show_timestamps_in_nearby_chat = gSavedSettings.getBOOL("FSTimestampsInNearbyChat"); + if (show_timestamps_in_nearby_chat) + { + if(tmp_chat.mTimeStr.empty()) + tmp_chat.mTimeStr = appendTime(); - if(tmp_chat.mTimeStr.empty()) - tmp_chat.mTimeStr = appendTime(); + } - if (!chat.mMuted) { tmp_chat.mFromName = chat.mFromName; LLSD chat_args = args; chat_args["use_plain_text_chat_history"] = use_plain_text_chat_history; + chat_args["show_timestamps_in_nearby_chat"] = show_timestamps_in_nearby_chat; mChatHistory->appendMessage(chat, chat_args); } diff --git a/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml b/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml index fb961dacf6..678d6278c0 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml @@ -167,6 +167,15 @@ left_delta="0" name="seconds_in_timestamps" top_pad="4" + width="237" /> +