From 5828d061144fe1d15580dc6f9e00d7dcf93456ea Mon Sep 17 00:00:00 2001
From: Mnikolenko Productengine <mnikolenko@productengine.com>
Date: Wed, 26 Oct 2016 15:10:40 +0300
Subject: SL-448 Implement a limit to block list

---
 indra/newview/app_settings/settings.xml              | 11 +++++++++++
 indra/newview/llmutelist.cpp                         | 11 +++++++++++
 indra/newview/skins/default/xui/en/notifications.xml | 11 ++++++++++-
 3 files changed, 32 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 8836ed0e5e..c6347c3f65 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -6617,6 +6617,17 @@
       <string>Boolean</string>
       <key>Value</key>
       <integer>0</integer>
+    </map>
+    <key>MuteListLimit</key>
+    <map>
+      <key>Comment</key>
+      <string>Maximum number of entries in the mute list</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>1000</integer>
     </map>
 	<key>MyOutfitsAutofill</key>
 	<map>
diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp
index 01cf68bcda..84cf7d0313 100644
--- a/indra/newview/llmutelist.cpp
+++ b/indra/newview/llmutelist.cpp
@@ -56,6 +56,7 @@
 #include "llworld.h" //for particle system banning
 #include "llimview.h"
 #include "llnotifications.h"
+#include "llviewercontrol.h"
 #include "llviewerobjectlist.h"
 #include "lltrans.h"
 
@@ -231,6 +232,16 @@ BOOL LLMuteList::add(const LLMute& mute, U32 flags)
 		return FALSE;
 	}
 	
+	S32 mute_list_limit = gSavedSettings.getS32("MuteListLimit");
+	if (getMutes().size() >= mute_list_limit)
+	{
+		LL_WARNS() << "Mute limit is reached; ignored" << LL_ENDL;
+		LLSD args;
+		args["MUTE_LIMIT"] = mute_list_limit;
+		LLNotifications::instance().add(LLNotification::Params("MuteLimitReached").substitutions(args));
+		return FALSE;
+	}
+
 	if (mute.mType == LLMute::BY_NAME)
 	{		
 		// Can't mute empty string by name
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 65ab3f001f..db90e6a163 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -1886,7 +1886,16 @@ Go to [_URL] for information on purchasing L$?
      notext="Cancel"
      yestext="OK"/>
   </notification>
-
+  
+  <notification
+   icon="alertmodal.tga"
+   name="MuteLimitReached"
+   persist="false"
+   type="notify">
+Unable to add new entry to block list because you reached the limit of [MUTE_LIMIT] entries.
+  <tag>fail</tag>
+  </notification>
+  
   <notification
    icon="alertmodal.tga"
    name="UnableToLinkObjects"
-- 
cgit v1.2.3