Add a distinct color for server side group chat replay

master
Zi Ree 2023-06-26 14:51:06 +02:00
parent c8b7e97b45
commit 4e0d8f82c3
6 changed files with 47 additions and 12 deletions

View File

@ -72,7 +72,11 @@ typedef enum e_chat_style
CHAT_STYLE_IRC,
CHAT_STYLE_HISTORY,
CHAT_STYLE_TELEPORT_SEP,
CHAT_STYLE_MODERATOR
// <FS:Zi> Add a distinct color for server side group chat replay
// CHAT_STYLE_MODERATOR
CHAT_STYLE_MODERATOR,
CHAT_STYLE_SERVER_HISTORY
// </FS:Zi>
}EChatStyle;
// A piece of chat

View File

@ -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);

View File

@ -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;

View File

@ -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
// <FS:Zi> 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
// <FS:Zi> 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;
// <FS:Zi> 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
// <FS:Zi> 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
// <FS:Zi> 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,
// <FS:Ansariel> 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
// <FS:Zi> 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<bool> show_im_in_chat(gSavedSettings, "FSShowIMInChatHistory");
if (show_im_in_chat && !is_announcement)

View File

@ -99,7 +99,9 @@ public:
const LLUUID& from_id,
const std::string& utf8_text,
const std::string& time,
const bool is_history,
// <FS:Zi> 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);

View File

@ -1358,6 +1358,11 @@
<color
name="ChatHistoryMessageFromLog"
reference="Gray" />
<!-- <FS:Zi> Add a distinct color for server side group chat replay -->
<color
name="ChatHistoryMessageFromServerLog"
value=".37 .51 .38 1" />
<!-- </FS:Zi> -->
<color
name="AreaSearchBeaconColor"
reference="Blue_80" />