Although I already searched lots of webpages, I have not found an answer to the following problem so far.
What I'm trying to do is to hook into AddMessage() and modify, e.g., all messages that are received from the guild channel, BattleNet friends, and via whispers.
Now the problem that I have is how to determine if the current AddMessage() call was fired due to, e.g., a MSG_CHAT_WHISPER event (which I want to modify) or due to, e.g., a MSG_CHAT_RAID (which I don't want to modify).
In previous WoW versions there was the global "event" variable that could be checked but that does not work anymore. And I have not found out how it is possible to determine the current event inside of my own hooked AddMessage() function.
I also thought about switching to use ChatFrame_AddMessageEventFilter instead of hooking AddMessage, but then I could only modify the textual part of the message, but not, e.g., anything about the author displayed. Or in shorter form: No, AddMessageEventFilter is no alternative for me.
Anyone knows how to determine the current event? Any help would be gladly appreciated!
Yes, that would be one possibility. But string-comparing each new message against various patterns is not what I would call "efficient". I just thought that maybe there is some other (better) new method since the release of Cata, after the global "event" is gone.
Yes, that would be one possibility. But string-comparing each new message against various patterns is not what I would call "efficient". I just thought that maybe there is some other (better) new method since the release of Cata, after the global "event" is gone.
It is, however, the only way. Unless you know which event you want the info from. It is possible that the string you're after is included an event. There are events that fire specifically for guild chat, BNet chat, and whispers.
I'm pretty sure the default UI adds all of its filters before loading any addons, plus it's only called once (in FrameXML\WorldStateFrame.lua). I'm afraid all you would get is other addon's filters.
Now I'm parsing the received messages in AddMessages(), but don't care for the event anymore. Instead, I just check in which channel the message was posted (regular, guild, whisper, party) etc, thats sufficient for me, as I found out.
Thanks for the help! :-)
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Although I already searched lots of webpages, I have not found an answer to the following problem so far.
What I'm trying to do is to hook into AddMessage() and modify, e.g., all messages that are received from the guild channel, BattleNet friends, and via whispers.
Now the problem that I have is how to determine if the current AddMessage() call was fired due to, e.g., a MSG_CHAT_WHISPER event (which I want to modify) or due to, e.g., a MSG_CHAT_RAID (which I don't want to modify).
In previous WoW versions there was the global "event" variable that could be checked but that does not work anymore. And I have not found out how it is possible to determine the current event inside of my own hooked AddMessage() function.
I also thought about switching to use ChatFrame_AddMessageEventFilter instead of hooking AddMessage, but then I could only modify the textual part of the message, but not, e.g., anything about the author displayed. Or in shorter form: No, AddMessageEventFilter is no alternative for me.
Anyone knows how to determine the current event? Any help would be gladly appreciated!
Thanks in advance,
Shardik
It is, however, the only way. Unless you know which event you want the info from. It is possible that the string you're after is included an event. There are events that fire specifically for guild chat, BNet chat, and whispers.
See: http://www.wowpedia.org/Events/Communication
Thanks for the help! :-)