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.
Writing modules: Difference between revisions
Jump to navigation
Jump to search
DarthGandalf (talk | contribs) No edit summary |
m Use https. |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Languages}} | {{Languages|Writing modules}} | ||
=== | === C++ === | ||
* Look at ZNC API [ | * Look at ZNC API [https://docs.znc.in/ here] or directly in ZNC headers | ||
* Create your own module.cpp file (you can look into the [[sample]] module's source for help) | * Create your own module.cpp file (you can look into the [[sample]] module's [https://github.com/znc/znc/blob/master/modules/sample.cpp source] for help. Of course, you can look to other existing [[:Category:Core Modules|modules]] too) | ||
* #include <znc/main.h> and <znc/Modules.h> | * #include <znc/main.h> and <znc/Modules.h> | ||
* Create a new class derived from CModule overriding any module hooks that you need | * Create a new class derived from CModule overriding any module hooks that you need | ||
Line 9: | Line 9: | ||
* Compile your module into a shared object (.so file) (See [[Compiling modules]]) | * Compile your module into a shared object (.so file) (See [[Compiling modules]]) | ||
* Place the .so file into your ~/.znc/modules directory !!!WARNING!!! '''if you overwrite a .so file while znc has it loaded, it can and probably will crash znc, ''/msg *status unloadmod foo'' first!''' | * Place the .so file into your ~/.znc/modules directory !!!WARNING!!! '''if you overwrite a .so file while znc has it loaded, it can and probably will crash znc, ''/msg *status unloadmod foo'' first!''' | ||
=== Perl === | |||
Look at [[modperl]]. | |||
=== Python === | |||
Look at [[modpython]]. | |||
[[Category:Modules]] | [[Category:Modules]] |
Latest revision as of 00:28, 30 October 2023
C++
- Look at ZNC API here or directly in ZNC headers
- Create your own module.cpp file (you can look into the sample module's source for help. Of course, you can look to other existing modules too)
- #include <znc/main.h> and <znc/Modules.h>
- Create a new class derived from CModule overriding any module hooks that you need
- Be sure to add the macro call MODULEDEFS(CYourClass) at the END of the file
- Compile your module into a shared object (.so file) (See Compiling modules)
- Place the .so file into your ~/.znc/modules directory !!!WARNING!!! if you overwrite a .so file while znc has it loaded, it can and probably will crash znc, /msg *status unloadmod foo first!
Perl
Look at modperl.
Python
Look at modpython.