View Single Post
01/24/22, 09:00 AM   #6
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,002
Originally Posted by Alianym View Post
So as far as hooking into FormatAndAddChatMessage, you're saying to leave it as is in my implementation and that'll work with pChat?
Yes, it "should" work properly. But to explain more in detail:

If you hook that function you might hook into it at event_add_on_loaded and after that, at event_player_activated pChat uses the CHAT_ROUTER:RegisterMessageFormatter function which will "overwrite" the original messageFormatter. Thus this could overwrite the original ZOs used function you had hooked into!

So you need to test if everything works fine together, or change your optional dependency on pChat and rChat (similar addon fork of pChat) to let them load before your addon AND change your code to also register the hook at event_player_activated first to that pChat does his message formatter overwrite and after that your addon hooks into the message formatter function.
-> I think ZOs function CHAT_ROUTER:RegisterMessageFormatter is adding it to a table internally and that way your hook might stay active as the function you hooked will just read that table internally and call the registered function (pChat's in that case) afterwards. And the surrounding function (FormatAndAddChatMessage) stays the same so your prehook stays the same.

Else your addon might just do nothing :-) I'm not sure anymore ind etail how pChat does that message formatter change but I'm pretty sure ZOs only allowes to register 1 function there, so it'soverwriting the original one. And it's not "hooking" into exisiting ones, where it would re-use ZOs vanilla code AND all already added pre and posthooks. So all other addons basically would loose their hook that way.



Originally Posted by Alianym View Post
My question regarding the chat history... if a message is muted (and hidden instead of muted + missed message notification), would the player want it to show up in the history? Because I think at the moment it would (and should) hide it from the chat history as well, which is how I imagine it works at the moment.
You are right and that was not the point I had in mind. The point is that there is a messageIndex posted as the message enters and pChat uses this to store it's data internally in the SV + history SV. And if the index would get out-of-sync as the message comes in and pChat stores it already, but then the message is forfeit and not shown, it will get out of sync. I think we had that in the past but added a fix so the index and message only update if they properly run though the message formatter. So I guess this is nothing we should worry about anymore today.

pChat is jsut that big that I do not remember all in detail anymore. I guess testing is the best to do here...

Last edited by Baertram : 01/24/22 at 09:02 AM.
  Reply With Quote