FIRE-24133 - Redirect chat channel messages typed into IMs, conferences or group chats
parent
4bdf0f0605
commit
c7448a0fa4
|
|
@ -37,6 +37,7 @@
|
|||
#include "fsdata.h"
|
||||
#include "fsfloaterimcontainer.h" // to replace separate IM Floaters with multifloater container
|
||||
#include "fsfloaternearbychat.h"
|
||||
#include "fsnearbychathub.h" // <FS:Zi> 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 <boost/regex.hpp> // <FS:Zi> 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;
|
||||
|
|
@ -352,6 +355,32 @@ void FSFloaterIM::onVisibilityChange(BOOL new_visibility)
|
|||
}
|
||||
}
|
||||
|
||||
// <FS:Zi> FIRE-24133 - Redirect chat channel messages
|
||||
void FSFloaterIM::onChatChannelTextSend(const LLSD& notification, const LLSD& response)
|
||||
{
|
||||
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
|
||||
if (option == 2) // Discard message
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LLSD payload = notification["payload"];
|
||||
std::string text = payload["MESSAGE"];
|
||||
|
||||
if (option == 0) // Send to Channel
|
||||
{
|
||||
// always send the chat as CHAT_TYPE_NORMAL since we don't have any other information
|
||||
FSNearbyChat::instance().sendChatFromViewer(text, CHAT_TYPE_NORMAL, false);
|
||||
}
|
||||
else if (option == 1) // Send to IM
|
||||
{
|
||||
// pass the message on to the IM unaltered
|
||||
sendMsg(text);
|
||||
}
|
||||
}
|
||||
// </FS:Zi> FIRE-24133 - Redirect chat channel messages
|
||||
|
||||
|
||||
void FSFloaterIM::sendMsgFromInputEditor(EChatType type)
|
||||
{
|
||||
if (gAgent.isGodlike()
|
||||
|
|
@ -381,7 +410,36 @@ void FSFloaterIM::sendMsgFromInputEditor(EChatType type)
|
|||
|
||||
// Truncate and convert to UTF8 for transport
|
||||
std::string utf8_text = wstring_to_utf8str(text);
|
||||
|
||||
|
||||
// <FS:Zi> 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 ask the user if they really want
|
||||
// to send this to an IM instead of a chat channel
|
||||
std::string sample_text = utf8_text;
|
||||
if (sample_text.size() > 30)
|
||||
{
|
||||
// shorten the sample text for the dialog
|
||||
sample_text.resize(26);
|
||||
sample_text += " ...";
|
||||
}
|
||||
|
||||
LLSD args;
|
||||
args["MESSAGE"] = sample_text;
|
||||
|
||||
LLSD payload;
|
||||
payload["MESSAGE"] = utf8_text;
|
||||
|
||||
LLNotificationsUtil::add("SendToChannelInIM", args, payload, boost::bind(&FSFloaterIM::onChatChannelTextSend, this, _1, _2));
|
||||
|
||||
// clean out the text box and typing indicator, which we wouldn't reach otherwise
|
||||
mInputEditor->setText(LLStringUtil::null);
|
||||
setTyping(false);
|
||||
|
||||
return;
|
||||
}
|
||||
// </FS:Zi> FIRE-24133 - Redirect chat channel messages
|
||||
|
||||
// Convert OOC and MU* style poses
|
||||
utf8_text = FSCommon::applyAutoCloseOoc(utf8_text);
|
||||
utf8_text = FSCommon::applyMuPose(utf8_text);
|
||||
|
|
|
|||
|
|
@ -172,6 +172,7 @@ protected:
|
|||
LLButton* mSysinfoButton;
|
||||
// support sysinfo button -Zi
|
||||
|
||||
void onChatChannelTextSend(const LLSD& notification, const LLSD& response); // <FS:Zi> FIRE-24133 - Redirect chat channel messages
|
||||
BOOL enableViewerVersionCallback(const LLSD& notification,const LLSD& response); // <FS:Zi> Viewer version popup
|
||||
void reshapeFloater(bool collapse);
|
||||
void reshapeChatLayoutPanel();
|
||||
|
|
|
|||
|
|
@ -13624,4 +13624,34 @@ Firestorm Animation Overrider: [AO_MESSAGE]
|
|||
name="notifyignore"/>
|
||||
</notification>
|
||||
|
||||
<!-- <FS:Zi> FIRE-24133 - Redirect chat channel messages -->
|
||||
<notification
|
||||
icon="notify.tga"
|
||||
name="SendToChannelInIM"
|
||||
type="alertmodal">
|
||||
It looks like you want to send a command to a chat channel instead of an instant message:
|
||||
|
||||
[MESSAGE]
|
||||
|
||||
Please choose one of the options below to proceed:
|
||||
<form name="form">
|
||||
<button
|
||||
index="0"
|
||||
name="Channel"
|
||||
text="Send to Channel"/>
|
||||
<button
|
||||
index="1"
|
||||
name="IM"
|
||||
text="Send to IM"/>
|
||||
<button
|
||||
index="2"
|
||||
name="Discard"
|
||||
text="Discard Message"/>
|
||||
<ignore name="ignore"
|
||||
text="A message looks like a chat channel command but was sent to an IM"
|
||||
save_option="true" />
|
||||
</form>
|
||||
</notification>
|
||||
<!-- </FS:Zi> FIRE-24133 - Redirect chat channel messages -->
|
||||
|
||||
</notifications>
|
||||
|
|
|
|||
Loading…
Reference in New Issue