Added @sendchannel_except[:<channel>]=n|y (requested)

--HG--
branch : RLVa
master
Kitty Barnett 2016-06-02 22:18:59 +02:00
parent c0fa9eda0f
commit 2864442dd6
7 changed files with 24 additions and 7 deletions

View File

@ -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)

View File

@ -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)
{

View File

@ -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)
*/

View File

@ -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"

View File

@ -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<S32>(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<RLV_BHVR_EDIT>::onCommandToggle(ERlvBehaviour eBh
RlvUIEnabler::instance().removeGenericFloaterFilter("beacons");
}
// Handles: @sendchannel[:<channel>]=n|y
// Handles: @sendchannel[:<channel>]=n|y and @sendchannel_except[:<channel>]=n|y
template<> template<>
ERlvCmdRet RlvBehaviourHandler<RLV_BHVR_SENDCHANNEL>::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<RLV_BHVR_SIT>::onCommand(const RlvCommand& rlvCmd)
return RLV_RET_SUCCESS;
}
// Handles: @tpto:<vector>[;<angle>]=force and @tpto:<region>;<vector>[;<angle>]=force
// Handles: @tpto:<vector>[;<angle>]=force and @tpto:<region>/<vector>[;<angle>]=force
template<> template<>
ERlvCmdRet RlvForceHandler<RLV_BHVR_TPTO>::onCommand(const RlvCommand& rlvCmd)
{

View File

@ -75,7 +75,8 @@ RlvBehaviourDictionary::RlvBehaviourDictionary()
addEntry(new RlvBehaviourProcessor<RLV_BHVR_REMATTACH, RlvBehaviourAddRemAttachHandler>("remattach"));
addEntry(new RlvBehaviourInfo("remoutfit", RLV_BHVR_REMOUTFIT, RLV_TYPE_ADDREM));
addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE>("rez", RLV_BHVR_REZ));
addEntry(new RlvBehaviourProcessor<RLV_BHVR_SENDCHANNEL>("sendchannel", RlvBehaviourInfo::BHVR_STRICT));
addEntry(new RlvBehaviourProcessor<RLV_BHVR_SENDCHANNEL, RlvBehaviourSendChannelHandler>("sendchannel", RlvBehaviourInfo::BHVR_STRICT));
addEntry(new RlvBehaviourProcessor<RLV_BHVR_SENDCHANNELEXCEPT, RlvBehaviourSendChannelHandler>("sendchannel_except", RlvBehaviourInfo::BHVR_STRICT));
addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE>("sendchat", RLV_BHVR_SENDCHAT));
addEntry(new RlvBehaviourToggleProcessor<RLV_BHVR_SENDIM, RLV_OPTION_NONE_OR_EXCEPTION>("sendim", RlvBehaviourInfo::BHVR_STRICT));
addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_EXCEPTION>("sendimto", RLV_BHVR_SENDIMTO, RlvBehaviourInfo::BHVR_STRICT));

View File

@ -115,6 +115,7 @@ template<ERlvBehaviour eBhvr> using RlvReplyHandler = RlvCommandHandler<RLV_TYPE
// List of shared handlers
typedef RlvBehaviourHandler<RLV_BHVR_REMATTACH> RlvBehaviourAddRemAttachHandler; // Shared between @addattach and @remattach
typedef RlvBehaviourHandler<RLV_BHVR_SENDCHANNEL> RlvBehaviourSendChannelHandler; // Shared between @addattach and @remattach
typedef RlvForceHandler<RLV_BHVR_REMATTACH> RlvForceRemAttachHandler; // Shared between @remattach and @detach
//