From 71b0c35653cfdc19bc89bb0d2bd03e09c69fb4ec Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Thu, 23 Aug 2012 00:12:09 -0400 Subject: [PATCH] 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... --- indra/newview/NACLantispam.cpp | 16 +++++++----- indra/newview/app_settings/settings.xml | 15 +++++++++-- indra/newview/ascentprefschat.cpp | 26 +++++++++++++++++++ indra/newview/ascentprefschat.h | 2 ++ .../en-us/panel_preferences_ascent_chat.xml | 13 +++++----- 5 files changed, 58 insertions(+), 14 deletions(-) diff --git a/indra/newview/NACLantispam.cpp b/indra/newview/NACLantispam.cpp index aac555a50..cabd47ed0 100644 --- a/indra/newview/NACLantispam.cpp +++ b/indra/newview/NACLantispam.cpp @@ -111,6 +111,8 @@ void NACLAntiSpamQueue::blockEntry(LLUUID& source) } int NACLAntiSpamQueue::checkEntry(LLUUID& name, U32 multiplier) { + static LLCachedControl 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 enabled(gSavedSettings,"AntiSpamEnabled",false); + if(!enabled) return 0; it2=globalEntries.find(name.asString()); if(it2 != globalEntries.end()) { diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index dfa1375a2..36279ab1f 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -930,6 +930,17 @@ Value 0 + AntiSpamEnabled + + Comment + When false, antispam, not relating to dialog blocking, will be turned off. + Persist + 1 + Type + Boolean + Value + 0 + AntiSpamFriendshipOffers Comment @@ -1060,7 +1071,7 @@ Type U32 Value - 20 + 100 _NACL_AntiSpamNewlines @@ -1082,7 +1093,7 @@ Type U32 Value - 20 + 100 AgentChatColor diff --git a/indra/newview/ascentprefschat.cpp b/indra/newview/ascentprefschat.cpp index 5960024bd..d368e07a8 100644 --- a/indra/newview/ascentprefschat.cpp +++ b/indra/newview/ascentprefschat.cpp @@ -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); diff --git a/indra/newview/ascentprefschat.h b/indra/newview/ascentprefschat.h index 936646164..661ddc4f6 100644 --- a/indra/newview/ascentprefschat.h +++ b/indra/newview/ascentprefschat.h @@ -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; 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 439d12eec..64e739716 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 @@ -68,23 +68,24 @@ - +