├── SpamThrottle ├── icon.tga ├── SpamThrottle.toc ├── STMinimapButton.lua ├── Readme.txt ├── Localization.lua ├── SpamThrottle.lua └── SpamThrottle.xml ├── README.md ├── .gitignore └── LICENSE /SpamThrottle/icon.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/laytya/SpamThrottle/HEAD/SpamThrottle/icon.tga -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SpamThrottle 2 | 3 | Vanilla WoW addon to remove unwanted chat messages. 4 | 5 | To install, click the "Download ZIP" button on the right hand side (above), which will download the SpamThrottle-master.zip file. Inside that ZIP archive there is a folder called SpamThrottle. Copy that folder into the Interface/Addons directory under your main WoW installation. 6 | -------------------------------------------------------------------------------- /SpamThrottle/SpamThrottle.toc: -------------------------------------------------------------------------------- 1 | ## Interface: 11200 2 | ## Title: SpamThrottle 3 | ## Notes: Eliminates unnecessary and annoying chat messages 4 | ## Notes-ruRU: Устраняет ненужные и раздражающие сообщения чата. 5 | ## Author: Mopar 6 | ## Version:Vanilla 1.17 7 | ## SavedVariablesPerCharacter: SpamThrottle_Config 8 | ## SavedVariables: SpamThrottle_KeywordFilterList SpamThrottle_PlayerFilterList SpamThrottle_PlayerBanTime 9 | SpamThrottle.xml 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.psd 2 | *.png 3 | 4 | 5 | ################# 6 | ## Eclipse 7 | ################# 8 | 9 | *.pydevproject 10 | .project 11 | .metadata 12 | bin/ 13 | tmp/ 14 | *.tmp 15 | *.bak 16 | *.swp 17 | *~.nib 18 | local.properties 19 | .classpath 20 | .settings/ 21 | .loadpath 22 | 23 | # External tool builders 24 | .externalToolBuilders/ 25 | 26 | # Locally stored "Eclipse launch configurations" 27 | *.launch 28 | 29 | # CDT-specific 30 | .cproject 31 | 32 | # PDT-specific 33 | .buildpath 34 | 35 | 36 | ################# 37 | ## Visual Studio 38 | ################# 39 | 40 | ## Ignore Visual Studio temporary files, build results, and 41 | ## files generated by popular Visual Studio add-ons. 42 | 43 | # User-specific files 44 | *.suo 45 | *.user 46 | *.sln.docstates 47 | 48 | # Build results 49 | 50 | [Dd]ebug/ 51 | [Rr]elease/ 52 | x64/ 53 | build/ 54 | [Bb]in/ 55 | [Oo]bj/ 56 | 57 | # MSTest test Results 58 | [Tt]est[Rr]esult*/ 59 | [Bb]uild[Ll]og.* 60 | 61 | *_i.c 62 | *_p.c 63 | *.ilk 64 | *.meta 65 | *.obj 66 | *.pch 67 | *.pdb 68 | *.pgc 69 | *.pgd 70 | *.rsp 71 | *.sbr 72 | *.tlb 73 | *.tli 74 | *.tlh 75 | *.tmp 76 | *.tmp_proj 77 | *.log 78 | *.vspscc 79 | *.vssscc 80 | .builds 81 | *.pidb 82 | *.log 83 | *.scc 84 | 85 | # Visual C++ cache files 86 | ipch/ 87 | *.aps 88 | *.ncb 89 | *.opensdf 90 | *.sdf 91 | *.cachefile 92 | 93 | # Visual Studio profiler 94 | *.psess 95 | *.vsp 96 | *.vspx 97 | 98 | # Guidance Automation Toolkit 99 | *.gpState 100 | 101 | # ReSharper is a .NET coding add-in 102 | _ReSharper*/ 103 | *.[Rr]e[Ss]harper 104 | 105 | # TeamCity is a build add-in 106 | _TeamCity* 107 | 108 | # DotCover is a Code Coverage Tool 109 | *.dotCover 110 | 111 | # NCrunch 112 | *.ncrunch* 113 | .*crunch*.local.xml 114 | 115 | # Installshield output folder 116 | [Ee]xpress/ 117 | 118 | # DocProject is a documentation generator add-in 119 | DocProject/buildhelp/ 120 | DocProject/Help/*.HxT 121 | DocProject/Help/*.HxC 122 | DocProject/Help/*.hhc 123 | DocProject/Help/*.hhk 124 | DocProject/Help/*.hhp 125 | DocProject/Help/Html2 126 | DocProject/Help/html 127 | 128 | # Click-Once directory 129 | publish/ 130 | 131 | # Publish Web Output 132 | *.Publish.xml 133 | *.pubxml 134 | *.publishproj 135 | 136 | # NuGet Packages Directory 137 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 138 | #packages/ 139 | 140 | # Windows Azure Build Output 141 | csx 142 | *.build.csdef 143 | 144 | # Windows Store app package directory 145 | AppPackages/ 146 | 147 | # Others 148 | sql/ 149 | *.Cache 150 | ClientBin/ 151 | [Ss]tyle[Cc]op.* 152 | ~$* 153 | *~ 154 | *.dbmdl 155 | *.[Pp]ublish.xml 156 | *.pfx 157 | *.publishsettings 158 | 159 | # RIA/Silverlight projects 160 | Generated_Code/ 161 | 162 | # Backup & report files from converting an old project file to a newer 163 | # Visual Studio version. Backup files are not needed, because we have git ;-) 164 | _UpgradeReport_Files/ 165 | Backup*/ 166 | UpgradeLog*.XML 167 | UpgradeLog*.htm 168 | 169 | # SQL Server files 170 | App_Data/*.mdf 171 | App_Data/*.ldf 172 | 173 | ############# 174 | ## Windows detritus 175 | ############# 176 | 177 | # Windows image file caches 178 | Thumbs.db 179 | ehthumbs.db 180 | 181 | # Folder config file 182 | Desktop.ini 183 | 184 | # Recycle Bin used on file shares 185 | $RECYCLE.BIN/ 186 | 187 | # Mac crap 188 | .DS_Store 189 | 190 | 191 | ############# 192 | ## Python 193 | ############# 194 | 195 | *.py[cod] 196 | 197 | # Packages 198 | *.egg 199 | *.egg-info 200 | dist/ 201 | build/ 202 | eggs/ 203 | parts/ 204 | var/ 205 | sdist/ 206 | develop-eggs/ 207 | .installed.cfg 208 | 209 | # Installer logs 210 | pip-log.txt 211 | 212 | # Unit test / coverage reports 213 | .coverage 214 | .tox 215 | 216 | #Translations 217 | *.mo 218 | 219 | #Mr Developer 220 | .mr.developer.cfg 221 | -------------------------------------------------------------------------------- /SpamThrottle/STMinimapButton.lua: -------------------------------------------------------------------------------- 1 | function SpamThrottle_OnClick(arg1) 2 | if( arg1 and arg1 == "RightButton" and IsShiftKeyDown() ) then 3 | if( SpamThrottle_Config.MinimapButtonAtt ) then 4 | local xpos,ypos = GetCursorPosition(); 5 | local scale = SpamThrottle_MinimapButtonFrame:GetEffectiveScale() 6 | 7 | SpamThrottle_Config.MinimapButtonAtt = false; 8 | SpamThrottle_Config.ButtonPosX = xpos/scale 9 | SpamThrottle_Config.ButtonPosY = ypos/scale 10 | 11 | SpamThrottle_SetButtonPosition(); 12 | else 13 | SpamThrottle_ResetPosition(); 14 | end 15 | elseif( arg1 and arg1 == "LeftButton" and not IsShiftKeyDown() ) then 16 | SpamThrottleConfigFrame:Show(); 17 | else 18 | 19 | end 20 | end 21 | 22 | function SpamThrottle_DragStart() 23 | if (IsShiftKeyDown()) then 24 | GameTooltip:Hide(); 25 | SpamThrottle_DragFlag = 1; 26 | if( SpamThrottle_Config.MinimapButtonAtt ) then 27 | 28 | else 29 | local _,_,_,xpos,ypos = this:GetPoint(); 30 | this.orig = {xpos, ypos}; 31 | this:StartMoving(); 32 | _,_,_,xpos,ypos = this:GetPoint(); 33 | this.start = {xpos, ypos}; 34 | 35 | end 36 | else 37 | SpamThrottle_DragFlag = 0; 38 | end 39 | 40 | end 41 | 42 | function SpamThrottle_DragStop() 43 | if SpamThrottle_DragFlag == 1 then 44 | local _,_,_,xpos,ypos = this:GetPoint(); 45 | 46 | if( SpamThrottle_Config.MinimapButtonAtt ) then 47 | SpamThrottle_Config.ButtonPosX = xpos 48 | SpamThrottle_Config.ButtonPosY = ypos 49 | else 50 | this:StopMovingOrSizing(); 51 | xpos = this.orig[1] + (xpos - this.start[1]) 52 | ypos = this.orig[2] + (ypos - this.start[2]) 53 | SpamThrottle_Config.ButtonPosX = xpos 54 | SpamThrottle_Config.ButtonPosY = ypos 55 | end 56 | SpamThrottle_DragFlag = 0; 57 | end 58 | end 59 | 60 | function SpamThrottle_OnUpdate(elapsed) 61 | if( SpamThrottle_DragFlag == 1 and SpamThrottle_Config.MinimapButtonAtt ) then 62 | local xpos,ypos = GetCursorPosition(); 63 | local xmin,ymin,xm,ym = Minimap:GetLeft(), Minimap:GetBottom(), Minimap:GetRight(), Minimap:GetTop(); 64 | local scale = Minimap:GetEffectiveScale(); 65 | local xdelta, ydelta = (xm - xmin)/2*scale, (ym - ymin) /2 * scale; 66 | 67 | xpos = xmin*scale-xpos+xdelta; 68 | ypos = ypos-ymin*scale-ydelta; 69 | 70 | local angle = math.deg(math.atan2(ypos,xpos)); 71 | 72 | local x,y =0,0; 73 | if (Squeenix or (simpleMinimap_Skins and simpleMinimap_Skins:GetShape() == "square") 74 | or (pfUI and pfUI_config["disabled"]["minimap"] ~= "1")) then 75 | x = math.max(-xdelta, math.min((xdelta*1.5) * cos(angle), xdelta)) 76 | y = math.max(-ydelta, math.min((ydelta*1.5) * sin(angle), ydelta)) 77 | else 78 | x= cos(angle)*xdelta 79 | y= sin(angle)*ydelta 80 | end 81 | local sc= SpamThrottle_MinimapButtonFrame:GetEffectiveScale() 82 | SpamThrottle_MinimapButtonFrame:SetPoint("TOPLEFT", Minimap, "TOPLEFT", (xdelta-x)/sc -17 , (y-ydelta)/sc +17); 83 | end 84 | end 85 | 86 | function SpamThrottle_ResetPosition() 87 | SpamThrottle_Config.ButtonPosX = Default_SpamThrottle_Config.ButtonPosX 88 | SpamThrottle_Config.ButtonPosY = Default_SpamThrottle_Config.ButtonPosY 89 | SpamThrottle_Config.MinimapButtonAtt = Default_SpamThrottle_Config.MinimapButtonAtt 90 | SpamThrottle_SetButtonPosition(); 91 | end 92 | 93 | function SpamThrottle_SetButtonPosition() 94 | if (not SpamThrottle_Config) then return; end 95 | if SpamThrottle_Config.STMinimapButton then 96 | SpamThrottle_MinimapButtonFrame:Show(); 97 | else 98 | SpamThrottle_MinimapButtonFrame:Hide(); 99 | end 100 | if( SpamThrottle_Config.MinimapButtonAtt ) then 101 | SpamThrottle_MinimapButtonFrame:ClearAllPoints(); 102 | SpamThrottle_MinimapButtonFrame:SetPoint("TOPLEFT", Minimap, "TOPLEFT", SpamThrottle_Config.ButtonPosX, SpamThrottle_Config.ButtonPosY); 103 | else 104 | SpamThrottle_MinimapButtonFrame:ClearAllPoints(); 105 | SpamThrottle_MinimapButtonFrame:SetPoint("CENTER", UIParent, "BOTTOMLEFT", SpamThrottle_Config.ButtonPosX, SpamThrottle_Config.ButtonPosY); 106 | end 107 | end 108 | 109 | function SpamThrottle_ToggleMinibutton(checked) 110 | if checked then 111 | SpamThrottle_MinimapButtonFrame:Show(); 112 | SpamThrottle_Config.STMinimapButton = true; 113 | else 114 | SpamThrottle_MinimapButtonFrame:Hide(); 115 | SpamThrottle_Config.STMinimapButton = false; 116 | end 117 | end -------------------------------------------------------------------------------- /SpamThrottle/Readme.txt: -------------------------------------------------------------------------------- 1 | SpamThrottle (Eliminates duplicated messages in chat channels) 2 | 3 | Version: Vanilla 1.17 4 | Date: 17.07.2018 5 | Author: Mopar, laytya 6 | 7 | On many servers the Trade channel is the main LFG channel in use today. On full servers, many people spam the channel to increase the visibility of their messages (or just be a general nuisance) by making macros and repeating the message once every few minutes. And then there’s gold sellers. This means you spend more time reading crap and less time interacting with normal people. 8 | 9 | This addon filters the trade channel (and all other numbered channels, i.e. /1 through /99), /y, and optionally /s and /w so that any individual message is only displayed ONCE. Repeats are filtered out, as long as the text is identical or very close. A message is determined to be 'close' based on some advanced heuristics. It means you will only see unique LFG messages once. On heavily populated servers for example this may reduce the chat messages by 70% to 80%, and makes the channels readable again. 10 | 11 | Any message which is identified to be a duplicate of one sent earlier is "gapped", which means that it is only allowed to be shown once every X seconds - where X is settable by the user. The default is 600 seconds (10 minutes). 12 | 13 | The default is to hide the message entirely so that you never see the repeat. If you want to see what you are missing, then you can set "color" mode, for which the repeats will be colored dark gray - easy to ignore, and gives you a sense of what is being blocked. The author recommends using the hide mode under normal circumstances. 14 | 15 | 16 | Behavior: 17 | * Spam is filtered from the numbered channels, i.e. /1 to /99 (which includes the trade channel, the worst offender). 18 | * Spam on /y (yell) is treated the same as a numbered channel, and is filtered similarly. 19 | * Spam on /w (whisper) is treated the same as well (optionally). 20 | * Spam on /s (say) is treated the same as well (optionally). 21 | * There is an option to reply to whispers automatically with a message telling the person their message was blocked. 22 | * The filter will not affect raid/bg, guild chat and so on. 23 | * It won't filter your OWN messages AT ALL; they will show up as normal, even if you're committing the spam yourself. 24 | * It filters by the content of the message itself, looking for repetitive messages. 25 | * There is a keyword list that you can adjust to filter by keyword. 26 | * There is a player list that you can adjust to filter by player name. 27 | * The first time a unique message arrives, it is always shown. 28 | * It is free-standing and compatible with other spam filters. 29 | * Repeated messages are allowed every X seconds, where X defaults to 600. This is user settable. 30 | * Windfury is in the default keyword list, as well as many common gold selling sites. 31 | 32 | Usage: 33 | /spamthrottle, or /st 34 | Opens the main configuration GUI. All settings are controllable here. 35 | 36 | /st reset 37 | Resets the memory to start from scratch - effectively making the program forget all previous messages. 38 | 39 | The settings are remembered account-wide (affects all characters). 40 | 41 | 42 | Changes (for PRIVATE SERVER 1.12 version): 43 | Vanilla_1.0 (22/06/2014): Ported to work on Classic Wow 1.12.x. Added code to block join/leave channels spam, and channel ownership spam. 44 | Note that Vanilla version uses a much older event handling mechanism, so may conflict with other chat related add ons. 45 | 46 | Vanilla_1.2 (24/07/2014): Added configuration GUI, and more features. 47 | 48 | Vanilla_1.3 (04/06/2015): Added more features based on suggestions on Nostalrius. 49 | 50 | Vanilla_1.4 (08/08/2015): Improvements that keep spammers from deliberately bypassing the filters, and performance improvements. 51 | 52 | Vanilla_1.5 (10/08/2015): Added whitelist capability. 53 | 54 | Vanilla_1.6 (26/09/2015): Added yell filter option, keywords 55 | 56 | Vanilla_1.7 (16/04/2016): Intermediate update to try to make more compatible with other addons; a work in progress. Also more keywords. 57 | 58 | Vanilla_1.8 (23/04/2016): Implemented overhook, delaying the chat handler hook for compatibility. This works now. 59 | 60 | Vanilla_1.9 (25/04/2016): Added QQ filtering into the Chinese message filter option. If turned on, filters messages with a QQ address. Also added normalization of some obfuscated letters. 61 | 62 | Vanilla_1.9a (15/06/2016): Additional anti-obfuscation for UTF-8 2-byte characters codes masquerading as english characters. Also added another gold seller site to the default block list. 63 | 64 | Vanilla_1.10 (20/06/2016): Added code to handle multiple windows, written by github’s sipertruk. Thanks mate! Also added some more anti-obfuscation code. 65 | 66 | Vanilla_1.11 (17/08/2016): Added (optional) aggressive gold spam filtering 67 | 68 | Vanilla_1.12c (30/12/2016): Added WIM support (by laytya) 69 | Added "invite to channel" spam block (by Sqoops) 70 | Added Multi-line spam block (by EvilSanta) 71 | 72 | Vanilla 1.12d (04/01/2017): More compatible WIM support w/ multi-line 73 | 74 | Vanilla 1.12e (04/01/2017):Add more sites by @Bondon 75 | 76 | Vanilla 1.13 (16/01/2017): Added support for .wr command and saving state 77 | 78 | Vanilla 1.14 (04/02/2017): Improved multyline goldslers ban. 79 | Changed the way of storing filter and ban lists. Its should be same across alts on same account 80 | Added new stopwords for ban 81 | 82 | Vanilla 1.15 (05/02/2017): added minimap button w/ tooltip of last filtered or baned player 83 | improved multyline ban 84 | added new stopwords 85 | some options dialog improvements 86 | 87 | Vanilla 1.16 (11/02/2017): fixed spam filter (repeated messages) 88 | fixed some memory leaks 89 | some minor fixes 90 | Vanilla 1.16a (21/02/2017): refactoring of spam filter (repeated messages) should work now 91 | added emote spam block 92 | 93 | Vanilla 1.17 (17.07.2018): refactoring multiline spam detection, some minor enhansements, added some stopwords for Northdale =) 94 | 95 | 96 | Acknowledgements: 97 | This addon was originally inspired by ASSFilter, created by Yewbacca. 98 | Thanks to Tori of Blackrock for helping with some of the event handler code on the retail version. Much appreciated! 99 | -------------------------------------------------------------------------------- /SpamThrottle/Localization.lua: -------------------------------------------------------------------------------- 1 | -- English localization 2 | -- English by Mopar 3 | 4 | -- Localization Strings 5 | 6 | SpamThrottleProp = {}; 7 | SpamThrottleProp.Version = GetAddOnMetadata("SpamThrottle", "Version"); 8 | SpamThrottleProp.Author = "Mopar"; 9 | SpamThrottleProp.AppName = "SpamThrottle"; 10 | SpamThrottleProp.Label = SpamThrottleProp.AppName .. " version " .. SpamThrottleProp.Version; 11 | SpamThrottleProp.LongLabel = SpamThrottleProp.Label .. " by " .. SpamThrottleProp.Author; 12 | SpamThrottleProp.CleanLabel = SpamThrottleProp.AppName .. " by " .. SpamThrottleProp.Author; 13 | SpamThrottleProp.Description = "A spam-reducing addon to remove repeated and annoying chat messages"; 14 | 15 | SpamThrottleConfigMenuTitle = SpamThrottleProp.Label; 16 | SpamThrottleGlobalOptions = "Global SpamThrottle Options"; 17 | SpamThrottleStatus = "SpamThrottle Status & Gapping"; 18 | SpamThrottleKeywords = "Filtering Keywords"; 19 | SpamThrottlePlayerbans = "Filtered Player Names (local bans)"; 20 | SpamThrottleGeneralMask = "<<<----[%a%d][%a%d][%a%d][%a%d][%a%d][%a%d][%a%d][%a%d][%a%d][%a%d][%a%d][%a%d]"; 21 | 22 | SpamThrottleChatMsg = { 23 | WelcomeMsg = SpamThrottleProp.CleanLabel .. " for reducing chat spam (Slash commands: /spamthrottle or /st)"; 24 | ObjectLoadFail = "Error! Failed to load object:"; 25 | ObjectSaveFail = "Error! Failed to save object:"; 26 | LoadDefault = "Version update detected. Options have been reset to defaults."; 27 | LoadKeywordDefault = "Keyword filtering list has been reset to defaults."; 28 | LoadPlayerbanDefault = "Local player silencing list has been cleared."; 29 | EnterFilterKeyword = "Enter new filtering keyword:"; 30 | EnterPlayername = "Enter player name:"; 31 | BanAdded = "added to your local SpamThrottle ban list"; 32 | BanRemoved = "removed from your local SpamThrottle ban list"; 33 | Permanent = "unlimited time"; 34 | Timeout = "timeout"; 35 | WhisperBack = "Message delivery failure: Your whisper was blocked by an addon."; 36 | } 37 | 38 | SpamThrottleStatusMsg = { 39 | StatusText1 = "keywords in keyword filter list"; 40 | StatusText2 = "player names in player filter list"; 41 | StatusText4 = "player names in moderated ban list"; 42 | StatusText5 = "unique received messages currently in database"; 43 | StatusText6 = "messages filtered so far in this session"; 44 | StatusText7 = "Whitelisted Channels:"; 45 | StatusText8 = "1: "; 46 | StatusText9 = "2: "; 47 | StatusText10 = "3: "; 48 | } 49 | 50 | SpamThrottleConfigObjectText ={ 51 | STActive = "Enable SpamThrottle Filtering"; 52 | STDupFilter = "Remove duplicated messages until gap timeout"; 53 | STColor = "Color messages rather than hiding"; 54 | STFuzzy = "Fuzzy filter messages enabled"; 55 | STGoldSeller = "Gold seller ad aggressive filtering enabled"; 56 | STChinese = "Chinese character & QQ filtering enabled"; 57 | STCtrlMsgs = "Control message block for chat channels"; 58 | STYellMsgs = "Filtering of /y (yell) messages enabled"; 59 | STSayMsgs = "Filtering of /s (say) messages enabled"; 60 | STWispMsgs = "Filtering of /w (whisper) messages enabled"; 61 | STWispBack = "Auto reply if filtered"; 62 | STMultiWisp = "Filtering combined whispers from same player"; 63 | STWispMsgsOFF = "Turn whispers completely off"; 64 | STReverse = "Display ONLY keyword matches as a whitelist"; 65 | STMinimapButton = "Display Minimap button"; 66 | STGap = "Message Gapping (sec)"; 67 | STBanPerm = "Permanent"; 68 | STBanTimeout = "Ban Timeout (sec)"; 69 | } 70 | 71 | SpamThrottleConfigObjectTooltip ={ 72 | STActive = "Enable or disable all chat message filtering."; 73 | STDupFilter = "If checked, will filter duplicate messages, not allowing them to appear again until the number of seconds specified by Message Gapping has passed"; 74 | STColor = "If checked, filtered messages are identified by coloring them rather than hiding. You see the messages but can visually skip over them more easily."; 75 | STFuzzy = "Enables fuzzy filtering which catches very similar repeated messages such as those sent by drunk characters."; 76 | STGoldSeller = "Enables aggressive gold advertising filtering to remove gold ad spam."; 77 | STChinese = "Filters messages containing Chinese, Korean or Japanese characters."; 78 | STCtrlMsgs = "Filters channel control messages to remove joined/left channel spam."; 79 | STYellMsgs = "Enables filtering of player messages yelled by nearby players"; 80 | STSayMsgs = "Enables filtering of player messages said by nearby players."; 81 | STWispMsgs = "Enables filtering of player messages whispered to you directly."; 82 | STWispBack = "Automatically responds with a polite whisper back to the player telling them their message was blocked. Will not work if WIM present"; 83 | STMultiWisp = "Enables filtering of multiple player messages combined, whispered to you by the same player within the last few seconds."; 84 | STWispMsgsOFF = "Turn whispers completely off by server command .wr at start"; 85 | STReverse = "Reverses the sense of SpamThrottle filtering. Messages matching a keyword will be shown, all others will be blocked."; 86 | STMinimapButton = "Turn On or Off minimap button"; 87 | STGap = "Sets the minimum required gap between repeated messages. If the gap time has not been reached for that player and message since the last one, it will be filtered."; 88 | STBanPerm = "If enabled, player bans stay in place until you remove them. Otherwise players will be removed automatically after the timeout expires for them."; 89 | STBanTimeout = "Players will automatically be removed from this list after this amount of time if permanent ban (above) is not set."; 90 | } 91 | 92 | SpamThrottleGSC1 = { "%d%s+[Gg]", "%d+%D?%D?%D?%D?%D?[Gg]" }; 93 | SpamThrottleGSC2 = { "%$", "USD", "C[O@]M", "W@W", "G4", ">>", ">>>", "[gG][^%$]*%$", "%$[^gG]*[gG]", "[gG]%D?%D?%D?%D?%d+", "[lL][vV][lL]?%D?%D?%D?%D?%D?%d+" }; 94 | SpamThrottleGSO1 = { "ACCOUNT", "CHEAP", "LEGIT", "LEVELING", "LEVELLING", "LEVLING", "LEVILING", "LEVEL", "IEVEING","LVLING", "SAFE", "ITEM", "SERVICE", "NOST", "SELL", "POTION","POWER", "WOW", }; 95 | SpamThrottleGSO2 = { "PRICE", "GOLD", "CURRENCY", "MONEY", "STARS", "SKYPE", "EPIC", "DOLLARS", "PROFESSIONAL", "RELIABLE", "PROMOTION", "DELIVER", "NAXX", "GAMES", "GREETINGS", "WEBSITE", "GOID", "CQM" , "MOK", "WEBMO", "MOGS", "NOST", "SAGEBLADE", "LFMDPSCOM","LFMBRDCOM"}; 96 | SpamThrottleGSUC5 = { "ITEM4" } 97 | SpamThrottleSWLO = { "OKO", "GAMES", "NOST", "COM", "TANK", "WG" , "WMO", "K4WOW", } 98 | 99 | if GetLocale() == "ruRU" then 100 | -- Russian localization by Lichery 101 | 102 | SpamThrottleProp.Label = SpamThrottleProp.AppName .. " версия " .. SpamThrottleProp.Version; 103 | SpamThrottleProp.LongLabel = SpamThrottleProp.Label .. " от " .. SpamThrottleProp.Author; 104 | SpamThrottleProp.CleanLabel = SpamThrottleProp.AppName .. " от " .. SpamThrottleProp.Author; 105 | SpamThrottleProp.Description = "Снижающий спам аддон для удаления повторяющихся и раздражающих сообщений чата."; 106 | 107 | SpamThrottleConfigMenuTitle = SpamThrottleProp.Label; 108 | SpamThrottleGlobalOptions = "Настройки SpamThrottle"; 109 | SpamThrottleStatus = "SpamThrottle Статус & Повтор"; 110 | SpamThrottleKeywords = "Фильтрация ключевых слов"; 111 | SpamThrottlePlayerbans = "Фильтрация имен игроков (местные запреты)"; 112 | SpamThrottleGeneralMask = "<<<----[%a%d][%a%d][%a%d][%a%d][%a%d][%a%d][%a%d][%a%d][%a%d][%a%d][%a%d][%a%d]"; 113 | 114 | SpamThrottleChatMsg = { 115 | WelcomeMsg = SpamThrottleProp.CleanLabel .. " для уменьшения спама чата (Команды: /spamthrottle или /st)"; 116 | ObjectLoadFail = "Ошибка! Не удалось загрузить объект:"; 117 | ObjectSaveFail = "Ошибка! Не удалось сохранить объект:"; 118 | LoadDefault = "Обнаружено обновление версии. Настройки сброшены до значений по умолчанию."; 119 | LoadKeywordDefault = "Список фильтров ключевых слов сброшен до значений по умолчанию."; 120 | LoadPlayerbanDefault = "Местный список блокировки игроков был очищен."; 121 | EnterFilterKeyword = "Введите новое ключевое слово фильтрации:"; 122 | EnterPlayername = "Введите имя игрока:"; 123 | BanAdded = "добавлен в ваш местный список запрета спама SpamThrottle"; 124 | BanRemoved = "удален из вашего местного списка запрета спама SpamThrottle"; 125 | Permanent = "неограниченное время"; 126 | Timeout = "перерыв"; 127 | WhisperBack = "Ошибка доставки сообщений: ваш шепот был заблокирован аддоном."; 128 | } 129 | 130 | SpamThrottleStatusMsg = { 131 | StatusText1 = "ключевых слов в списке фильтрации слов"; 132 | StatusText2 = "имен игроков в списке фильтрации игроков"; 133 | StatusText4 = "имен игроков в списке модерируемых запретов"; 134 | StatusText5 = "уникальных полученных сообщений в базе данных"; 135 | StatusText6 = "отфильтрованных сообщений в этом сеансе"; 136 | StatusText7 = "Каналы \"Белого\" списка:"; 137 | StatusText8 = "1: "; 138 | StatusText9 = "2: "; 139 | StatusText10 = "3: "; 140 | } 141 | 142 | SpamThrottleConfigObjectText ={ 143 | STActive = "Включить фильтрацию SpamThrottle"; 144 | STDupFilter = "Удалять дублир. сообщения до истечения времени ожид."; 145 | STColor = "Окрашивать сообщения вместо скрытия"; 146 | STFuzzy = "Нечеткая фильтрация"; 147 | STGoldSeller = "Активная фильтрация рекламы продавцов золота включена"; 148 | STChinese = "Китайские символы & QQ фильтрация включена"; 149 | STCtrlMsgs = "Фильтрация контрольных сообщений для каналов чата"; 150 | STYellMsgs = "Фильтрация /y (крикнуть) сообщений включена"; 151 | STSayMsgs = "Фильтрация /s (сказать) сообщений включена"; 152 | STWispMsgs = "Фильтрация /w (шепот) сообщений включена"; 153 | STWispBack = "Автоматический ответ, если фильтруется"; 154 | STMultiWisp = "Фильтрация комбинированного шепота одного и того же игрока"; -- 155 | STWispMsgsOFF = "Выключить шепот полностью"; -- 156 | STReverse = "Показывать ТОЛЬКО соответствия ключевых слов как\nв \"белом\" списке"; 157 | STMinimapButton = "Отображать кнопку мини-карты"; -- 158 | STGap = "Повтор сообщений (секунды)"; 159 | STBanPerm = "Постоянный"; 160 | STBanTimeout = "Время запрета\n(секунды)"; 161 | } 162 | 163 | SpamThrottleConfigObjectTooltip ={ 164 | STActive = "Включение или отключение фильтрации всех сообщений чата."; 165 | STDupFilter = "Если флажок установлен, будет фильтровать повторяющиеся сообщения, не позволяя им появляться снова до тех пор, пока не пройдет число секунд, указанное в \"Повтор сообщений\"."; 166 | STColor = "Если флажок установлен, отфильтрованные сообщения идентифицируются путем их окраски, а не скрытия. Вы видите сообщения, но можете визуально пропустить их более легко."; 167 | STFuzzy = "Включает нечеткую фильтрацию, которая захватывает очень похожие повторяющиеся сообщения, такие как отправленные пьяные символами."; 168 | STGoldSeller = "Включает агрессивную фильтрацию рекламы золота."; 169 | STChinese = "Фильтрует сообщения, содержащие иероглифы."; 170 | STCtrlMsgs = "Фильтрует сообщения каналов для удаления спама \"присоединяется к каналу\"/\"покидает канал\"."; 171 | STYellMsgs = "Включает фильтрацию сообщений игроков, кричащих неподалеку."; 172 | STSayMsgs = "Включает фильтрацию сообщений игроков, говорящих неподалеку."; 173 | STWispMsgs = "Включает фильтрацию сообщений игроков, шепчущих вам."; 174 | STWispBack = "Автоматически отвечает вежливым шепотом обратно игроку, сообщая им, что их сообщение заблокировано. Не будет работать, если присутствует WIM"; 175 | STMultiWisp = "Включает фильтрацию нескольких объединенных сообщений, шепчущий вам один и тот же игрок в течение последних нескольких секунд."; -- 176 | STWispMsgsOFF = "Полностью отключить шепот по команде сервера .wr при запуске"; -- 177 | STReverse = "Изменяет смысл фильтрации SpamThrottle. Будут показаны сообщения, соответствующие ключевому слову, все остальные будут заблокированы."; 178 | STMinimapButton = "Кнопка включения или выключения мини-карты"; -- 179 | STGap = "Устанавливает минимальный необходимый промежуток между повторяющимися сообщениями. Если для этого игрока с момента отправки последнего сообщения не было достигнуто установленное время, сообщение будет отфильтровано."; 180 | STBanPerm = "Если включено, запреты игроков остаются на месте, пока вы их не удалите. В противном случае игроки будут удалены автоматически после истечения времени ожидания для них."; 181 | STBanTimeout = "Игроки будут автоматически удаляться из списка через этот промежуток времени, если постоянный запрет (выше) не установлен."; 182 | } 183 | 184 | SpamThrottleGSC1 = { "%d%s+[Gg]", "%d+%D?%D?%D?%D?%D?[Gg]" }; 185 | SpamThrottleGSC2 = { "%$", "USD", "C[O@]M", "W@W", "G4", ">>", ">>>", "[gG][^%$]*%$", "%$[^gG]*[gG]", "[gG]%D?%D?%D?%D?%d+", "[lL][vV][lL]?%D?%D?%D?%D?%D?%d+" }; 186 | SpamThrottleGSO1 = { "ACCOUNT", "CHEAP", "LEGIT", "LEVELING", "LEVELLING", "LEVLING", "LEVILING", "LEVEL", "IEVEING","LVLING", "SAFE", "ITEM", "SERVICE", "NOST", "SELL", "POTION","POWER", "WOW", }; 187 | SpamThrottleGSO2 = { "PRICE", "GOLD", "CURRENCY", "MONEY", "STARS", "SKYPE", "EPIC", "DOLLARS", "PROFESSIONAL", "RELIABLE", "PROMOTION", "DELIVER", "NAXX", "GAMES", "GREETINGS", "WEBSITE", "GOID", "CQM" , "MOK", "WEBMO", "MOGS", "NOST", "SAGEBLADE", "LFMDPSCOM","LFMBRDCOM"}; 188 | SpamThrottleGSUC5 = { "ITEM4" } 189 | SpamThrottleSWLO = { "OKO", "GAMES", "NOST", "COM", "TANK", "WG" , "WMO", "K4WOW", } 190 | end -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | 676 | -------------------------------------------------------------------------------- /SpamThrottle/SpamThrottle.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | SpamThrottle - Remove redundant and annoying chat messages 3 | Version: Vanilla 1.16 4 | Date: 11.02.2017 5 | Author: Mopar 6 | This is a port of SpamThrottle to work with Vanilla WoW, release 1.12.1 and 1.12.2. 7 | I am also the author of the retail version (no longer maintained). 8 | Only allows a particular message to be displayed once, rather than repeated. 9 | A timeout (call the gapping value) controls how often the exact same message 10 | may be repeated, and this value is settable by the user. There is also a keyword 11 | list to filter by keywords, and a player name list to filter by specific players. 12 | Both lists are unlimited in size. 13 | 14 | Also allows (optional) blocking of chat channel join/leave spam, 15 | and other chat channel control messages. 16 | Portions of this code were adapted from the following addons: 17 | - SpamEraser 18 | - ASSFilter 19 | 20 | Special thanks to Github's sipertruk for multiple-chat frame handling code. 21 | ]] 22 | 23 | --============================ 24 | --= Settings, Defaults, and Local Variables 25 | --============================ 26 | local DebugMsg = false; 27 | local ErrorMsg = true; 28 | local DebugMode = false; 29 | local BlockReportMode = false; 30 | local ScoreMsg = false; 31 | local debugWin = 0; 32 | 33 | local MessageList = {} 34 | for i=1, NUM_CHAT_WINDOWS do 35 | MessageList["ChatFrame"..i] = {} 36 | end 37 | MessageList["WIM_Core"] = {} 38 | local WIM_Present = false; 39 | local MultiMessageCache = {} 40 | local MultiLastMsg = {} 41 | local LastPurgeTime = time() 42 | local LastAuditTime = time() 43 | local FilteredCount = 0; 44 | local UniqueCount = 0; 45 | local PlayerListAuditGap = 10; 46 | local DelayHookInitTime = time(); 47 | local DelayHookReHooked; 48 | 49 | Default_SpamThrottle_Config = { 50 | Version = SpamThrottleProp.Version; 51 | STActive = true; 52 | STDupFilter = true; 53 | STColor = false; 54 | STGoldSeller = true; 55 | STFuzzy = true; 56 | STChinese = true; 57 | STCtrlMsgs = true; 58 | STYellMsgs = true; 59 | STSayMsgs = true; 60 | STWispMsgs = true; 61 | STWispBack = false; 62 | STMultiWisp = true; 63 | STWispMsgsOFF = false; 64 | STReverse = false; 65 | STGap = 180; 66 | STBanPerm = true; 67 | STBanTimeout = 600; 68 | STWhiteChannel1 = ""; 69 | STWhiteChannel2 = ""; 70 | STWhiteChannel3 = ""; 71 | MinimapButtonAtt = true; 72 | STMinimapButton = true; 73 | ButtonPosX = -17; 74 | ButtonPosY = -113; 75 | } 76 | 77 | Default_SpamThrottle_KeywordFilterList = { 78 | "Blessed Blade of the Windseeker", "item4game", "moneyforgames", 79 | "goldinsider", "sinbagame", "sinbagold", "sinbaonline", "susangame", 80 | "4gamepower", "iloveugold", "okogames", "okogomes", "item4wow", "gold4mmo", 81 | "wtsitem", "golddeal", "g4wow", 82 | "legacy-boost", "mmotank", "naxxgames", "nost100", "wwvokgames"} 83 | 84 | Default_SpamThrottle_PlayerFilterList = {}; 85 | 86 | SpamThrottle_PlayerBanTime = {}; 87 | 88 | local SpamThrottle_GlobalBanList = {} 89 | 90 | SpamThrottle_LastClickedItem = nil; 91 | SpamThrottle_LastClickedTable = nil; 92 | SpamThrottle_LastClickedValue = nil; 93 | 94 | SpamThrottle_LastPlayerBanned = " "; 95 | SpamThrottle_LastPlayerFiltered = " "; 96 | 97 | SpamThrottle_UTF8Convert = {}; 98 | 99 | SpamThrottle_UTF8Convert[tonumber("391",16)] = "A"; 100 | SpamThrottle_UTF8Convert[tonumber("392",16)] = "B"; 101 | SpamThrottle_UTF8Convert[tonumber("395",16)] = "E"; 102 | SpamThrottle_UTF8Convert[tonumber("396",16)] = "Z"; 103 | SpamThrottle_UTF8Convert[tonumber("397",16)] = "H"; 104 | SpamThrottle_UTF8Convert[tonumber("399",16)] = "I"; 105 | SpamThrottle_UTF8Convert[tonumber("39A",16)] = "K"; 106 | SpamThrottle_UTF8Convert[tonumber("39C",16)] = "M"; 107 | SpamThrottle_UTF8Convert[tonumber("39D",16)] = "N"; 108 | SpamThrottle_UTF8Convert[tonumber("39F",16)] = "O"; 109 | SpamThrottle_UTF8Convert[tonumber("3A1",16)] = "P"; 110 | SpamThrottle_UTF8Convert[tonumber("3A4",16)] = "T"; 111 | SpamThrottle_UTF8Convert[tonumber("3A5",16)] = "Y"; 112 | SpamThrottle_UTF8Convert[tonumber("3A6",16)] = "O"; 113 | SpamThrottle_UTF8Convert[tonumber("3A7",16)] = "X"; 114 | SpamThrottle_UTF8Convert[tonumber("405",16)] = "S"; 115 | SpamThrottle_UTF8Convert[tonumber("406",16)] = "I"; 116 | SpamThrottle_UTF8Convert[tonumber("408",16)] = "J"; 117 | SpamThrottle_UTF8Convert[tonumber("410",16)] = "A"; 118 | SpamThrottle_UTF8Convert[tonumber("412",16)] = "B"; 119 | SpamThrottle_UTF8Convert[tonumber("415",16)] = "E"; 120 | SpamThrottle_UTF8Convert[tonumber("41A",16)] = "K"; 121 | SpamThrottle_UTF8Convert[tonumber("41C",16)] = "M"; 122 | SpamThrottle_UTF8Convert[tonumber("41D",16)] = "H"; 123 | SpamThrottle_UTF8Convert[tonumber("41E",16)] = "O"; 124 | SpamThrottle_UTF8Convert[tonumber("420",16)] = "P"; 125 | SpamThrottle_UTF8Convert[tonumber("421",16)] = "C"; 126 | SpamThrottle_UTF8Convert[tonumber("422",16)] = "T"; 127 | SpamThrottle_UTF8Convert[tonumber("423",16)] = "Y"; 128 | SpamThrottle_UTF8Convert[tonumber("425",16)] = "X"; 129 | SpamThrottle_UTF8Convert[tonumber("428",16)] = "W"; 130 | SpamThrottle_UTF8Convert[tonumber("429",16)] = "W"; 131 | SpamThrottle_UTF8Convert[tonumber("435",16)] = "O"; 132 | SpamThrottle_UTF8Convert[tonumber("448",16)] = "w"; 133 | SpamThrottle_UTF8Convert[tonumber("449",16)] = "w"; 134 | SpamThrottle_UTF8Convert[tonumber("460",16)] = "W"; 135 | SpamThrottle_UTF8Convert[tonumber("461",16)] = "w"; 136 | SpamThrottle_UTF8Convert[tonumber("49A",16)] = "K"; 137 | SpamThrottle_UTF8Convert[tonumber("49B",16)] = "k"; 138 | SpamThrottle_UTF8Convert[tonumber("49C",16)] = "K"; 139 | SpamThrottle_UTF8Convert[tonumber("49D",16)] = "k"; 140 | SpamThrottle_UTF8Convert[tonumber("49E",16)] = "K"; 141 | SpamThrottle_UTF8Convert[tonumber("49F",16)] = "k"; 142 | SpamThrottle_UTF8Convert[tonumber("4A0",16)] = "K"; 143 | SpamThrottle_UTF8Convert[tonumber("4A1",16)] = "k"; 144 | SpamThrottle_UTF8Convert[tonumber("4AE",16)] = "Y"; 145 | SpamThrottle_UTF8Convert[tonumber("4AF",16)] = "Y"; 146 | SpamThrottle_UTF8Convert[tonumber("51C",16)] = "W"; 147 | SpamThrottle_UTF8Convert[tonumber("51D",16)] = "w"; 148 | 149 | 150 | --============================ 151 | --= Static Popup Dialog Definitions 152 | --============================ 153 | StaticPopupDialogs["SPAMTHROTTLE_ADD_KEYWORD"] = { 154 | text = "%s"; 155 | button1 = "Okay"; 156 | button2 = "Cancel"; 157 | hasEditBox = 1, 158 | whileDead = 1, 159 | hideOnEscape = 1, 160 | timeout = 0, 161 | enterClicksFirstButton = 1, 162 | OnShow = function() 163 | getglobal(this:GetName().."EditBox"):SetText(""); 164 | end, 165 | OnAccept = function() 166 | variable = getglobal(this:GetParent():GetName().."EditBox"):GetText(); 167 | SpamThrottle_AddKeyword(variable); 168 | end, 169 | EditBoxOnEnterPressed = function() 170 | variable = getglobal(this:GetParent():GetName().."EditBox"):GetText(); 171 | SpamThrottle_AddKeyword(variable); 172 | this:GetParent():Hide(); 173 | end, 174 | OnAlt = function() 175 | variable = getglobal(this:GetParent():GetName().."EditBox"):GetText(); 176 | end 177 | } 178 | 179 | StaticPopupDialogs["SPAMTHROTTLE_ADD_PLAYERBAN"] = { 180 | text = "%s"; 181 | button1 = "Okay"; 182 | button2 = "Cancel"; 183 | hasEditBox = 1, 184 | whileDead = 1, 185 | hideOnEscape = 1, 186 | timeout = 0, 187 | enterClicksFirstButton = 1, 188 | OnShow = function() 189 | getglobal(this:GetName().."EditBox"):SetText(""); 190 | end, 191 | OnAccept = function() 192 | variable = getglobal(this:GetParent():GetName().."EditBox"):GetText(); 193 | SpamThrottle_AddPlayerban(variable); 194 | end, 195 | EditBoxOnEnterPressed = function() 196 | variable = getglobal(this:GetParent():GetName().."EditBox"):GetText(); 197 | SpamThrottle_AddPlayerban(variable); 198 | this:GetParent():Hide(); 199 | end, 200 | OnAlt = function() 201 | variable = getglobal(this:GetParent():GetName().."EditBox"):GetText(); 202 | end 203 | } 204 | 205 | --============================ 206 | --= Unit popup options (right clicking on character name in chat) 207 | --= This is really dirty. It would cause taint on later versions of WoW. 208 | --============================ 209 | UnitPopupButtons["SPAMTHROTTLE_ADD_PLAYERBAN"] = { 210 | text = "Ban player chat", 211 | dist = 0 212 | } 213 | 214 | UnitPopupButtons["SPAMTHROTTLE_REMOVE_PLAYERBAN"] = { 215 | text = "Unban player chat", 216 | dist = 0 217 | } 218 | 219 | table.insert(UnitPopupMenus["FRIEND"], 1, "SPAMTHROTTLE_ADD_PLAYERBAN"); 220 | table.insert(UnitPopupMenus["FRIEND"], 2, "SPAMTHROTTLE_REMOVE_PLAYERBAN"); 221 | 222 | local SpamThrottleUnitPopup_OnClick = UnitPopup_OnClick; 223 | function UnitPopup_OnClick(self) 224 | local theFrame = UIDROPDOWNMENU_INIT_MENU 225 | local theName = FriendsDropDown.name; 226 | local theButton = this.value; 227 | 228 | if theFrame == "FriendsDropDown" then 229 | if theButton == "SPAMTHROTTLE_ADD_PLAYERBAN" then 230 | if theName ~= UnitName("player") then 231 | local banType; 232 | if SpamThrottle_Config.STBanPerm then 233 | banType = " (" .. SpamThrottleChatMsg.Permanent .. ")"; 234 | else 235 | banType = " (" .. SpamThrottleChatMsg.Timeout .. "=" .. SpamThrottle_Config.STBanTimeout .. ")"; 236 | end 237 | SpamThrottle_AddPlayerban(theName); 238 | SpamThrottleMessage(true,theName,SpamThrottleChatMsg.BanAdded,banType); 239 | end 240 | elseif theButton == "SPAMTHROTTLE_REMOVE_PLAYERBAN" then 241 | if theName ~= UnitName("player") then 242 | SpamThrottle_RemovePlayerban(theName); 243 | SpamThrottleMessage(true,theName,SpamThrottleChatMsg.BanRemoved); 244 | end 245 | else 246 | -- do nothing 247 | end 248 | end 249 | SpamThrottleUnitPopup_OnClick(self); 250 | end 251 | 252 | --============================ 253 | --= Message function that prints variable to default chat frame 254 | --============================ 255 | function SpamThrottleMessage(visible, ...) 256 | debugWin = 0 257 | local name, shown; 258 | for i=1, NUM_CHAT_WINDOWS do 259 | name,_,_,_,_,_,shown = GetChatWindowInfo(i); 260 | if (string.lower(name) == "stdebug") then debugWin = i; break; end 261 | end 262 | if (debugWin == 0) then 263 | debugWin = DEFAULT_CHAT_FRAME 264 | else 265 | debugWin = getglobal("ChatFrame"..debugWin) 266 | end 267 | for i = 1,arg.n do 268 | if type(arg[i]) == "nil" then 269 | arg[i] = "(nil)"; 270 | elseif type(arg[i]) == "boolean" and arg[i] then 271 | arg[i] = "(true)"; 272 | elseif type(arg[i]) == "boolean" and not arg[i] then 273 | arg[i] = "(false)"; 274 | end 275 | end 276 | 277 | if (visible) then 278 | debugWin:AddMessage("SpamThrottle: " .. table.concat (arg, " "), 0.5, 0.5, 1); 279 | end 280 | end 281 | 282 | function SpamThrottleMessageHex(visible, msg) 283 | local Nlen = string.len(msg); 284 | local out = "" 285 | for i = 1, Nlen do 286 | out = out .. string.format("%X ",string.byte(msg,i,i)) 287 | end 288 | if Prat_UrlCopy then out = Prat_UrlCopy:Link(out) end 289 | if (visible) then 290 | debugWin:AddMessage("SpamThrottle: " .. out, 0.5, 0.5, 1); 291 | end 292 | end 293 | 294 | --============================ 295 | --= Delay the hook of the chat messaging function 296 | --============================ 297 | 298 | local UFStartTime = time(); 299 | local UFInitialized; 300 | local UpdateFrame; 301 | 302 | function UFOverHookEvents() 303 | if(time() - UFStartTime > 10 and UFInitialized == nil) then 304 | SpamThrottle_OrigChatFrame_OnEvent = ChatFrame_OnEvent; 305 | ChatFrame_OnEvent = SpamThrottle_ChatFrame_OnEvent; 306 | if WIM_ChatFrame_OnEvent then 307 | SpamThrottle_Orig_WIM_ChatFrame_OnEvent = WIM_ChatFrame_OnEvent; 308 | WIM_ChatFrame_OnEvent = SpamThrottle_WIM_ChatFrame_OnEvent; 309 | WIM_Present = true; 310 | SpamThrottle_SetAlphas(SpamThrottle_Config.STActive); 311 | end 312 | SpamThrottleMessage(true,"Chat message hook is now enabled."); 313 | UFStartTime = nil; 314 | UFInitialized = true; 315 | this:Hide(); 316 | this:SetScript("OnUpdate", nil); 317 | this = nil; 318 | end 319 | end 320 | 321 | local UpdateFrame = CreateFrame("Frame", nil); 322 | UpdateFrame:SetScript("OnUpdate",UFOverHookEvents); 323 | UpdateFrame:RegisterEvent("OnUpdate"); 324 | 325 | 326 | --============================ 327 | -- Local function to normalize chat strings to avoid attempts to bypass SpamThrottle 328 | --============================ 329 | local function SpamThrottle_strNorm(msg, Author) 330 | local Nmsg = ""; 331 | local c = ""; 332 | local lastc = ""; 333 | local Bmsg = ""; 334 | 335 | if (msg == nil) then return end; 336 | 337 | if (not SpamThrottle_Config.STFuzzy) then 338 | return string.upper(Author) .. msg; 339 | end 340 | 341 | Nmsg = string.gsub(msg,"\\/\\/","W"); 342 | Nmsg = string.gsub(Nmsg,"/\\/\\","M"); 343 | Nmsg = string.gsub(Nmsg,"/-\\","A"); 344 | Nmsg = string.gsub(Nmsg,"!<","K"); 345 | Nmsg = string.gsub(Nmsg,"I<","K"); 346 | Nmsg = string.gsub(Nmsg,"0","O"); 347 | Nmsg = string.gsub(Nmsg,"3","E"); 348 | Nmsg = string.gsub(Nmsg,"...hic!",""); 349 | Nmsg = string.upper(Nmsg); 350 | 351 | Nmsg = string.gsub(Nmsg,"\|HITEM[^|]+\|H",""); 352 | Nmsg = string.gsub(Nmsg,"\|C%S%S%S%S%S%S%S%S",""); 353 | Nmsg = string.gsub(Nmsg,"\|H",""); 354 | Nmsg = string.gsub(Nmsg,"\|R",""); 355 | 356 | Nmsg = string.gsub(Nmsg,"%d",""); 357 | Nmsg = string.gsub(Nmsg,"%c",""); 358 | Nmsg = string.gsub(Nmsg,"%p",""); 359 | Nmsg = string.gsub(Nmsg,"%s",""); 360 | 361 | Nmsg = string.gsub(Nmsg,"SH","S"); 362 | Nmsg = string.gsub(Nmsg,"RN","M"); 363 | Nmsg = string.gsub(Nmsg,"VV","W"); 364 | 365 | local Nlen = string.len(Nmsg); 366 | 367 | for i = 1, Nlen do 368 | if i ~= Nlen then 369 | s1 = string.sub(Nmsg,i,i); 370 | s2 = string.sub(Nmsg,i+1,i+1); 371 | c1 = string.byte(s1); 372 | c2 = string.byte(s2); 373 | 374 | if c1 > 192 and c1 <= 225 then -- it's a UTF-8 2 byte code 375 | p1 = c1 - math.floor(c1/32)*32; 376 | p2 = c2 - math.floor(c2/64)*64; 377 | p = p1*64+p2; 378 | 379 | if SpamThrottle_UTF8Convert[p] ~= nil then 380 | Bmsg = Bmsg .. SpamThrottle_UTF8Convert[p]; 381 | i = i + 1; 382 | else 383 | Bmsg = Bmsg .. s1; 384 | end 385 | else 386 | if c1 == 151 and c2 == 139 then 387 | Bmsg = Bmsg .. "O"; 388 | i = i + 1; 389 | else 390 | Bmsg = Bmsg .. s1; 391 | end 392 | end 393 | else 394 | Bmsg = Bmsg .. string.sub(Nmsg,i,i); 395 | end 396 | end 397 | Nmsg = Bmsg; 398 | Bmsg = ""; 399 | 400 | for i = 1, string.len(Nmsg) do -- for c in string.gmatch(Nmsg,"%u") do 401 | c = string.sub(Nmsg,i,i) 402 | if (c ~= lastc) then 403 | Bmsg = Bmsg .. c; 404 | end 405 | lastc = c; 406 | end 407 | Nmsg = Bmsg 408 | 409 | if (Author ~= nil) then 410 | Nmsg = string.upper(Author) .. Nmsg; 411 | end 412 | 413 | return Nmsg 414 | end 415 | 416 | 417 | --============================ 418 | --= Utility function to count the number of entries in a table 419 | --============================ 420 | function table.length(T) 421 | local count = 0 422 | for _ in pairs(T) do count = count + 1 end 423 | return count 424 | end 425 | 426 | --============================ 427 | --= Utility function to find the index of element in table T 428 | --============================ 429 | function table.find(table, element) -- find element v of T satisfying f(v) 430 | for key, value in ipairs(table) do 431 | if value == element then 432 | return key 433 | end 434 | end 435 | return nil 436 | end 437 | 438 | 439 | local function MergeTables(a, b) 440 | if type(a) == 'table' and type(b) == 'table' then 441 | table.foreach(b, function(k,v) 442 | for kk,vv in a do 443 | if v == vv then return; end 444 | end 445 | table.insert(a,v) 446 | end) 447 | end 448 | return a 449 | end 450 | 451 | 452 | --============================ 453 | --= Utility function to check each variable in two tables making sure their variable type match. 454 | --============================ 455 | function SpamThrottle_TableTypeMatch(table1, table2) 456 | for key,value in pairs(table1) do 457 | if type(table1[key]) ~= type(table2[key]) then 458 | return false 459 | end 460 | end 461 | return true; 462 | end 463 | 464 | 465 | local function StringHash(text) 466 | local counter = 1 467 | local len = string.len(text) 468 | for i = 1, len, 3 do 469 | counter = math.mod(counter*8161, 4294967279) + -- 2^32 - 17: Prime! 470 | (string.byte(text,i)*16776193) + 471 | ((string.byte(text,i+1) or (len-i+256))*8372226) + 472 | ((string.byte(text,i+2) or (len-i+256))*3932164) 473 | end 474 | return math.mod(counter, 4294967291) -- 2^32 - 5: Prime (and different from the prime in the loop) 475 | end 476 | 477 | 478 | --============================ 479 | --= OnLoad registers events and prints the welcome message 480 | --============================ 481 | function SpamThrottle_OnLoad() 482 | this:RegisterEvent("PLAYER_ENTERING_WORLD"); 483 | UpdateFrame:Show(); 484 | SpamThrottleMessage(true,SpamThrottleChatMsg.WelcomeMsg); 485 | end 486 | 487 | --============================ 488 | --= Initialize SpamThrottle 489 | --============================ 490 | function SpamThrottle_init() 491 | 492 | -- Install or upgrade, Load Variable from default and show config window 493 | 494 | if type(SpamThrottle_Config) ~= "table" or not SpamThrottle_TableTypeMatch(Default_SpamThrottle_Config, SpamThrottle_Config) or (SpamThrottle_Config.Version ~= Default_SpamThrottle_Config.Version) then 495 | if SpamThrottle_Config == nil then SpamThrottle_Config = {}; end 496 | table.foreach(Default_SpamThrottle_Config, function(k,v) 497 | if SpamThrottle_Config[k] == nil then 498 | SpamThrottle_Config[k] = v; 499 | -- SpamThrottleMessage(true, k.." = "..v); 500 | end 501 | end) 502 | 503 | if type(SpamThrottle_KeywordFilterList) == "table" then 504 | MergeTables(SpamThrottle_KeywordFilterList, Default_SpamThrottle_KeywordFilterList); 505 | else 506 | SpamThrottle_KeywordFilterList = Default_SpamThrottle_KeywordFilterList; 507 | end 508 | if SpamThrottle_PlayerFilterList == nil then 509 | SpamThrottle_PlayerFilterList = Default_SpamThrottle_PlayerFilterList; 510 | end 511 | 512 | SpamThrottle_Config.Version = Default_SpamThrottle_Config.Version; 513 | SpamThrottleMessage(ErrorMsg, SpamThrottleChatMsg.LoadDefault); 514 | end 515 | 516 | if type(SpamThrottle_KeywordFilterList) ~= "table" then 517 | SpamThrottle_KeywordFilterList = {}; 518 | SpamThrottle_KeywordFilterList = Default_SpamThrottle_KeywordFilterList; 519 | SpamThrottleMessage(ErrorMsg, SpamThrottleChatMsg.LoadKeywordDefault); 520 | end 521 | 522 | if type(SpamThrottle_PlayerFilterList) ~= "table" then 523 | SpamThrottle_PlayerFilterList = {}; 524 | SpamThrottle_PlayerFilterList = Default_SpamThrottle_PlayerFilterList; 525 | SpamThrottleMessage(ErrorMsg, SpamThrottleChatMsg.LoadPlayerbanDefault); 526 | end 527 | 528 | SpamThrottle_ToggleWispersOFF( SpamThrottle_Config.STWispMsgsOFF ); 529 | 530 | end 531 | 532 | 533 | --============================ 534 | --= OnEvent is the main event handler for registered events 535 | --============================ 536 | function SpamThrottle_OnEvent() 537 | if event == "PLAYER_ENTERING_WORLD" then 538 | SpamThrottle_init(); 539 | SpamThrottle_SetButtonPosition(); 540 | end 541 | end 542 | 543 | function SpamThrottleCreateTooltip(STTooltip) 544 | if SpamThrottle_LastPlayerBanned ~= " " then STTooltip:AddLine("Last player BANed: ".. SpamThrottle_LastPlayerBanned , 0, 1, 0); end 545 | if SpamThrottle_LastPlayerFiltered ~= " " then STTooltip:AddLine("Last player filtered: ".. SpamThrottle_LastPlayerFiltered , 0, 1, 0); end 546 | end 547 | 548 | --============================ 549 | --= User Interface Handling Functions 550 | --============================ 551 | 552 | function SpamThrottleConfigFrame_OnShow() 553 | local theStatusValue; 554 | 555 | SpamThrottleConfigFrameLoadSettings(SpamThrottle_Config); 556 | SpamThrottle_LastClickedItem = nil; 557 | SpamThrottle_LastClickedTable = nil; 558 | SpamThrottle_LastClickedValue = nil; 559 | 560 | theStatusValue = string.format("%7d",table.length(SpamThrottle_KeywordFilterList)); 561 | SpamThrottleStatusValue1:SetTextColor(1,1,1); 562 | SpamThrottleStatusValue1:SetText(theStatusValue); 563 | SpamThrottleStatusValue1:Show(); 564 | 565 | theStatusValue = string.format("%7d",table.length(SpamThrottle_PlayerFilterList)); 566 | SpamThrottleStatusValue2:SetTextColor(1,1,1); 567 | SpamThrottleStatusValue2:SetText(theStatusValue); 568 | SpamThrottleStatusValue2:Show(); 569 | 570 | theStatusValue = string.format("%7d",table.length(SpamThrottle_GlobalBanList)); 571 | SpamThrottleStatusValue4:SetTextColor(1,1,1); 572 | SpamThrottleStatusValue4:SetText(theStatusValue); 573 | SpamThrottleStatusValue4:Show(); 574 | 575 | theStatusValue = string.format("%7d",UniqueCount); 576 | SpamThrottleStatusValue5:SetTextColor(1,1,1); 577 | SpamThrottleStatusValue5:SetText(theStatusValue); 578 | SpamThrottleStatusValue5:Show(); 579 | 580 | theStatusValue = string.format("%7d",FilteredCount); 581 | SpamThrottleStatusValue6:SetTextColor(1,1,1); 582 | SpamThrottleStatusValue6:SetText(theStatusValue); 583 | SpamThrottleStatusValue6:Show(); 584 | 585 | for key,value in pairs(SpamThrottleStatusMsg) do 586 | local nametag = getglobal("SpamThrottle" .. key); 587 | 588 | nametag:SetTextColor(1,1,1); 589 | nametag:SetText(value); 590 | nametag:Show(); 591 | end 592 | end 593 | 594 | function SpamThrottleConfigFrameOkay_OnClick() 595 | SpamThrottleConfigFrameSaveSettings(SpamThrottle_Config); 596 | SpamThrottleConfigFrame:Hide(); 597 | end 598 | 599 | function SpamThrottleConfigFrameLoadSettings(configset) 600 | SpamThrottle_SetAlphas(SpamThrottle_Config.STActive); 601 | SpamThrottle_SetBanSliderAlpha(SpamThrottle_Config.STBanPerm); 602 | for key,value in pairs(configset) do 603 | SpamThrottleMessage(DebugMsg, key, value, "type=",type(value)); 604 | if key == "Version" or string.find(key,"ST") == nil then 605 | -- do nothing 606 | elseif type(value) == "boolean" then 607 | local nametag = getglobal(key .. "_CheckButton"); 608 | if type(nametag) ~= "nil" then 609 | if value then 610 | nametag:SetChecked(1); 611 | else 612 | nametag:SetChecked(0); 613 | end 614 | nametag.tooltipText = SpamThrottleConfigObjectTooltip[key]; 615 | 616 | nametag = getglobal(key .. "_CheckButtonText"); 617 | nametag:SetText(SpamThrottleConfigObjectText[key]); 618 | nametag:SetTextColor(1,1,1); 619 | 620 | else 621 | SpamThrottleMessage(ErrorMsg, SpamThrottleChatMsg.ObjectLoadFail, key, "(", value, ")"); 622 | end 623 | 624 | elseif type(value) == "number" then 625 | local nametag = getglobal(key .. "_Slider"); 626 | if type(nametag) ~= "nil" then 627 | nametag:SetValue(value); 628 | nametag = getglobal(key .. "_SliderTitle"); 629 | nametag:SetText(SpamThrottleConfigObjectText[key]); 630 | else 631 | SpamThrottleMessage(ErrorMsg, SpamThrottleChatMsg.ObjectLoadFail, key, "(", value, ")"); 632 | end 633 | 634 | elseif type(value) == "string" then 635 | local nametag = getglobal(key .. "_EditBox"); 636 | if type(nametag) ~= "nil" then 637 | nametag:SetText(value); 638 | else 639 | SpamThrottleMessage(ErrorMsg, SpamThrottleChatMsg.ObjectLoadFail, key, "(", value, ")"); 640 | end 641 | end 642 | end 643 | end 644 | 645 | function SpamThrottleConfigFrameSaveSettings(configset) 646 | for key,oldvalue in pairs(configset) do 647 | if key == "Version" or string.find(key,"ST") == nil then 648 | -- do nothing 649 | 650 | elseif type(oldvalue) == "boolean" then 651 | local nametag = getglobal(key .. "_CheckButton"); 652 | if type(nametag) ~= "nil" then 653 | local newvalue = not not nametag:GetChecked(); 654 | if newvalue ~= oldvalue then 655 | configset[key] = newvalue; 656 | SpamThrottleMessage(DebugMsg, key, "has been updated from", oldvalue,"to", newvalue) 657 | end 658 | else 659 | SpamThrottleMessage(ErrorMsg, SpamThrottleChatMsg.ObjectSaveFail, key, "(", oldvalue, ")"); 660 | end 661 | 662 | elseif type(oldvalue) == "number" then 663 | local nametag = getglobal(key .. "_Slider"); 664 | if type(nametag) ~= "nil" then 665 | local newvalue = nametag:GetValue(); 666 | if (oldvalue ~= newvalue) then 667 | configset[key] = newvalue; 668 | SpamThrottleMessage(DebugMsg, key, "has been updated from", oldvalue,"to", newvalue) 669 | end 670 | else 671 | SpamThrottleMessage(ErrorMsg, SpamThrottleChatMsg.ObjectSaveFail, key, "(", oldvalue, ")"); 672 | end 673 | 674 | elseif type(oldvalue) == "string" then 675 | local nametag = getglobal(key .. "_EditBox"); 676 | if type(nametag) ~= "nil" then 677 | local newvalue = nametag:GetText(); 678 | if (oldvalue ~= newvalue) then 679 | configset[key] = newvalue; 680 | SpamThrottleMessage(DebugMsg, key, "has been updated from", oldvalue,"to", newvalue) 681 | end 682 | else 683 | SpamThrottleMessage(ErrorMsg, SpamThrottleChatMsg.ObjectSaveFail, key, "(", oldvalue, ")"); 684 | end 685 | end 686 | end 687 | end 688 | 689 | function SpamThrottle_SetAlphas(myStatus) 690 | local theAlpha = 1.0; 691 | 692 | if not myStatus then 693 | theAlpha = 0.5; 694 | end 695 | 696 | STDupFilter_CheckButton:SetAlpha(theAlpha); 697 | STColor_CheckButton:SetAlpha(theAlpha); 698 | STFuzzy_CheckButton:SetAlpha(theAlpha); 699 | STGoldSeller_CheckButton:SetAlpha(theAlpha); 700 | STChinese_CheckButton:SetAlpha(theAlpha); 701 | STCtrlMsgs_CheckButton:SetAlpha(theAlpha); 702 | STYellMsgs_CheckButton:SetAlpha(theAlpha); 703 | STSayMsgs_CheckButton:SetAlpha(theAlpha); 704 | STWispMsgs_CheckButton:SetAlpha(theAlpha); 705 | STReverse_CheckButton:SetAlpha(theAlpha); 706 | STGap_Slider:SetAlpha(theAlpha); 707 | 708 | if myStatus then 709 | STDupFilter_CheckButton:Enable(); 710 | STColor_CheckButton:Enable(); 711 | STFuzzy_CheckButton:Enable(); 712 | STGoldSeller_CheckButton:Enable(); 713 | STChinese_CheckButton:Enable(); 714 | STCtrlMsgs_CheckButton:Enable(); 715 | STYellMsgs_CheckButton:Enable(); 716 | STSayMsgs_CheckButton:Enable(); 717 | STWispMsgs_CheckButton:Enable(); 718 | STReverse_CheckButton:Enable(); 719 | else 720 | STDupFilter_CheckButton:Disable(); 721 | STColor_CheckButton:Disable(); 722 | STFuzzy_CheckButton:Disable(); 723 | STGoldSeller_CheckButton:Disable(); 724 | STChinese_CheckButton:Disable(); 725 | STCtrlMsgs_CheckButton:Disable(); 726 | STYellMsgs_CheckButton:Disable(); 727 | STSayMsgs_CheckButton:Disable(); 728 | STWispMsgs_CheckButton:Disable(); 729 | STReverse_CheckButton:Disable(); 730 | end 731 | 732 | SpamThrottle_SetWispBackAlpha(myStatus); 733 | SpamThrottle_SetMultiWispAlpha(myStatus); 734 | end 735 | 736 | function SpamThrottle_SetWispBackAlpha(myStatus) 737 | local theAlpha = 1.0; 738 | 739 | if not myStatus or WIM_Present then 740 | theAlpha = 0.5; 741 | end 742 | 743 | STWispBack_CheckButton:SetAlpha(theAlpha); 744 | 745 | if myStatus and not WIM_Present then 746 | STWispBack_CheckButton:Enable(); 747 | else 748 | STWispBack_CheckButton:Disable(); 749 | end 750 | end 751 | 752 | function SpamThrottle_SetMultiWispAlpha(myStatus) 753 | local theAlpha = 1.0; 754 | 755 | if not myStatus then 756 | theAlpha = 0.5; 757 | end 758 | 759 | STMultiWisp_CheckButton:SetAlpha(theAlpha); 760 | 761 | if myStatus then 762 | STMultiWisp_CheckButton:Enable(); 763 | else 764 | STMultiWisp_CheckButton:Disable(); 765 | end 766 | end 767 | 768 | function SpamThrottle_ToggleWispersOFF(myStatus) 769 | if myStatus then 770 | SendChatMessage(".wr on", "SAY"); 771 | else 772 | SendChatMessage(".wr off", "SAY"); 773 | end 774 | end 775 | 776 | function SpamThrottle_SetBanSliderAlpha(myStatus) 777 | if myStatus then 778 | STBanTimeout_Slider:SetAlpha(0.5); 779 | else 780 | STBanTimeout_Slider:SetAlpha(1.0); 781 | end 782 | end 783 | 784 | 785 | function SpamThrottle_KeywordList_Update() 786 | local tableLen = table.length(SpamThrottle_KeywordFilterList); 787 | local line; -- 1 through 9 of our window to scroll 788 | local lineplusoffset; -- an index into our data calculated from the scroll offset 789 | 790 | FauxScrollFrame_Update(KeywordListScrollFrame, tableLen, 9, 16); 791 | 792 | for line = 1,9 do 793 | local nametag = getglobal("SpamThrottleKeywordItem" .. line) 794 | lineplusoffset = line + FauxScrollFrame_GetOffset(KeywordListScrollFrame); 795 | 796 | if lineplusoffset <= tableLen and SpamThrottle_KeywordFilterList[lineplusoffset] ~= nil then 797 | local listword = string.gsub(SpamThrottle_KeywordFilterList[lineplusoffset]," ","_"); 798 | nametag:SetText(listword); 799 | if nametag ~= SpamThrottle_LastClickedItem then 800 | nametag:SetTextColor(1,1,1); 801 | else 802 | nametag:SetTextColor(1,1,0); 803 | end 804 | nametag:Show(); 805 | else 806 | nametag:Hide(); 807 | end 808 | end 809 | end 810 | 811 | function SpamThrottle_AddKeyword(theKeyword) 812 | theKeyword = string.gsub(theKeyword,"_"," "); 813 | local index = table.find(SpamThrottle_KeywordFilterList,theKeyword) 814 | if index ~= nil then return end; 815 | 816 | table.insert(SpamThrottle_KeywordFilterList,theKeyword); 817 | table.sort(SpamThrottle_KeywordFilterList); 818 | SpamThrottle_KeywordList_Update(); 819 | end 820 | 821 | function SpamThrottle_AddPlayerban(thePlayer) 822 | 823 | MultiMessageCache[thePlayer] = nil 824 | 825 | local pl = thePlayer; 826 | 827 | thePlayer = string.upper(string.gsub(thePlayer," ","")); 828 | local index = table.find(SpamThrottle_PlayerFilterList,thePlayer) 829 | if index then return end; 830 | 831 | SpamThrottle_PlayerBanTime[thePlayer] = time(); 832 | 833 | SpamThrottle_LastPlayerBanned = pl; 834 | 835 | table.insert(SpamThrottle_PlayerFilterList,thePlayer); 836 | table.sort(SpamThrottle_PlayerFilterList); 837 | SpamThrottle_PlayerbanList_Update(); 838 | end 839 | 840 | function SpamThrottle_RemovePlayerban(thePlayer) 841 | thePlayer = string.upper(string.gsub(thePlayer," ","")); 842 | SpamThrottle_PlayerBanTime[thePlayer] = nil; 843 | 844 | local index = table.find(SpamThrottle_PlayerFilterList,thePlayer) 845 | if not index then return end; 846 | table.remove(SpamThrottle_PlayerFilterList,index); 847 | SpamThrottle_PlayerbanList_Update(); 848 | end 849 | 850 | function SpamThrottleKeywordList_OnClick(nametag) 851 | local value = nametag:GetText(); 852 | 853 | if SpamThrottle_LastClickedItem ~= nil then 854 | SpamThrottle_LastClickedItem:SetTextColor(1,1,1); 855 | end 856 | 857 | SpamThrottle_LastClickedItem = nametag; 858 | SpamThrottle_LastClickedTable = SpamThrottle_KeywordFilterList; 859 | SpamThrottle_LastClickedValue = nametag:GetText(); 860 | 861 | nametag:SetTextColor(1,1,0); 862 | nametag:Show(); 863 | end 864 | 865 | function SpamThrottlePlayerList_OnClick(nametag) 866 | local value = nametag:GetText(); 867 | 868 | if SpamThrottle_LastClickedItem ~= nil then 869 | SpamThrottle_LastClickedItem:SetTextColor(1,1,1); 870 | end 871 | 872 | SpamThrottle_LastClickedItem = nametag; 873 | SpamThrottle_LastClickedTable = SpamThrottle_PlayerFilterList; 874 | SpamThrottle_LastClickedValue = nametag:GetText(); 875 | 876 | nametag:SetTextColor(1,1,0); 877 | nametag:Show(); 878 | end 879 | 880 | function SpamThrottle_RemoveLastClicked() 881 | if SpamThrottle_LastClickedItem then 882 | local index = table.find(SpamThrottle_LastClickedTable,string.gsub(SpamThrottle_LastClickedValue,"_"," ")); 883 | table.remove(SpamThrottle_LastClickedTable,index); 884 | else 885 | return; 886 | end 887 | 888 | if SpamThrottle_LastClickedTable == SpamThrottle_KeywordFilterList then 889 | SpamThrottle_LastClickedItem = nil; 890 | SpamThrottle_LastClickedTable = nil; 891 | SpamThrottle_LastClickedValue = nil; 892 | SpamThrottle_KeywordList_Update(); 893 | elseif SpamThrottle_LastClickedTable == SpamThrottle_PlayerFilterList then 894 | SpamThrottle_RemovePlayerban(SpamThrottle_LastClickedValue); 895 | SpamThrottle_LastClickedItem = nil; 896 | SpamThrottle_LastClickedTable = nil; 897 | SpamThrottle_LastClickedValue = nil; 898 | SpamThrottle_PlayerbanList_Update(); 899 | else 900 | SpamThrottle_LastClickedItem = nil; 901 | SpamThrottle_LastClickedTable = nil; 902 | SpamThrottle_LastClickedValue = nil; 903 | SpamThrottleMessage(ErrorMsg,"Attempt to remove item=",SpamThrottle_LastClickedItem," from non-existent table=",SpamThrottle_LastClickedTable); 904 | end 905 | end 906 | 907 | function SpamThrottle_PlayerbanList_Update() 908 | local tableLen = table.length(SpamThrottle_PlayerFilterList); 909 | local line; -- 1 through 9 of our window to scroll 910 | local lineplusoffset; -- an index into our data calculated from the scroll offset 911 | 912 | FauxScrollFrame_Update(PlayerbanListScrollFrame, tableLen, 9, 16); 913 | 914 | for line = 1,9 do 915 | local nametag = getglobal("SpamThrottlePlayerbanItem" .. line) 916 | lineplusoffset = line + FauxScrollFrame_GetOffset(PlayerbanListScrollFrame); 917 | 918 | if lineplusoffset <= tableLen then 919 | nametag:SetText(SpamThrottle_PlayerFilterList[lineplusoffset]); 920 | if nametag ~= SpamThrottle_LastClickedItem then 921 | nametag:SetTextColor(1,1,1); 922 | else 923 | nametag:SetTextColor(1,1,0); 924 | end 925 | nametag:Show(); 926 | else 927 | nametag:Hide(); 928 | end 929 | end 930 | end 931 | 932 | --============================ 933 | --= DecodeMessage - Print a detailed breakdown byte-by-byte of the message 934 | --============================ 935 | function SpamThrottle_DecodeMessage(msg,Author) 936 | local theString =""; 937 | local Nlen = string.len(msg); 938 | 939 | for i = 1, Nlen do 940 | if i ~= Nlen then 941 | s1 = string.sub(msg,i,i); 942 | s2 = string.sub(msg,i+1,i+1); 943 | c1 = string.byte(s1); 944 | c2 = string.byte(s2); 945 | 946 | if c1 > 192 and c1 <= 225 then -- it's a UTF-8 2 byte code 947 | p1 = c1 - math.floor(c1/32)*32; 948 | p2 = c2 - math.floor(c2/64)*64; 949 | p = p1*64+p2; 950 | 951 | if SpamThrottle_UTF8Convert[p] == nil then 952 | SpamThrottleMessage(true,Author,": Unhandled UTF code: ",string.format("%x",p)); 953 | end 954 | theString = theString .. string.format("[UTF8-%x]",p); 955 | i = i + 1; 956 | else -- it's a normal char 957 | theString = theString .. string.format("[%s-%x]",s1,c1); 958 | end 959 | end 960 | end 961 | SpamThrottleMessage(true,"Decoded:",theString); 962 | end 963 | 964 | 965 | --============================ 966 | --= RecordMessage - save it in our database 967 | --============================ 968 | function SpamThrottle_RecordMessage(msg,Author) 969 | local Msg = SpamThrottle_strNorm(msg,Author); 970 | local hash = StringHash(Msg); 971 | 972 | SpamThrottleMessage(false,"MSG: ",Msg); 973 | --SpamThrottleMessage(true,"MSG: ",StringHash(Msg)); 974 | 975 | local frameName = this:GetName() 976 | if (MessageList[frameName][hash] == nil) then -- If we have NOT seen this text before 977 | UniqueCount = UniqueCount + 1 978 | MessageList[frameName][hash] = { 979 | count = 1, 980 | firstTime = time(), 981 | lastTime =time() 982 | } 983 | else 984 | MessageList[frameName][hash].count = MessageList[frameName][hash].count + 1; 985 | end 986 | end 987 | 988 | 989 | --============================ 990 | --= QQCheck - Determine if the message contains a QQ name 991 | --= Make sure to send it the original message 992 | --============================ 993 | function SpamThrottle_QQCheck(msg,Author) 994 | local testResult = false; 995 | 996 | if msg == nil then return false end 997 | 998 | if string.find(msg, "QQ[ :~%d][ :~%d][ :~%d][ :~%d][ :~%d][ :~%d][ :~%d]") then 999 | testResult = true; 1000 | end 1001 | 1002 | local Nlen = string.len(msg); 1003 | 1004 | for i = 1, string.len(msg) do 1005 | if string.byte(string.sub(msg,i,i)) > 225 then 1006 | testResult = true; 1007 | end 1008 | end 1009 | 1010 | if testResult then 1011 | SpamThrottleMessage(DebugMsg,"QQCheck flagged: (",Author,") ",msg); 1012 | end 1013 | 1014 | return testResult; 1015 | end 1016 | 1017 | --============================ 1018 | --= SpamScoreBlock - Determine the spam score and perma-block if exceeded 1019 | --= Returns TRUE if blocked 1020 | --= Returns FALSE if clear 1021 | --============================ 1022 | function SpamThrottle_SpamScoreBlock(msg,NormalizedMessage,Author,multiCheck) 1023 | local theScore = 0; 1024 | local theThreshold = 4; 1025 | local BlockFlag = false; 1026 | 1027 | -- ScoreMsg = multiCheck 1028 | 1029 | local index = table.find(SpamThrottle_PlayerFilterList,string.upper(Author)); 1030 | if index then return true; end 1031 | 1032 | for key, value in pairs(SpamThrottleGSO2) do 1033 | local testval = SpamThrottle_strNorm(value,""); 1034 | if (string.find(NormalizedMessage,testval) ~= nil) then 1035 | theScore = theScore + 2 1036 | SpamThrottleMessage(ScoreMsg, "Match : ".. testval) 1037 | end 1038 | end 1039 | 1040 | for key, value in pairs(SpamThrottleGSO1) do 1041 | local testval = SpamThrottle_strNorm(value,""); 1042 | if (string.find(NormalizedMessage,testval) ~= nil) then 1043 | theScore = theScore + 1 1044 | SpamThrottleMessage(ScoreMsg, "Match : ".. testval) 1045 | end 1046 | end 1047 | 1048 | for key, value in pairs(SpamThrottleGSC2) do 1049 | if (string.find(msg,value) ~= nil) then 1050 | theScore = theScore + 2 1051 | SpamThrottleMessage(ScoreMsg, "Match : ".. value) 1052 | end 1053 | end 1054 | 1055 | for key, value in pairs(SpamThrottleGSC1) do 1056 | if (string.find(msg,value) ~= nil) then 1057 | theScore = theScore + 1 1058 | SpamThrottleMessage(ScoreMsg, "Match : ".. value) 1059 | end 1060 | end 1061 | 1062 | for key, value in pairs(SpamThrottleGSUC5) do 1063 | if (string.find(string.upper(msg),value) ~= nil) then 1064 | theScore = theScore + 5 1065 | SpamThrottleMessage(ScoreMsg, "Match : ".. value) 1066 | end 1067 | end 1068 | 1069 | for key, value in pairs(SpamThrottleSWLO) do 1070 | local testval = SpamThrottle_strNorm(value,Author); 1071 | if (string.find(NormalizedMessage,testval) ~= nil) then 1072 | theScore = theScore + 100 1073 | end 1074 | end 1075 | SpamThrottleMessage(ScoreMsg, "Score : "..theScore.." : "..Author.." : "..msg.." : "..NormalizedMessage); 1076 | SpamThrottleMessageHex(ScoreMsg, msg); 1077 | 1078 | if theScore > theThreshold then 1079 | BlockFlag = true; 1080 | SpamThrottle_AddPlayerban(Author); 1081 | SpamThrottle_PlayerbanList_Update(); 1082 | SpamThrottleMessage(ScoreMsg, "Blocked "..Author.." gold advertising: "..msg); 1083 | end 1084 | 1085 | return BlockFlag; 1086 | end 1087 | 1088 | --============================ 1089 | --= ShouldBlock - Determine whether message should be blocked. 1090 | --= return = 0, don't block. 1091 | --= return = 1, use graytext to de-emphasize 1092 | --= return = 2, block altogether. 1093 | --============================ 1094 | function SpamThrottle_ShouldBlock(msg,Author,event,channel,multiCheck) 1095 | local BlockFlag = false; 1096 | local NormalizedMessage = ""; 1097 | 1098 | 1099 | NormalizedMessage = SpamThrottle_strNorm(msg, Author); 1100 | UpperCaseMessage = string.upper(msg); 1101 | OriginalMessage = msg; 1102 | 1103 | 1104 | if (NormalizedMessage == nil) then -- If no message just tell caller to block altogether 1105 | return 2; 1106 | end 1107 | 1108 | if (SpamThrottle_Config.STActive == false or Author == UnitName("player")) then -- If filter not active or it's our message, just let it go thru 1109 | return 0; 1110 | end 1111 | 1112 | if (SpamThrottle_Config.STWhiteChannel1 ~= "" or SpamThrottle_Config.STWhiteChannel2 ~= "" or SpamThrottle_Config.STWhiteChannel3 ~= "") then 1113 | local normChannel = SpamThrottle_strNorm(channel,""); 1114 | local testval1 = SpamThrottle_strNorm(SpamThrottle_Config.STWhiteChannel1,""); 1115 | local testval2 = SpamThrottle_strNorm(SpamThrottle_Config.STWhiteChannel2,""); 1116 | local testval3 = SpamThrottle_strNorm(SpamThrottle_Config.STWhiteChannel3,""); 1117 | 1118 | if (testval1 ~= "" and string.find(normChannel,testval1) ~= nil) then return 0; end; 1119 | if (testval2 ~= "" and string.find(normChannel,testval2) ~= nil) then return 0; end; 1120 | if (testval3 ~= "" and string.find(normChannel,testval3) ~= nil) then return 0; end; 1121 | end 1122 | 1123 | if time() - LastPurgeTime > 5 then 1124 | SpamThrottleMessage(DebugMsg,"purging database to free memory"); 1125 | for chan, msgs in pairs(MessageList) do 1126 | for key, value in pairs(msgs) do 1127 | if time() - value.firstTime > SpamThrottle_Config.STGap then 1128 | SpamThrottleMessage(DebugMsg,"Removing key ",key," as it is older than timeout."); 1129 | MessageList[chan][key] = nil; 1130 | end 1131 | end 1132 | end 1133 | 1134 | if not multiCheck then 1135 | local remove = {} 1136 | for playerName, value in pairs(MultiMessageCache) do 1137 | if time() - value.lastMessage > 30 then 1138 | SpamThrottleMessage(DebugMsg,"Removing player ",playerName," from multi-message cache (timeout)."); 1139 | table.insert(remove, playerName) 1140 | end 1141 | end 1142 | for _, playerName in ipairs(remove) do 1143 | MultiMessageCache[playerName] = nil 1144 | end 1145 | end 1146 | LastPurgeTime = time(); 1147 | end 1148 | 1149 | if string.find(msg, SpamThrottleGeneralMask) then BlockFlag = true; end 1150 | 1151 | if multiCheck then SpamThrottleMessage(false, "multiCheck") end 1152 | if SpamThrottle_SpamScoreBlock(msg,NormalizedMessage,Author,multiCheck) then BlockFlag = true; end 1153 | 1154 | if not SpamThrottle_Config.STBanPerm then 1155 | if time() - LastAuditTime > PlayerListAuditGap then 1156 | SpamThrottleMessage(DebugMsg, "auditing player filter list and expiring timeouts"); 1157 | LastAuditTime = time(); 1158 | for key,value in pairs(SpamThrottle_PlayerBanTime) do 1159 | if time() - value > SpamThrottle_Config.STBanTimeout then 1160 | SpamThrottleMessage(DebugMsg, "removing playername " .. key .. " from player filter list"); 1161 | SpamThrottle_PlayerBanTime[string.upper(key)] = nil; 1162 | local index = table.find(SpamThrottle_PlayerFilterList,string.upper(key)); 1163 | if index then table.remove(SpamThrottle_PlayerFilterList,index) end; 1164 | SpamThrottle_PlayerbanList_Update(); 1165 | end 1166 | end 1167 | end 1168 | end 1169 | 1170 | for key, value in pairs(SpamThrottle_KeywordFilterList) do 1171 | local testval = SpamThrottle_strNorm(value,""); 1172 | if (string.find(NormalizedMessage,testval) ~= nil) then BlockFlag = true; end 1173 | end 1174 | 1175 | if SpamThrottle_Config.STReverse then -- Completely different processing if this is the case 1176 | if BlockFlag then -- we have a match with the keyword filter, let it go through. 1177 | return 0; 1178 | else 1179 | if SpamThrottle_Config.STColor then 1180 | return 1; 1181 | else 1182 | return 2; 1183 | end 1184 | end 1185 | end 1186 | 1187 | for key, value in pairs(SpamThrottle_PlayerFilterList) do 1188 | local testval = string.upper(string.gsub(value," ","")); 1189 | if (string.find(string.upper(Author),testval) ~= nil) then BlockFlag = true; end 1190 | end 1191 | 1192 | if (SpamThrottle_Config.STChinese) then 1193 | if (string.find(OriginalMessage,"[\228-\233]") ~=nil) then BlockFlag = true; end 1194 | if SpamThrottle_QQCheck(OriginalMessage,Author) then BlockFlag = true; end 1195 | end 1196 | 1197 | local frameName = this:GetName() 1198 | 1199 | 1200 | if not multiCheck then 1201 | local hash = StringHash(NormalizedMessage); 1202 | if (SpamThrottle_Config.STDupFilter and MessageList[frameName][hash] ~= nil) then -- If duplicate message filter enabled AND we have seen this exact text before 1203 | 1204 | if time() - MessageList[frameName][hash].firstTime <= SpamThrottle_Config.STGap then 1205 | BlockFlag = true; 1206 | SpamThrottleMessage(DebugMsg, "DUP:", msg); 1207 | end 1208 | 1209 | end 1210 | 1211 | end 1212 | 1213 | if BlockFlag then 1214 | FilteredCount = FilteredCount + 1; 1215 | end 1216 | 1217 | if SpamThrottle_Config.STColor then 1218 | if BlockFlag then 1219 | return 1; 1220 | end 1221 | end 1222 | 1223 | if BlockFlag then 1224 | return 2; 1225 | end 1226 | 1227 | return 0; 1228 | end 1229 | 1230 | --============================ 1231 | --= SpamThrottle_ShouldMultiBlock - Determine whether message should be blocked 1232 | --= based on previous messages of the same author 1233 | --= return = 0, don't block. 1234 | --= return = 1, use graytext to de-emphasize 1235 | --= return = 2, block altogether. 1236 | --============================ 1237 | function SpamThrottle_ShouldMultiBlock(msg,Author,event,channel) 1238 | if (SpamThrottle_Config.STActive == false or Author == UnitName("player")) then -- If filter not active or it's our message, just let it go thru 1239 | return 0 1240 | end 1241 | local frameName = this:GetName() 1242 | if MultiMessageCache[Author] == nil then 1243 | MultiMessageCache[Author] = { 1244 | lastMessage = 0, 1245 | history = {} 1246 | } 1247 | end 1248 | local playerCache = MultiMessageCache[Author] 1249 | 1250 | local payload = { 1251 | msg = msg, 1252 | event = event, 1253 | channel = channel, 1254 | time = time() 1255 | --playerCache.lastMessage 1256 | } 1257 | if playerCache.history[frameName] == nil then playerCache.history[frameName]={} end 1258 | table.insert(playerCache.history[frameName], payload) 1259 | 1260 | -- concatenate all messages sent in the past few seconds 1261 | local multiMsg = "" 1262 | local numMsg = 0 1263 | for i, pl in ipairs(playerCache.history[frameName]) do 1264 | -- SpamThrottleMessage(true, "cache "..i.." : "..pl.msg) 1265 | local dTime = time() - pl.time 1266 | -- SpamThrottleMessage(true,"dTime: "..dTime) 1267 | if dTime < 20 then 1268 | multiMsg = string.format("%s%s", multiMsg, pl.msg) 1269 | numMsg = numMsg + 1 1270 | end 1271 | end 1272 | -- check if combined message should be blocked 1273 | local ShouldBlock = 0 1274 | if numMsg > 1 then 1275 | --SpamThrottleMessage(true, "MultiMSG:"..multiMsg) 1276 | ShouldBlock = SpamThrottle_ShouldBlock(multiMsg,Author,event,channel,true) 1277 | end 1278 | return ShouldBlock 1279 | end 1280 | 1281 | --============================ 1282 | --= ChatFrame_OnEvent - The main event handler 1283 | --============================ 1284 | function SpamThrottle_ChatFrame_OnEvent(event, WIM_msg) 1285 | -- arg1 is the actual message 1286 | -- arg2 is the player name 1287 | -- arg4 is the composite channel name (e.g. "3. global") 1288 | -- arg8 is the channel number (e.g. "3") 1289 | -- arg9 is the channel name (e.g. "global") 1290 | 1291 | local hideColor = "|cFF5C5C5C"; 1292 | local oppFacColor = "|cA0A00000"; 1293 | local theColor = hideColor; 1294 | local frameName = this:GetName() 1295 | if SpamThrottle_Config == nil then SpamThrottle_init(); end 1296 | 1297 | if not SpamThrottle_Config.STActive then 1298 | if WIM_msg then 1299 | SpamThrottle_Orig_WIM_ChatFrame_OnEvent(event) 1300 | else 1301 | SpamThrottle_OrigChatFrame_OnEvent(event); 1302 | end 1303 | return; 1304 | end; 1305 | if (SpamThrottle_Config.STCtrlMsgs) then -- Remove the "has invited you to join the channel"-spam and left/joined channel spam and a few other notification messages 1306 | if (event == "CHANNEL_INVITE_REQUEST" or event == "CHAT_MSG_CHANNEL_JOIN" or event == "CHAT_MSG_CHANNEL_LEAVE" or event == "CHAT_MSG_CHANNEL_NOTICE" or event == "CHAT_MSG_CHANNEL_NOTICE_USER") then 1307 | 1308 | return; 1309 | end 1310 | end 1311 | 1312 | if arg2 then -- if this is not a server message 1313 | if (event == "CHAT_MSG_CHANNEL" or (event == "CHAT_MSG_YELL" and SpamThrottle_Config.STYellMsgs) or (event == "CHAT_MSG_SAY" and SpamThrottle_Config.STSayMsgs) or (event == "CHAT_MSG_WHISPER" and SpamThrottle_Config.STWispMsgs) or event == "CHAT_MSG_EMOTE" 1314 | or event == "CHAT_MSG_TEXT_EMOTE") then 1315 | 1316 | 1317 | 1318 | -- Code to handle message goes here. Just return if we are going to ignore it. 1319 | local channelFound 1320 | 1321 | if event == "CHAT_MSG_CHANNEL" then 1322 | for index, value in this.channelList do 1323 | if ((arg7 > 0) and (this.zoneChannelList[index] == arg7)) or strupper(value) == strupper(arg9) then 1324 | channelFound = value 1325 | end 1326 | end 1327 | if not channelFound then return end 1328 | end 1329 | SpamThrottleMessage(false, GetTime(), frameName,event,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9); 1330 | if arg1 and arg2 then -- only execute this code once although event handler is called many times per message 1331 | local NormalizedMessage = SpamThrottle_strNorm(arg1, arg2); 1332 | --if time() == MessageLatestTime[NormalizedMessage] then return end; 1333 | end 1334 | 1335 | 1336 | local BlockType = SpamThrottle_ShouldBlock(arg1,arg2,event,arg9); 1337 | 1338 | 1339 | if SpamThrottle_Config.STMultiWisp and (event == "CHAT_MSG_WHISPER" or event == "CHAT_MSG_CHANNEL" ) and not SpamThrottle_Config.STReverse and not WIM_msg then 1340 | if BlockType == 0 then 1341 | BlockType = SpamThrottle_ShouldMultiBlock(arg1,arg2,event,arg9); 1342 | end 1343 | end 1344 | 1345 | SpamThrottle_RecordMessage(arg1,arg2); 1346 | 1347 | if BlockType ~= 0 then 1348 | SpamThrottle_LastPlayerFiltered = arg2 1349 | end 1350 | 1351 | if SpamThrottle_Config.STWispBack and event == "CHAT_MSG_WHISPER" and not SpamThrottle_Config.STReverse and not WIM_Present then 1352 | if BlockType == 1 or BlockType == 2 then 1353 | SendChatMessage(SpamThrottleChatMsg.WhisperBack, "WHISPER", nil, arg2); 1354 | SpamThrottleMessage(BlockReportMode, "BLOCKED [",arg4,"] {",arg2,"} ",arg1); 1355 | return; 1356 | end 1357 | end 1358 | 1359 | if BlockType == 2 then 1360 | SpamThrottleMessage(BlockReportMode, "BLOCKED [",arg4,"] {",arg2,"} ",arg1); 1361 | return; 1362 | end 1363 | 1364 | if BlockType == 3 then 1365 | theColor = oppFacColor; 1366 | end 1367 | 1368 | if BlockType == 1 or BlockType == 3 then 1369 | local CleanText = ""; 1370 | CleanText = string.gsub(arg1,"|c%x%x%x%x%x%x%x%x", ""); 1371 | CleanText = string.gsub(CleanText,"|r", ""); 1372 | CleanText = string.gsub(CleanText,"|H.-|h", ""); 1373 | CleanText = string.gsub(CleanText,"|h", ""); 1374 | 1375 | if event == "CHAT_MSG_YELL" then 1376 | CleanText = theColor .. "[" .. arg2 .. "] yells: " .. CleanText .. "|r"; 1377 | else 1378 | if event == "CHAT_MSG_SAY" then 1379 | CleanText = theColor .. "[" .. arg2 .. "] says: " .. CleanText .. "|r"; 1380 | else 1381 | if event == "CHAT_MSG_WHISPER" then 1382 | CleanText = theColor .. "[" .. arg2 .. "] whispers: " .. CleanText .. "|r"; 1383 | else 1384 | if event == "CHAT_MSG_EMOTE" then 1385 | CleanText = theColor .. arg2 .. " " .. CleanText .. "|r"; 1386 | else 1387 | CleanText = theColor .. "[" .. arg4 .. "] [" .. arg2 .. "]: " .. CleanText .. "|r"; 1388 | end 1389 | end 1390 | end 1391 | end 1392 | 1393 | this:AddMessage(CleanText); 1394 | return; 1395 | end 1396 | end 1397 | end 1398 | 1399 | local theStatusValue = string.format("%7d",UniqueCount); 1400 | SpamThrottleStatusValue5:SetText(theStatusValue); 1401 | 1402 | theStatusValue = string.format("%7d",FilteredCount); 1403 | SpamThrottleStatusValue6:SetText(theStatusValue); 1404 | 1405 | if WIM_msg then 1406 | SpamThrottle_Orig_WIM_ChatFrame_OnEvent(event) 1407 | else 1408 | SpamThrottle_OrigChatFrame_OnEvent(event); 1409 | end 1410 | end 1411 | 1412 | function SpamThrottle_WIM_ChatFrame_OnEvent(event) 1413 | SpamThrottle_ChatFrame_OnEvent(event, true) 1414 | end 1415 | 1416 | 1417 | --============================ 1418 | --= Register the Slash Command 1419 | --============================ 1420 | SlashCmdList["SPTHRTL"] = function(_msg) 1421 | if (_msg) then 1422 | local _, _, cmd, arg1 = string.find(string.upper(_msg), "([%w]+)%s*(.*)$"); 1423 | if ("OFF" == cmd) then -- disable the filter 1424 | local confirmMsg = "|cFFFFFFFFSpamThrottle: |cFF00BEFFFilter Disabled|cFFFFFFFF" 1425 | SpamThrottle_Config.STActive = false; 1426 | DEFAULT_CHAT_FRAME:AddMessage(confirmMsg); 1427 | elseif ("ON" == cmd) then -- enable the filter 1428 | local confirmMsg = "|cFFFFFFFFSpamThrottle: |cFF00BEFFFilter Enabled" 1429 | SpamThrottle_Config.STActive = true; 1430 | if SpamThrottle_Config.STColor then 1431 | confirmMsg = confirmMsg .. " (color mode)|cFFFFFFFF." 1432 | else 1433 | confirmMsg = confirmMsg .. " (hide mode)|cFFFFFFFF." 1434 | end 1435 | DEFAULT_CHAT_FRAME:AddMessage(confirmMsg); 1436 | elseif ("COLOR" == cmd) then -- change the spam to a darker color to make it easy for your eyes to skip (but you still see it) 1437 | SpamThrottle_Config.STColor = true; 1438 | DEFAULT_CHAT_FRAME:AddMessage("|cFFFFFFFFSpamThrottle: |cFF00BEFFColor|cFFFFFFFF mode enabled."); 1439 | elseif ("HIDE" == cmd) then -- completely hide the spam 1440 | SpamThrottle_Config.STColor = false; 1441 | DEFAULT_CHAT_FRAME:AddMessage("|cFFFFFFFFSpamThrottle: |cFF00BEFFHide|cFFFFFFFF mode enabled."); 1442 | elseif ("FUZZY" == cmd) then -- enable the fuzzy matching filter (default) 1443 | SpamThrottle_Config.STFuzzy = true; 1444 | DEFAULT_CHAT_FRAME:AddMessage("|cFFFFFFFFSpamThrottle: |cFF00BEFFFuzzy|cFFFFFFFF match filter enabled."); 1445 | elseif ("NOFUZZY" == cmd) then -- disable the fuzzy matching filter, instead requiring exact matches 1446 | SpamThrottle_Config.STFuzzy = false; 1447 | DEFAULT_CHAT_FRAME:AddMessage("|cFFFFFFFFSpamThrottle: |cFF00BEFFFuzzy|cFFFFFFFF match filter disabled - strict match mode."); 1448 | elseif ("CBLOCK" == cmd) then -- block messages with chinese/japanese/korean characters 1449 | SpamThrottle_Config.STChinese = true; 1450 | DEFAULT_CHAT_FRAME:AddMessage("|cFFFFFFFFSpamThrottle: |cFF00BEFFChinese/Japanese/Korean|cFFFFFFFF messages are now blocked."); 1451 | elseif ("NOCBLOCK" == cmd) then -- allow messages with chinese/japanese/korean characters 1452 | SpamThrottle_Config.STChinese = false; 1453 | DEFAULT_CHAT_FRAME:AddMessage("|cFFFFFFFFSpamThrottle: |cFF00BEFFChinese/Japanese/Korean|cFFFFFFFF messages are now allowed."); 1454 | elseif ("RESET" == cmd) then -- reset the unique message list 1455 | MessageList = {} 1456 | 1457 | DEFAULT_CHAT_FRAME:AddMessage("|cFFFFFFFFSpamThrottle: |cFF00BEFFReset|cFFFFFFFF of unique message database complete."); 1458 | elseif (tonumber(_msg) ~= nil) then 1459 | local gapseconds = tonumber(_msg); 1460 | if (gapseconds >= 0 and gapseconds <= 10000) then 1461 | SpamThrottle_Config.STGap = tonumber(_msg); 1462 | DEFAULT_CHAT_FRAME:AddMessage("|cFFFFFFFFSpamThrottle: gapping now set to |cFF00BEFF" .. SpamThrottle_Config.STGap .. "|cFFFFFFFF seconds."); 1463 | else 1464 | DEFAULT_CHAT_FRAME:AddMessage("|cFFFFFFFFSpamThrottle: gapping value can only be set from 0 to 10000 seconds."); 1465 | end 1466 | elseif ("HELP" == cmd) then 1467 | SpamThrottleMessage(true,"Type /st or /spamthrottle to display the configuration options menu."); 1468 | 1469 | elseif ("TEST" == cmd) then 1470 | -- Placeholder for testing 1471 | else -- Just show the configuration frame 1472 | SpamThrottleConfigFrame:Show(); 1473 | end 1474 | end 1475 | end 1476 | 1477 | SLASH_SPTHRTL1 = "/spamthrottle"; 1478 | SLASH_SPTHRTL2 = "/st"; 1479 | -------------------------------------------------------------------------------- /SpamThrottle/SpamThrottle.xml: -------------------------------------------------------------------------------- 1 | 3 |