|Go to Page...|
|Thread Tools||Display Modes|
|01/22/22, 10:17 PM||#1|
Session Mute Players in Chat
I'm not really requesting an AddOn here, but I am searching to see if anyone knows of one already in existence that does what the title says. Basically instead of adding people to the ignore list (that takes a permanent spot, and they might just be a fleeting /zone troll), you can "session mute" a player and they'll disappear from all chats until the next /reloadui or logout. I already went ahead and wrote my own implementation, but before I upload it to ESOUI I wanted to see if anyone who's a prolific AddOn user might know if something that does that (or similar) already exists on ESOUI.
I did a search, and could only find Mute List which is in Discontinued and Outdated. I looked at pChat too and asked the current maintainer (thanks Baertram!) but couldn't see it doing anything like what I was doing. It does more than a few things though, so it's possible I missed a feature.
So if anyone else knows of a "Session Mute" or anything similar to a chat mute on other players (that doesn't use the Ignore List) then let me know! Otherwise I can share my version.
|01/23/22, 08:43 AM||#2|
I'd be interested into adding it to pChat though, sounds like a good addition.
If you want to we can add your addon to pChat, if this would make the both addons work properly together (as chat handlers etc. are actually a bit problematic if many addons overwrite the same, the ## OptionalDependsOn and the event (player_activated at pchat e.g.) where the stuff get's changed paly a role).
Other addon providing chat filters with names, strings etc. But it does not do this per session or user afaik.
If both (multiple, there are doznes of other chat addons out there) work together fine though just release your addon I'd be happy to try and use it for sure!
|01/24/22, 06:21 AM||#3|
|01/24/22, 08:05 AM||#4|
Thanks. After checking the code: Yes, they should work fine as standalone addons.
I'd change a bit like not using AddMenuItem and not directly hooking the chat context menu for player names, but using LibCustomMenu and it's API to do so, so that other addons doing the same will work properly together!
You hook into "FormatAndAddChatMessage" (at event_add_on_loaded) and pChat does it the official way by using CHAT_ROUTER:RegisterMessageFormatter(EVENT_CHAT_MESSAGE_CHANNEL, pChatChatHandlersMessageChannelReceiver) (at event_player_activated, but this CHAT_ROUTER:RegisterMessageFormatter will overwrite other handlers so it can only be used once properly! If you'd used the same it would have broken pChat ).
I guess it should work properly that way. You could add ## OptionalDependsOn: pChat rChat
to make the chat addons load before yours and make them add hoks etc. properly.
But this is optional I guess.
You'd have to try both addons enabled at the same time though. pChat e.g. provides a history which is saved for incoming / send messages.
Some addons disturb that if they prehook into the chat and returning true to prevent the message output. So adding the optional dependency should fix this in most cases.
We would have to test ;-) I'll add your addon to my active ones and use it a bit to see if I might see anything disturbing each other.
|01/24/22, 08:48 AM||#5|
I did check LibCustomMenu originally, but I didn't notice until just then that it has an API for lib:RegisterPlayerContextMenu(func, category) I'll update my code to use it.
So as far as hooking into FormatAndAddChatMessage, you're saying to leave it as is in my implementation and that'll work with pChat?
Adding an ##OptionalDependsOn for pChat is no issue, I can do that.
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.
|01/24/22, 09:00 AM||#6|
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.
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.
|ESOUI » AddOns » AddOn Search/Requests » Session Mute Players in Chat|