From db643d1881196c01687b06130f26452cd2e04bac Mon Sep 17 00:00:00 2001
From: Jonathan Yap <none@none>
Date: Wed, 26 Oct 2011 11:21:01 -0400
Subject: STORM-1653 Group notices sent by muted residents are still displayed

---
 indra/newview/llviewermessage.cpp | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

(limited to 'indra/newview')

diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 74ee918bfe..fe613b3dc9 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -2241,6 +2241,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 	{
         name = LLTrans::getString("Unnamed");
 	}
+
+	// Preserve the unaltered name for use in group notice mute checking.
+	std::string original_name = name;
+
 	// IDEVO convert new-style "Resident" names for display
 	name = clean_name_from_im(name, dialog);
 
@@ -2447,6 +2451,17 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 				break;
 			}
 
+			// The group notice packet does not have an AgentID.  Try to obtain one from the name cache.
+			// If there is a cache miss and a background fetch has to occur the group notice may
+			// be displayed even though the resident has been muted.
+			std::string legacy_name = gCacheName->buildLegacyName(original_name);
+			LLUUID agent_id;
+			gCacheName->getUUID(legacy_name, agent_id);
+			if (agent_id.notNull() && LLMuteList::getInstance()->isMuted(agent_id))
+			{
+				break;
+			}
+
 			notice_bin_bucket = (struct notice_bucket_full_t*) &binary_bucket[0];
 			U8 has_inventory = notice_bin_bucket->header.has_inventory;
 			U8 asset_type = notice_bin_bucket->header.asset_type;
-- 
cgit v1.2.3