View Single Post
01-01-15, 05:07 AM   #10
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Alright, after installing Trade Forwarder and glancing through it's code, I think I finally understand what problem you're complaining about, and why it's happening. When you're in town, and Trade Forwarder is forwarding messages you see in Trade to its custom channel, everything seems to be working correctly:

1. Trade Chat Cleaner sees the message in Trade channel via a chat filter, and either blocks it or lets it pass.
2. Trade Forwarder sees the message in Trade channel via an event handler (which is not affected by filters) and sends it to the custom channel.
3. Trade Chat Cleaner sees the message in the custom channel via a chat filter, and lets it pass, because it doesn't apply any filtering to custom channels.

The problem happens when you are out of town, when messages forwarded to you from other players are getting shown in your chat frame, even though Trade Chat Cleaner would hide them if they were really in Trade chat. The reason this is happening is that Trade Forwarder is (as suspected) not using chat filters correctly. It's using them incorrectly in a different way that I thought, but it's still incorrect.

What it's doing is getting a list of chat filters for the CHAT_MSG_CHANNEL event and calling them, just like would normally happen for a channel message, but the arguments it's passing to the filters are wrong -- it's passing the name and number of its own custom channel instead of the name and number of the Trade channel, so as far as Trade Chat Cleaner or any other filtering addon is concerned, the message is not in the Trade channel.

The ideal solution for this problem would be for Trade Forwarder to do a better job of emulating the Trade channel. This could be done in one of two ways:

1) Pass better arguments to the chat filters so that messages actually get filtered like Trade chat messages, instead of like custom channel messages.

2) Just call ChatFrame_MessageEventHandler (with appropriate arguments) instead of handling all this itself.

Additionally, Trade Forwarder should probably update to using SendAddonMessage instead of SendChatMessage to do its forwarding; as of 6.0 "CHANNEL" is a viable target for SendAddonMessage (see this and this). This way it wouldn't have to worry about hiding its own messages from the chat frame.

In any case, Trade Chat Cleaner is working exactly as it should, and I don't plan to add any special checks to work around other addons' idiosyncracies.
__________________
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.

Last edited by Phanx : 01-01-15 at 05:14 AM.
  Reply With Quote