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

Modules: Difference between revisions

From ZNC
Jump to navigation Jump to search
Wollino (talk | contribs)
No edit summary
KindOne (talk | contribs)
m →‎Network Modules: Add stripcontrols
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Languages|Modules}}
{{Languages|Modules}}


== Panoramica ==
== Overview ==
'''Modules''' are used to extend and modify the way ZNC functions. Users interact with modules most commonly by messaging a special user on IRC. For example, to view the highlight keywords in your watch list, you'd send ''/msg *watch list''. When ZNC sees that the nick you're messaging starts with an asterisk, it doesn't forward the message to the IRCd/server but instead sends it to the proper module for processing. In this case, the watch module will get the message and reply to you with a listing of your keywords. This makes for a very convenient and standard way of configuring or otherwise communicating with your loaded modules, as well as a common and standard way for your loaded modules to display status or other information. Notice that this is for loaded modules. You must load a given module, for example ''/znc loadmod watch'', before you can interface with the watch module. Most modules will reply to ''/msg *module help'' with a listing of available commands.


I '''Moduli''' vengono usati per estendere e modificare le funzioni dello '''ZNC'''. Gli utenti interagiscono con i mouduli inviando messaggi ad un utente speciale su IRC. Per esempio, per vedere le parole chiave evidenziate ''(highlight keywords)'' nella '''watch list''', puoi inviare il comando '''"/msg *watch list"'''. Quando lo '''ZNC''' vede che il nick a cui stai inviando un messaggio inizia con un '''asterisco''', non inoltra il messaggio all'IRCd/server, ma lo invia al modulo appropriato per l'elaborazione. In questo caso, il modulo '''watch''' riceverà il messaggio, e risponderà con un elenco delle parole chiave ''(keywords)'' impostate in precedenza. Ciò costituisce un modo molto comodo e standard di configurare o comunicare in altro modo con i moduli caricati, nonché un modo comune e standard per i moduli caricati di visualizzare lo stato o altre informazioni. Si noti che questo è per i moduli caricati. È necessario caricare un determinato modulo, ad esempio '''"/znc loadmod watch"''', prima di potersi interfacciare con il modulo '''watch'''. La maggior parte dei moduli risponde al comando '''"/msg *nome-del-modulo help"''' con un elenco di comandi disponibili.
ZNC modules are loaded either '''globally''', '''per-network''', or on a '''per-user''' basis. Each module defines for itself whether it is available to load as global, network-specific and/or user-specific. User level and network modules can do things such as [[crypt|manipulating the incoming/outgoing messages]]. They can also do more traditional IRC tasks such as [[autoop|challenge based auto-op]], [[simple_away|setting you away]], or [[log|logging to disk]]. Each user gets to load and configure their own set of modules to customize their experience to suit their preference.


I moduli '''ZNC''' possono essere caricati in tre "diversi livelli": livello '''globale''', livello '''network''' e livello '''utente'''. Ogni modulo definisce autonomamente se è disponibile per il caricamento globale, specifico per una rete, o specifico per un utente. Il livello utente e i moduli di network possono fare cose che vanno da [[crypt|manipolare messaggi di entrata/uscita]] a [[twitter|implementare un client Twitter completo]]. Possono anche svolgere attività IRC più tradizionali come [[autoop|auto-op basata sulla sfida]], [[simple_away|impostare il tuo away (l'assenza)]], o [[log|logging su disco]]. Ogni utente può caricare e configurare il proprio set di moduli per personalizzare la propria esperienza in base alle proprie preferenze.
Global modules are loadable by admins and provide functionality or change behavior for all users. For example, the [[partyline]] module has to be global since it provides functionality for all users on a given ZNC instance to be able to communicate with each other from within ZNC itself. Global modules can do everything that user-level modules can do, as well as a few extras. They can replace ZNC's [[imapauth|authentication system]], modify the config-writing process, deal with CAP, etc.


I moduli globali sono caricabili dagli amministratori e forniscono funzionalità o modificano il comportamento di tutti gli utenti. Per esempio, il modulo [[partyline]] deve essere globale poiché fornisce funzionalità a tutti gli utenti di una determinata istanza '''ZNC''' per poter comunicare tra loro all'interno dello '''ZNC''' stesso. I moduli globali possono fare tutto ciò che possono fare i moduli a livello utente, nonché alcuni extra. Possono sostituire il [[imapauth|sistema di autenticazione]], modificare il processo di scrittura della configurazione, gesstire i CAP, etc.
The modules can also hook into ZNC's [[WebMods|web interface]] and provide web content. The most common web module is [[webadmin]] which allows admins to add/remove users and allows users to configure their settings from a browser.
 
I moduli possono collegarsi allo '''ZNC''' anche tramite [[WebMods|interfaccia web]] per fornire contenuti via web. Il modulo web più comune è il [[webadmin]] che consente agli amministratori di '''aggiungere/rimuovere''' utenti, consentendo a questi ultimi di osservare e configurare le impostazioni del proprio '''ZNC''' anche attraverso il browser.


== Developers ==
== Developers ==
I moduli ZNC sono scritti nativamente in C++. Ci sono anche un paio di moduli che incorporano un interprete per permettere di caricare moduli Perl, Python, o moduli Tcl. Per saperne di più sula creazione di moduli, si consiglia di leggere [[modperl|Moduli Perl]], [[modpython|Moduli Python]], [[modtcl|Moduli TCL]], o [[Writing modules|Moduli C++]].
ZNC modules are written in C++ natively. There are also a couple of modules that embed an interpreter to allow you to load Perl, Python, or Tcl modules. To learn more about creation of modules you should read [[modperl|Perl Modules]], [[modpython|Python Modules]], [[modtcl|TCL Modules]], or [[Writing modules|C++ Modules]].


Sentitevi liberi di creare wikipages sui moduli che avete creato, ma non dimenticate di aggiungere un link per il download, informazioni di contatto e utilizzare lo stesso layout del resto dei moduli. I contributi sono sempre molto apprezzati.
Feel free to create wikipages about modules you have created, but don't forget to add a download link, contact information, and use the same layout as the rest of the modules. Contributions are always much appreciated.


== Lista Moduli ==
== Module List ==
=== Moduli Globali ===
=== Global Modules ===
; [[adminlog]] : Log user connects, disconnects, and failed logins to a file and/or to syslog.
; [[adminlog]] : Log user connects, disconnects, and failed logins to a file and/or to syslog.
; [[blockuser]] : Blocks certain users from using ZNC, saying their account was disabled.
; [[blockuser]] : Blocks certain users from using ZNC, saying their account was disabled.
; [[certauth]] : This module lets users to log in via SSL client keys.
; [[certauth]] : This module lets users to log in via SSL client keys.
; [[cyrusauth]] : This module is intended for admins who run a shell/web/email/etc server and want to provide ZNC access to their existing users.
; [[cyrusauth]] : This module is intended for admins who run a shell/web/email/etc server and want to provide ZNC access to their existing users.
;  [[corecaps]]            : Adds support for several IRC capabilities, extracted from ZNC core.
; [[fail2ban]] : Block IPs for some time after a failed login.
; [[fail2ban]] : Block IPs for some time after a failed login.
; [[identfile]] : Posts the ident of a user to a file when they are trying to connect.
; [[identfile]] : Posts the ident of a user to a file when they are trying to connect.
Line 32: Line 32:
; [[webadmin]] : Allows you to add/remove/edit users and settings on the fly via a web browser.
; [[webadmin]] : Allows you to add/remove/edit users and settings on the fly via a web browser.


=== Moduli Utente ===
=== User Modules ===
; [[controlpanel|admin]] : (Now [[controlpanel]]) Allows you to add/remove/edit users and settings on the fly via IRC messages.
; [[controlpanel|admin]] : (Now [[controlpanel]]) Allows you to add/remove/edit users and settings on the fly via IRC messages.
; [[autoattach]] : Watches your [[Detaching|detached]] channels and reattaches you automatically when there is specified activity in a channel you added to your autoattach list.
; [[autoattach]] : Watches your [[Detaching|detached]] channels and reattaches you automatically when there is specified activity in a channel you added to your autoattach list.
Line 56: Line 56:
; [[shell]] : Access your Unix shell via query right inside of your IRC client.
; [[shell]] : Access your Unix shell via query right inside of your IRC client.


=== Moduli Network ===
=== Network Modules ===
; [[autocycle]] : Rejoin a channel when you are the only one there (to gain operator status).
; [[autocycle]] : Rejoin a channel when you are the only one there (to gain operator status).
; [[autoop]] : Automatically give operator status to the good guys.
; [[autoop]] : Automatically give operator status to the good guys.
Line 78: Line 78:
; [[simple_away]] : Automatically set you away on IRC when disconnected from the bouncer.
; [[simple_away]] : Automatically set you away on IRC when disconnected from the bouncer.
; [[stickychan]] : Keeps you in specified channels.
; [[stickychan]] : Keeps you in specified channels.
;  [[stripcontrols]]      : Strips control codes (Colors, Bold, ..) from channel and private messages.
; [[watch]] : Monitor activity for specific text patterns from specific users and have the text sent to a special query window.
; [[watch]] : Monitor activity for specific text patterns from specific users and have the text sent to a special query window.


=== Altri moduli ===
=== More Modules ===
Per altri moduli, vedi [[:Category:Modules]].
For more modules, see [[:Category:Modules]].


== Gestione moduli ==
== Managing Modules ==
I moduli possono essere aggiunti o rimossi facilmente. I moduli possono essere memorizzati <code>~/.znc/modules</code> e <code>/usr/local/lib/znc</code> di default. Lo ZNC installa i suoi moduli in quella seconda directory, che in realtà è <code>${prefix}/lib/znc</code>, ma questo può essere cambiato con <code>./configure --module-prefix=DIR</code> prima della compilazione.
Modules can be added or removed easily. Modules can be stored in <code>~/.znc/modules</code> and <code>/usr/local/lib/znc</code> by default. ZNC installs its modules to that second directory, which in fact is <code>${prefix}/lib/znc</code>, but this can be changed with <code>./configure --module-prefix=DIR</code> before compiling.


Lo ZNC cercherà prima nella sottocartella locale <code>modules</code> quando ricerca i moduli. Solo i file che terminano con ".so" verranno visti come un modulo. Per rimuovere i moduli è sufficente eliminarli dalla cartella. Non sono necessarie altre modifiche. Per rimuovere, ma anche mantenere un modulo per un uso successivo è anche possibile cambiare il nome, come:: <code>mv sample.so sample.so_</code>.
ZNC will first look in the local sub-directory <code>modules</code> when searching for modules. Only files that end with ".so" will be seen as a module. To remove modules you can simply delete them from the folder. No other configuration changes or restarts are necessary. To remove, but also keep a module for later use you can also change the name, like: <code>mv sample.so sample.so_</code>.


Per complilare un nuovo modulo è necessario prima salvare il sorgente come file ".cpp". Leggi [[Compiling modules|Compilazione moduli]]
To compile a new module you must first save the source as a ".cpp" file. [[Compiling modules]] describes the process in detail.
che descrive il processo nel dettaglio.


=== Aggiungere/Rimuovere moduli ===
=== (Un)Loading Modules ===
I moduli Global, user, e network possono essere aggiunti e rimossi tramite il pannello [[webadmin]] oppure tramite la finestra di query <tt>*status</tt>, come:
Global, user, and network modules can be (un)loaded from [[webadmin]] or via the <tt>*status</tt> query window, like:


  /msg *status LoadMod [--type=global|user|network] <modulo> <parametri>
  /msg *status LoadMod [--type=global|user|network] <module> <parameters>
  /msg *status UnloadMod [--type=global|user|network] <modulo>
  /msg *status UnloadMod [--type=global|user|network] <module>


* <code>*</code> è lo StatusPrefix impostato nelle tua [[configuration]]. Solitamente è un asterisco ("*").
* <code>*</code> is the StatusPrefix set in your [[configuration]]. Usually it's just an asterisk ("*").
* <code>[--type=global|user|network]</code> opzionalmente specifica se caricare o rimuovere il modulo come modulo Globale, Utente o Network. Non tutti i moduli possono essere caricati su tutti i livelli; vedi individuale [[:Category:Modules|Module documentation]] per scoprire dove può essere caricato.
* <code>[--type=global|user|network]</code> optionally specifies whether to (un)load the module as a global, user, or network module. Not all modules can be loaded at all levels; see individual [[:Category:Modules|Module documentation]] to find out where it may be loaded.
* <code><modulo></code> si riferisce al nome del file dei moduli, esclusa l'estensione ".so".
* <code><module></code> is based on the modules file name, excluding the ".so" extension.
* <code><parametri></code> sono specifici per ogni modulo e non richiesti: È possibile fornire i parametri quando si carica il modulo, oppure è possibile configurare il modulo dopo averlo caricato.
* <code><parameters></code> are specific for each module and not required: You can provide parameters when loading the module, or you can set up the module after loading it.


Quindi, per caricare il modulo '''[[log]]''' a livello '''globale''' (rispetto all'utente o al network) e rimuovere tutti i codici di controllo colore/formattazione con il comando '''<code>-sanitize</code>''' parametro, si dovrebbe digitare:
So, to load the '''[[log]]''' module at the '''global''' level (as opposed to user or network) and remove all color/formatting control codes with the '''<code>-sanitize</code>''' parameter, you would type:


  /msg *status LoadMod --type=global log -sanitize
  /msg *status LoadMod --type=global log -sanitize


Nelle versioni precedenti dello ZNC, non è presente l'opzione per specificare <code>[--type=global|user|network]</code>. In questo caso, usa soltanto:
For older versions of ZNC, you won't have the option to specify <code>[--type=global|user|network]</code>. In that case, just use:
  /msg *status LoadMod <modulo> <parametri>
  /msg *status LoadMod <module> <parameters>
  /msg *status UnloadMod <modulo>
  /msg *status UnloadMod <module>
 
Please keep in mind that a user is not able to load a module if the directive "DenyLoadMod" is set to true. Trying to load a module will fail with "Unable to load [<module>] Access Denied.".
 
If a module prevents ZNC from starting up and therefore you can't unload the module using [[webadmin]], you can edit [[configuration|znc.conf]] and remove the corresponding <code>LoadModule</code> line.
 


Si prega di tenere presente che un utente non è in grado di caricare un modulo se la direttiva "DenyLoadMod" è impostata su true (vero). Il tentativo dicaricare un modulo fallirà, e verrà visualizzato il messaggio: "Impossibile caricare [<modulo>] Accesso negato.".
Modules run in the order they are loaded <code>/msg *status listmods</code> starting with global modules, then user modules, and finally network modules.  


Se un modulo impedisce l'avvio dello ZNC e quindi non è possibile scaricare il modulo usando il [[webadmin]], è possibile modificare il file [[configuration|znc.conf]] e rimuovere la linea <code>LoadModule</code> corrispondente.
Example: The [[crypt]] module is a network module. If the [[log]] module is loaded as a network module AFTER the crypt module then all encrypted conversations are logged in plain text on the znc server.


== Utilizzo dei moduli ==
== Using modules ==
Si raccomanda di leggere la wikipage del modulo se si vuole scoprire come funziona un modulo. In alternativa si può usare il seguenete comando per ottenere una lista comandi:
It is recommended to read the module's wikipage if you want to find out how a module works. Alternatively the following command can be used to get a command list:
  /msg *<modulo> help
  /msg *<module> help
* <code>*</code> è lo StatusPrefix impostato nelle tua [[configuration]]. Solitamente è un asterisco ("*").
* <code>*</code> is the StatusPrefix set in your [[configuration]]. Usually it's just an asterisk ("*").


== Moduli esterni ==
== External modules ==
Per favore leggi [[:Category:External Modules]] per un elenco completo.
Please see [[:Category:External Modules]] for a comprehensive list.


[[Category:Modules]]
[[Category:Modules]]

Latest revision as of 11:28, 26 January 2024

Overview

Modules are used to extend and modify the way ZNC functions. Users interact with modules most commonly by messaging a special user on IRC. For example, to view the highlight keywords in your watch list, you'd send /msg *watch list. When ZNC sees that the nick you're messaging starts with an asterisk, it doesn't forward the message to the IRCd/server but instead sends it to the proper module for processing. In this case, the watch module will get the message and reply to you with a listing of your keywords. This makes for a very convenient and standard way of configuring or otherwise communicating with your loaded modules, as well as a common and standard way for your loaded modules to display status or other information. Notice that this is for loaded modules. You must load a given module, for example /znc loadmod watch, before you can interface with the watch module. Most modules will reply to /msg *module help with a listing of available commands.

ZNC modules are loaded either globally, per-network, or on a per-user basis. Each module defines for itself whether it is available to load as global, network-specific and/or user-specific. User level and network modules can do things such as manipulating the incoming/outgoing messages. They can also do more traditional IRC tasks such as challenge based auto-op, setting you away, or logging to disk. Each user gets to load and configure their own set of modules to customize their experience to suit their preference.

Global modules are loadable by admins and provide functionality or change behavior for all users. For example, the partyline module has to be global since it provides functionality for all users on a given ZNC instance to be able to communicate with each other from within ZNC itself. Global modules can do everything that user-level modules can do, as well as a few extras. They can replace ZNC's authentication system, modify the config-writing process, deal with CAP, etc.

The modules can also hook into ZNC's web interface and provide web content. The most common web module is webadmin which allows admins to add/remove users and allows users to configure their settings from a browser.

Developers

ZNC modules are written in C++ natively. There are also a couple of modules that embed an interpreter to allow you to load Perl, Python, or Tcl modules. To learn more about creation of modules you should read Perl Modules, Python Modules, TCL Modules, or C++ Modules.

Feel free to create wikipages about modules you have created, but don't forget to add a download link, contact information, and use the same layout as the rest of the modules. Contributions are always much appreciated.

Module List

Global Modules

adminlog
Log user connects, disconnects, and failed logins to a file and/or to syslog.
blockuser
Blocks certain users from using ZNC, saying their account was disabled.
certauth
This module lets users to log in via SSL client keys.
cyrusauth
This module is intended for admins who run a shell/web/email/etc server and want to provide ZNC access to their existing users.
corecaps
Adds support for several IRC capabilities, extracted from ZNC core.
fail2ban
Block IPs for some time after a failed login.
identfile
Posts the ident of a user to a file when they are trying to connect.
imapauth
Allow users to authenticate via IMAP.
lastseen
Logs when a user last logged in to ZNC.
modperl
Loads Perl scripts as ZNC modules.
modpython
Allows you to use modules written on Python.
notify_connect
Sends a notice to all admins when a user logs in or out of ZNC.
partyline
Allows ZNC users to join internal channels and query other ZNC users on the same ZNC.
webadmin
Allows you to add/remove/edit users and settings on the fly via a web browser.

User Modules

admin
(Now controlpanel) Allows you to add/remove/edit users and settings on the fly via IRC messages.
autoattach
Watches your detached channels and reattaches you automatically when there is specified activity in a channel you added to your autoattach list.
autoreply
Gives a automatic reply if someone messages you while you are away.
block_motd
Blocks the server's Message of the Day.
bouncedcc
Bounces DCC transfers through the znc server instead of sending them directly to the user.
buffextras
Add nick changes, joins, parts, topic changes etc. to your playback buffer.
chansaver
Saves channels to config when user joins and parts.
charset
Normalizes (i.e. converts) character encodings.
clearbufferonmsg
This module attempts to bridge the gap between being inundated with old buffer if you have KeepBuffer=true; and possibly missing messages when you ping out, if you have KeepBuffer=false.
clientnotify
Notify about new incoming connections to your user.
controlpanel
Allows you to add/remove/edit users and settings on the fly via IRC messages.
ctcpflood
This module tries to block CTCP floods.
dcc
This module allows you to transfer files to and from ZNC
disconkick
This module will kick your client from all channels if ZNC disconnects from server.
flooddetach
This module detaches you from channels which are flooded.
listsockets
This module displays a list of all open sockets in ZNC.
log
Log chat activity to file.
missingmotd
This user module will send 422 to clients when they login.
notes
Keep and replay notes. This is an example of WebMods.
sample
This is an example module to help with writing modules to do whatever you want.
send_raw
Allows you to send raw traffic to IRC from other users.
shell
Access your Unix shell via query right inside of your IRC client.

Network Modules

autocycle
Rejoin a channel when you are the only one there (to gain operator status).
autoop
Automatically give operator status to the good guys.
modtcl
Allows you to run Tcl scripts in ZNC.
autovoice
Automatically give voice status to everyone who joins some channel.
awaynick
Change your nick while you are away.
awaystore
When you are set away or detached, this module will save all private messages for you. The messages can be read until you delete them. This module will also set you away when you are idle some time.
cert
This module lets users use their own SSL certificate to connect to a server.
crypt
Encryption for channel/private messages.
keepnick
Tries to get and keep your primary nick if it is taken.
kickrejoin
Implements auto-rejoin-on-kick.
modules_online
Fakes online status of ZNC modules to fix some clients.
nickserv
Auths you with NickServ.
perform
Performs commands on connect.
q
Auths you with Q (and a little more).
raw
View all of the raw traffic.
route_replies
Routes back answers to the right client when connected with multiple clients.
sasl
Allows you to authenticate to an IRC network via SASL
savebuff
Saves your channel buffers into an encrypted file so they can survive restarts and reboots.
schat
SSL (encrypted) DCC chats.
simple_away
Automatically set you away on IRC when disconnected from the bouncer.
stickychan
Keeps you in specified channels.
stripcontrols
Strips control codes (Colors, Bold, ..) from channel and private messages.
watch
Monitor activity for specific text patterns from specific users and have the text sent to a special query window.

More Modules

For more modules, see Category:Modules.

Managing Modules

Modules can be added or removed easily. Modules can be stored in ~/.znc/modules and /usr/local/lib/znc by default. ZNC installs its modules to that second directory, which in fact is ${prefix}/lib/znc, but this can be changed with ./configure --module-prefix=DIR before compiling.

ZNC will first look in the local sub-directory modules when searching for modules. Only files that end with ".so" will be seen as a module. To remove modules you can simply delete them from the folder. No other configuration changes or restarts are necessary. To remove, but also keep a module for later use you can also change the name, like: mv sample.so sample.so_.

To compile a new module you must first save the source as a ".cpp" file. Compiling modules describes the process in detail.

(Un)Loading Modules

Global, user, and network modules can be (un)loaded from webadmin or via the *status query window, like:

/msg *status LoadMod [--type=global|user|network] <module> <parameters>
/msg *status UnloadMod [--type=global|user|network] <module>
  • * is the StatusPrefix set in your configuration. Usually it's just an asterisk ("*").
  • [--type=global|user|network] optionally specifies whether to (un)load the module as a global, user, or network module. Not all modules can be loaded at all levels; see individual Module documentation to find out where it may be loaded.
  • <module> is based on the modules file name, excluding the ".so" extension.
  • <parameters> are specific for each module and not required: You can provide parameters when loading the module, or you can set up the module after loading it.

So, to load the log module at the global level (as opposed to user or network) and remove all color/formatting control codes with the -sanitize parameter, you would type:

/msg *status LoadMod --type=global log -sanitize

For older versions of ZNC, you won't have the option to specify [--type=global|user|network]. In that case, just use:

/msg *status LoadMod <module> <parameters>
/msg *status UnloadMod <module>

Please keep in mind that a user is not able to load a module if the directive "DenyLoadMod" is set to true. Trying to load a module will fail with "Unable to load [<module>] Access Denied.".

If a module prevents ZNC from starting up and therefore you can't unload the module using webadmin, you can edit znc.conf and remove the corresponding LoadModule line.


Modules run in the order they are loaded /msg *status listmods starting with global modules, then user modules, and finally network modules.

Example: The crypt module is a network module. If the log module is loaded as a network module AFTER the crypt module then all encrypted conversations are logged in plain text on the znc server.

Using modules

It is recommended to read the module's wikipage if you want to find out how a module works. Alternatively the following command can be used to get a command list:

/msg *<module> help
  • * is the StatusPrefix set in your configuration. Usually it's just an asterisk ("*").

External modules

Please see Category:External Modules for a comprehensive list.