Thread Tools Display Modes
01/22/22, 10:17 PM   #1
Alianym
AddOn Author - Click to view addons
Join Date: Jan 2018
Posts: 10
Session Mute Players in Chat

Hi!

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.
  Reply With Quote
01/23/22, 08:43 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,973
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.
Nope, I re-checked today and pChat does not povide that feature so far.
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.
https://www.esoui.com/downloads/info...sSpamMore.html

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!
  Reply With Quote
01/24/22, 06:21 AM   #3
Alianym
AddOn Author - Click to view addons
Join Date: Jan 2018
Posts: 10
Originally Posted by Baertram View Post
Nope, I re-checked today and pChat does not povide that feature so far.
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.

[...]

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!
I think they'd work fine together, but admittedly haven't tested thoroughly. That said I'm happy to throw the code up on Github and send you a link so you can take a look. Might be easier to just add it into pChat, (I did a quick pro/con list). I can make sure the code is properly commented and answer any questions.
  Reply With Quote
01/24/22, 08:05 AM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,973
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.
  Reply With Quote
01/24/22, 08:48 AM   #5
Alianym
AddOn Author - Click to view addons
Join Date: Jan 2018
Posts: 10
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.
  Reply With Quote
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: 4,973
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

ESOUI » AddOns » AddOn Search/Requests » Session Mute Players in Chat


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off