From 8320480971cf705507c97b6ae46699fc143ff33d Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Tue, 9 Feb 2016 03:51:39 -0500 Subject: [PATCH] AntiSpam bypasses for friends and own objects should override the antispam master filter --- indra/newview/llviewermessage.cpp | 23 ++++++++++--------- .../en-us/panel_preferences_ascent_chat.xml | 6 ++--- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 1a97a3463..6c2d268b5 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1727,14 +1727,24 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& return false; } +bool has_spam_bypass(bool is_friend, bool is_owned_by_me) +{ + static LLCachedControl antispam_not_mine(gSavedSettings,"AntiSpamNotMine"); + static LLCachedControl antispam_not_friend(gSavedSettings,"AntiSpamNotFriend"); + return (antispam_not_mine && is_owned_by_me) || (antispam_not_friend && is_friend); +} + void script_msg_api(const std::string& msg); bool is_spam_filtered(const EInstantMessage& dialog, bool is_friend, bool is_owned_by_me) { - // First, check the master filter + // First, check that this doesn't bypass. + if (has_spam_bypass(is_friend, is_owned_by_me)) return false; + + // Second, check the master filter static LLCachedControl antispam(gSavedSettings,"_NACL_Antispam"); if (antispam) return true; - // Second, check if this dialog type is even being filtered + // Third, check if this dialog type is even being filtered switch(dialog) { case IM_GROUP_NOTICE: @@ -1768,15 +1778,6 @@ bool is_spam_filtered(const EInstantMessage& dialog, bool is_friend, bool is_own return false; } - // Third, possibly filtered, check the filter bypasses - static LLCachedControl antispam_not_mine(gSavedSettings,"AntiSpamNotMine"); - if (antispam_not_mine && is_owned_by_me) - return false; - - static LLCachedControl antispam_not_friend(gSavedSettings,"AntiSpamNotFriend"); - if (antispam_not_friend && is_friend) - return false; - // Last, definitely filter return true; } diff --git a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_chat.xml b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_chat.xml index a835181d3..7bfda2319 100644 --- a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_chat.xml +++ b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_chat.xml @@ -158,9 +158,9 @@ The following wildcards are available to enhance your autoresponses: #n for user - Except those from: - - + Except those from: + +