From 83eba38a444d553cb0009b6888a54449f3ed9109 Mon Sep 17 00:00:00 2001
From: Testicular Slingshot <automatic@null.net>
Date: Wed, 12 Feb 2020 22:11:44 -0400
Subject: [PATCH] Made marking unnamed objects in chat and IMs a toggleable
 feature in preferences.

---
 indra/newview/app_settings/settings_alchemy.xml       | 11 +++++++++++
 indra/newview/llimprocessing.cpp                      |  3 ++-
 indra/newview/llviewermessage.cpp                     |  3 ++-
 .../default/xui/en/panel_preferences_interface.xml    |  9 +++++++++
 4 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/indra/newview/app_settings/settings_alchemy.xml b/indra/newview/app_settings/settings_alchemy.xml
index 1fff56b532..9c7d05a8cd 100644
--- a/indra/newview/app_settings/settings_alchemy.xml
+++ b/indra/newview/app_settings/settings_alchemy.xml
@@ -277,6 +277,17 @@
       <key>Value</key>
       <string>/tp2cam</string>
     </map>
+    <key>AlchemyChatMarkUnnamedObjects</key>
+    <map>
+      <key>Comment</key>
+      <string>Marks unnamed objects in chat and IMs.</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>1</integer>
+    </map>
     <key>AlchemyChatMUPose</key>
     <map>
       <key>Comment</key>
diff --git a/indra/newview/llimprocessing.cpp b/indra/newview/llimprocessing.cpp
index 5d86997d96..f6093437bb 100644
--- a/indra/newview/llimprocessing.cpp
+++ b/indra/newview/llimprocessing.cpp
@@ -492,7 +492,8 @@ void LLIMProcessing::processNewMessage(LLUUID from_id,
 
     // make sure that we don't have an empty or all-whitespace name
     LLStringUtil::trim(name);
-    if (name.empty())
+    static const LLCachedControl<bool> sMarkUnnamedObjects(gSavedSettings, "AlchemyChatMarkUnnamedObjects");
+    if (name.empty() && sMarkUnnamedObjects)
     {
         name = LLTrans::getString("Unnamed");
     }
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 4ecddd9abc..8fe20e98cb 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -2411,7 +2411,8 @@ void process_chat_from_simulator(LLMessageSystem* msg, void** user_data)
 	{
 		// make sure that we don't have an empty or all-whitespace name
 		LLStringUtil::trim(from_name);
-		if (from_name.empty())
+		static const LLCachedControl<bool> sMarkUnnamedObjects(gSavedSettings, "AlchemyChatMarkUnnamedObjects");
+		if (from_name.empty() && sMarkUnnamedObjects)
 		{
 			from_name = LLTrans::getString("Unnamed");
 		}
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_interface.xml b/indra/newview/skins/default/xui/en/panel_preferences_interface.xml
index 451955346a..3e51f28ad0 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_interface.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_interface.xml
@@ -277,6 +277,15 @@
          value="3"
          width="90" />
     </radio_group>
+    <check_box
+      follows="left|top"
+      height="16"
+      label="Mark unnamed objects in chat and IMs"
+      left="7"
+      top_pad="15"
+      name="AlchemyChatMarkUnnamedObjects"
+      control_name="AlchemyChatMarkUnnamedObjects"
+      width="150" />
    </panel>
   </tab_container>
 </panel>
-- 
GitLab