PRIVMSGs sent to prefixed channels by a client are not broadcast to all other clients as ordinary PRIVMSGs are #330

Closed
opened 2026-10-05 04:13:34 +02:00 by adam · 3 comments
Owner

Many modern ircds (freenode included) will allow PRIVMSGs of the following format:

PRIVMSG @#channel :This is an ops-only message.

ZNC will not echo PRIVMSGs of this format to all connected clients when one client sends one, as it will with other PRIVMSGs sent to channels.

I didn't actually try it, but if it were happening it would happen here: https://github.com/znc/znc/blob/master/src/Client.cpp#L357
And I don't see anything there that would handle it.

The network sends its list of prefix symbols in the ISUPPORT (005) numeric upon connecting, so basically the chance you'd be looking at is:

CChan* pChan = m_pNetwork->FindChan(sTarget);
if (pChan == NULL && GetIRCSock()->GetPerms().find(sTarget[0]) != CString::npos)
{
    pChan = m_pNetwork->FindChan(sTarget.substr(1));
}

Or, you could modify CIRCNetwork::IsChan to return true for valid channel names prepended with a valid channel mode prefix. That wouldn't change the fact that prefixed channel messages wouldn't end up in the scrollback though.

Maybe I'll patch this myself. Who knows.

Many modern ircds (freenode included) will allow PRIVMSGs of the following format: ``` PRIVMSG @#channel :This is an ops-only message. ``` ZNC will not echo PRIVMSGs of this format to all connected clients when one client sends one, as it will with other PRIVMSGs sent to channels. I didn't actually try it, but if it were happening it would happen here: https://github.com/znc/znc/blob/master/src/Client.cpp#L357 And I don't see anything there that would handle it. The network sends its list of prefix symbols in the ISUPPORT (005) numeric upon connecting, so basically the chance you'd be looking at is: ``` CChan* pChan = m_pNetwork->FindChan(sTarget); if (pChan == NULL && GetIRCSock()->GetPerms().find(sTarget[0]) != CString::npos) { pChan = m_pNetwork->FindChan(sTarget.substr(1)); } ``` Or, you could modify _CIRCNetwork::IsChan_ to return true for valid channel names prepended with a valid channel mode prefix. That wouldn't change the fact that prefixed channel messages wouldn't end up in the scrollback though. Maybe I'll patch this myself. Who knows. <!-- github-sync-id:33331535 -->
adam closed this issue 2026-10-05 04:13:35 +02:00
Author
Owner

Actually, it looks like it might be as simple as replacing

[367] if (m_pNetwork->IsChan(sTarget)) {

with

[367] if (pChan != NULL) {
Actually, it looks like it might be as simple as replacing ``` [367] if (m_pNetwork->IsChan(sTarget)) { ``` with ``` [367] if (pChan != NULL) { ``` <!-- github-comment-id:42868867 -->
Author
Owner

I think this doesn't happen anymore and should be closed.

I think this doesn't happen anymore and should be closed. <!-- github-comment-id:138903686 -->
Author
Owner

ZNC 1.7.x-git-377-3d95aea - http://znc.in

CLI -> ZNC [PRIVMSG @#znc-test :hello ops]
ZNC -> CLI [@time=... :jpnurmi!jpnurmi@qt/jpnurmi PRIVMSG @#znc-test :hello ops]
ZNC -> CLI [@time=... :jpnurmi!jpnurmi@qt/jpnurmi PRIVMSG @#znc-test :hello ops]
ZNC -> IRC [PRIVMSG @#znc-test :hello ops]
ZNC 1.7.x-git-377-3d95aea - http://znc.in ``` CLI -> ZNC [PRIVMSG @#znc-test :hello ops] ZNC -> CLI [@time=... :jpnurmi!jpnurmi@qt/jpnurmi PRIVMSG @#znc-test :hello ops] ZNC -> CLI [@time=... :jpnurmi!jpnurmi@qt/jpnurmi PRIVMSG @#znc-test :hello ops] ZNC -> IRC [PRIVMSG @#znc-test :hello ops] ``` <!-- github-comment-id:139783424 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/znc#330