Thread Tools Display Modes
Prev Previous Post   Next Post Next
11-24-07, 03:28 PM   #1
stqn
A Deviate Faerie Dragon
Join Date: Sep 2007
Posts: 11
ChatFrame_MessageEventHandler() being called multiple times per message

Hi!

I'm writing a small chat message filter. I'm hooking ChatFrame_MessageEventHandler() like this:

Code:
-- Store original ChatFrame_MessageEventHandler
local ORIG_ChatFrame_MessageEventHandler = ChatFrame_MessageEventHandler

-- Replacement for ChatFrame_MessageEventHandler
function ChatFrame_MessageEventHandler( event, ... )
	if event == "CHAT_MSG_MONSTER_SAY" then
		-- Ignore annoying NPC messages
		if	arg2 == "Topper McNabb" or
			arg2 == "Thomas Miller" or
			arg2 == "William" or
			arg2 == "Donna" then
			return
		end
	elseif	event == "CHAT_MSG_SAY" or
		event == "CHAT_MSG_CHANNEL" or
		event == "CHAT_MSG_EMOTE" or
		event == "CHAT_MSG_YELL" then

		say( "event="..event..", arg1="..arg1..", arg2="..arg2..", arg3="..arg3..", arg4="..arg4..", arg5="..arg5..", arg6="..arg6..", arg7="..arg7..", arg8="..arg8..", arg9="..arg9)

	end
	return ORIG_ChatFrame_MessageEventHandler( event, ... )
end
...and it turns out I get SEVEN calls to this function per message received in the "LookingForGroup" channel! (don't know about other channels as noone is talking in Desolace ) Seven identical events. The text is output in the chat frame right after the first event is received, and then the 6 others follow.

Is this normal? I can simply process all 7 events like the first one, but it seems like a waste of resources...

Last edited by stqn : 11-24-07 at 03:31 PM.
  Reply With Quote
 

WoWInterface » Developer Discussions » General Authoring Discussion » ChatFrame_MessageEventHandler() being called multiple times per message


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off