From 3190814265ac7b38eb4aedbe1a8d006c0f13135b Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Wed, 25 Jul 2012 09:03:41 -0400 Subject: [PATCH 01/26] Made AntiSpam better AntiSpamNotify setting to turn off notifications, which seemed to become a new form of spam, otherwise. Add tool_tips to UI explaining how to make the system less sensitive. Made defaults for antispam a lot less sensitive, so users used to the old antispam defaults won't likely need to configure the new panel. Pull in license from NaCl... (Why wasn't it already there, Ruby?!) Fixed spaces being where tabs should be... Added in selective Dialog disabling, instead of just all, nice little feature in itself. Potentially fixed a bug where sounds would be blocked when they shouldn't be... but, if this still happens, I'll put in a debug setting to disable sound antispam. --- indra/newview/NACLantispam.cpp | 19 +- indra/newview/NACLantispam.h | 18 +- indra/newview/app_settings/settings.xml | 106 +++++++- indra/newview/ascentprefschat.cpp | 42 ++++ indra/newview/ascentprefschat.h | 9 + indra/newview/llviewermessage.cpp | 227 +++++++++--------- .../en-us/panel_preferences_ascent_chat.xml | 25 +- 7 files changed, 311 insertions(+), 135 deletions(-) diff --git a/indra/newview/NACLantispam.cpp b/indra/newview/NACLantispam.cpp index 95aad581b..aac555a50 100644 --- a/indra/newview/NACLantispam.cpp +++ b/indra/newview/NACLantispam.cpp @@ -1,3 +1,18 @@ +/* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + * Version 2, December 2004 + * + * Copyright (C) 2004 Sam Hocevar + * + * Everyone is permitted to copy and distribute verbatim or modified + * copies of this license document, and changing it is allowed as long + * as the name is changed. + * + * DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + * TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + * + * 0. You just DO WHAT THE FUCK YOU WANT TO. + */ + #include "llviewerprecompiledheaders.h" #include "NACLantispam.h" #include "llviewercontrol.h" @@ -263,7 +278,7 @@ void NACLAntiSpamRegistry::blockGlobalEntry(LLUUID& source) } globalEntries[source.asString()]->setBlocked(); } -bool NACLAntiSpamRegistry::checkQueue(U32 name, LLUUID& source, U32 multiplier, bool silent) +bool NACLAntiSpamRegistry::checkQueue(U32 name, LLUUID& source, U32 multiplier) { if(source.isNull()) return false; if(gAgent.getID() == source) return false; @@ -295,7 +310,7 @@ bool NACLAntiSpamRegistry::checkQueue(U32 name, LLUUID& source, U32 multiplier, } else { - if(!silent) + if(gSavedSettings.getBOOL("AntiSpamNotify")) { LLSD args; args["MESSAGE"] = std::string(getQueueName(name))+": Blocked object "+source.asString(); diff --git a/indra/newview/NACLantispam.h b/indra/newview/NACLantispam.h index 2f65fc423..6da32f5c1 100644 --- a/indra/newview/NACLantispam.h +++ b/indra/newview/NACLantispam.h @@ -1,3 +1,18 @@ +/* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + * Version 2, December 2004 + * + * Copyright (C) 2004 Sam Hocevar + * + * Everyone is permitted to copy and distribute verbatim or modified + * copies of this license document, and changing it is allowed as long + * as the name is changed. + * + * DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + * TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + * + * 0. You just DO WHAT THE FUCK YOU WANT TO. + */ + #ifndef NACLANTISPAM_H #define NACLANTISPAM_H #include @@ -48,7 +63,7 @@ public: static void setRegisteredQueueAmount(U32 name,U32 amount); static void setAllQueueTimes(U32 amount); static void setAllQueueAmounts(U32 time); - static bool checkQueue(U32 name, LLUUID& source, U32 multiplier=1, bool silent=false); + static bool checkQueue(U32 name, LLUUID& source, U32 multiplier=1); static bool handleNaclAntiSpamGlobalQueueChanged(const LLSD& newvalue); static bool handleNaclAntiSpamTimeChanged(const LLSD& newvalue); static bool handleNaclAntiSpamAmountChanged(const LLSD& newvalue); @@ -86,7 +101,6 @@ private: static void blockGlobalEntry(LLUUID& source); }; - extern const std::string COLLISION_SOUNDS[]; extern const int COLLISION_SOUNDS_SIZE; diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 54f1e1402..92f6f1eaf 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -894,7 +894,95 @@ Value 1 - _NACL_Antispam + AntiSpamAlerts + + Comment + When true, dialogs from alerts will be blocked. + Persist + 1 + Type + Boolean + Value + 0 + + AntiSpamFriendshipOffers + + Comment + When true, dialogs from friendship requests will be blocked. + Persist + 1 + Type + Boolean + Value + 0 + + AntiSpamGroupInvites + + Comment + When true, dialogs from group invites will be blocked. + Persist + 1 + Type + Boolean + Value + 0 + + AntiSpamGroupNotices + + Comment + When true, dialogs from group notices will be blocked. + Persist + 1 + Type + Boolean + Value + 0 + + AntiSpamItemOffers + + Comment + When true, dialogs from inventory item offers will be blocked. + Persist + 1 + Type + Boolean + Value + 0 + + AntiSpamNotify + + Comment + When true, notifications will appear any time a spamtype is blocked. + Persist + 1 + Type + Boolean + Value + 1 + + AntiSpamScripts + + Comment + When true, dialogs from scripts, including script-driven teleports and questions, and other interactive script stuff, will be blocked. + Persist + 1 + Type + Boolean + Value + 0 + + AntiSpamTeleports + + Comment + When true, dialogs from teleport requests from other residents will be blocked. + Persist + 1 + Type + Boolean + Value + 0 + + _NACL_Antispam Comment When true, all dialogs will be blocked, resets on restart. @@ -908,7 +996,7 @@ _NACL_AntiSpamGlobalQueue Comment - + Collect spamtypes together, instead of individually counting them Persist 1 Type @@ -919,24 +1007,24 @@ _NACL_AntiSpamTime Comment - + Time in seconds for spamtype to accumulate the _NACL_AntiSpamAmount and be blocked Persist 1 Type U32 Value - 2 + 1 _NACL_AntiSpamAmount Comment - + Amount of spamtype to be reached before the blocking will occur. Persist 1 Type U32 Value - 10 + 30 _NACL_AntiSpamSoundMulti @@ -947,7 +1035,7 @@ Type U32 Value - 4 + 20 _NACL_AntiSpamNewlines @@ -958,7 +1046,7 @@ Type U32 Value - 30 + 20 _NACL_AntiSpamSoundPreloadMulti @@ -969,7 +1057,7 @@ Type U32 Value - 4 + 20 AgentChatColor diff --git a/indra/newview/ascentprefschat.cpp b/indra/newview/ascentprefschat.cpp index 29e5d3ff0..77bc6611e 100644 --- a/indra/newview/ascentprefschat.cpp +++ b/indra/newview/ascentprefschat.cpp @@ -95,6 +95,7 @@ LLPrefsAscentChat::LLPrefsAscentChat() childSetEnabled("reset_antispam", started); childSetCommitCallback("reset_antispam", onCommitResetAS, this); + childSetCommitCallback("antispam_checkbox", onCommitDialogBlock, this); childSetCommitCallback("KeywordsOn", onCommitKeywords, this); childSetCommitCallback("KeywordsList", onCommitKeywords, this); @@ -248,6 +249,21 @@ void LLPrefsAscentChat::onCommitResetAS(LLUICtrl*, void*) NACLAntiSpamRegistry::purgeAllQueues(); } +//static +void LLPrefsAscentChat::onCommitDialogBlock(LLUICtrl* ctrl, void* user_data) +{ + LLPrefsAscentChat* self = (LLPrefsAscentChat*)user_data; + bool enabled = ctrl->getValue().asBoolean(); + self->childSetEnabled("Block All Dialogs From", !enabled); + self->childSetEnabled("Alerts", !enabled); + self->childSetEnabled("Friendship Offers", !enabled); + self->childSetEnabled("Group Invites", !enabled); + self->childSetEnabled("Group Notices", !enabled); + self->childSetEnabled("Item Offers", !enabled); + self->childSetEnabled("Scripts", !enabled); + self->childSetEnabled("Teleport Offers", !enabled); +} + //static void LLPrefsAscentChat::onCommitKeywords(LLUICtrl* ctrl, void* user_data) { @@ -331,6 +347,14 @@ void LLPrefsAscentChat::refreshValues() mChatSpamCount = gSavedSettings.getU32("_NACL_AntiSpamAmount"); mChatSpamTime = gSavedSettings.getU32("_NACL_AntiSpamTime"); mBlockDialogSpam = gSavedSettings.getBOOL("_NACL_Antispam"); + mBlockAlertSpam = gSavedSettings.getBOOL("AntiSpamAlerts"); + mBlockFriendSpam = gSavedSettings.getBOOL("AntiSpamFriendshipOffers"); + mBlockGroupInviteSpam = gSavedSettings.getBOOL("AntiSpamGroupInvites"); + mBlockGroupNoticeSpam = gSavedSettings.getBOOL("AntiSpamGroupNotices"); + mBlockItemOfferSpam = gSavedSettings.getBOOL("AntiSpamItemOffers"); + mBlockScriptSpam = gSavedSettings.getBOOL("AntiSpamScripts"); + mBlockTeleportSpam = gSavedSettings.getBOOL("AntiSpamTeleports"); + mNotifyOnSpam = gSavedSettings.getBOOL("AntiSpamNotify"); mSoundMulti = gSavedSettings.getU32("_NACL_AntiSpamSoundMulti"); mNewLines = gSavedSettings.getU32("_NACL_AntiSpamNewlines"); mPreloadMulti = gSavedSettings.getU32("_NACL_AntiSpamSoundPreloadMulti"); @@ -378,6 +402,16 @@ void LLPrefsAscentChat::refresh() LLWStringUtil::replaceChar(auto_response, '%', ' '); childSetText("im_response", wstring_to_utf8str(auto_response)); + //Antispam ------------------------------------------------------------------------ + childSetEnabled("Block All Dialogs From", !mBlockDialogSpam); + childSetEnabled("Alerts", !mBlockDialogSpam); + childSetEnabled("Friendship Offers", !mBlockDialogSpam); + childSetEnabled("Group Invites", !mBlockDialogSpam); + childSetEnabled("Group Notices", !mBlockDialogSpam); + childSetEnabled("Item Offers", !mBlockDialogSpam); + childSetEnabled("Scripts", !mBlockDialogSpam); + childSetEnabled("Teleport Offers", !mBlockDialogSpam); + //Text Options ------------------------------------------------------------------------ combo = getChild("SpellBase"); @@ -518,6 +552,14 @@ void LLPrefsAscentChat::cancel() gSavedSettings.setU32("_NACL_AntiSpamAmount", mChatSpamCount); gSavedSettings.setU32("_NACL_AntiSpamTime", mChatSpamTime); gSavedSettings.setBOOL("_NACL_Antispam", mBlockDialogSpam); + gSavedSettings.setBOOL("AntiSpamAlerts", mBlockAlertSpam); + gSavedSettings.setBOOL("AntiSpamFriendshipOffers", mBlockFriendSpam); + gSavedSettings.setBOOL("AntiSpamGroupNotices", mBlockGroupNoticeSpam); + gSavedSettings.setBOOL("AntiSpamGroupInvites", mBlockGroupInviteSpam); + gSavedSettings.setBOOL("AntiSpamItemOffers", mBlockItemOfferSpam); + gSavedSettings.setBOOL("AntiSpamScripts", mBlockScriptSpam); + gSavedSettings.setBOOL("AntiSpamTeleports", mBlockTeleportSpam); + gSavedSettings.setBOOL("AntiSpamNotify", mNotifyOnSpam); gSavedSettings.setU32("_NACL_AntiSpamSoundMulti", mSoundMulti); gSavedSettings.setU32("_NACL_AntiSpamNewlines", mNewLines); gSavedSettings.setU32("_NACL_AntiSpamSoundPreloadMulti", mPreloadMulti); diff --git a/indra/newview/ascentprefschat.h b/indra/newview/ascentprefschat.h index d83b5b2d9..936646164 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 onCommitDialogBlock(LLUICtrl*, void*); static void onCommitKeywords(LLUICtrl* ctrl, void* user_data); //Chat/IM ----------------------------------------------------------------------------- @@ -89,6 +90,14 @@ protected: U32 mChatSpamCount; U32 mChatSpamTime; BOOL mBlockDialogSpam; + BOOL mBlockAlertSpam; + BOOL mBlockFriendSpam; + BOOL mBlockGroupNoticeSpam; + BOOL mBlockGroupInviteSpam; + BOOL mBlockItemOfferSpam; + BOOL mBlockScriptSpam; + BOOL mBlockTeleportSpam; + BOOL mNotifyOnSpam; BOOL mSoundMulti; U32 mNewLines; U32 mPreloadMulti; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index f4f21f113..414c4bff2 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1638,7 +1638,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& void inventory_offer_handler(LLOfferInfo* info, BOOL from_task) { - //Until throttling is implmented, busy mode should reject inventory instead of silently + //Until throttling is implemented, busy mode should reject inventory instead of silently //accepting it. SEE SL-39554 if (gAgent.getBusy()) { @@ -1648,7 +1648,7 @@ void inventory_offer_handler(LLOfferInfo* info, BOOL from_task) // NaCl - Antispam Registry static LLCachedControl antispam(gSavedSettings,"_NACL_Antispam"); - if(antispam || NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_INVENTORY,info->mFromID)) + if(antispam || gSavedSettings.getBOOL("AntiSpamItemOffers") || NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_INVENTORY,info->mFromID)) return; // NaCl End //If muted, don't even go through the messaging stuff. Just curtail the offer here. @@ -1933,24 +1933,27 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) //msg->getData("MessageBlock", "Count", &count); msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_FromAgentName, name); msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_Message, message); - // NaCl - Newline flood protection - LLViewerObject* obj=gObjectList.findObject(from_id); - if(!from_id.isNull() //Not from nothing. - && gAgent.getID() != from_id //Not from self. - && !(obj && obj->permYouOwner())) //Not from own object. - { - static LLCachedControl SpamNewlines(gSavedSettings,"_NACL_AntiSpamNewlines"); - boost::sregex_iterator iter(message.begin(), message.end(), NEWLINES); - if((U32)std::abs(std::distance(iter, boost::sregex_iterator())) > SpamNewlines) - { - NACLAntiSpamRegistry::blockOnQueue((U32)NACLAntiSpamRegistry::QUEUE_IM,from_id); - LLSD args; - args["MESSAGE"] = "Message: Blocked newline flood from "+from_id.asString(); - LLNotificationsUtil::add("SystemMessageTip", args); - return; - } - } - // NaCl End + // NaCl - Newline flood protection + LLViewerObject* obj=gObjectList.findObject(from_id); + if(!from_id.isNull() //Not from nothing. + && gAgent.getID() != from_id //Not from self. + && !(obj && obj->permYouOwner())) //Not from own object. + { + static LLCachedControl SpamNewlines(gSavedSettings,"_NACL_AntiSpamNewlines"); + boost::sregex_iterator iter(message.begin(), message.end(), NEWLINES); + if((U32)std::abs(std::distance(iter, boost::sregex_iterator())) > SpamNewlines) + { + NACLAntiSpamRegistry::blockOnQueue((U32)NACLAntiSpamRegistry::QUEUE_IM,from_id); + if(gSavedSettings.getBOOL("AntiSpamNotify")) + { + LLSD args; + args["MESSAGE"] = "Message: Blocked newline flood from "+from_id.asString(); + LLNotificationsUtil::add("SystemMessageTip", args); + } + return; + } + } + // NaCl End msg->getU32Fast(_PREHASH_MessageBlock, _PREHASH_ParentEstateID, parent_estate_id); msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_RegionID, region_id); msg->getVector3Fast(_PREHASH_MessageBlock, _PREHASH_Position, position); @@ -1959,10 +1962,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) EInstantMessage dialog = (EInstantMessage)d; // NaCl - Antispam Registry - if((dialog != IM_TYPING_START && dialog != IM_TYPING_STOP) - && NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_IM,from_id)) - return; - // NaCl End + if((dialog != IM_TYPING_START && dialog != IM_TYPING_STOP) + && NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_IM,from_id)) + return; + // NaCl End // make sure that we don't have an empty or all-whitespace name LLStringUtil::trim(name); @@ -2427,7 +2430,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) case IM_GROUP_NOTICE_REQUESTED: { // NaCl - Antispam - if(antispam) + if(antispam || gSavedSettings.getBOOL("AntiSpamGroupNotices")) return; // NaCl End LL_INFOS("Messaging") << "Received IM_GROUP_NOTICE message." << LL_ENDL; @@ -2526,7 +2529,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) case IM_GROUP_INVITATION: { // NaCl - Antispam - if(antispam) + if(antispam || gSavedSettings.getBOOL("AntiSpamGroupInvites")) return; // NaCl End //if (!is_linden && (is_busy || is_muted)) @@ -2574,7 +2577,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // Someone has offered us some inventory. { // NaCl - Antispam - if(antispam) + if(antispam || gSavedSettings.getBOOL("AntiSpamItemOffers")) return; // NaCl End LLOfferInfo* info = new LLOfferInfo; @@ -2829,10 +2832,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) } break; case IM_FROM_TASK_AS_ALERT: - // NaCl - Antispam - if(antispam) - return; - // NaCl End + // NaCl - Antispam + if(antispam || (!is_owned_by_me && gSavedSettings.getBOOL("AntiSpamAlerts"))) + return; + // NaCl End if (is_busy && !is_owned_by_me) { return; @@ -2870,7 +2873,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) case IM_LURE_USER: { - if(antispam) return; //NaCl Antispam + if(antispam || gSavedSettings.getBOOL("AntiSpamTeleports")) return; //NaCl Antispam // [RLVa:KB] - Checked: 2010-12-11 (RLVa-1.2.2c) | Added: RLVa-1.2.2c // If the lure sender is a specific @accepttp exception they will override muted and busy status bool fRlvSummon = (rlv_handler_t::isEnabled()) && (gRlvHandler.isException(RLV_BHVR_ACCEPTTP, from_id)); @@ -3011,10 +3014,6 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) case IM_GOTO_URL: { - // NaCl - Antispam - if(antispam) - return; - // NaCl End LLSD args; // n.b. this is for URLs sent by the system, not for // URLs sent by scripts (i.e. llLoadURL) @@ -3040,7 +3039,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) case IM_FRIENDSHIP_OFFERED: { // NaCl - Antispam - if(antispam) + if(antispam || gSavedSettings.getBOOL("AntiSpamFriendshipOffers")) return; // NaCl End LLSD payload; @@ -3179,7 +3178,7 @@ void process_offer_callingcard(LLMessageSystem* msg, void**) { // NaCl - Antispam static LLCachedControl antispam(gSavedSettings,"_NACL_Antispam"); - if(antispam) + if(antispam || gSavedSettings.getBOOL("AntiSpamFriendshipOffers")) return; // NaCl End // someone has offered to form a friendship @@ -3189,9 +3188,9 @@ void process_offer_callingcard(LLMessageSystem* msg, void**) msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, source_id); // NaCl - Antispam Registry - if(NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_CALLING_CARD,source_id)) - return; - // NaCl End + if(NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_CALLING_CARD,source_id)) + return; + // NaCl End LLUUID tid; msg->getUUIDFast(_PREHASH_AgentBlock, _PREHASH_TransactionID, tid); @@ -3379,13 +3378,12 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) msg->getU8("ChatData", "ChatType", type_temp); chat.mChatType = (EChatType)type_temp; - - // NaCL - Antispam Registry - if((chat.mChatType != CHAT_TYPE_START && chat.mChatType != CHAT_TYPE_STOP) //Chat type isn't typing - &&((owner_id.isNull() && NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_CHAT,from_id)) //Spam from an object? - ||(NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_CHAT,owner_id)))) //Spam from a resident? - return; - // NaCl End + // NaCL - Antispam Registry + if((chat.mChatType != CHAT_TYPE_START && chat.mChatType != CHAT_TYPE_STOP) //Chat type isn't typing + &&((owner_id.isNull() && NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_CHAT,from_id)) //Spam from an object? + ||(NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_CHAT,owner_id)))) //Spam from a resident? + return; + // NaCl End msg->getU8Fast(_PREHASH_ChatData, _PREHASH_Audible, audible_temp); chat.mAudible = (EChatAudible)audible_temp; @@ -3507,23 +3505,26 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) msg->getStringFast(_PREHASH_ChatData, _PREHASH_Message, mesg); // NaCl - Newline flood protection - LLViewerObject* obj=gObjectList.findObject(from_id); - if(!(from_id.isNull()) //Not from nothing. - || !(gAgent.getID() != from_id) //Not from self. - || !(obj && obj->permYouOwner())) //Not from own object. - { - static LLCachedControl SpamNewlines(gSavedSettings,"_NACL_AntiSpamNewlines"); - boost::sregex_iterator iter(mesg.begin(), mesg.end(), NEWLINES); - if((U32)std::abs(std::distance(iter, boost::sregex_iterator())) > SpamNewlines) - { - NACLAntiSpamRegistry::blockOnQueue((U32)NACLAntiSpamRegistry::QUEUE_CHAT,owner_id); - LLSD args; - args["MESSAGE"] = "Chat: Blocked newline flood from "+owner_id.asString(); - LLNotificationsUtil::add("SystemMessageTip", args); - return; - } - } - // NaCl End + LLViewerObject* obj=gObjectList.findObject(from_id); + if(!(from_id.isNull()) //Not from nothing. + || !(gAgent.getID() != from_id) //Not from self. + || !(obj && obj->permYouOwner())) //Not from own object. + { + static LLCachedControl SpamNewlines(gSavedSettings,"_NACL_AntiSpamNewlines"); + boost::sregex_iterator iter(mesg.begin(), mesg.end(), NEWLINES); + if((U32)std::abs(std::distance(iter, boost::sregex_iterator())) > SpamNewlines) + { + NACLAntiSpamRegistry::blockOnQueue((U32)NACLAntiSpamRegistry::QUEUE_CHAT,owner_id); + if(gSavedSettings.getBOOL("AntiSpamNotify")) + { + LLSD args; + args["MESSAGE"] = "Chat: Blocked newline flood from "+owner_id.asString(); + LLNotificationsUtil::add("SystemMessageTip", args); + } + return; + } + } + // NaCl End static std::map sChatObjectAuth; @@ -4850,19 +4851,18 @@ void process_sound_trigger(LLMessageSystem *msg, void **) msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_ObjectID, object_id); // NaCl - Antispam Registry - /*if(owner_id.isNull()) - {*/ - bool bDoSpamCheck=1; - std::string sSound=sound_id.asString(); - static LLCachedControl _NACL_AntiSpamSoundMulti(gSavedSettings,"_NACL_AntiSpamSoundMulti"); - for(int i=0;i< COLLISION_SOUNDS_SIZE;i++) - if(COLLISION_SOUNDS[i] == sSound) - bDoSpamCheck=0; + static LLCachedControl _NACL_AntiSpamSoundMulti(gSavedSettings,"_NACL_AntiSpamSoundMulti"); + if(owner_id.isNull()) + { + bool bDoSpamCheck=1; + std::string sSound=sound_id.asString(); + for(int i=0;i< COLLISION_SOUNDS_SIZE;i++) + if(COLLISION_SOUNDS[i] == sSound) + bDoSpamCheck=0; if(bDoSpamCheck) - if(NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SOUND,object_id, _NACL_AntiSpamSoundMulti,true)) return; - /*} - else - if(NACLAntiSpamRegistry::checkQueue("Soundspam",owner_id)) return;*/ + if(NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SOUND,object_id, _NACL_AntiSpamSoundMulti)) return; + } + else if(NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SOUND,owner_id, _NACL_AntiSpamSoundMulti)) return; // NaCl End msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_ParentID, parent_id); @@ -4928,13 +4928,13 @@ void process_preload_sound(LLMessageSystem *msg, void **user_data) msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_ObjectID, object_id); msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_OwnerID, owner_id); - // NaCl - Antispam Registry - static LLCachedControl _NACL_AntiSpamSoundPreloadMulti(gSavedSettings,"_NACL_AntiSpamSoundPreloadMulti"); - if((owner_id.isNull() - && NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SOUND_PRELOAD,object_id,_NACL_AntiSpamSoundPreloadMulti)) - || NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SOUND_PRELOAD,owner_id,_NACL_AntiSpamSoundPreloadMulti)) - return; - // NaCl End + // NaCl - Antispam Registry + static LLCachedControl _NACL_AntiSpamSoundPreloadMulti(gSavedSettings,"_NACL_AntiSpamSoundPreloadMulti"); + if((owner_id.isNull() + && NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SOUND_PRELOAD,object_id,_NACL_AntiSpamSoundPreloadMulti)) + || NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SOUND_PRELOAD,owner_id,_NACL_AntiSpamSoundPreloadMulti)) + return; + // NaCl End LLViewerObject *objectp = gObjectList.findObject(object_id); if (!objectp) return; @@ -4972,12 +4972,12 @@ void process_attached_sound(LLMessageSystem *msg, void **user_data) msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_ObjectID, object_id); msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_OwnerID, owner_id); - // NaCl - Antispam Registry - if(/*owner_id.isNull() - &&*/ NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SOUND,object_id)) - /*|| (NACLAntiSpamRegistry::checkQueue("Soundspam",owner_id))*/ - return; - // NaCl End + // NaCl - Antispam Registry + if((owner_id.isNull() + && NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SOUND,object_id)) + || NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SOUND,owner_id)) + return; + // NaCl End msg->getF32Fast(_PREHASH_DataBlock, _PREHASH_Gain, gain); msg->getU8Fast(_PREHASH_DataBlock, _PREHASH_Flags, flags); @@ -6243,7 +6243,7 @@ void process_script_question(LLMessageSystem *msg, void **user_data) { // NaCl - Antispam static LLCachedControl antispam(gSavedSettings,"_NACL_Antispam"); - if(antispam) + if(antispam || gSavedSettings.getBOOL("AntiSpamScripts")) return; // NaCl End // *TODO: Translate owner name -> [FIRST] [LAST] @@ -6261,12 +6261,12 @@ void process_script_question(LLMessageSystem *msg, void **user_data) // itemid -> script asset key of script requesting permissions msg->getUUIDFast(_PREHASH_Data, _PREHASH_ItemID, itemid ); - // NaCl - Antispam Registry - if((taskid.isNull() - && NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG,itemid)) - || NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG,taskid)) - return; - // NaCl End + // NaCl - Antispam Registry + if((taskid.isNull() + && NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG,itemid)) + || NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG,taskid)) + return; + // NaCl End msg->getStringFast(_PREHASH_Data, _PREHASH_ObjectName, object_name); msg->getStringFast(_PREHASH_Data, _PREHASH_ObjectOwner, owner_name); @@ -6928,7 +6928,7 @@ void process_script_dialog(LLMessageSystem* msg, void**) { // NaCl - Antispam static LLCachedControl antispam(gSavedSettings,"_NACL_Antispam"); - if(antispam) + if(antispam || gSavedSettings.getBOOL("AntiSpamScripts")) return; // NaCl End S32 i; @@ -6938,9 +6938,9 @@ void process_script_dialog(LLMessageSystem* msg, void**) msg->getUUID("Data", "ObjectID", object_id); // NaCl - Antispam Registry - if(NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG,object_id)) - return; - // NaCl End + if(NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG,object_id)) + return; + // NaCl End // For compability with OS grids first check for presence of extended packet before fetching data. LLUUID owner_id; @@ -6948,11 +6948,10 @@ void process_script_dialog(LLMessageSystem* msg, void**) { msg->getUUID("OwnerData", "OwnerID", owner_id); - // NaCl - Antispam Registry - if(NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG,owner_id)) - return; - // NaCl End - + // NaCl - Antispam Registry + if(NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG,owner_id)) + return; + // NaCl End } if (LLMuteList::getInstance()->isMuted(object_id) || LLMuteList::getInstance()->isMuted(owner_id)) @@ -7110,7 +7109,7 @@ void process_load_url(LLMessageSystem* msg, void**) { // NaCl - Antispam static LLCachedControl antispam(gSavedSettings,"_NACL_Antispam"); - if(antispam) + if(antispam || gSavedSettings.getBOOL("AntiSpamScripts")) return; // NaCl End LLUUID object_id; @@ -7124,12 +7123,12 @@ void process_load_url(LLMessageSystem* msg, void**) msg->getUUID( "Data", "ObjectID", object_id); msg->getUUID( "Data", "OwnerID", owner_id); - // NaCl - Antispam Registry - if((owner_id.isNull() - && NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG,object_id)) - || NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG,owner_id)) - return; - // NaCl End + // NaCl - Antispam Registry + if((owner_id.isNull() + && NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG,object_id)) + || NACLAntiSpamRegistry::checkQueue((U32)NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG,owner_id)) + return; + // NaCl End msg->getBOOL( "Data", "OwnerIsGroup", owner_is_group); msg->getString("Data", "Message", 256, message); @@ -7205,7 +7204,7 @@ void process_script_teleport_request(LLMessageSystem* msg, void**) { // NaCl - Antispam static LLCachedControl antispam(gSavedSettings,"_NACL_Antispam"); - if(antispam) + if(antispam || gSavedSettings.getBOOL("AntiSpamScripts")) return; // NaCl End if (!gSavedSettings.getBOOL("ScriptsCanShowUI")) return; 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 0d5167818..1680634f5 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 @@ -16,7 +16,7 @@ --> - Chat: + Chat: - Show links on chatting object names in chat history for: + Show links on chatting object names in chat history for: No object @@ -70,12 +70,21 @@