From 3f498c46d52b018add61815bff4eff0ce28a2370 Mon Sep 17 00:00:00 2001
From: Kitty Barnett <develop@catznip.com>
Date: Sat, 14 May 2016 10:46:00 +0200
Subject: [PATCH] Added @sendgesture=n to block sending/playing gestures
 (requested)

--HG--
branch : RLVa
---
 indra/newview/llgesturemgr.cpp | 9 +++++++++
 indra/newview/rlvactions.cpp   | 7 ++++++-
 indra/newview/rlvactions.h     | 7 ++++++-
 indra/newview/rlvdefines.h     | 1 +
 indra/newview/rlvhelper.cpp    | 1 +
 5 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp
index 950a6cfaef..d22c40922a 100755
--- a/indra/newview/llgesturemgr.cpp
+++ b/indra/newview/llgesturemgr.cpp
@@ -56,6 +56,10 @@
 #include "llappearancemgr.h"
 #include "llgesturelistener.h"
 
+// [RLVa:KB] - Checked: RLVa-2.0.0
+#include "rlvactions.h"
+// [/RLVa:KB]
+
 // Longest time, in seconds, to wait for all animations to stop playing
 const F32 MAX_WAIT_ANIM_SECS = 30.f;
 
@@ -527,6 +531,11 @@ void LLGestureMgr::playGesture(LLMultiGesture* gesture)
 {
 	if (!gesture) return;
 
+// [RLVa:KB] - Checked: RLVa-2.0.0 | Handles: @sendgesture
+	if (!RlvActions::canPlayGestures())
+		return;
+// [/RLVa:KB]
+
 	// Reset gesture to first step
 	gesture->mCurrentStep = 0;
 
diff --git a/indra/newview/rlvactions.cpp b/indra/newview/rlvactions.cpp
index b97e060de3..bf30e8305c 100644
--- a/indra/newview/rlvactions.cpp
+++ b/indra/newview/rlvactions.cpp
@@ -1,6 +1,6 @@
 /** 
  *
- * Copyright (c) 2009-2013, Kitty Barnett
+ * Copyright (c) 2009-2016, Kitty Barnett
  * 
  * The source code in this file is provided to you under the terms of the 
  * GNU Lesser General Public License, version 2.1, but WITHOUT ANY WARRANTY;
@@ -38,6 +38,11 @@ bool RlvActions::canReceiveIM(const LLUUID& idSender)
 		  ( (!gRlvHandler.hasBehaviour(RLV_BHVR_RECVIMFROM)) || (!gRlvHandler.isException(RLV_BHVR_RECVIMFROM, idSender)) ) );
 }
 
+bool RlvActions::canPlayGestures()
+{
+	return (!gRlvHandler.hasBehaviour(RLV_BHVR_SENDGESTURE));
+}
+
 // 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 fbc8ab12ba..9aa729e0df 100644
--- a/indra/newview/rlvactions.h
+++ b/indra/newview/rlvactions.h
@@ -1,6 +1,6 @@
 /** 
  *
- * Copyright (c) 2009-2013, Kitty Barnett
+ * Copyright (c) 2009-2016, Kitty Barnett
  * 
  * The source code in this file is provided to you under the terms of the 
  * GNU Lesser General Public License, version 2.1, but WITHOUT ANY WARRANTY;
@@ -34,6 +34,11 @@ public:
 	 */
 	static bool canReceiveIM(const LLUUID& idSender);
 
+	/*
+	 * Returns true if the user is allowed to send/play gestures (whether active ones from the chat bar or using the gesture preview floater)
+	 */
+	static bool canPlayGestures();
+
 	/*
 	 * 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 3e45ff3398..898880d7ad 100644
--- a/indra/newview/rlvdefines.h
+++ b/indra/newview/rlvdefines.h
@@ -143,6 +143,7 @@ enum ERlvBehaviour {
 	RLV_BHVR_RECVIMFROM,			// "recvimfrom"
 	RLV_BHVR_STARTIM,				// "startim"
 	RLV_BHVR_STARTIMTO,				// "startimto"
+	RLV_BHVR_SENDGESTURE,
 	RLV_BHVR_PERMISSIVE,			// "permissive"
 	RLV_BHVR_NOTIFY,				// "notify"
 	RLV_BHVR_SHOWINV,				// "showinv"
diff --git a/indra/newview/rlvhelper.cpp b/indra/newview/rlvhelper.cpp
index ff05df400c..71e782feb9 100644
--- a/indra/newview/rlvhelper.cpp
+++ b/indra/newview/rlvhelper.cpp
@@ -79,6 +79,7 @@ RlvBehaviourDictionary::RlvBehaviourDictionary()
 	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));
+	addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE>("sendgesture", RLV_BHVR_SENDGESTURE, RlvBehaviourInfo::BHVR_EXPERIMENTAL));
 	addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE>("setdebug", RLV_BHVR_SETDEBUG));
 	addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE>("setenv", RLV_BHVR_SETENV));
 	addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE>("setgroup", RLV_BHVR_SETGROUP));
-- 
GitLab