Closed S-S-X closed 1 year ago
Reason for this is rather simple, jail simply cancels formatting which also happens in event handler defined at hash.lua: https://github.com/mt-mods/beerchat/blob/85467723242f8875be9b03ef06c01e5333eca55b/plugin/hash.lua#L51-L63
And handler in jail.lua is called before hash.lua handler, it stops event propagation and delivers message as is: https://github.com/mt-mods/beerchat/blob/85467723242f8875be9b03ef06c01e5333eca55b/plugin/jail.lua#L158-L167
There's other things too that could use ordering/priority system for event handlers because some handlers are clearly more important than others and some could clearly be postponed to take shortest possible path if message is dropped or event propagation stopped.
How to exactly define it sure isn't that simple, at least I've no idea what would cover as many use cases as possible without being too complicated for API usage.
With channel aliases I've tested with probably simplest possible option which is simply yes or no for priority, first or last when adding: https://github.com/mt-mods/beerchat/blob/94cb2c449c0dfb1d7b981e564360ce3c0aedce5b/hooks.lua#L25-L42 Upside with such simple boolean implementation is that it is fairly easy to rework it to be more complex and just turn boolean into for example predetermined number.
Anyway while what was said in earlier comment would be possible I think probably for jail it would actually be best to just have its own formatting and make it use just very basic formatting instead global fancy formatting with nick colors and all.
Almost sure caused by
85
It seems like formatting is completely skipped. Data is available because on remote side messages are still formatted correctly. In game there's no player name, no channel, apparently no nothing but just message sent by player.
Special formatting to reconstruct original message from jailed player does happen but generic formatting that adds player name / channel name / colorizes message / etc. does not seem to be called at all for messages sent by jailed players.
Also would be good to check if restoring generic formatting vs adding more appropriate custom formatting for jailed players would be better.