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.

Difference between revisions of "Writing modules"

From ZNC
Jump to: navigation, search
(Overview)
Line 1: Line 1:
 
{{Languages}}
 
{{Languages}}
=== Overview ===
+
=== C++ ===
  
 
* Look at ZNC API [http://people.znc.in/~psychon/znc/doc here] or directly in ZNC headers
 
* Look at ZNC API [http://people.znc.in/~psychon/znc/doc here] or directly in ZNC headers
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 [[modperl|here]].
 +
 +
=== Python ===
 +
Look [[modpython|here]].
  
 
[[Category:Modules]]
 
[[Category:Modules]]

Revision as of 02:38, 16 December 2012

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 here.

Python

Look here.