Sending commands to modules - colons needed? #903

Open
opened 2026-10-05 04:51:56 +02:00 by adam · 3 comments
Owner

For a while, I've been using a script I wrote in order to delete ZNC accounts from our company server when people leave. The script has been working fine until something changed which resulted in the ZNC server returning an error instead of deleting the user.

Upon further inspection, it looks like some of the controlpanel commands require a colon in front of them in order to work. So, for example:

PRIVMSG *controlpanel AddUser pcolmer pcolmer
:*controlpanel!znc@znc.in PRIVMSG linaro_znc :Usage: AddUser <username> <password>

That doesn't work but:

PRIVMSG *controlpanel :AddUser pcolmer pcolmer
:*controlpanel!znc@znc.in PRIVMSG linaro_znc :User pcolmer added!

does.

Curiously, for ListUsers, that seems to work with or without a leading colon:

PRIVMSG *controlpanel :ListUsers
:*controlpanel!znc@znc.in PRIVMSG linaro_znc :+------------+----------------------+---------+------------+-------------+------------+----------+
:*controlpanel!znc@znc.in PRIVMSG linaro_znc :| Username   | Realname             | IsAdmin | Nick       | AltNick     | Ident      | BindHost |
:*controlpanel!znc@znc.in PRIVMSG linaro_znc :+------------+----------------------+---------+------------+-------------+------------+----------+
:*controlpanel!znc@znc.in PRIVMSG linaro_znc :| linaro_znc | ZNC - https://znc.in | Yes     | linaro_znc | linaro_znc_ | linaro_znc |          |
:*controlpanel!znc@znc.in PRIVMSG linaro_znc :+------------+----------------------+---------+------------+-------------+------------+----------+
PRIVMSG *controlpanel ListUsers
:*controlpanel!znc@znc.in PRIVMSG linaro_znc :+------------+----------------------+---------+------------+-------------+------------+----------+
:*controlpanel!znc@znc.in PRIVMSG linaro_znc :| Username   | Realname             | IsAdmin | Nick       | AltNick     | Ident      | BindHost |
:*controlpanel!znc@znc.in PRIVMSG linaro_znc :+------------+----------------------+---------+------------+-------------+------------+----------+
:*controlpanel!znc@znc.in PRIVMSG linaro_znc :| linaro_znc | ZNC - https://znc.in | Yes     | linaro_znc | linaro_znc_ | linaro_znc |          |
:*controlpanel!znc@znc.in PRIVMSG linaro_znc :+------------+----------------------+---------+------------+-------------+------------+----------+

Is this a documented change or a bug in the code?

Weirdly, I only discovered the colon solution because I was running tcpdump at the server end while using irssi to send the commands my script sends and I noticed that when I typed:

/msg *controlpanel AddUser pcolmer pcolmer

the server actually received

PRIVMSG *controlpanel :AddUser pcolmer pcolmer

I have no idea how irssi knew to add that colon in.

For a while, I've been using a script I wrote in order to delete ZNC accounts from our company server when people leave. The script has been working fine until something changed which resulted in the ZNC server returning an error instead of deleting the user. Upon further inspection, it looks like *some* of the controlpanel commands require a colon in front of them in order to work. So, for example: PRIVMSG *controlpanel AddUser pcolmer pcolmer :*controlpanel!znc@znc.in PRIVMSG linaro_znc :Usage: AddUser <username> <password> That doesn't work but: PRIVMSG *controlpanel :AddUser pcolmer pcolmer :*controlpanel!znc@znc.in PRIVMSG linaro_znc :User pcolmer added! does. Curiously, for ListUsers, that seems to work with or without a leading colon: ``` PRIVMSG *controlpanel :ListUsers :*controlpanel!znc@znc.in PRIVMSG linaro_znc :+------------+----------------------+---------+------------+-------------+------------+----------+ :*controlpanel!znc@znc.in PRIVMSG linaro_znc :| Username | Realname | IsAdmin | Nick | AltNick | Ident | BindHost | :*controlpanel!znc@znc.in PRIVMSG linaro_znc :+------------+----------------------+---------+------------+-------------+------------+----------+ :*controlpanel!znc@znc.in PRIVMSG linaro_znc :| linaro_znc | ZNC - https://znc.in | Yes | linaro_znc | linaro_znc_ | linaro_znc | | :*controlpanel!znc@znc.in PRIVMSG linaro_znc :+------------+----------------------+---------+------------+-------------+------------+----------+ PRIVMSG *controlpanel ListUsers :*controlpanel!znc@znc.in PRIVMSG linaro_znc :+------------+----------------------+---------+------------+-------------+------------+----------+ :*controlpanel!znc@znc.in PRIVMSG linaro_znc :| Username | Realname | IsAdmin | Nick | AltNick | Ident | BindHost | :*controlpanel!znc@znc.in PRIVMSG linaro_znc :+------------+----------------------+---------+------------+-------------+------------+----------+ :*controlpanel!znc@znc.in PRIVMSG linaro_znc :| linaro_znc | ZNC - https://znc.in | Yes | linaro_znc | linaro_znc_ | linaro_znc | | :*controlpanel!znc@znc.in PRIVMSG linaro_znc :+------------+----------------------+---------+------------+-------------+------------+----------+ ``` Is this a documented change or a bug in the code? Weirdly, I only discovered the colon solution because I was running tcpdump at the server end while using irssi to send the commands my script sends and I noticed that when I typed: /msg *controlpanel AddUser pcolmer pcolmer the server actually received PRIVMSG *controlpanel :AddUser pcolmer pcolmer I have no idea how irssi knew to add that colon in. <!-- github-sync-id:420031997 -->
Author
Owner

The colon is part of the IRC spec. If the final parameter of a command (in this case, PRIVMSG) contains the space character, it must be prepended with a colon. irssi knew to put in the colon because your message contained a space.

If your script was not sending a colon, it was technically sending invalid lines.

The colon is part of the IRC spec. If the final parameter of a command (in this case, `PRIVMSG`) contains the space character, it must be prepended with a colon. irssi knew to put in the colon because your message contained a space. If your script was not sending a colon, it was technically sending invalid lines. <!-- github-comment-id:472042622 -->
Author
Owner

Thank you for that explanation, @dgw.

Thank you for that explanation, @dgw. <!-- github-comment-id:472048572 -->
Author
Owner

The change that caused this is a rewrite of the IRC line parsing code. It now actually makes use of the requirements from the RFC to simplify some things. However, I think ZNC should still accept PRIVMSGs without the colon. It's a common mistake to make. Thus, reopening.

The change that caused this is a rewrite of the IRC line parsing code. It now actually makes use of the requirements from the RFC to simplify some things. However, I think ZNC should still accept `PRIVMSG`s without the colon. It's a common mistake to make. Thus, reopening. <!-- github-comment-id:472074669 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/znc#903