diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp index f1b07abbc5..5f9ecbd30c 100755 --- a/indra/newview/llfloaterimnearbychat.cpp +++ b/indra/newview/llfloaterimnearbychat.cpp @@ -69,6 +69,7 @@ #include "llautoreplace.h" // [RLVa:KB] - Checked: 2010-02-27 (RLVa-1.2.0b) #include "rlvhandler.h" +#include "rlvactions.h" // [/RLVa:KB] S32 LLFloaterIMNearbyChat::sLastSpecialChatChannel = 0; @@ -874,7 +875,7 @@ void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channe else { // Don't allow chat on a non-public channel if sendchannel restricted (unless the channel is an exception) - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SENDCHANNEL)) && (!gRlvHandler.isException(RLV_BHVR_SENDCHANNEL, channel)) ) + if (!RlvActions::canSendChannel(channel)) return; // Don't allow chat on debug channel if @sendchat, @redirchat or @rediremote restricted (shows as public chat on viewers) diff --git a/indra/newview/rlvactions.cpp b/indra/newview/rlvactions.cpp index fc53801275..c000fe27f0 100644 --- a/indra/newview/rlvactions.cpp +++ b/indra/newview/rlvactions.cpp @@ -45,6 +45,13 @@ bool RlvActions::canPlayGestures() return (!gRlvHandler.hasBehaviour(RLV_BHVR_SENDGESTURE)); } +bool RlvActions::canSendChannel(int nChannel) +{ + return + ( (!gRlvHandler.hasBehaviour(RLV_BHVR_SENDCHANNEL)) || (gRlvHandler.isException(RLV_BHVR_SENDCHANNEL, nChannel)) ) && + ( (!gRlvHandler.hasBehaviour(RLV_BHVR_SENDCHANNELEXCEPT)) || (!gRlvHandler.isException(RLV_BHVR_SENDCHANNELEXCEPT, nChannel)) ); +} + // Checked: 2010-11-30 (RLVa-1.3.0) bool RlvActions::canSendIM(const LLUUID& idRecipient) { diff --git a/indra/newview/rlvactions.h b/indra/newview/rlvactions.h index a3fe248d2f..dc67527e9b 100644 --- a/indra/newview/rlvactions.h +++ b/indra/newview/rlvactions.h @@ -39,6 +39,11 @@ public: */ static bool canPlayGestures(); + /* + * Returns true if the user is allowed to chat on the specified channel + */ + static bool canSendChannel(int nChannel); + /* * Returns true if the user is allowed to send IMs to the specified recipient (can be an avatar or a group) */ diff --git a/indra/newview/rlvdefines.h b/indra/newview/rlvdefines.h index 3e5335415c..3358a4f6ec 100644 --- a/indra/newview/rlvdefines.h +++ b/indra/newview/rlvdefines.h @@ -104,7 +104,8 @@ enum ERlvBehaviour { RLV_BHVR_CHATWHISPER, // "chatwhisper" RLV_BHVR_CHATNORMAL, // "chatnormal" RLV_BHVR_CHATSHOUT, // "chatshout" - RLV_BHVR_SENDCHANNEL, // "sendchannel" + RLV_BHVR_SENDCHANNEL, + RLV_BHVR_SENDCHANNELEXCEPT, RLV_BHVR_SENDIM, // "sendim" RLV_BHVR_SENDIMTO, // "sendimto" RLV_BHVR_RECVIM, // "recvim" diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index 900325bc15..c748a4de27 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -40,6 +40,7 @@ // RLVa includes #include "rlvfloaters.h" +#include "rlvactions.h" #include "rlvhandler.h" #include "rlvhelper.h" #include "rlvinventory.h" @@ -833,7 +834,7 @@ bool RlvHandler::redirectChatOrEmote(const std::string& strUTF8Text) const endRedir = m_Exceptions.upper_bound(eBhvr); itRedir != endRedir; ++itRedir) { S32 nChannel = boost::get(itRedir->second.varOption); - if ( (!hasBehaviour(RLV_BHVR_SENDCHANNEL)) || (isException(RLV_BHVR_SENDCHANNEL, nChannel)) ) + if (RlvActions::canSendChannel(nChannel)) RlvUtil::sendChatReply(nChannel, strUTF8Text); } @@ -1531,9 +1532,9 @@ void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehaviour eBh RlvUIEnabler::instance().removeGenericFloaterFilter("beacons"); } -// Handles: @sendchannel[:]=n|y +// Handles: @sendchannel[:]=n|y and @sendchannel_except[:]=n|y template<> template<> -ERlvCmdRet RlvBehaviourHandler::onCommand(const RlvCommand& rlvCmd, bool& fRefCount) +ERlvCmdRet RlvBehaviourSendChannelHandler::onCommand(const RlvCommand& rlvCmd, bool& fRefCount) { // If there's an option then it should be a valid (= positive and non-zero) chat channel if (rlvCmd.hasOption()) @@ -1930,7 +1931,7 @@ ERlvCmdRet RlvForceHandler::onCommand(const RlvCommand& rlvCmd) return RLV_RET_SUCCESS; } -// Handles: @tpto:[;]=force and @tpto:;[;]=force +// Handles: @tpto:[;]=force and @tpto:/[;]=force template<> template<> ERlvCmdRet RlvForceHandler::onCommand(const RlvCommand& rlvCmd) { diff --git a/indra/newview/rlvhelper.cpp b/indra/newview/rlvhelper.cpp index f9f15f77df..ccc3b433a6 100644 --- a/indra/newview/rlvhelper.cpp +++ b/indra/newview/rlvhelper.cpp @@ -75,7 +75,8 @@ RlvBehaviourDictionary::RlvBehaviourDictionary() addEntry(new RlvBehaviourProcessor("remattach")); addEntry(new RlvBehaviourInfo("remoutfit", RLV_BHVR_REMOUTFIT, RLV_TYPE_ADDREM)); addEntry(new RlvBehaviourGenericProcessor("rez", RLV_BHVR_REZ)); - addEntry(new RlvBehaviourProcessor("sendchannel", RlvBehaviourInfo::BHVR_STRICT)); + addEntry(new RlvBehaviourProcessor("sendchannel", RlvBehaviourInfo::BHVR_STRICT)); + addEntry(new RlvBehaviourProcessor("sendchannel_except", RlvBehaviourInfo::BHVR_STRICT)); addEntry(new RlvBehaviourGenericProcessor("sendchat", RLV_BHVR_SENDCHAT)); addEntry(new RlvBehaviourToggleProcessor("sendim", RlvBehaviourInfo::BHVR_STRICT)); addEntry(new RlvBehaviourGenericProcessor("sendimto", RLV_BHVR_SENDIMTO, RlvBehaviourInfo::BHVR_STRICT)); diff --git a/indra/newview/rlvhelper.h b/indra/newview/rlvhelper.h index f3deb05cc6..c75cc1fb9c 100644 --- a/indra/newview/rlvhelper.h +++ b/indra/newview/rlvhelper.h @@ -115,6 +115,7 @@ template using RlvReplyHandler = RlvCommandHandler RlvBehaviourAddRemAttachHandler; // Shared between @addattach and @remattach +typedef RlvBehaviourHandler RlvBehaviourSendChannelHandler; // Shared between @addattach and @remattach typedef RlvForceHandler RlvForceRemAttachHandler; // Shared between @remattach and @detach //