From 79e51195fbf3409611b413c006fb4061ca820e91 Mon Sep 17 00:00:00 2001
From: Andrey Lihatskiy <alihatskiy@productengine.com>
Date: Wed, 1 Mar 2023 01:27:30 +0200
Subject: [PATCH] SL-19289 UI for Estate Floater - Block Scripted Agents from
 Estate/Region

---
 indra/llmessage/llregionflags.h                      |  2 ++
 indra/newview/llestateinfomodel.cpp                  |  4 ++++
 indra/newview/llestateinfomodel.h                    |  2 ++
 indra/newview/llfloaterregioninfo.cpp                |  5 +++++
 .../skins/default/xui/en/panel_region_estate.xml     | 12 +++++++++++-
 5 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/indra/llmessage/llregionflags.h b/indra/llmessage/llregionflags.h
index c13f39df9bd..8548ed51e74 100644
--- a/indra/llmessage/llregionflags.h
+++ b/indra/llmessage/llregionflags.h
@@ -89,6 +89,8 @@ const U64 REGION_FLAGS_ALLOW_VOICE = (1 << 28);
 const U64 REGION_FLAGS_BLOCK_PARCEL_SEARCH = (1 << 29);
 const U64 REGION_FLAGS_DENY_AGEUNVERIFIED	= (1 << 30);
 
+const U64 REGION_FLAGS_DENY_BOTS = (1 << 31);
+
 const U64 REGION_FLAGS_DEFAULT = REGION_FLAGS_ALLOW_LANDMARK |
 								 REGION_FLAGS_ALLOW_SET_HOME |
                                  REGION_FLAGS_ALLOW_PARCEL_CHANGES |
diff --git a/indra/newview/llestateinfomodel.cpp b/indra/newview/llestateinfomodel.cpp
index 4fdb8605928..5be56660d65 100644
--- a/indra/newview/llestateinfomodel.cpp
+++ b/indra/newview/llestateinfomodel.cpp
@@ -74,6 +74,7 @@ bool LLEstateInfoModel::getDenyAgeUnverified()		const {	return getFlag(REGION_FL
 bool LLEstateInfoModel::getAllowVoiceChat()			const { return getFlag(REGION_FLAGS_ALLOW_VOICE); }
 bool LLEstateInfoModel::getAllowAccessOverride()	const { return getFlag(REGION_FLAGS_ALLOW_ACCESS_OVERRIDE); }
 bool LLEstateInfoModel::getAllowEnvironmentOverride() const { return getFlag(REGION_FLAGS_ALLOW_ENVIRONMENT_OVERRIDE); }
+bool LLEstateInfoModel::getDenyScriptedAgents()     const { return getFlag(REGION_FLAGS_DENY_BOTS); }
 
 void LLEstateInfoModel::setUseFixedSun(bool val)			{ setFlag(REGION_FLAGS_SUN_FIXED, 				val);	}
 void LLEstateInfoModel::setIsExternallyVisible(bool val)	{ setFlag(REGION_FLAGS_EXTERNALLY_VISIBLE,		val);	}
@@ -83,6 +84,7 @@ void LLEstateInfoModel::setDenyAgeUnverified(bool val)		{ setFlag(REGION_FLAGS_D
 void LLEstateInfoModel::setAllowVoiceChat(bool val)		    { setFlag(REGION_FLAGS_ALLOW_VOICE,				val);	}
 void LLEstateInfoModel::setAllowAccessOverride(bool val)    { setFlag(REGION_FLAGS_ALLOW_ACCESS_OVERRIDE,   val);   }
 void LLEstateInfoModel::setAllowEnvironmentOverride(bool val) { setFlag(REGION_FLAGS_ALLOW_ENVIRONMENT_OVERRIDE, val); }
+void LLEstateInfoModel::setDenyScriptedAgents(bool val)     { setFlag(REGION_FLAGS_DENY_BOTS, val); }
 
 void LLEstateInfoModel::update(const strings_t& strings)
 {
@@ -148,6 +150,7 @@ void LLEstateInfoModel::commitEstateInfoCapsCoro(std::string url)
     body["allow_direct_teleport"] = getAllowDirectTeleport();
     body["deny_anonymous"] = getDenyAnonymous();
     body["deny_age_unverified"] = getDenyAgeUnverified();
+    body["block_bots"] = getDenyScriptedAgents();
     body["allow_voice_chat"] = getAllowVoiceChat();
     body["override_public_access"] = getAllowAccessOverride();
 
@@ -222,6 +225,7 @@ std::string LLEstateInfoModel::getInfoDump()
 	dump["allow_direct_teleport"] = getAllowDirectTeleport();
 	dump["deny_anonymous"       ] = getDenyAnonymous();
 	dump["deny_age_unverified"  ] = getDenyAgeUnverified();
+    dump["block_bots"           ] = getDenyScriptedAgents();
 	dump["allow_voice_chat"     ] = getAllowVoiceChat();
     dump["override_public_access"] = getAllowAccessOverride();
     dump["override_environment"] = getAllowEnvironmentOverride();
diff --git a/indra/newview/llestateinfomodel.h b/indra/newview/llestateinfomodel.h
index d6f00c573cf..cfe91a29309 100644
--- a/indra/newview/llestateinfomodel.h
+++ b/indra/newview/llestateinfomodel.h
@@ -57,6 +57,7 @@ class LLEstateInfoModel : public LLSingleton<LLEstateInfoModel>
 	bool				getAllowVoiceChat()			const;
     bool                getAllowAccessOverride()    const;
     bool                getAllowEnvironmentOverride() const;
+    bool                getDenyScriptedAgents()     const;
 
 	const std::string&	getName()					const { return mName; }
 	const LLUUID&		getOwnerID()				const { return mOwnerID; }
@@ -72,6 +73,7 @@ class LLEstateInfoModel : public LLSingleton<LLEstateInfoModel>
 	void setAllowVoiceChat(bool val);
     void setAllowAccessOverride(bool val);
     void setAllowEnvironmentOverride(bool val);
+    void setDenyScriptedAgents(bool val);
 
 	void setSunHour(F32 sun_hour) { mSunHour = sun_hour; }
 
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index 64f84cbe4fc..da7a4733c7d 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -1880,6 +1880,7 @@ BOOL LLPanelEstateInfo::postBuild()
 	initCtrl("allow_direct_teleport");
 	initCtrl("limit_payment");
 	initCtrl("limit_age_verified");
+    initCtrl("limit_bots");
 	initCtrl("voice_chat_check");
     initCtrl("parcel_access_override");
 
@@ -1903,12 +1904,14 @@ void LLPanelEstateInfo::refresh()
 	getChildView("Only Allow")->setEnabled(public_access);
 	getChildView("limit_payment")->setEnabled(public_access);
 	getChildView("limit_age_verified")->setEnabled(public_access);
+    getChildView("limit_bots")->setEnabled(public_access);
 
 	// if this is set to false, then the limit fields are meaningless and should be turned off
 	if (public_access == false)
 	{
 		getChild<LLUICtrl>("limit_payment")->setValue(false);
 		getChild<LLUICtrl>("limit_age_verified")->setValue(false);
+        getChild<LLUICtrl>("limit_bots")->setValue(false);
 	}
 }
 
@@ -1925,6 +1928,7 @@ void LLPanelEstateInfo::refreshFromEstate()
 	getChild<LLUICtrl>("limit_payment")->setValue(estate_info.getDenyAnonymous());
 	getChild<LLUICtrl>("limit_age_verified")->setValue(estate_info.getDenyAgeUnverified());
     getChild<LLUICtrl>("parcel_access_override")->setValue(estate_info.getAllowAccessOverride());
+    getChild<LLUICtrl>("limit_bots")->setValue(estate_info.getDenyScriptedAgents());
 
 	// Ensure appriopriate state of the management UI
 	updateControls(gAgent.getRegion());
@@ -1968,6 +1972,7 @@ bool LLPanelEstateInfo::callbackChangeLindenEstate(const LLSD& notification, con
 			estate_info.setDenyAgeUnverified(getChild<LLUICtrl>("limit_age_verified")->getValue().asBoolean());
 			estate_info.setAllowVoiceChat(getChild<LLUICtrl>("voice_chat_check")->getValue().asBoolean());
             estate_info.setAllowAccessOverride(getChild<LLUICtrl>("parcel_access_override")->getValue().asBoolean());
+            estate_info.setDenyScriptedAgents(getChild<LLUICtrl>("limit_bots")->getValue().asBoolean());
             // JIGGLYPUFF
             //estate_info.setAllowAccessOverride(getChild<LLUICtrl>("")->getValue().asBoolean());
 			// send the update to sim
diff --git a/indra/newview/skins/default/xui/en/panel_region_estate.xml b/indra/newview/skins/default/xui/en/panel_region_estate.xml
index 9b9c870c49f..33e99a46aec 100644
--- a/indra/newview/skins/default/xui/en/panel_region_estate.xml
+++ b/indra/newview/skins/default/xui/en/panel_region_estate.xml
@@ -82,7 +82,7 @@
     <view_border
      bevel_style="none"
      follows="top|left"
-     height="185"
+     height="205"
      layout="topleft"
      left="10"
      top_pad="5"
@@ -125,6 +125,16 @@
      tool_tip="Residents must have payment information on file to access this estate.  See the [SUPPORT_SITE] for more information."
      top_pad="2"
      width="278" />
+    <check_box
+     follows="top|left"
+     height="18"
+     label="Must not be a scripted agent"
+     layout="topleft"
+     left_delta="0"
+     name="limit_bots"
+     tool_tip="Residents must not be a scripted agents (bots) to access this estate.  See the [SUPPORT_SITE] for more information."
+     top_pad="2"
+     width="278" />
     <check_box
      height="18"
      label="Parcel owners can be more restrictive"
-- 
GitLab