summaryrefslogtreecommitdiff
path: root/indra/newview/llchathistory.cpp
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2024-05-24 15:24:50 +0300
committerMnikolenko Productengine <mnikolenko@productengine.com>2024-05-24 15:24:50 +0300
commite4b7d2f463d19cab28985414365fd8415e3dc700 (patch)
tree4c2d6ba634d2cdd0be3154d5e469a0cc9f386ca1 /indra/newview/llchathistory.cpp
parent591a80765c4438f72795230824d2e549bafc592d (diff)
Mark script messages in compact mode too; code clean up
Diffstat (limited to 'indra/newview/llchathistory.cpp')
-rw-r--r--indra/newview/llchathistory.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 54b0c171f1..7ee0f3dd7a 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -665,6 +665,7 @@ public:
mSessionID = chat.mSessionID;
mSourceType = chat.mSourceType;
mIsFromScript = is_script;
+ mPrefix = mIsFromScript ? LLTrans::getString("ScriptBy") : "";
// To be able to report a message, we need a copy of it's text
// and it's easier to store text directly than trying to get
@@ -734,7 +735,7 @@ public:
username_end == (chat.mFromName.length() - 1))
{
mFrom = chat.mFromName.substr(0, username_start);
- user_name->setValue(mIsFromScript ? LLTrans::getString("ScriptBy") + mFrom : mFrom);
+ user_name->setValue(mPrefix + mFrom);
if (gSavedSettings.getBOOL("NameTagShowUsernames"))
{
@@ -789,7 +790,7 @@ public:
icon->setValue(LLSD("Command_Destinations_Icon"));
break;
case CHAT_SOURCE_UNKNOWN:
- icon->setValue(mIsFromScript ? LLSD("Inv_Script") : LLSD(chat.mFromID));
+ icon->setValue(mIsFromScript ? LLSD("Inv_Script") : LLSD("Unknown_Icon"));
}
// In case the message came from an object, save the object info
@@ -1031,14 +1032,7 @@ private:
mFrom = av_name.getDisplayName();
LLTextBox* user_name = getChild<LLTextBox>("user_name");
- if(mIsFromScript)
- {
- user_name->setValue(LLSD(LLTrans::getString("ScriptBy") + av_name.getDisplayName()));
- }
- else
- {
- user_name->setValue(LLSD(av_name.getDisplayName()));
- }
+ user_name->setValue(LLSD(mPrefix + av_name.getDisplayName()));
user_name->setToolTip( av_name.getUserName() );
if (gSavedSettings.getBOOL("NameTagShowUsernames") &&
@@ -1081,6 +1075,7 @@ protected:
bool mNeedsTimeBox;
bool mIsFromScript;
+ std::string mPrefix;
private:
boost::signals2::connection mAvatarNameCacheConnection;
@@ -1270,8 +1265,11 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
name_params.color(name_color);
name_params.readonly_color(name_color);
- bool is_lua = (chat.mText.substr(0, LUA_PREFIX.size()) == LUA_PREFIX);
- std::string prefix = chat.mText.substr(is_lua ? LUA_PREFIX.size() : 0, 4);
+ bool is_lua = LLStringUtil::startsWith(chat.mText, LUA_PREFIX);
+
+ std::string message = remove_LUA_PREFIX(chat.mText, is_lua);
+ std::string prefix = message.substr(0, 4);
+
//IRC styled /me messages.
bool irc_me = prefix == "/me " || prefix == "/me'";
@@ -1347,6 +1345,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
// names showing
if (args["show_names_for_p2p_conv"].asBoolean() && utf8str_trim(chat.mFromName).size())
{
+ std::string script_prefix = is_lua ? LLTrans::getString("ScriptBy") : "";
// Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text.
if (chat.mSourceType == CHAT_SOURCE_OBJECT && chat.mFromID.notNull())
{
@@ -1371,7 +1370,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
link_params.overwriteFrom(LLStyleMap::instance().lookupAgent(chat.mFromID));
// Add link to avatar's inspector and delimiter to message.
- mEditor->appendText(std::string(link_params.link_href) + delimiter,
+ mEditor->appendText(script_prefix + std::string(link_params.link_href) + delimiter,
prependNewLineState, link_params);
prependNewLineState = false;
}
@@ -1384,7 +1383,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
}
else
{
- mEditor->appendText("<nolink>" + chat.mFromName + "</nolink>" + delimiter,
+ mEditor->appendText(script_prefix + "<nolink>" + chat.mFromName + "</nolink>" + delimiter,
prependNewLineState, body_message_params);
prependNewLineState = false;
}
@@ -1505,7 +1504,6 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
// usual messages showing
else if (!teleport_separator)
{
- std::string message = is_lua ? chat.mText.substr(LUA_PREFIX.size()) : chat.mText;
message = irc_me ? message.substr(3) : message;
//MESSAGE TEXT PROCESSING