From e34c28e09fc9db32f2e42c4070e60ee19a424994 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Thu, 8 Oct 2009 22:43:51 -0700 Subject: Applied lldialog spam throttle from Emerald viewer --- linden/indra/newview/app_settings/settings.xml | 22 ++++++++++++ linden/indra/newview/llviewermessage.cpp | 47 +++++++++++++++++++++++++- 2 files changed, 68 insertions(+), 1 deletion(-) (limited to 'linden/indra/newview') diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index f167840..f148b80 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -8003,6 +8003,28 @@ Value 0 + SpamCount + + Comment + Number of items spammed per time set in SpamTime. RECOMMENDED IS 4.000 + Persist + 1 + Type + F32 + Value + 4.0 + + SpamTime + + Comment + Time of Evalulating spam. RECOMMENDED NUMBER IS 1.000 + Persist + 1 + Type + F32 + Value + 1.0 + SpeakingColor Comment diff --git a/linden/indra/newview/llviewermessage.cpp b/linden/indra/newview/llviewermessage.cpp index f460996..d784f52 100644 --- a/linden/indra/newview/llviewermessage.cpp +++ b/linden/indra/newview/llviewermessage.cpp @@ -146,6 +146,12 @@ extern LLMap< const LLUUID, LLFloaterAvatarInfo* > gAvatarInfoInstances; // Only defined in llfloateravatarinfo.cpp // [/RLVa:KB] +//silly spam define D: +bool dialogSpamOn; +static LLFrameTimer d_spam; +std::map< std::string , S32 > lastd_names; +LLDynamicArray< std::string > blacklisted_names; + // // Constants // @@ -5471,9 +5477,9 @@ void process_script_dialog(LLMessageSystem* msg, void**) msg->getS32("Data", "ChatChannel", info->mChatChannel); // Don't show lldialog boxes from muted avs -- McCabe + std::string agent_name = first_name + " " + last_name; if (!first_name.empty()) { - std::string agent_name = first_name + " " + last_name; std::vector mutes = LLMuteList::getInstance()->getMutes(); for (U32 i = 0; i < mutes.size(); i++) { @@ -5507,6 +5513,45 @@ void process_script_dialog(LLMessageSystem* msg, void**) args["[MESSAGE]"] = message; if (!first_name.empty()) { + // Dialog Spam Prevention by Cryogenic + if(dialogSpamOn) + { + if(!d_spam.getStarted()) + { + d_spam.start(); + } + if(blacklisted_names.find(agent_name) != -1) + { + return; + } + std::map< std::string , S32 >::iterator itr = lastd_names.find(agent_name); + if(itr != lastd_names.end()) + { + if(d_spam.getElapsedTimeF32() <= gSavedSettings.getF32("SpamTime")) + { + if((*itr).second > gSavedSettings.getF32("SpamCount")) + { + blacklisted_names.put(agent_name); + LL_INFOS("process_script_dialog") << "blocked " << info->mObjectID.asString() << " owned by " << agent_name << LL_ENDL;//" (" << key.asString() << ")" <