AntiSpam bypasses for friends and own objects should override the antispam master filter

This commit is contained in:
Lirusaito
2016-02-09 03:51:39 -05:00
parent 0e349736b7
commit 8320480971
2 changed files with 15 additions and 14 deletions

View File

@@ -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<bool> antispam_not_mine(gSavedSettings,"AntiSpamNotMine");
static LLCachedControl<bool> 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<bool> 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<bool> antispam_not_mine(gSavedSettings,"AntiSpamNotMine");
if (antispam_not_mine && is_owned_by_me)
return false;
static LLCachedControl<bool> antispam_not_friend(gSavedSettings,"AntiSpamNotFriend");
if (antispam_not_friend && is_friend)
return false;
// Last, definitely filter
return true;
}

View File

@@ -158,9 +158,9 @@ The following wildcards are available to enhance your autoresponses: #n for user
<check_box disabled_control="_NACL_Antispam" control_name="AntiSpamTeleports" height="16" label="Teleport Offers" name="Teleport Offers" bottom_delta="0" left_delta="120"/>
<check_box disabled_control="_NACL_Antispam" control_name="AntiSpamGroupNotices" height="16" label="Group Notices" name="Group Notices" bottom_delta="0" left_delta="120"/>
<check_box disabled_control="_NACL_Antispam" control_name="AntiSpamTeleportRequests" height="16" label="Teleport Requests" name="Teleport Requests" left="14" bottom_delta="-20"/>
<text disabled_control="_NACL_Antispam" name="Except those from:" left="21" bottom_delta="-10">Except those from:</text>
<check_box disabled_control="_NACL_Antispam" control_name="AntiSpamNotMine" height="16" label="My objects" name="My objects" left="25" bottom_delta="-23"/>
<check_box disabled_control="_NACL_Antispam" control_name="AntiSpamNotFriend" height="16" label="My friends" name="My friends" bottom_delta="0" left_delta="120"/>
<text name="Except those from:" left="21" bottom_delta="-10">Except those from:</text>
<check_box control_name="AntiSpamNotMine" height="16" label="My objects" name="My objects" left="25" bottom_delta="-23"/>
<check_box control_name="AntiSpamNotFriend" height="16" label="My friends" name="My friends" bottom_delta="0" left_delta="120"/>
<check_box control_name="EnableGestureSounds" label="Enable Gesture Sounds" name="Enable Gesture Sounds" left="3" bottom_delta="-20"/>
</panel>