SpamThrottle: Vanilla addon to reduce chat spam

Re: SpamThrottle: Vanilla addon to reduce chat spam

by revulsion » Tue Oct 13, 2015 6:52 pm

Hey Mopar, would grafting your SpamThrottle into an existing chat addon like Prat or ChatMOD get around both needing the same API in incompatible ways?

I ask because as much as I like your addon, having clean chat windows is better than not seeing gold whispers.
revulsion
Tester
 

Re: SpamThrottle: Vanilla addon to reduce chat spam

by Mopar » Wed Oct 14, 2015 4:11 am

It's certainly possible, although both addons are pretty complex. What they are doing is hooking the same function, ChatFrame_OnEvent() - a hook replaces the default function (while saving it), does something, then calls the original function.

But note that SpamThrottle has a lot of GUI code for managing the options that might be an issue.

I guess the main comment though is I don't have time to do this myself at the moment, due to work commitments. Although I do plan to have a look at that hook as well as the hook for UnitPopup_OnClick() to see if I can resolve some conflicts - when I have some time available.
The pizza level in my bloodstream is dangerously low.
User avatar
Mopar
Sergeant Major
Sergeant Major
 

Re: SpamThrottle: Vanilla addon to reduce chat spam

by Logon » Wed Oct 14, 2015 12:05 pm

Mopar wrote:Yeah this is an aspect of the original vanilla way of creating chat handlers. The APIs were modified in 2.0 and it's possible to make it compatible there, but not in vanilla, because of the way you have to hook the chat handling function. Sorry about that, just have to choose between the two.


Are you sure?
You can Always hook the prat function that does the registering and you just pass Prat the info it needs from your addon? haven't got prat infront of me, but look into it.

Just wait a few seconds reallife time
then do
Code: Select all
local oldChatFrameFunction;
local function ChatFrameEvent(event, arg1,etctec)
  --Do ya shizzle
  if(we want the message not to be filtered)
    oldChatFrameFunction(event, arg1, etcetc);
  end
end
function delayedInit()
  oldChatFrameFunction  = ChatFrame_OnEvent;
  ChatFrame_OnEvent = ChatFrameEvent;
end


edit: test this, do mind that this is all written free hand and havent been tested

Code: Select all
--============================
--= This replaces the default ChatFrame handler with our own.
--= Implementation could conflict with other chat handling programs, but the API here is really old,
--= and was from before Chat Filters were implemented.
--============================

local OldChatFrame_OnEvent;

local SpamThrottle_ChatFrame_OnEvent;

local UpdateFrame = CreateFrame("Frame", nil);
UpdateFrame:SetScript("OnUpdate",OverHookEvents);
UpdateFrame:Show();
local StartTime = time();
local Initialized;
function OverHookEvents()
   if(time() - StartTime > 10 and Initialized == nil) then
      OldChatFrame_OnEvent = ChatFrame_OnEvent;
      ChatFrame_OnEvent = SpamThrottle_ChatFrame_OnEvent;
      StartTime = nil;
      UpdateFrame:SetScript("OnUpdate", nil);
      UpdateFrame = nil;
      Initialized = true;
   end
end
--ChatFrame_OnEvent
function SpamThrottle_ChatFrame_OnEvent(event)
-- arg1 is the actual message
-- arg2 is the player name
-- arg4 is the composite channel name (e.g. "3. global")
-- arg8 is the channel number (e.g. "3")
-- arg9 is the channel name (e.g. "global")

   local hideColor = "|cFF5C5C5C";
   local oppFacColor = "|cA0A00000";
   local theColor = hideColor;

   if SpamThrottle_Config == nil then SpamThrottle_init(); end
   
   if not SpamThrottle_Config.STActive then
      OldChatFrame_OnEvent(event);
      return;
   end;

   if (SpamThrottle_Config.STCtrlMsgs) then -- Remove the left/joined channel spam and a few other notification messages
      if (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      
         return;
      end
   end
         
   if arg2 then -- if this is not a server message
      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)) then
         
         -- Code to handle message goes here. Just return if we are going to ignore it.
         
         if arg1 and arg2 then   -- only execute this code once although event handler is called many times per message
            local NormalizedMessage = SpamThrottle_strNorm(arg1, arg2);
            if time() == MessageLatestTime[NormalizedMessage] then return end;
         end

         local BlockType = SpamThrottle_ShouldBlock(arg1,arg2,event,arg9);
         SpamThrottle_RecordMessage(arg1,arg2);
         
         if SpamThrottle_Config.STWispBack and event == "CHAT_MSG_WHISPER" and not SpamThrottle_Config.STReverse then
            if BlockType == 1 or BlockType == 2 then
               SendChatMessage(SpamThrottleChatMsg.WhisperBack, "WHISPER", nil, arg2);
            end
         end

         if BlockType == 2 then
            return;
         end
         
         if BlockType == 3 then
            theColor = oppFacColor;
         end
         
         if BlockType == 1 or BlockType == 3 then
            local CleanText = "";
            CleanText = string.gsub(arg1,"|c%x%x%x%x%x%x%x%x", "");
            CleanText = string.gsub(CleanText,"|r", "");
            CleanText = string.gsub(CleanText,"|H.-|h", "");
            CleanText = string.gsub(CleanText,"|h", "");
            
            if event == "CHAT_MSG_YELL" then
               CleanText = theColor .. "[" .. arg2 .. "] yells: " .. CleanText .. "|r";
            else
               if event == "CHAT_MSG_SAY" then
                  CleanText = theColor .. "[" .. arg2 .. "] says: " .. CleanText .. "|r";
               else
                  if event == "CHAT_MSG_WHISPER" then
                     CleanText = theColor .. "[" .. arg2 .. "] whispers: " .. CleanText .. "|r";
                  else
                     CleanText = theColor .. "[" .. arg4 .. "] [" .. arg2 .. "]: " .. CleanText .. "|r";
                  end
               end
            end
            
            DEFAULT_CHAT_FRAME:AddMessage(CleanText);
            return;
         end
      end
   end

   local theStatusValue = string.format("%7d",table.length(MessageList));
   SpamThrottleStatusValue5:SetText(theStatusValue);

   theStatusValue = string.format("%7d",FilteredCount);
   SpamThrottleStatusValue6:SetText(theStatusValue);

   OldChatFrame_OnEvent(event);
end
-- Developer of Questie --
-- Download at: https://github.com/AeroScripts/QuestieDev --
Logon
Grunt
Grunt
 

Re: SpamThrottle: Vanilla addon to reduce chat spam

by Logon » Wed Oct 14, 2015 12:36 pm

I Think you can even unhook the fucker by doing Prat:AceHook:unhook(getglobal("ChatFrame"..id), "AddMessage")
-- Developer of Questie --
-- Download at: https://github.com/AeroScripts/QuestieDev --
Logon
Grunt
Grunt
 

Re: SpamThrottle: Vanilla addon to reduce chat spam

by Canibalismo » Sat Feb 27, 2016 9:10 pm

does anyone know of an add-on that does the opposite thing?
I want to be notified on specific keywords i.e. BRD
Canibalismo
Tester
 

Re: SpamThrottle: Vanilla addon to reduce chat spam

by kaybee10 » Thu Mar 17, 2016 2:41 am

Canibalismo wrote:does anyone know of an add-on that does the opposite thing?
I want to be notified on specific keywords i.e. BRD


Addon called calltoarms, pretty sure thats what you're looking for
kaybee10
Tester
 

Re: SpamThrottle: Vanilla addon to reduce chat spam

by darkreignfox » Thu Mar 17, 2016 11:34 am

Love the addon, only recently started getting this silly level of spamage from gold sellers and happy there is something out there to stop it.

One question, getting a new notice after the addon was installed: "system message if you have used your current password at another private server please change it through our website for more information"
darkreignfox
Grunt
Grunt
 

Re: SpamThrottle: Vanilla addon to reduce chat spam

by Azonos » Fri Mar 18, 2016 11:39 am

Will this block the gold spam whispers as well?
Azonos 36 - PVE
User avatar
Azonos
Grunt
Grunt
 

Re: SpamThrottle: Vanilla addon to reduce chat spam

by Petroix » Sun Mar 27, 2016 11:20 am

This addon is broken it hides all messages if I add any keyword.. added .com and gold sellers are still visible, added $ and it hide almost all messages, X messages are hidden every second, gold sellers don't spam so fast, it's not working completly. And /y doesnt work ppl keep spamming every few seconds and this addon doesnt do shit to block them till I set it to 3k seconds but thats stupid cuz it hides important messages too.
Petroix
Senior Sergeant
Senior Sergeant
 

Re: SpamThrottle: Vanilla addon to reduce chat spam

by Soulxlock » Wed Mar 30, 2016 8:11 am

Azonos wrote:Will this block the gold spam whispers as well?

Yes it will, if you add the correct catchphrase.

Thanks to the creator of this addon, a must have in my opinion.
User avatar
Soulxlock
Senior Sergeant
Senior Sergeant
 

PreviousNext

Return to Addons & macros