summaryrefslogtreecommitdiff
path: root/indra/newview/llchathistory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llchathistory.cpp')
-rw-r--r--indra/newview/llchathistory.cpp22
1 files changed, 8 insertions, 14 deletions
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 54b0c171f1..f16377d7e3 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;
+ mScriptPrefix = is_script? 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(mScriptPrefix + 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(mScriptPrefix + av_name.getDisplayName()));
user_name->setToolTip( av_name.getUserName() );
if (gSavedSettings.getBOOL("NameTagShowUsernames") &&
@@ -1070,6 +1064,7 @@ protected:
std::string mFrom;
LLUUID mSessionID;
std::string mText;
+ std::string mScriptPrefix;
F64 mTime; // IM's frame time
time_t mCreationTime; // Views's time
@@ -1080,7 +1075,7 @@ protected:
bool mNeedsTimeBox;
- bool mIsFromScript;
+ bool mIsFromScript;
private:
boost::signals2::connection mAvatarNameCacheConnection;
@@ -1270,8 +1265,8 @@ 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);
+ auto [message, is_lua] = LLStringUtil::withoutPrefix(chat.mText, LUA_PREFIX);
+ std::string prefix = message.substr(0, 4);
//IRC styled /me messages.
bool irc_me = prefix == "/me " || prefix == "/me'";
@@ -1505,7 +1500,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