From f1616b1196f95c2768de35b0aa80101b57429d59 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Thu, 8 Oct 2009 14:36:57 -0700 Subject: Don't show lldialog boxes from muted avatars anymore --- linden/indra/newview/llviewermessage.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'linden') diff --git a/linden/indra/newview/llviewermessage.cpp b/linden/indra/newview/llviewermessage.cpp index 88f6b36..f460996 100644 --- a/linden/indra/newview/llviewermessage.cpp +++ b/linden/indra/newview/llviewermessage.cpp @@ -5470,6 +5470,21 @@ void process_script_dialog(LLMessageSystem* msg, void**) msg->getString("Data", "Message", message); msg->getS32("Data", "ChatChannel", info->mChatChannel); + // Don't show lldialog boxes from muted avs -- McCabe + 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++) + { + if (mutes[i].mName == agent_name) + { + delete info; + return; + } + } + } + // unused for now LLUUID image_id; msg->getUUID("Data", "ImageID", image_id); -- cgit v1.1 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') 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() << ")" <= - @findfolder with multiple results +#define RLV_EXTENSION_FLAG_NOSTRIP // Layers and attachments marked as "nostrip" are exempt from @detach/@remoutfit +#define RLV_EXTENSION_STARTLOCATION // Reenables "Start Location" at login if not @tploc=n or @unsit=n restricted at last logoff +#define RLV_EXPERIMENTAL // Enables/disables experimental features en masse + +// Experimental features +#ifdef RLV_EXPERIMENTAL + // Stable (will mature to RLV_EXTENSION_XXX in next release if no bugs are found) + #define RLV_EXPERIMENTAL_FARTOUCH_FEEDBACK // Enables "cleaner" UI responses when fartouch blocks something + + // Under testing (stable, but requires further testing - safe for public release but may be quirky) + #define RLV_EXPERIMENTAL_FIRSTUSE // Enables a number of "first use" popups + + // Under development (don't include in public release) + #if LL_RELEASE_WITH_DEBUG_INFO || LL_DEBUG + #endif // LL_RELEASE_WITH_DEBUG_INFO || LL_DEBUG +#endif // RLV_EXPERIMENTAL + +// ============================================================================ +// Defines +// + +// Version of the specifcation we support +const S32 RLV_VERSION_MAJOR = 1; +const S32 RLV_VERSION_MINOR = 20; +const S32 RLV_VERSION_PATCH = 2; + +// Implementation version +const S32 RLVa_VERSION_MAJOR = 1; +const S32 RLVa_VERSION_MINOR = 0; +const S32 RLVa_VERSION_PATCH = 3; +const S32 RLVa_VERSION_BUILD = 4; + +// The official viewer version we're patching against +#define RLV_MAKE_TARGET(x, y, z) ((x << 16) | (y << 8) | z) +#define RLV_TARGET RLV_MAKE_TARGET(1, 22, 11) + +// Defining these makes it easier if we ever need to change our tag +#define RLV_WARNS LL_WARNS("RLV") +#define RLV_INFOS LL_INFOS("RLV") +#define RLV_DEBUGS LL_DEBUGS("RLV") + +#if LL_RELEASE_WITH_DEBUG_INFO || LL_DEBUG + // Turn on extended debugging information + #define RLV_DEBUG + // Make sure we halt execution on errors + #define RLV_ERRS LL_ERRS("RLV") + // Uncomment to enable the Advanced / RLVa / Unit Tests menu (non-public) + //#define RLV_DEBUG_TESTS +#else + // Uncomment if you want extended debugging information on release builds + //#define RLV_DEBUG + // Don't halt execution on errors in release + #define RLV_ERRS LL_WARNS("RLV") +#endif // LL_RELEASE_WITH_DEBUG_INFO || LL_DEBUG + +#define RLV_ROOT_FOLDER "#RLV" +#define RLV_CMD_PREFIX '@' +#define RLV_PUTINV_PREFIX "#RLV/~" +#define RLV_SETROT_OFFSET F_PI_BY_TWO // @setrot is off by 90° with the rest of SL + +#define RLV_FOLDER_FLAG_NOSTRIP "nostrip" +#define RLV_FOLDER_PREFIX_HIDDEN '.' +#define RLV_FOLDER_PREFIX_PUTINV '~' + +// ============================================================================ +// Enumeration declarations +// + +// NOTE: any changes to this enumeration should be reflected in initLookupTable() +enum ERlvBehaviour { + RLV_BHVR_VERSION = 0, // "version" + RLV_BHVR_DETACH, // "detach" + RLV_BHVR_SENDCHAT, // "sendchat" + RLV_BHVR_EMOTE, // "emote" + RLV_BHVR_CHATSHOUT, // "chatshout" + RLV_BHVR_CHATNORMAL, // "chatnormal" + RLV_BHVR_CHATWHISPER, // "chatwhisper" + RLV_BHVR_REDIRCHAT, // "redirchat" + RLV_BHVR_REDIREMOTE, // "rediremote" + RLV_BHVR_SENDIM, // "sendim" + RLV_BHVR_RECVCHAT, // "recvchat" + RLV_BHVR_RECVEMOTE, // "recvemote" + RLV_BHVR_RECVIM, // "recvim" + RLV_BHVR_TPLM, // "tplm" + RLV_BHVR_TPLOC, // "tploc" + RLV_BHVR_TPLURE, // "tplure" + RLV_BHVR_SITTP, // "sittp" + RLV_BHVR_EDIT, // "edit" + RLV_BHVR_REZ, // "rez" + RLV_BHVR_ADDOUTFIT, // "addoutfit" + RLV_BHVR_REMOUTFIT, // "remoutfit" + RLV_BHVR_GETOUTFIT, // "getoutfit" + RLV_BHVR_GETATTACH, // "getattach" + RLV_BHVR_SHOWINV, // "showinv" + RLV_BHVR_VIEWNOTE, // "viewnote" + RLV_BHVR_UNSIT, // "unsit" + RLV_BHVR_SIT, // "sit" + RLV_BHVR_SENDCHANNEL, // "sendchannel" + RLV_BHVR_GETSTATUS, // "getstatus" + RLV_BHVR_GETSTATUSALL, // "getstatusall" + RLV_BHVR_GETINV, // "getinv" + RLV_BHVR_GETINVWORN, // "getinvworn" + RLV_BHVR_FINDFOLDER, // "findfolder" + RLV_BHVR_FINDFOLDERS, // "findfolders" + RLV_BHVR_ATTACH, // "attach" + RLV_BHVR_ATTACHALL, // "attachall" + RLV_BHVR_DETACHALL, // "detachall" + RLV_BHVR_GETPATH, // "getpath" + RLV_BHVR_ATTACHTHIS, // "attachthis" + RLV_BHVR_ATTACHALLTHIS, // "attachallthis" + RLV_BHVR_DETACHTHIS, // "detachthis" + RLV_BHVR_DETACHALLTHIS, // "detachallthis" + RLV_BHVR_FARTOUCH, // "fartouch" + RLV_BHVR_SHOWWORLDMAP, // "showworldmap" + RLV_BHVR_SHOWMINIMAP, // "showminimap" + RLV_BHVR_SHOWLOC, // "showloc" + RLV_BHVR_TPTO, // "tpto" + RLV_BHVR_ACCEPTTP, // "accepttp" + RLV_BHVR_SHOWNAMES, // "shownames" + RLV_BHVR_FLY, // "fly" + RLV_BHVR_GETSITID, // "getsitid" + RLV_BHVR_SETDEBUG, // "setdebug" + RLV_BHVR_SETENV, // "setenv" + RLV_BHVR_DETACHME, // "detachme" + RLV_BHVR_SHOWHOVERTEXTALL, // "showhovertextall" + RLV_BHVR_SHOWHOVERTEXTWORLD, // "showhovertextworld" + RLV_BHVR_SHOWHOVERTEXTHUD, // "showhovertexthud" + RLV_BHVR_SHOWHOVERTEXT, // "showhovertext" + RLV_BHVR_NOTIFY, // "notify" + + RLV_BHVR_COUNT, + RLV_BHVR_UNKNOWN +}; + +enum ERlvParamType { + RLV_TYPE_UNKNOWN, + RLV_TYPE_ADD, // == "n"|"add" + RLV_TYPE_REMOVE, // == "y"|"rem" + RLV_TYPE_FORCE, // == "force" + RLV_TYPE_REPLY, // == + RLV_TYPE_CLEAR +}; + +enum ERlvCmdRet { + RLV_RET_NOERROR, // Command executed succesfully + RLV_RET_RETAINED, // Command was retained + RLV_RET_DISABLED, // Command is disabled (by user) + RLV_RET_FAILED, // Command failed (general failure) + RLV_RET_FAILED_SYNTAX, // Command failed (syntax error) + RLV_RET_FAILED_UNSET, // Command failed (unset restriction) + RLV_RET_FAILED_DUPLICATE, // Command failed (duplicate) + RLV_RET_FAILED_OPTION, // Command failed (invalid option) + RLV_RET_FAILED_PARAM, // Command failed (invalid param) + RLV_RET_UNKNOWN // Command unkown +}; + +// ============================================================================ +// Settings + +#define RLV_SETTING_MAIN "RestrainedLife" +#define RLV_SETTING_DEBUG "RestrainedLifeDebug" +#define RLV_SETTING_NOSETENV "RestrainedLifeNoSetEnv" +#define RLV_SETTING_FORBIDGIVETORLV "RestrainedLifeForbidGiveToRLV" + +#define RLV_SETTING_ENABLEWEAR "RLVaEnableWear" +#define RLV_SETTING_ENABLELEGACYNAMING "RLVaEnableLegacyNaming" +#define RLV_SETTING_HIDELOCKEDLAYER "RLVaHideLockedLayers" +#define RLV_SETTING_HIDELOCKEDATTACH "RLVaHideLockedAttachments" +#define RLV_SETTING_HIDELOCKEDINVENTORY "RLVaHideLockedInventory" +#define RLV_SETTING_LOGINLASTLOCATION "RLVaLoginLastLocation" +#define RLV_SETTING_SHOWNAMETAGS "RLVaShowNameTags" + +#define RLV_SETTING_FIRSTUSE_PREFIX "FirstRLV" +#define RLV_SETTING_FIRSTUSE_DETACH RLV_SETTING_FIRSTUSE_PREFIX"Detach" +#define RLV_SETTING_FIRSTUSE_ENABLEWEAR RLV_SETTING_FIRSTUSE_PREFIX"EnableWear" +#define RLV_SETTING_FIRSTUSE_FARTOUCH RLV_SETTING_FIRSTUSE_PREFIX"Fartouch" +#define RLV_SETTING_FIRSTUSE_GIVETORLV RLV_SETTING_FIRSTUSE_PREFIX"GiveToRLV" + +// ============================================================================ + +#endif // RLV_DEFINES_H -- cgit v1.1