From fb1d3dbee3198aecd521824252191af634d58aa2 Mon Sep 17 00:00:00 2001 From: Zi Ree Date: Sat, 13 Feb 2021 01:35:56 +0100 Subject: [PATCH] Revised - FIRE-24133 - Redirect chat channel messages --- indra/newview/fsfloaterim.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/indra/newview/fsfloaterim.cpp b/indra/newview/fsfloaterim.cpp index d63c509230..591d76f91e 100644 --- a/indra/newview/fsfloaterim.cpp +++ b/indra/newview/fsfloaterim.cpp @@ -37,6 +37,7 @@ #include "fsdata.h" #include "fsfloaterimcontainer.h" // to replace separate IM Floaters with multifloater container #include "fsfloaternearbychat.h" +#include "fsnearbychathub.h" // FIRE-24133 - Redirect chat channel messages #include "fspanelimcontrolpanel.h" #include "llagent.h" #include "llappviewer.h" @@ -77,6 +78,8 @@ #include "rlvactions.h" #include "rlvhandler.h" +#include // FIRE-24133 - Redirect chat channel messages + const F32 ME_TYPING_TIMEOUT = 4.0f; const F32 OTHER_TYPING_TIMEOUT = 9.0f; const F32 NAME_REFRESH_TIMEOUT = 300.0f; @@ -381,7 +384,20 @@ void FSFloaterIM::sendMsgFromInputEditor(EChatType type) // Truncate and convert to UTF8 for transport std::string utf8_text = wstring_to_utf8str(text); - + + // FIRE-24133 - Redirect chat channel messages + if (boost::regex_match(utf8_text.c_str(), boost::regex("/-{0,1}[0-9].*"))) + { + // message starts with a / and a valid channel number, so redirect it to a chat channel + FSNearbyChat::instance().sendChatFromViewer(text, CHAT_TYPE_NORMAL, false); + + // clean out the text box and typing indicator, which we wouldn't reach otherwise + mInputEditor->setText(LLStringUtil::null); + setTyping(false); + + return; + } + // Convert OOC and MU* style poses utf8_text = FSCommon::applyAutoCloseOoc(utf8_text); utf8_text = FSCommon::applyMuPose(utf8_text);