possible improvement: split whisper suppression in the filter from message processing
mooreatv opened this issue ยท 1 comments
<foxlit>is there some reason you want to process your message in a chat *filter*?
<foxlit>The saner thing to do would be to just register for CHAT_MSG_WHATEVER and do whatever processing you need there.
<sylvanaar>hes filtering it though
<MooreaTv>if addressed to me, because it is a filter, I suppress the message if it's for the addon
<foxlit>MooreaTv: but you supress the duplicates as well. So the simpler version is just to have a filter that supresses everything with your prefix/event logic, and a separate event handler that calls DB:ProcessMessage.
<foxlit>(which drops the deduplication code and doesn't screw you over if someone has disabled whispers in all their chat frames)
<MooreaTv>oh that's possible ? hmmm
<MooreaTv>I mean it's possible for a user to supress whispers altogether and then no filter is called?
<sylvanaar>I had a similar problem with chat sounds. I wanted to play a sound for an event, but only if it printed on one of the chatfranes
<MooreaTv>but yeah it's a good idea to seperate the supression from the processing... it was sort of a short cut to not have to look at the whispers in 2 places
<sylvanaar>Can you come up with a solution to avoid deduping in that case foxlit ?
<foxlit>hm, maybe not. it runs the filters before FCFManager_ShouldSuppressMessage, which is perhaps a waste.
<foxlit>sylvanaar: PlaySound from a hook on the ChatFrame's AddMessage.
<sylvanaar>What if it goes to all the frames
<foxlit>(although that interprets one of as "a specific" rather than "any")
<MooreaTv>you mean the filters are always run, there is no way for a user to not have filters triggered on whispers?
(so not super useful to change as it's working if there isn't a way to not get the filter triggered)
todo: test and maybe cleanup/split the code