View Single Post
Old 12-23-2009   #5
Phanx
Seal Cub Clubbing Club
 
Phanx's Avatar
 
Join Date: May 2005
Location: California, US
Posts: 7,760
Default Re: You are not in a raid group (or party) spam

"this" is still assigned, but it is deprecated and its use is strongly discouraged... but it's still the only way (that I know of) to get the name of the object calling SendAddOnMessage, since it doesn't pass itself to the function. Maybe you could do some trickery with the debugstack to figure it out, but using "this" is probably easier.

That said, here's a simpler version of the previously posted code that doesn't leak a global (bad Farmbuyer! )
Code:
hooksecurefunc("SendAddonMessage", function(prefix, msg, distro, destination)
	if distro == "PARTY" or distro == "RAID" then
		local addon, _
		local name = this and this.GetName and this:GetName()
		if name and _G[name] then
			_, addon = issecurevariable(name)
		end
		print(("SendAddonMessage, addon: %s, prefix: %s, distro: %s"):format(addon or "???", prefix, distro))
	end
end)
If updating your addons doesn't do the trick, the above code will print out a message every time an addon tries to send a comm message via the party or raid distributions. Obviously you won't want to run it all the time (or change the "print" call to "ChatFrameN:AddMessage" where N is an otherwise unused but existing chat frame), but it should help identify which addon is doing the bad thing.
__________________
& Author/maintainer of Grid, PhanxChat, and many more. | PM me on CurseForge
Troubleshoot an addon | Turn any code into an addon | More addon resources
Need help with your code? Attach or paste your whole, real files.
Please don't PM me about addon bugs, requests, or code help. Post a comment, ticket, or thread instead!
Phanx is offline   Reply With Quote