AntiSpam improvements: Less sensitive defaults for sound multi's and an off switch.

Polished the Spam tab a bit...
Also, slightly better errors for antispam bugs... Which Ruby neglected to take from me...
This commit is contained in:
Lirusaito
2012-08-23 00:12:09 -04:00
parent 6eadc29ca0
commit 71b0c35653
5 changed files with 58 additions and 14 deletions

View File

@@ -111,6 +111,8 @@ void NACLAntiSpamQueue::blockEntry(LLUUID& source)
}
int NACLAntiSpamQueue::checkEntry(LLUUID& name, U32 multiplier)
{
static LLCachedControl<bool> enabled(gSavedSettings,"AntiSpamEnabled",false);
if(!enabled) return 0;
it=entries.find(name.asString());
if(it != entries.end())
{
@@ -200,7 +202,7 @@ void NACLAntiSpamRegistry::setRegisteredQueueTime(U32 name, U32 time)
{
if(name >= QUEUE_MAX || queues[name] == 0)
{
LL_ERRS("AntiSpam") << "CODE BUG: Attempting to use a antispam queue that was not created or was outside of the reasonable range of queues. Queue: " << getQueueName(name) << llendl;
LL_ERRS("AntiSpam") << "CODE BUG: Attempting to set time of antispam queue that was outside of the reasonable range of queues or not created. Queue: " << getQueueName(name) << llendl;
return;
}
@@ -210,7 +212,7 @@ void NACLAntiSpamRegistry::setRegisteredQueueAmount(U32 name, U32 amount)
{
if(name >= QUEUE_MAX || queues[name] == 0)
{
LL_ERRS("AntiSpam") << "CODE BUG: Attempting to use a antispam queue that was not created or was outside of the reasonable range of queues. Queue: " << getQueueName(name) << llendl;
LL_ERRS("AntiSpam") << "CODE BUG: Attempting to set amount for antispam queue that was outside of the reasonable range of queues or not created. Queue: " << getQueueName(name) << llendl;
return;
}
@@ -237,7 +239,7 @@ void NACLAntiSpamRegistry::clearRegisteredQueue(U32 name)
{
if(name >= QUEUE_MAX || queues[name] == 0)
{
LL_ERRS("AntiSpam") << "CODE BUG: Attempting to use a antispam queue that was not created or was outside of the reasonable range of queues. Queue: " << getQueueName(name) << llendl;
LL_ERRS("AntiSpam") << "CODE BUG: Attempting to clear antispam queue that was outside of the reasonable range of queues or not created. Queue: " << getQueueName(name) << llendl;
return;
}
@@ -247,7 +249,7 @@ void NACLAntiSpamRegistry::purgeRegisteredQueue(U32 name)
{
if(name >= QUEUE_MAX || queues[name] == 0)
{
LL_ERRS("AntiSpam") << "CODE BUG: Attempting to use a antispam queue that was not created or was outside of the reasonable range of queues. Queue: " << getQueueName(name) << llendl;
LL_ERRS("AntiSpam") << "CODE BUG: Attempting to purge antispam queue that was outside of the reasonable range of queues or not created. Queue: " << getQueueName(name) << llendl;
return;
}
@@ -263,7 +265,7 @@ void NACLAntiSpamRegistry::blockOnQueue(U32 name, LLUUID& source)
{
if(name >= QUEUE_MAX || queues[name] == 0)
{
LL_ERRS("AntiSpam") << "CODE BUG: Attempting to use a antispam queue that was not created or was outside of the reasonable range of queues. Queue: " << getQueueName(name) << llendl;
LL_ERRS("AntiSpam") << "CODE BUG: Attempting to use a antispam queue that was outside of the reasonable range of queues or not created. Queue: " << getQueueName(name) << llendl;
return;
}
queues[name]->blockEntry(source);
@@ -295,7 +297,7 @@ bool NACLAntiSpamRegistry::checkQueue(U32 name, LLUUID& source, U32 multiplier)
{
if(name >= QUEUE_MAX || queues[name] == 0)
{
LL_ERRS("AntiSpam") << "CODE BUG: Attempting to use a antispam queue that was not created or was outside of the reasonable range of queues. Queue: " << getQueueName(name) << llendl;
LL_ERRS("AntiSpam") << "CODE BUG: Attempting to check antispam queue that was outside of the reasonable range of queues or not created. Queue: " << getQueueName(name) << llendl;
return false;
}
result=queues[name]->checkEntry(source,multiplier);
@@ -356,6 +358,8 @@ void NACLAntiSpamRegistry::purgeAllQueues()
}
int NACLAntiSpamRegistry::checkGlobalEntry(LLUUID& name, U32 multiplier)
{
static LLCachedControl<bool> enabled(gSavedSettings,"AntiSpamEnabled",false);
if(!enabled) return 0;
it2=globalEntries.find(name.asString());
if(it2 != globalEntries.end())
{

View File

@@ -930,6 +930,17 @@
<key>Value</key>
<integer>0</integer>
</map>
<key>AntiSpamEnabled</key>
<map>
<key>Comment</key>
<string>When false, antispam, not relating to dialog blocking, will be turned off.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>AntiSpamFriendshipOffers</key>
<map>
<key>Comment</key>
@@ -1060,7 +1071,7 @@
<key>Type</key>
<string>U32</string>
<key>Value</key>
<integer>20</integer>
<integer>100</integer>
</map>
<key>_NACL_AntiSpamNewlines</key>
<map>
@@ -1082,7 +1093,7 @@
<key>Type</key>
<string>U32</string>
<key>Value</key>
<integer>20</integer>
<integer>100</integer>
</map>
<!-- Vanilla SL settings that are now optionally Account-Specific -->
<key>AgentChatColor</key>

View File

@@ -96,6 +96,7 @@ LLPrefsAscentChat::LLPrefsAscentChat()
childSetEnabled("reset_antispam", started);
childSetCommitCallback("reset_antispam", onCommitResetAS, this);
childSetCommitCallback("enable_as", onCommitEnableAS, this);
childSetCommitCallback("antispam_checkbox", onCommitDialogBlock, this);
childSetCommitCallback("KeywordsOn", onCommitKeywords, this);
@@ -250,6 +251,20 @@ void LLPrefsAscentChat::onCommitResetAS(LLUICtrl*, void*)
NACLAntiSpamRegistry::purgeAllQueues();
}
//static
void LLPrefsAscentChat::onCommitEnableAS(LLUICtrl* ctrl, void* user_data)
{
LLPrefsAscentChat* self = (LLPrefsAscentChat*)user_data;
bool enabled = ctrl->getValue().asBoolean();
self->childSetEnabled("spammsg_checkbox", enabled);
self->childSetEnabled("antispamtime", enabled);
self->childSetEnabled("antispamamount", enabled);
self->childSetEnabled("antispamsoundmulti", enabled);
self->childSetEnabled("antispamsoundpreloadmulti", enabled);
self->childSetEnabled("antispamnewlines", enabled);
self->childSetEnabled("Notify On Spam", enabled);
}
//static
void LLPrefsAscentChat::onCommitDialogBlock(LLUICtrl* ctrl, void* user_data)
{
@@ -344,6 +359,7 @@ void LLPrefsAscentChat::refreshValues()
mIMResponseText = gSavedPerAccountSettings.getString("AscentInstantMessageResponse");
//Spam --------------------------------------------------------------------------------
mEnableAS = gSavedSettings.getBOOL("AntiSpamEnabled");
mGlobalQueue = gSavedSettings.getBOOL("_NACL_AntiSpamGlobalQueue");
mChatSpamCount = gSavedSettings.getU32("_NACL_AntiSpamAmount");
mChatSpamTime = gSavedSettings.getU32("_NACL_AntiSpamTime");
@@ -404,6 +420,15 @@ void LLPrefsAscentChat::refresh()
childSetText("im_response", wstring_to_utf8str(auto_response));
//Antispam ------------------------------------------------------------------------
// sensitivity tuners
childSetEnabled("spammsg_checkbox", mEnableAS);
childSetEnabled("antispamtime", mEnableAS);
childSetEnabled("antispamamount", mEnableAS);
childSetEnabled("antispamsoundmulti", mEnableAS);
childSetEnabled("antispamsoundpreloadmulti", mEnableAS);
childSetEnabled("antispamnewlines", mEnableAS);
childSetEnabled("Notify On Spam", mEnableAS);
// dialog blocking tuners
childSetEnabled("Block All Dialogs From", !mBlockDialogSpam);
childSetEnabled("Alerts", !mBlockDialogSpam);
childSetEnabled("Friendship Offers", !mBlockDialogSpam);
@@ -549,6 +574,7 @@ void LLPrefsAscentChat::cancel()
gSavedPerAccountSettings.setString("AscentInstantMessageResponse", mIMResponseText);
//Spam --------------------------------------------------------------------------------
gSavedSettings.setBOOL("AntiSpamEnabled", mEnableAS);
gSavedSettings.setBOOL("_NACL_AntiSpamGlobalQueue", mGlobalQueue);
gSavedSettings.setU32("_NACL_AntiSpamAmount", mChatSpamCount);
gSavedSettings.setU32("_NACL_AntiSpamTime", mChatSpamTime);

View File

@@ -57,6 +57,7 @@ protected:
static void onCommitTimeDate(LLUICtrl* ctrl, void *userdata);
static void onCommitAutoResponse(LLUICtrl* ctrl, void* user_data);
static void onCommitResetAS(LLUICtrl*,void*);
static void onCommitEnableAS(LLUICtrl*, void*);
static void onCommitDialogBlock(LLUICtrl*, void*);
static void onCommitKeywords(LLUICtrl* ctrl, void* user_data);
@@ -86,6 +87,7 @@ protected:
std::string mIMResponseText;
//Spam --------------------------------------------------------------------------------
BOOL mEnableAS;
BOOL mGlobalQueue;
U32 mChatSpamCount;
U32 mChatSpamTime;

View File

@@ -68,23 +68,24 @@
</panel>
<panel border="true" left="1" bottom="-408" height="408" width="500" label="Spam" name="Spam">
<check_box control_name="_NACL_AntiSpamGlobalQueue" label="No messagetype-specific spam queues" name="spammsg_checkbox" width="256" left="6"/>
<check_box control_name="AntiSpamEnabled" label="Enable Antispam" name="enable_as" width="256" left="3"/>
<button height="23" label="Reset antispam queues" label_selected="Reset antispam queues" name="reset_antispam" width="230" bottom_delta="0" left="260"/>
<spinner control_name="_NACL_AntiSpamTime" decimal_digits="0" increment="1" min_val="0" max_val="60" label="Antispam time(seconds):" label_width="330" tool_tip="Lower is less sensitive, 0 will turn off Antispam, but not Dialog Blocking." name="antispamtime" width="390" left="10"/>
<check_box control_name="_NACL_AntiSpamGlobalQueue" label="No messagetype-specific spam queues" name="spammsg_checkbox" width="256" left="6" bottom_delta="-20"/>
<spinner control_name="_NACL_AntiSpamTime" decimal_digits="0" increment="1" min_val="1" max_val="60" label="Antispam time(seconds):" label_width="330" tool_tip="Lower is less sensitive" name="antispamtime" width="390" left="10" bottom_delta="-10"/>
<spinner control_name="_NACL_AntiSpamAmount" decimal_digits="0" increment="1" min_val="5" max_val="99999" label="Antispam amount:" label_width="330" tool_tip="Higher is less sensitive" name="antispamamount" width="390"/>
<spinner control_name="_NACL_AntiSpamSoundMulti" decimal_digits="0" increment="1" min_val="1" max_val="99999" label="Amount multiplicatior for sound antispam:" label_width="330" tool_tip="Higher is less sensitive" left="10" name="antispamsoundmulti" width="390"/>
<spinner control_name="_NACL_AntiSpamSoundPreloadMulti" decimal_digits="0" increment="1" min_val="1" max_val="99999" label="Amount multiplicatior for sound preload antispam:" label_width="330" tool_tip="Higher is less sensitive" name="antispamsoundpreloadmulti" width="390"/>
<spinner control_name="_NACL_AntiSpamNewlines" decimal_digits="0" increment="1" min_val="5" max_val="99999" label="Amount of newlines to instablock message:" label_width="330" tool_tip="Higher is less sensitive" name="antispamnewlines" width="390"/>
<check_box control_name="_NACL_Antispam" height="16" label="Disable -all- dialogs (resets on login)" name="antispam_checkbox" left="6"/>
<text name="Block All Dialogs From" left="10">Block All Dialogs From</text>
<check_box control_name="AntiSpamAlerts" height="16" label="Alerts" name="Alerts" left="14"/>
<check_box control_name="AntiSpamNotify" height="16" label="Notify when spam is blocked" name="Notify On Spam" tool_tip="When enabled, the bottom right corner may become a source of pseudo-spam whenever real spam is blocked." left="6" bottom_delta="-22"/>
<check_box control_name="_NACL_Antispam" height="16" label="Disable -all- dialogs (resets on login)" name="antispam_checkbox" left="3"/>
<text name="Block All Dialogs From" left="10" bottom_delta="-10">Block All Dialogs From</text>
<check_box control_name="AntiSpamAlerts" height="16" label="Alerts" name="Alerts" left="14" bottom_delta="-23"/>
<check_box control_name="AntiSpamFriendshipOffers" height="16" label="Friendship Offers" name="Friendship Offers" bottom_delta="0" left_delta="120"/>
<check_box control_name="AntiSpamGroupInvites" height="16" label="Group Invites" name="Group Invites" bottom_delta="0" left_delta="120"/>
<check_box control_name="AntiSpamGroupNotices" height="16" label="Group Notices" name="Group Notices" bottom_delta="0" left_delta="120"/>
<check_box control_name="AntiSpamItemOffers" height="16" label="Item Offers" name="Item Offers" left="14"/>
<check_box control_name="AntiSpamScripts" height="16" label="Scripts" name="Scripts" bottom_delta="0" left_delta="120"/>
<check_box control_name="AntiSpamTeleports" height="16" label="Teleport Offers" name="Teleport Offers" bottom_delta="0" left_delta="120"/>
<check_box control_name="AntiSpamNotify" height="16" label="Notify when spam is blocked" name="Notify On Spam" tool_tip="When enabled, the bottom right corner may become a source of pseudo-spam whenever real spam is blocked." left="6"/>
</panel>
<panel border="true" bottom="-580" height="525" label="Text Options" left="1" name="TextOptions" width="418">