From 4e0d8f82c3dadaf756c6fc30283e087c7badd501 Mon Sep 17 00:00:00 2001 From: Zi Ree Date: Mon, 26 Jun 2023 14:51:06 +0200 Subject: [PATCH] Add a distinct color for server side group chat replay --- indra/llui/llchat.h | 6 +++++- indra/newview/fschathistory.cpp | 13 +++++++++++-- indra/newview/fsfloaterim.cpp | 7 +++++-- indra/newview/llimview.cpp | 24 ++++++++++++++++++------ indra/newview/llimview.h | 4 +++- indra/newview/skins/default/colors.xml | 5 +++++ 6 files changed, 47 insertions(+), 12 deletions(-) diff --git a/indra/llui/llchat.h b/indra/llui/llchat.h index 89ded99f9d..20ff912ecf 100644 --- a/indra/llui/llchat.h +++ b/indra/llui/llchat.h @@ -72,7 +72,11 @@ typedef enum e_chat_style CHAT_STYLE_IRC, CHAT_STYLE_HISTORY, CHAT_STYLE_TELEPORT_SEP, - CHAT_STYLE_MODERATOR + // Add a distinct color for server side group chat replay + // CHAT_STYLE_MODERATOR + CHAT_STYLE_MODERATOR, + CHAT_STYLE_SERVER_HISTORY + // }EChatStyle; // A piece of chat diff --git a/indra/newview/fschathistory.cpp b/indra/newview/fschathistory.cpp index 46ed261d15..64407cbdd1 100644 --- a/indra/newview/fschathistory.cpp +++ b/indra/newview/fschathistory.cpp @@ -803,6 +803,7 @@ public: } else if ((mSourceType == CHAT_SOURCE_AGENT || (mSourceType == CHAT_SOURCE_SYSTEM && mType == CHAT_TYPE_RADAR)) && !mAvatarID.isNull() + && chat.mChatStyle != CHAT_STYLE_SERVER_HISTORY && chat.mChatStyle != CHAT_STYLE_HISTORY) { // ...from a normal user, lookup the name and fill in later. @@ -831,6 +832,7 @@ public: // [/RLVa:KB] } else if (chat.mChatStyle == CHAT_STYLE_HISTORY || + chat.mChatStyle == CHAT_STYLE_SERVER_HISTORY || (mSourceType == CHAT_SOURCE_AGENT || (mSourceType == CHAT_SOURCE_SYSTEM && mType == CHAT_TYPE_RADAR))) { //if it's an avatar name with a username add formatting @@ -1506,12 +1508,19 @@ void FSChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL delimiter_style = "BOLD"; } - bool message_from_log = chat.mChatStyle == CHAT_STYLE_HISTORY; + bool message_from_log = (chat.mChatStyle == CHAT_STYLE_HISTORY || chat.mChatStyle == CHAT_STYLE_SERVER_HISTORY); bool teleport_separator = chat.mSourceType == CHAT_SOURCE_TELEPORT; // We graying out chat history by graying out messages that contains full date in a time string if (message_from_log && !is_conversation_log) { - txt_color = LLUIColorTable::instance().getColor("ChatHistoryMessageFromLog"); + if (chat.mChatStyle == CHAT_STYLE_HISTORY) + { + txt_color = LLUIColorTable::instance().getColor("ChatHistoryMessageFromLog"); + } + else if (chat.mChatStyle == CHAT_STYLE_SERVER_HISTORY) + { + txt_color = LLUIColorTable::instance().getColor("ChatHistoryMessageFromServerLog"); + } body_message_params.color(txt_color); body_message_params.readonly_color(txt_color); name_params.color(txt_color); diff --git a/indra/newview/fsfloaterim.cpp b/indra/newview/fsfloaterim.cpp index 380d317222..b96d8461d2 100644 --- a/indra/newview/fsfloaterim.cpp +++ b/indra/newview/fsfloaterim.cpp @@ -1473,7 +1473,7 @@ void FSFloaterIM::updateMessages() LLUUID from_id = msg["from_id"].asUUID(); std::string from = msg["from"].asString(); std::string message = msg["message"].asString(); - bool is_history = msg["is_history"].asBoolean(); + S32 is_history = msg["is_history"].asInteger(); bool is_region_msg = msg["is_region_msg"].asBoolean(); LLChat chat; @@ -1481,7 +1481,10 @@ void FSFloaterIM::updateMessages() chat.mSessionID = mSessionID; chat.mFromName = from; chat.mTimeStr = time; - chat.mChatStyle = is_history ? CHAT_STYLE_HISTORY : chat.mChatStyle; + if (is_history) + { + chat.mChatStyle = (EChatStyle) is_history; + } if (is_region_msg) { chat.mSourceType = CHAT_SOURCE_REGION; diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 92c084a08f..e12390a2fa 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1032,7 +1032,9 @@ void LLIMModel::LLIMSession::addMessage(const std::string& from, const LLUUID& from_id, const std::string& utf8_text, const std::string& time, - const bool is_history, // comes from a history file or chat server + // Add a distinct color for server side group chat replay + // const bool is_history, // comes from a history file or chat server + const S32 is_history, // comes from a history file or chat server const bool is_region_msg, const U32 timestamp) // may be zero { @@ -1101,7 +1103,9 @@ void LLIMModel::LLIMSession::addMessagesFromHistoryCache(const chat_message_list LL_DEBUGS("ChatHistory") << mSessionID << ": Adding history cache message: " << msg << LL_ENDL; // Add message from history cache to the display - addMessage(from, from_id, msg[LL_IM_TEXT], msg[LL_IM_TIME], true, false, 0); // from history data, not region message, no timestamp + // Add a distinct color for server side group chat replay + // addMessage(from, from_id, msg[LL_IM_TEXT], msg[LL_IM_TIME], true, false, 0); // from history data, not region message, no timestamp + addMessage(from, from_id, msg[LL_IM_TEXT], msg[LL_IM_TIME], CHAT_STYLE_HISTORY, false, 0); // from history data, not region message, no timestamp } } @@ -1309,7 +1313,9 @@ void LLIMModel::LLIMSession::addMessagesFromServerHistory(const LLSD& history, message["time"] = chat_time_str; message["timestamp"] = (S32)history_msg_timestamp; message["index"] = (LLSD::Integer)mMsgs.size(); - message["is_history"] = true; + // Add a distinct color for server side group chat replay + // message["is_history"] = true; + message["is_history"] = CHAT_STYLE_SERVER_HISTORY; mMsgs.push_front(message); LL_DEBUGS("ChatHistory") << mSessionID << ": push_front() adding group chat history message " << message << LL_ENDL; @@ -1356,12 +1362,16 @@ void LLIMModel::LLIMSession::chatFromLogFile(LLLogChat::ELogLineType type, const if (type == LLLogChat::LOG_LINE) { LL_DEBUGS("ChatHistory") << "chatFromLogFile() adding LOG_LINE message from " << msg << LL_ENDL; - self->addMessage("", LLSD(), msg["message"].asString(), "", true, false, 0); // from history data, not region message, no timestamp + // Add a distinct color for server side group chat replay + // self->addMessage("", LLSD(), msg["message"].asString(), "", true, false, 0); // from history data, not region message, no timestamp + self->addMessage("", LLSD(), msg["message"].asString(), "", CHAT_STYLE_HISTORY, false, 0); // from history data, not region message, no timestamp } else if (type == LLLogChat::LOG_LLSD) { LL_DEBUGS("ChatHistory") << "chatFromLogFile() adding LOG_LLSD message from " << msg << LL_ENDL; - self->addMessage(msg["from"].asString(), msg["from_id"].asUUID(), msg["message"].asString(), msg["time"].asString(), true, false, 0); // from history data, not region message, no timestamp + // Add a distinct color for server side group chat replay + // self->addMessage(msg["from"].asString(), msg["from_id"].asUUID(), msg["message"].asString(), msg["time"].asString(), true, false, 0); // from history data, not region message, no timestamp + self->addMessage(msg["from"].asString(), msg["from_id"].asUUID(), msg["message"].asString(), msg["time"].asString(), CHAT_STYLE_HISTORY, false, 0); // from history data, not region message, no timestamp } } @@ -1717,7 +1727,9 @@ bool LLIMModel::addToHistory(const LLUUID& session_id, // Forward IM to nearby chat if wanted std::string timestr = LLLogChat::timestamp2LogString(timestamp, false); - session->addMessage(from, from_id, utf8_text, timestr, false, is_region_msg, timestamp); //might want to add date separately + // Add a distinct color for server side group chat replay + // session->addMessage(from, from_id, utf8_text, timestr, false, is_region_msg, timestamp); //might want to add date separately + session->addMessage(from, from_id, utf8_text, timestr, CHAT_STYLE_NORMAL, is_region_msg, timestamp); //might want to add date separately static LLCachedControl show_im_in_chat(gSavedSettings, "FSShowIMInChatHistory"); if (show_im_in_chat && !is_announcement) diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index 4a3c430833..3c9ec41f16 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -99,7 +99,9 @@ public: const LLUUID& from_id, const std::string& utf8_text, const std::string& time, - const bool is_history, + // Add a distinct color for server side group chat replay + // const bool is_history, + const S32 is_history, const bool is_region_msg, U32 timestamp); diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml index a7bda69992..d7bbd28619 100644 --- a/indra/newview/skins/default/colors.xml +++ b/indra/newview/skins/default/colors.xml @@ -1358,6 +1358,11 @@ + + +