From 6d9c0fab8f2c19fa624e3c1f697ee9c7f08d9245 Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Fri, 11 May 2012 14:31:45 -0400
Subject: [PATCH] remove author tracking, non-wordstyle option, and
 notifications

---
 .../app_settings/settings_autoreplace.xml     | 18 -----
 indra/newview/llautoreplace.cpp               | 71 -------------------
 indra/newview/llautoreplace.h                 |  2 -
 indra/newview/llautoreplacefloater.cpp        |  5 --
 .../default/xui/en/floater_autoreplace.xml    | 63 +---------------
 .../skins/default/xui/en/notifications.xml    |  7 --
 6 files changed, 1 insertion(+), 165 deletions(-)

diff --git a/indra/newview/app_settings/settings_autoreplace.xml b/indra/newview/app_settings/settings_autoreplace.xml
index 4669ba58223..790cd62a02f 100644
--- a/indra/newview/app_settings/settings_autoreplace.xml
+++ b/indra/newview/app_settings/settings_autoreplace.xml
@@ -2,25 +2,15 @@
     <map>
     <key>Custom</key>
         <map>
-        <key>announce</key>
-            <integer>0</integer>
-        <key>author</key>
-            <string>You</string>
         <key>data</key>
             <map></map>
         <key>enabled</key>
             <integer>1</integer>
         <key>priority</key>
             <integer>10</integer>
-        <key>wordStyle</key>
-            <integer>1</integer>
         </map>
     <key>Abbreviations</key>
         <map>
-        <key>announce</key>
-            <integer>0</integer>
-        <key>author</key>
-            <string>Wulf / TankMaster</string>
         <key>data</key>
             <map>
             <key>afaic</key>
@@ -90,15 +80,9 @@
             <integer>1</integer>
         <key>priority</key>
             <integer>4</integer>
-        <key>wordStyle</key>
-            <integer>1</integer>
         </map>
     <key>Spelling Corrections</key>
         <map>
-        <key>announce</key>
-            <integer>0</integer>
-        <key>author</key>
-            <string>LordGregGreg / Wikipedia</string>
         <key>data</key>
             <map>
             <key>Amercia</key>
@@ -8362,8 +8346,6 @@
             <integer>1</integer>
         <key>priority</key>
             <integer>5</integer>
-        <key>wordStyle</key>
-            <integer>1</integer>
         </map>
     </map>
 </llsd>
diff --git a/indra/newview/llautoreplace.cpp b/indra/newview/llautoreplace.cpp
index a5683e41907..fa46f53e96d 100644
--- a/indra/newview/llautoreplace.cpp
+++ b/indra/newview/llautoreplace.cpp
@@ -137,8 +137,6 @@ LLSD AutoReplace::exportList(std::string listName)
 	{
 		toReturn["listName"]=listName;
 		toReturn["data"]=mAutoReplaces[listName]["data"];
-		toReturn["author"]=mAutoReplaces[listName]["author"];
-		toReturn["wordStyle"]=mAutoReplaces[listName]["wordStyle"];
 		toReturn["priority"]=mAutoReplaces[listName]["priority"];
 	}
 	return toReturn;
@@ -152,9 +150,6 @@ BOOL AutoReplace::addReplacementList(LLSD newList)
 		LLSD newPart;
 		newPart["data"]=newList["data"];
 		newPart["enabled"]=TRUE;
-		newPart["announce"]=FALSE;
-		newPart["author"]=newList["author"];
-		newPart["wordStyle"]=newList["wordStyle"];
 		newPart["priority"]=newList["priority"].asInteger();
 		llinfos << "adding new list with settings priority "<<newPart["priority"].asInteger() <<llendl;
 		mAutoReplaces[name]=newPart;
@@ -183,26 +178,6 @@ BOOL AutoReplace::setListEnabled(std::string listName, BOOL enabled)
 	
 	return FALSE;
 }
-BOOL AutoReplace::setListAnnounceeState(std::string listName, BOOL announce)
-{
-	
-
-	if(mAutoReplaces.has(listName))
-	{
-		mAutoReplaces[listName]["announce"]=announce;
-		return TRUE;
-	}
-	return FALSE;
-}
-BOOL AutoReplace::setListStyle(std::string listName, BOOL announce)
-{
-	if(mAutoReplaces.has(listName))
-	{
-		mAutoReplaces[listName]["wordStyle"]=announce;
-		return TRUE;
-	}
-	return FALSE;
-}
 BOOL AutoReplace::setListPriority(std::string listName, int priority)
 {
 	if(mAutoReplaces.has(listName))
@@ -214,7 +189,6 @@ BOOL AutoReplace::setListPriority(std::string listName, int priority)
 }
 LLSD AutoReplace::getAutoReplaces()
 {
-	//loadFromDisk();
 	return mAutoReplaces;
 }
 void AutoReplace::loadFromDisk()
@@ -308,39 +282,9 @@ std::string AutoReplace::replaceWord(std::string currentWord)
 			const LLSD& loc_map = (*loc_it).second;
 			if(loc_map["priority"].asInteger()==currentPriority)
 			{
-				if(!loc_map["wordStyle"].asBoolean())
-				{
-					//this means look for partial matches instead of a full word
-					if(loc_map["enabled"].asBoolean())
-					{
-						LLSD::map_const_iterator inner_it = loc_map["data"].beginMap();
-						LLSD::map_const_iterator inner_end = loc_map["data"].endMap();
-						for (; inner_it != inner_end; ++inner_it)
-						{
-							const std::string& wrong = (*inner_it).first;
-							const std::string& right = (*inner_it).second;
-							int location = currentWord.find(wrong);
-							if(location != std::string::npos)
-							{
-								currentWord=currentWord.replace(location,wrong.length(),right);
-							}
-						}
-					}
-
-				}else
 				if((loc_map["data"].has(currentWord))&&(loc_map["enabled"].asBoolean()))
 				{
 					std::string replacement = loc_map["data"][currentWord];
-					if(loc_map["announce"].asBoolean())
-					{
-						LLSD args; 
-						//"[Before]" has been auto replaced by "[Replacement]"
-						//	based on your [ListName] list.
-						args["BEFORE"] = currentWord;
-						args["LISTNAME"]=location;
-						args["REPLACEMENT"]=replacement;
-						LLNotificationsUtil::add("AutoReplace",args);
-					}
 					lldebugs << "found a word in list " << location.c_str() << " and it will replace  " << currentWord.c_str() << " => " << replacement.c_str() << llendl;
 					return replacement;
 				}
@@ -353,8 +297,6 @@ std::string AutoReplace::replaceWords(std::string words)
 {
 	static LLCachedControl<bool> perform_autoreplace(gSavedSettings, "AutoReplace");
 	if(!(perform_autoreplace))return words;
-	//*TODO update this function to use the "wordStyle" thing,
-	//but so far this function is never used, so later
 
 	boost_tokenizer tokens(words, boost::char_separator<char>(" "));
 	for (boost_tokenizer::iterator token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter)
@@ -369,16 +311,6 @@ std::string AutoReplace::replaceWords(std::string words)
 			if((loc_map["data"].has(currentWord))&&(loc_map["enabled"].asBoolean()))
 			{
 				std::string replacement = loc_map["data"][currentWord];
-				if(loc_map["announce"].asBoolean())
-				{
-					LLSD args; 
-					//"[Before]" has been auto replaced by "[Replacement]"
-					//	based on your [ListName] list.
-					args["BEFORE"] = currentWord;
-					args["LISTNAME"]=location;
-					args["REPLACEMENT"]=replacement;
-					LLNotificationsUtil::add("AutoReplace",args);
-				}
 				lldebugs << "found a word in list " << location.c_str() << " and it will replace  " << currentWord.c_str() << " => " << replacement.c_str() << llendl;
 				int wordStart = words.find(currentWord);
 				words.replace(wordStart,currentWord.length(),replacement);
@@ -399,12 +331,9 @@ BOOL AutoReplace::addEntryToList(std::string wrong, std::string right, std::stri
 	}
 	else if(listName == "Custom")
 	{
-		mAutoReplaces[listName]["announce"] = 0;
-		mAutoReplaces[listName]["author"] = "You";
 		mAutoReplaces[listName]["data"][wrong] = right;
 		mAutoReplaces[listName]["enabled"] = 1;
 		mAutoReplaces[listName]["priority"] = 10;
-		mAutoReplaces[listName]["wordStyle"] = 1;
 		return TRUE;
 	}
 		
diff --git a/indra/newview/llautoreplace.h b/indra/newview/llautoreplace.h
index b11c124a621..6c531d00407 100644
--- a/indra/newview/llautoreplace.h
+++ b/indra/newview/llautoreplace.h
@@ -33,9 +33,7 @@ class AutoReplace : public LLSingleton<AutoReplace>
 	BOOL addReplacementList(LLSD newList);
 	BOOL removeReplacementList(std::string listName);
 	BOOL setListEnabled(std::string listName, BOOL enabled);
-	BOOL setListAnnounceeState(std::string listName, BOOL announce);
 	BOOL setListPriority(std::string listName, int priority);
-	BOOL setListStyle(std::string listName, BOOL announce);
 	std::string replaceWords(std::string words);
 	std::string replaceWord(std::string currentWord);
 	BOOL addEntryToList(std::string wrong, std::string right, std::string listName);
diff --git a/indra/newview/llautoreplacefloater.cpp b/indra/newview/llautoreplacefloater.cpp
index 01950adb37f..ab299aeffe2 100644
--- a/indra/newview/llautoreplacefloater.cpp
+++ b/indra/newview/llautoreplacefloater.cpp
@@ -131,10 +131,7 @@ void AutoReplaceFloater::updateItemsList()
 	
 	LLSD listData = AutoReplace::getInstance()->getAutoReplaceEntries(listName);
 	childSetValue("ac_list_enabled",listData["enabled"].asBoolean());
-	childSetValue("ac_list_style",listData["wordStyle"].asBoolean());
-	childSetValue("ac_list_show",listData["announce"].asBoolean());
 	childSetValue("ac_text_name",listName);
-	childSetValue("ac_text_author",listData["author"]);
 	childSetValue("ac_priority",listData["priority"]);
 	
 	LLSD autoReplaces = listData["data"];
@@ -201,7 +198,6 @@ void AutoReplaceFloater::updateListControlsEnabled(BOOL selected)
 		childSetEnabled("ac_text1",selected);
 		childSetEnabled("ac_text2",selected);
 		childSetEnabled("ac_text_name",selected);
-		childSetEnabled("ac_text_author",selected);
 		childSetEnabled("ac_list_enabled",selected);
 		childSetEnabled("ac_list_show",selected);
 		childSetEnabled("ac_list_style",selected);
@@ -256,7 +252,6 @@ void AutoReplaceFloater::onEntrySettingChange(LLUICtrl* caller, void* user_data)
 		{
 			std::string listName= self->namesList->getFirstSelected()->getColumn(0)->getValue().asString();
 			AutoReplace::getInstance()->setListEnabled(listName,self->childGetValue("ac_list_enabled").asBoolean());
-			AutoReplace::getInstance()->setListAnnounceeState(listName,self->childGetValue("ac_list_show").asBoolean());
 			AutoReplace::getInstance()->setListStyle(listName,self->childGetValue("ac_list_style").asBoolean());
 			AutoReplace::getInstance()->setListPriority(listName,self->childGetValue("ac_priority").asInteger());
 
diff --git a/indra/newview/skins/default/xui/en/floater_autoreplace.xml b/indra/newview/skins/default/xui/en/floater_autoreplace.xml
index 5f53e61fa2a..f68aeacb974 100644
--- a/indra/newview/skins/default/xui/en/floater_autoreplace.xml
+++ b/indra/newview/skins/default/xui/en/floater_autoreplace.xml
@@ -126,39 +126,6 @@
    name="ac_text_name">
    List Name
   </text>
-  <text
-   bottom_delta="20"
-   left_delta="-2"
-   height="16"
-   width="40"
-   follows="left|top"
-   halign="center"
-   font="SansSerifSmall"
-   mouse_opaque="true"
-   name="ac_text2">
-   Author:
-  </text>
-  <view_border
-   bottom_delta="-0"
-   left_delta="42"
-   height="16"
-   width="140"
-   follows="left|top"
-   bevel_style="in"
-   mouse_opaque="false"
-   name="ac_box2"/>
-  <text
-   bottom_delta="0"
-   left_delta="0"
-   height="16"
-   width="140"
-   follows="left|top"
-   halign="center"
-   font="SansSerifSmall"
-   mouse_opaque="true"
-   name="ac_text_author">
-   Author Name
-  </text>
   <check_box
    bottom_delta="20"
    left_delta="-32"
@@ -188,34 +155,6 @@
    label_width="0"
    name="ac_priority"
    tool_tip="This number determine what order your list will be used to replace words.  A higher priority means it will be used before lower priority lists."/>
-  <check_box
-   bottom_delta="20"
-   left_delta="-120"
-   height="16"
-   width="100"
-   enabled="true"
-   follows="left|top"
-   font="SansSerifSmall"
-   mouse_opaque="true"
-   radio_style="false"
-   label="Show Notifications"
-   control_name="ac_list_show"
-   name="ac_list_show"
-   tool_tip="Having this enabled will make a notification pop up every time a word is replaced."/>
-  <check_box
-   bottom_delta="20"
-   left_delta="-0"
-   height="16"
-   width="100"
-   enabled="true"
-   follows="left|top"
-   font="SansSerifSmall"
-   mouse_opaque="true"
-   radio_style="false"
-   label="Word Style"
-   control_name="ac_list_style"
-   name="ac_list_style"
-   tool_tip="Having this checked means the list is for full words that should be replaced, unchecked means that it will look within words contents as well."/>
   <button
    top="100"
    left="5"
@@ -279,7 +218,7 @@
    left="10"
    top="450"
    width="364">
-   Original text:
+   Keyword:
   </text>
   <line_editor
    follows="left|top"
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 5680c6e676e..afc5b916e77 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -6763,13 +6763,6 @@ One or more of your Voice Morphs will expire in less than [INTERVAL] days.
     <tag>voice</tag>
   </notification>
 
-  <notification
-     icon="notifytip.tga"
-     name="AutoReplace"
-     type="notifytip">
-    &apos;[BEFORE]&apos; has been auto replaced by &apos;[REPLACEMENT]&apos;
-    based on your [LISTNAME] list.
-  </notification>
   <notification
    icon="notify.tga"
    name="VoiceEffectsNew"
-- 
GitLab