Add some way to bypass channel mode cache (or just remove it) #1026

Closed
opened 2026-10-05 04:59:06 +02:00 by adam · 6 comments
Owner

Right now, ZNC caches channel modes and will respond to MODE commands from the cache rather than forwarding it to the server (https://github.com/znc/znc/blob/master/src/Client.cpp#L1098). This causes issues if the channel modes that ZNC thinks are set doesn't actually match with what the server has set, and the design makes it impossible to re-synchronize what ZNC has without parting and re-joining the channel in question.

Right now, ZNC caches channel modes and will respond to MODE commands from the cache rather than forwarding it to the server (https://github.com/znc/znc/blob/master/src/Client.cpp#L1098). This causes issues if the channel modes that ZNC thinks are set doesn't actually match with what the server has set, and the design makes it impossible to re-synchronize what ZNC has without parting and re-joining the channel in question. <!-- github-sync-id:1862519607 -->
adam closed this issue 2026-10-05 04:59:06 +02:00
Author
Owner

Does server set some mode without telling ZNC about it?

Does server set some mode without telling ZNC about it? <!-- github-comment-id:1689437661 -->
Author
Owner

Yes. For a concrete example, libera.chat has the +M mode which is only visible to opers. If you join a channel with it set but without being opered up, you will not see the mode. If you later oper up, a /mode command will start showing it, however due to this caching this never actually gets reflected in ZNC. Rejoining the channel will show it, but this is noisy.

One could make a compelling argument that the current behavior of the mode is broken server-side but it’d be nice to have some way to make this work despite that.

Yes. For a concrete example, libera.chat has the +M mode which is only visible to opers. If you join a channel with it set but without being opered up, you will not see the mode. If you later oper up, a /mode command will start showing it, however due to this caching this never actually gets reflected in ZNC. Rejoining the channel will show it, but this is noisy. One could make a compelling argument that the current behavior of the mode is broken server-side but it’d be nice to have some way to make this work despite that. <!-- github-comment-id:1690010293 -->
Author
Owner

I can't find such mode at https://libera.chat/guides/channelmodes
What does it do?

One could make a compelling argument that the current behavior of the mode is broken server-side

Yes, it is.

to have some way to make this work

You can use the *send_raw module to send MODE to server directly, ignoring all ZNC's logic

I can't find such mode at https://libera.chat/guides/channelmodes What does it do? > One could make a compelling argument that the current behavior of the mode is broken server-side Yes, it is. > to have some way to make this work You can use the `*send_raw` module to send MODE to server directly, ignoring all ZNC's logic <!-- github-comment-id:1690721423 -->
Author
Owner

I arrived at the *send_raw method yesterday but would prefer something that happens automatically so I don't need to remember that ZNC plays games with channel data (such as a config option). Failing that, I suppose I could hook into OnUserRaw and just bypass it that way.

The mode is unfortunately undocumented. It prevents opers from being /kicked from the channels it's set in.

I arrived at the `*send_raw` method yesterday but would prefer something that happens automatically so I don't need to remember that ZNC plays games with channel data (such as a config option). Failing that, I suppose I could hook into OnUserRaw and just bypass it that way. The mode is unfortunately undocumented. It prevents opers from being `/kick`ed from the channels it's set in. <!-- github-comment-id:1690751745 -->
Author
Owner

OnUserRawMessage would work, yeah

`OnUserRawMessage` would work, yeah <!-- github-comment-id:1690816771 -->
Author
Owner

Solved via a module using OnUserRawMessage, so just going to close this out.

Solved via a module using `OnUserRawMessage`, so just going to close this out. <!-- github-comment-id:1691006862 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/znc#1026