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.

Stickychan and Writing modules: Difference between pages

From ZNC
(Difference between pages)
Jump to navigation Jump to search
 
 
Line 1: Line 1:
{{DISPLAYTITLE:stickychan}}
{{Languages}}
{{Core Module}}
=== C++ ===
This module can stick you to a channel, so that if you acidentally click it away it will simply come back.


If you <code>/part</code> the channel in your client, ZNC will intercept it and prevent it from being sent to the IRC server. Your client will immediately rejoin the channel.
* Look at ZNC API [http://people.znc.in/~psychon/znc/doc here] or directly in ZNC headers
* 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>
* 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!'''


If you are sapart'd or svspart'd from a stuck channel, you are automatically rejoined.
=== Perl ===
Look at [[modperl]].


== Usage ==
=== Python ===
{{Module arguments|count=up to one|extra=List of channels, separated by comma.}}
Look [[modpython|here]].


=== Commands ===
[[Category:Modules]]
You can use the following commands to <code>stick</code> and <code>unstick</code> #chan:
/msg *stickychan stick #chan <optional channel-password>
/msg *stickychan unstick #chan

Revision as of 04:48, 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 at modperl.

Python

Look here.