Wednesday, April 18, 2012

Need help with new chat hooking

http://www.wowwiki.com/API_ChatFrame...ageEventFilter

Was looking to rewrite one of my mods and found that the old method was replaced with this. Problem is that the explanation is short, not very helpful when compared to other API entries and the examples aren't commented to help explain wtf it's doing along the way.

So in short, can someone dumb this down a little?

My main issue is with


Code:
local myChatEventHandler(event)

local filterFuncList = ChatFrame_GetMessageEventFilters(event)
if filterFuncList then
for _, filterFunc in pairs(filterFuncList) do
local filter, newarg1 = filterFunc(arg1)
if filter then
return
end
arg1 = (newarg1 or arg1);
end
end

-- whoop de do, not filtered, go about our business and display etc
end

Here is what I do understand from this:

filterFunc - the name of my filtering function

That's it.

Looking at it again, I'm wondering if I even need that portion, or do I just need the first example? All I'm doing is checking for keywords and if they're present, display the message. If not, ignore it entirely.

Kinda like a reverse gold-spammer filter. I want to block everything except for messages that contain keywords defined in a list.

No comments:

Post a Comment