diff options
author | McCabe Maxsted | 2009-10-08 22:43:51 -0700 |
---|---|---|
committer | McCabe Maxsted | 2009-10-08 22:43:51 -0700 |
commit | e34c28e09fc9db32f2e42c4070e60ee19a424994 (patch) | |
tree | b6c7198308d070953f0ee29778ebe55651bcdeda /linden/indra/newview | |
parent | Don't show lldialog boxes from muted avatars anymore (diff) | |
download | meta-impy-e34c28e09fc9db32f2e42c4070e60ee19a424994.zip meta-impy-e34c28e09fc9db32f2e42c4070e60ee19a424994.tar.gz meta-impy-e34c28e09fc9db32f2e42c4070e60ee19a424994.tar.bz2 meta-impy-e34c28e09fc9db32f2e42c4070e60ee19a424994.tar.xz |
Applied lldialog spam throttle from Emerald viewer
Diffstat (limited to 'linden/indra/newview')
-rw-r--r-- | linden/indra/newview/app_settings/settings.xml | 22 | ||||
-rw-r--r-- | linden/indra/newview/llviewermessage.cpp | 47 |
2 files changed, 68 insertions, 1 deletions
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 @@ | |||
8003 | <key>Value</key> | 8003 | <key>Value</key> |
8004 | <integer>0</integer> | 8004 | <integer>0</integer> |
8005 | </map> | 8005 | </map> |
8006 | <key>SpamCount</key> | ||
8007 | <map> | ||
8008 | <key>Comment</key> | ||
8009 | <string>Number of items spammed per time set in SpamTime. RECOMMENDED IS 4.000</string> | ||
8010 | <key>Persist</key> | ||
8011 | <integer>1</integer> | ||
8012 | <key>Type</key> | ||
8013 | <string>F32</string> | ||
8014 | <key>Value</key> | ||
8015 | <real>4.0</real> | ||
8016 | </map> | ||
8017 | <key>SpamTime</key> | ||
8018 | <map> | ||
8019 | <key>Comment</key> | ||
8020 | <string>Time of Evalulating spam. RECOMMENDED NUMBER IS 1.000</string> | ||
8021 | <key>Persist</key> | ||
8022 | <integer>1</integer> | ||
8023 | <key>Type</key> | ||
8024 | <string>F32</string> | ||
8025 | <key>Value</key> | ||
8026 | <real>1.0</real> | ||
8027 | </map> | ||
8006 | <key>SpeakingColor</key> | 8028 | <key>SpeakingColor</key> |
8007 | <map> | 8029 | <map> |
8008 | <key>Comment</key> | 8030 | <key>Comment</key> |
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 @@ | |||
146 | extern LLMap< const LLUUID, LLFloaterAvatarInfo* > gAvatarInfoInstances; // Only defined in llfloateravatarinfo.cpp | 146 | extern LLMap< const LLUUID, LLFloaterAvatarInfo* > gAvatarInfoInstances; // Only defined in llfloateravatarinfo.cpp |
147 | // [/RLVa:KB] | 147 | // [/RLVa:KB] |
148 | 148 | ||
149 | //silly spam define D: | ||
150 | bool dialogSpamOn; | ||
151 | static LLFrameTimer d_spam; | ||
152 | std::map< std::string , S32 > lastd_names; | ||
153 | LLDynamicArray< std::string > blacklisted_names; | ||
154 | |||
149 | // | 155 | // |
150 | // Constants | 156 | // Constants |
151 | // | 157 | // |
@@ -5471,9 +5477,9 @@ void process_script_dialog(LLMessageSystem* msg, void**) | |||
5471 | msg->getS32("Data", "ChatChannel", info->mChatChannel); | 5477 | msg->getS32("Data", "ChatChannel", info->mChatChannel); |
5472 | 5478 | ||
5473 | // Don't show lldialog boxes from muted avs -- McCabe | 5479 | // Don't show lldialog boxes from muted avs -- McCabe |
5480 | std::string agent_name = first_name + " " + last_name; | ||
5474 | if (!first_name.empty()) | 5481 | if (!first_name.empty()) |
5475 | { | 5482 | { |
5476 | std::string agent_name = first_name + " " + last_name; | ||
5477 | std::vector<LLMute> mutes = LLMuteList::getInstance()->getMutes(); | 5483 | std::vector<LLMute> mutes = LLMuteList::getInstance()->getMutes(); |
5478 | for (U32 i = 0; i < mutes.size(); i++) | 5484 | for (U32 i = 0; i < mutes.size(); i++) |
5479 | { | 5485 | { |
@@ -5507,6 +5513,45 @@ void process_script_dialog(LLMessageSystem* msg, void**) | |||
5507 | args["[MESSAGE]"] = message; | 5513 | args["[MESSAGE]"] = message; |
5508 | if (!first_name.empty()) | 5514 | if (!first_name.empty()) |
5509 | { | 5515 | { |
5516 | // Dialog Spam Prevention by Cryogenic | ||
5517 | if(dialogSpamOn) | ||
5518 | { | ||
5519 | if(!d_spam.getStarted()) | ||
5520 | { | ||
5521 | d_spam.start(); | ||
5522 | } | ||
5523 | if(blacklisted_names.find(agent_name) != -1) | ||
5524 | { | ||
5525 | return; | ||
5526 | } | ||
5527 | std::map< std::string , S32 >::iterator itr = lastd_names.find(agent_name); | ||
5528 | if(itr != lastd_names.end()) | ||
5529 | { | ||
5530 | if(d_spam.getElapsedTimeF32() <= gSavedSettings.getF32("SpamTime")) | ||
5531 | { | ||
5532 | if((*itr).second > gSavedSettings.getF32("SpamCount")) | ||
5533 | { | ||
5534 | blacklisted_names.put(agent_name); | ||
5535 | LL_INFOS("process_script_dialog") << "blocked " << info->mObjectID.asString() << " owned by " << agent_name << LL_ENDL;//" (" << key.asString() << ")" <<LL_ENDL; | ||
5536 | return; | ||
5537 | } | ||
5538 | else | ||
5539 | { | ||
5540 | (*itr).second++; | ||
5541 | } | ||
5542 | } | ||
5543 | else | ||
5544 | { | ||
5545 | lastd_names.erase(lastd_names.begin(),lastd_names.end()); | ||
5546 | d_spam.reset(); | ||
5547 | } | ||
5548 | } | ||
5549 | else | ||
5550 | { | ||
5551 | //llinfos << "Added " << fullname << " to list" << llendl; | ||
5552 | lastd_names[agent_name] = 0; | ||
5553 | } | ||
5554 | } | ||
5510 | args["[FIRST]"] = first_name; | 5555 | args["[FIRST]"] = first_name; |
5511 | args["[LAST]"] = last_name; | 5556 | args["[LAST]"] = last_name; |
5512 | LLNotifyBox::showXml("ScriptDialog", args, | 5557 | LLNotifyBox::showXml("ScriptDialog", args, |