- changed : auto-deny PERMISSION_TELEPORT if the user is currently @tploc restricted

--HG--
branch : RLVa
meow-7.2.2
Kitty Barnett 2012-08-19 18:52:50 +02:00
parent c59f33eee8
commit 3ca9101c4d
5 changed files with 28 additions and 19 deletions

View File

@ -6487,26 +6487,9 @@ void process_script_question(LLMessageSystem *msg, void **user_data)
// [RLVa:KB] - Checked: 2012-07-28 (RLVa-1.4.7)
if (rlv_handler_t::isEnabled())
{
if ( (!gRlvAttachmentLocks.canAttach()) && (LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_ATTACH] & questions) )
{
// Notify the user that we blocked it since they're not allowed to wear any new attachments
payload["rlv_blocked"] = RLV_STRING_BLOCKED_PERMATTACH;
// If only attach is requested we'll auto-deny it; otherwise let the user decide over remaining permissions
if (LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_ATTACH] == questions)
{
payload["questions"] = 0;
LLNotifications::instance().forceResponse(
LLNotification::Params("ScriptQuestion").substitutions(args).payload(payload), 0/*YES*/);
return;
}
else
{
questions &= ~LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_ATTACH];
payload["questions"] = questions;
}
}
RlvUtil::filterScriptQuestions(questions, payload);
if (gRlvHandler.hasBehaviour(RLV_BHVR_ACCEPTPERMISSION))
if ( (questions) && (gRlvHandler.hasBehaviour(RLV_BHVR_ACCEPTPERMISSION)) )
{
const LLViewerObject* pObj = gObjectList.findObject(taskid);
if (pObj)

View File

@ -33,6 +33,7 @@
#include "rlvhandler.h"
#include "rlvlocks.h"
#include "lscript_byteformat.h"
#include <boost/algorithm/string.hpp>
// ============================================================================
@ -349,6 +350,28 @@ void RlvUtil::filterNames(std::string& strUTF8Text, bool fFilterLegacy)
}
}
// Checked: 2012-08-19 (RLVa-1.4.7)
void RlvUtil::filterScriptQuestions(S32& nQuestions, LLSD& sdPayload)
{
// Check SCRIPT_PERMISSION_ATTACH
if ( (!gRlvAttachmentLocks.canAttach()) && (LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_ATTACH] & nQuestions) )
{
// Notify the user that we blocked it since they're not allowed to wear any new attachments
sdPayload["rlv_blocked"] = RLV_STRING_BLOCKED_PERMATTACH;
nQuestions &= ~LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_ATTACH];
}
// Check SCRIPT_PERMISSION_TELEPORT
if ( (gRlvHandler.hasBehaviour(RLV_BHVR_TPLOC)) && (LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_TELEPORT] & nQuestions) )
{
// Notify the user that we blocked it since they're not allowed to teleport
sdPayload["rlv_blocked"] = RLV_STRING_BLOCKED_PERMTELEPORT;
nQuestions &= ~LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_TELEPORT];
}
sdPayload["questions"] = nQuestions;
}
// Checked: 2010-08-29 (RLVa-1.2.1c) | Added: RLVa-1.2.1c
void RlvUtil::forceTp(const LLVector3d& posDest)
{

View File

@ -154,6 +154,7 @@ public:
static void filterLocation(std::string& strUTF8Text); // @showloc
static void filterNames(std::string& strUTF8Text, bool fFilterLegacy = true); // @shownames
static void filterScriptQuestions(S32& nQuestions, LLSD& sdPayload);
static bool isForceTp() { return m_fForceTp; }
static void forceTp(const LLVector3d& posDest); // Ignores restrictions that might otherwise prevent tp'ing

View File

@ -328,6 +328,7 @@ enum ERlvAttachGroupType
#define RLV_STRING_BLOCKED_GENERIC "blocked_generic"
#define RLV_STRING_BLOCKED_PERMATTACH "blocked_permattach"
#define RLV_STRING_BLOCKED_PERMTELEPORT "blocked_permteleport"
#define RLV_STRING_BLOCKED_RECVIM "blocked_recvim"
#define RLV_STRING_BLOCKED_RECVIM_REMOTE "blocked_recvim_remote"
#define RLV_STRING_BLOCKED_SENDIM "blocked_sendim"

View File

@ -14,6 +14,7 @@
<!-- Shown as notifications -->
<string name="blocked_generic">Unable to perform action due to RLV restrictions</string>
<string name="blocked_permattach">Attempt to attach '[OBJECT]' was denied due to RLV restrictions</string>
<string name="blocked_permteleport">'[OBJECT]' was denied permission to teleport you due to RLV restrictions</string>
<string name="blocked_startim">Unable to start IM session with [RECIPIENT] due to RLV restrictions</string>
<string name="blocked_startconf">Unable to start conference with [RECIPIENT] due to RLV restrictions</string>
<string name="blocked_teleport">Unable to initiate teleport due to RLV restrictions</string>