How do I know If i'm interacting with a perform module user-based or network-based? #1075

Open
opened 2026-10-05 05:02:07 +02:00 by adam · 6 comments
Owner

As far as I know the perform module can be loaded per user or per network.
As far as I understand I can have both a perform module for the user and a perform module for network [not sure].
As far as I can guess I can have perform module performs different stuff for different network of a user.

Let's say that user has set 2 IRC server (A &B) on ZNC, How do I set commands to perform when user connects to ZNC or (exclusively) when ZNC connects to a server A or when ZNC connects to a server B ?

As far as I know the perform module can be loaded per user or per network. As far as I understand I can have both a perform module for the user and a perform module for network [not sure]. As far as I can guess I can have perform module performs different stuff for different network of a user. Let's say that user has set 2 IRC server (A &B) on ZNC, How do I set commands to perform when user connects to ZNC or (exclusively) when ZNC connects to a server A or when ZNC connects to a server B ? <!-- github-sync-id:3304036151 -->
Author
Owner

How do I know If i'm interacting with a perform module user-based or network-based?

Depends on how it is loaded. If its loaded as both user and network (for the network you are currently connected on), you will be interacting with the network by /msg *perform ....

If its loaded as a user, but not as a network for the current network you will interact with it as a user.

As far as I know the perform module can be loaded per user or per network.

It can do both. Loading as user it runs on ALL networks. If you only load it at network then it only runs for that network.

The perform module is loaded as a network module by default when using *status.

/msg *status loadmod perform

https://github.com/znc/znc/blob/8890a7bb0da00df03652c36a2d7ec764b592790e/modules/perform.cpp#L190

It can be loaded as a user module by /msg *status loadmod --type=user perform

https://github.com/znc/znc/blob/8890a7bb0da00df03652c36a2d7ec764b592790e/modules/perform.cpp#L186

As far as I understand I can have both a perform module for the user and a perform module for network [not sure].

Yes.

As far as I can guess I can have perform module performs different stuff for different network of a user.

Yes. Load as a network (default).

Let's say that user has set 2 IRC server (A &B) on ZNC, How do I set commands to perform when user connects to ZNC or (exclusively) when ZNC connects to a server A or when ZNC connects to a server B ?

Load it on each network.

>How do I know If i'm interacting with a perform module user-based or network-based? Depends on how it is loaded. If its loaded as both `user` and `network` (for the network you are currently connected on), you will be interacting with the `network` by `/msg *perform ...`. If its loaded as a `user`, but not as a `network` for the current network you will interact with it as a `user`. >As far as I know the perform module can be loaded per user or per network. It can do both. Loading as `user` it runs on ALL networks. If you only load it at `network` then it only runs for that network. The perform module is loaded as a `network` module by default when using `*status`. `/msg *status loadmod perform` https://github.com/znc/znc/blob/8890a7bb0da00df03652c36a2d7ec764b592790e/modules/perform.cpp#L190 It can be loaded as a `user` module by `/msg *status loadmod --type=user perform` https://github.com/znc/znc/blob/8890a7bb0da00df03652c36a2d7ec764b592790e/modules/perform.cpp#L186 >As far as I understand I can have both a perform module for the user and a perform module for network [not sure]. Yes. >As far as I can guess I can have perform module performs different stuff for different network of a user. Yes. Load as a `network` (default). >Let's say that user has set 2 IRC server (A &B) on ZNC, How do I set commands to perform when user connects to ZNC or (exclusively) when ZNC connects to a server A or when ZNC connects to a server B ? Load it on each network. <!-- github-comment-id:3168697242 -->
Author
Owner

Ability to load the same module as both user and network was one of my biggest mistakes I made in ZNC

Ability to load the same module as both user and network was one of my biggest mistakes I made in ZNC <!-- github-comment-id:3168951147 -->
Author
Owner

Thank you @RealKindOne, really a real kind one.

Ok, let's check if I get it right:
I am user foo in my znc. foo has set two IRC server, serverA and serverB. Both networks have a perform module loaded.

If I (foo) will log into znc using as username foo/serverA I will interact with the perform module that will interact with serverA. If I will log into using as username foo/serverB I will interact with perform module that will operate on serverB.
I think that is now pretty clear (unless I am wrong, lol).

The only thing that is not clear now is:
If perform module is loaded both for user, for network on serverA and for network on serverB: how do I interact with the perform loaded at user level? How do I launch a, for example, Add command (or a Del, or Execute,...) to the user-loaded perform module? Do I need to login to znc using as username only the username without specifying a network ?

@DarthGandalf

Ability to load the same module as both user and network was one of my biggest mistakes I made in ZNC

Nooo. They are pretty cool, thank you for that. It is that this kind of CLI on IRC thing is a bit weird for me.

Thank you @RealKindOne, really a real kind one. Ok, let's check if I get it right: I am user `foo` in my znc. `foo` has set two IRC server, `serverA` and `serverB`. Both networks have a perform module loaded. If I (`foo`) will log into znc using as username `foo/serverA` I will interact with the perform module that will interact with `serverA`. If I will log into using as username `foo/serverB` I will interact with perform module that will operate on `serverB`. I think that is now pretty clear (unless I am wrong, lol). The only thing that is not clear now is: If perform module is loaded both for user, for network on serverA and for network on serverB: how do I interact with the perform loaded at user level? How do I launch a, for example, Add command (or a Del, or Execute,...) to the user-loaded perform module? Do I need to login to znc using as username only the username without specifying a network ? @DarthGandalf > Ability to load the same module as both user and network was one of my biggest mistakes I made in ZNC Nooo. They are pretty cool, thank you for that. It is that this kind of CLI on IRC thing is a bit weird for me. <!-- github-comment-id:3170417078 -->
Author
Owner

The only thing that is not clear now is: If perform module is loaded both for user, for network on serverA and for network on serverB: how do I interact with the perform loaded at user level? How do I launch a, for example, Add command (or a Del, or Execute,...) to the user-loaded perform module? Do I need to login to znc using as username only the username without specifying a network ?

This is the annoying part.

You can either use the browser http://ip:port/mods/user/perform/ or add another network and edit it from that *perform, since it is already loaded as user.

Do I need to login to znc using as username only the username without specifying a network ?

That will connect you to the first network listed in your znc.conf for your user.

I personally don't even use perform as a user, it makes things difficult with 20+ networks.

> The only thing that is not clear now is: If perform module is loaded both for user, for network on serverA and for network on serverB: how do I interact with the perform loaded at user level? How do I launch a, for example, Add command (or a Del, or Execute,...) to the user-loaded perform module? Do I need to login to znc using as username only the username without specifying a network ? This is the annoying part. You can either use the browser `http://ip:port/mods/user/perform/` or add another network and edit it from that `*perform`, since it is already loaded as `user`. >Do I need to login to znc using as username only the username without specifying a network ? That will connect you to the first network listed in your `znc.conf` for your user. I personally don't even use perform as a `user`, it makes things difficult with 20+ networks. <!-- github-comment-id:3172342625 -->
Author
Owner

If while connecting, you specify a network name which doesn't exist, you'll get into a mode without any network, and edit *perform from that. No need to create the network for that.


What do you think about the following idea?

Add aliases like *module:user, *module:network, *module:global which route the message to the correct module. Existing *module may preserve old behavior, or may need to warn that there are several modules with that name, listing their full names.
When a module calls PutModule(), the call would check if the other levels have a module with the same name, and if yes, send the message from the full name, and only use short name if the module is unique.

The syntax of the full names is to be discussed, of course. Maybe reuse somehow IRC's ability to send PRIVMSG to nick!ident@host for this rather than plain nick?

If while connecting, you specify a network name which doesn't exist, you'll get into a mode without any network, and edit `*perform` from that. No need to create the network for that. ------ What do you think about the following idea? Add aliases like `*module:user`, `*module:network`, `*module:global` which route the message to the correct module. Existing `*module` may preserve old behavior, or may need to warn that there are several modules with that name, listing their full names. When a module calls `PutModule()`, the call would check if the other levels have a module with the same name, and if yes, send the message from the full name, and only use short name if the module is unique. The syntax of the full names is to be discussed, of course. Maybe reuse somehow IRC's ability to send PRIVMSG to `nick!ident@host` for this rather than plain `nick`? <!-- github-comment-id:3172476999 -->
Author
Owner
Also related https://github.com/znc/znc/issues/614 <!-- github-comment-id:3187184416 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/znc#1075