Closed johannes-krude closed 3 years ago
adjustMute
checks via CanSeeRoom
whether a user is relayed in that room. CanSeeRoom
attempts to find a relay for the room and checks if the user is in the relay whitelist, so I guess that the PR already does handle this case. I will test what actually happens.
I verified that muting is working correctly with respect to relay puppets. The only caveat is, that changes to the relay whitelist are not propagated to mute status for users already joined to a room, a user can unmute himself with fixmute <room>
to fix this.
I noticed, that direct-message-rooms may get muted, so it is now checked that a room is not direct before muting someone in there.
handleUserJoinEvent
now catches all exceptions from adjustMute
to ensure that all the other join logic is still executed in case something fails.
This adjusts powel levels to -1 or 0 based on whether the user can be relayed. Power leves are adjusted when joining a room, (un-)linking a puppet, and when calling the "fixmute" command.
There are two aspect about this code where I am unsatisfied, but was not able to do any better with the available data & hooks:
listrooms
is called to get all rooms where a user may need to be unmuted.