To create new wiki account, please join us on #znc at freenode and ask admins to create a wiki account for you. You can say thanks to spambots for this inconvenience.

Multiple clients

From ZNC
Revision as of 14:11, 19 February 2020 by MetaNova (talk | contribs) (→‎Overview)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


It's rather commonly asked how to solve <x> problem when you are running ZNC with two or more clients connected to one user.

This page aims to describe some helpful modules you might wish to load to see if they fit your needs, and can be used as reference to see what is available.

The complete outline of the multiple client setup can be found at (outlined by MetaNova, summarized by Khaytsus in #znc on freenode).

Please note that some directories in the above outline may differ in your setup, such as ~/.znc/modules/ actually being /var/lib/znc/modules/ if you installed from a package, for example. You will need to be aware of your environment.

Core Modules[edit]

Core Modules are included by default with ZNC and can be enabled at any time with /znc LoadMod <module_name>

Route Replies by multiple authors [source] [znc >= 0.094]
Essential if you have multiple clients. This ensures responses to what the client requests (mostly within the background) from the server (e.g. /WHO, /WHOIS, and so on) are routed to the correct client. If you are seeing a bunch of WHO responses in your status window of your client, it probably means you need to load this module.

External Modules[edit]

External Modules are not officially supported by ZNC, and can be enabled by Compiling the Modules yourself.

Client Buffer by jpnurmi [source] [znc >= 1.6.0] (original, updated version linked below)
This is the buffer playback ZNC offers, but it keeps track of which client has received the buffer and which client hasn't.
The version above has become rather out-of-date. You may find the fork by CyberShadow here to work better. Fixes/improvements include: timestamps fixed, 1.7.x support (which takes advantage of the new APIs, and is still backwards compatible), timelimit option, code cleanup, and additional smaller fixes.
Also, note the patch by BtbN to fix this issue with high CPU and disk usage on connect here. The functionality of this patch is included in CyberShadow's version linked directly above.
Chanfilter by jpnurmi [source] [znc >= 1.6.0]
The channel filter module maintains client specific channel lists for identified clients. A typical use case is to have a subset of channels visible for a mobile client.
Playback by jpnurmi [source] [znc >= 1.6.0]
The advanced playback module for ZNC makes it possible for IRC clients to avoid undesired repetitive buffer playback.

Older way[edit]

This is how you could achieve similar results (and more!) before 1.6.0, and it still works today. This is posted here for posterity reasons, and for advanced users who want better per-client control than what's available above via modules above.

First, you should know number of wanted clients. Let's say that you want 3 clients: 1 hexchat and 2 irssi-s. Let's say that your username is johndoe.

Make following users: johndoe_ircd, johndoe_hexchat, johndoe_irssi1, johndoe_irssi2. This naming scheme isn't strict - everything is up to you. Set StatusPrefix for "client users" to something else, for example ^, because otherwise you won't be able to speak to both *status-es.

Connect user johndoe_ircd to IRC server. Connect users johndoe_hexchat, johndoe_irssi1 and johndoe_irssi2 to to the same ZNC, to user johndoe_ircd.

Connect hexchat to johndoe_hexchat, and irssis to johndoe_irssiN.

          /                                                   \
         |                         ZNC                         |
         |                                 via       |
hexchat ----> user "johndoe_hexchat"----------\                |
         |                                     v               |
irssi1 -----> user "johndoe_irssi1" ---> user "johndoe_ircd" -----> IRC server
         |                                     ^               |
irssi2 -----> user "johndoe_irssi2" ----------/                |
         |                                                     |

This way, every private message that johndoe_ircd gets, is sent to all "client users", and they remain in those buffers until that client reads them. Also you can have completely different modules, settings, etc for different clients.