View Single Post
05-22-14, 05:04 AM   #12
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Niketa View Post
I added an extra check for printing the message to make sure the chat window is supposed to display those toast alerts first (I actually have a custom window I dedicate to whispers only and it was posting there before I did this).
Rather than creating all those new tables and looping over all the registered message types, just check if the event is registered on the frame:

Code:
if message and toonid then
	for i = 1, NUM_CHAT_WINDOWS do
		local f = _G["ChatFrame"..i]
		if f:IsEventRegistered("CHAT_MSG_BN_INLINE_TOAST_ALERT") then
			ChatFrame_MessageEventHandler(f, "CHAT_MSG_BN_INLINE_TOAST_ALERT", message, name, nil, 0, nil, nil, nil, nil, nil, nil, 0, nil, toonid)
		end
	end
end
Also, I'd move the toonID check up with the prev check... no sense proceeding to check for a message if there's no toonID.

As for the other problems, I'll see what I can come up with.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote