From 167cb814f147a58b2273d5ce3a171a06dd6f6b53 Mon Sep 17 00:00:00 2001
From: cinder <cinder@cinderblocks.biz>
Date: Sat, 19 Nov 2022 16:27:09 -0600
Subject: [PATCH] Snapshot detection :^)

---
 indra/newview/app_settings/settings_alchemy.xml      | 11 +++++++++++
 indra/newview/llvoavatar.cpp                         |  9 ++++++++-
 indra/newview/skins/default/xui/en/notifications.xml |  7 +++++++
 3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/indra/newview/app_settings/settings_alchemy.xml b/indra/newview/app_settings/settings_alchemy.xml
index dd1da4dd3ef..e721e954246 100644
--- a/indra/newview/app_settings/settings_alchemy.xml
+++ b/indra/newview/app_settings/settings_alchemy.xml
@@ -1006,6 +1006,17 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
+    <key>SnapshotDetection</key>
+    <map>
+      <key>Comment</key>
+      <string>Detect snapshot animation being played</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>1</integer>
+    </map>
     <key>UIImgTransparentUUID</key>
     <map>
       <key>Comment</key>
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index b127f3edee6..000748bfa6c 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -6153,7 +6153,14 @@ BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL
 		{
 			sitDown(TRUE);
 		}
-
+        else if (anim_id == ANIM_AGENT_SNAPSHOT)
+        {
+            static LLCachedControl<bool> announce_snapshot(gSavedSettings, "SnapshotDetection");
+            if (announce_snapshot)
+            {
+                LLNotificationsUtil::add("SnapshotDetected", LLSD().with("NAME", LLSLURL("agent", mID, "about").getSLURLString()));
+            }
+        }
 
 		if (startMotion(anim_id))
 		{
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index d600f8989bf..02dc891b16f 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -12539,6 +12539,13 @@ Are you sure you wish to continue?
     Shape import failed. Are you sure [FILENAME] is an avatar genepool file?
   </notification>
 
+  <notification
+	icon="notifytip.tga"
+	name="SnapshotDetected"
+	type="notifytip">
+	[NAME] took a snapshot! :O
+  </notification>
+
   <notification
    icon="notifytip.tga"
    name="AlwaysRunEnabled"
-- 
GitLab