summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llchathistory.cpp24
-rw-r--r--indra/newview/llfloaterimnearbychathandler.cpp4
-rw-r--r--indra/newview/llfloaterimnearbychatlistener.cpp3
-rw-r--r--indra/newview/llfloaterimnearbychatlistener.h4
-rw-r--r--indra/newview/scripts/lua/test_LLChat.lua6
5 files changed, 29 insertions, 12 deletions
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index f16377d7e3..e5878a9a24 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -665,7 +665,7 @@ public:
mSessionID = chat.mSessionID;
mSourceType = chat.mSourceType;
mIsFromScript = is_script;
- mScriptPrefix = is_script? LLTrans::getString("ScriptBy") : "";
+ 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
@@ -735,7 +735,7 @@ public:
username_end == (chat.mFromName.length() - 1))
{
mFrom = chat.mFromName.substr(0, username_start);
- user_name->setValue(mScriptPrefix + mFrom);
+ user_name->setValue(mPrefix + mFrom);
if (gSavedSettings.getBOOL("NameTagShowUsernames"))
{
@@ -1032,7 +1032,7 @@ private:
mFrom = av_name.getDisplayName();
LLTextBox* user_name = getChild<LLTextBox>("user_name");
- user_name->setValue(LLSD(mScriptPrefix + av_name.getDisplayName()));
+ user_name->setValue(LLSD(mPrefix + av_name.getDisplayName()));
user_name->setToolTip( av_name.getUserName() );
if (gSavedSettings.getBOOL("NameTagShowUsernames") &&
@@ -1064,7 +1064,6 @@ protected:
std::string mFrom;
LLUUID mSessionID;
std::string mText;
- std::string mScriptPrefix;
F64 mTime; // IM's frame time
time_t mCreationTime; // Views's time
@@ -1076,6 +1075,7 @@ protected:
bool mNeedsTimeBox;
bool mIsFromScript;
+ std::string mPrefix;
private:
boost::signals2::connection mAvatarNameCacheConnection;
@@ -1265,8 +1265,19 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
name_params.color(name_color);
name_params.readonly_color(name_color);
+<<<<<<< variant A
auto [message, is_lua] = LLStringUtil::withoutPrefix(chat.mText, LUA_PREFIX);
std::string prefix = message.substr(0, 4);
+>>>>>>> variant B
+ 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);
+
+####### Ancestor
+ 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);
+======= end
//IRC styled /me messages.
bool irc_me = prefix == "/me " || prefix == "/me'";
@@ -1342,6 +1353,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())
{
@@ -1366,7 +1378,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;
}
@@ -1379,7 +1391,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;
}
diff --git a/indra/newview/llfloaterimnearbychathandler.cpp b/indra/newview/llfloaterimnearbychathandler.cpp
index cda71f97d4..6a9dccf2f4 100644
--- a/indra/newview/llfloaterimnearbychathandler.cpp
+++ b/indra/newview/llfloaterimnearbychathandler.cpp
@@ -614,7 +614,11 @@ void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg,
}
else
{
+<<<<<<< HEAD
toast_msg = msg_text;
+=======
+ toast_msg = remove_LUA_PREFIX(chat_msg.mText, chat_msg.mIsScript);
+>>>>>>> release/luau-scripting
}
bool chat_overlaps = false;
diff --git a/indra/newview/llfloaterimnearbychatlistener.cpp b/indra/newview/llfloaterimnearbychatlistener.cpp
index 9093db282a..0618741cc4 100644
--- a/indra/newview/llfloaterimnearbychatlistener.cpp
+++ b/indra/newview/llfloaterimnearbychatlistener.cpp
@@ -40,7 +40,8 @@ static const F32 CHAT_THROTTLE_PERIOD = 1.f;
LLFloaterIMNearbyChatListener::LLFloaterIMNearbyChatListener()
: LLEventAPI("LLChatBar",
- "LLChatBar listener to (e.g.) sendChat, etc.")
+ "LLChatBar listener to (e.g.) sendChat, etc."),
+ mLastThrottleTime(0)
{
add("sendChat",
"Send chat to the simulator:\n"
diff --git a/indra/newview/llfloaterimnearbychatlistener.h b/indra/newview/llfloaterimnearbychatlistener.h
index 34d4effd48..18a8bacfaa 100644
--- a/indra/newview/llfloaterimnearbychatlistener.h
+++ b/indra/newview/llfloaterimnearbychatlistener.h
@@ -41,9 +41,9 @@ public:
LLFloaterIMNearbyChatListener();
private:
- F64 mLastThrottleTime{ 0.0 };
-
void sendChat(LLSD const & chat_data);
+
+ F64 mLastThrottleTime{ 0.0 };
};
#endif // LL_LLFLOATERIMNEARBYCHATLISTENER_H
diff --git a/indra/newview/scripts/lua/test_LLChat.lua b/indra/newview/scripts/lua/test_LLChat.lua
index 3c5cbeeeb2..3abaf28e42 100644
--- a/indra/newview/scripts/lua/test_LLChat.lua
+++ b/indra/newview/scripts/lua/test_LLChat.lua
@@ -2,12 +2,12 @@ LLChat = require 'LLChat'
function generateRandomWord(length)
local alphabet = "abcdefghijklmnopqrstuvwxyz"
- local word = {}
+ local wordTable = {}
for i = 1, length do
local randomIndex = math.random(1, #alphabet)
- table.insert(word, alphabet:sub(randomIndex, randomIndex))
+ table.insert(wordTable, alphabet:sub(randomIndex, randomIndex))
end
- return table.concat(word)
+ return table.concat(wordTable)
end
local msg = {'AI says:'}