Ehrm...
./configure make
Edit the .conf file.
See ./eiwic -h
please.
./configure --enable-vv-debug make clean make ./eiwic -l - -v 10 debug.conf
Every single .c file which is in modules/ will be compiled to as .so library. Every .so library in the
modules/ directory can be loaded as a module. If you want to write your own module, copy "template.c"
to "yourmodule.c" and modify it. To compile it, just type "make" in the eiwic directory.
EP_SETNAME()
is a macro which sets the module name. The parameter should be the same as the
file name. This must exist in the module source file.
int ep_init(OUTPUT *out)
is the init function. It doesn't have to exist. If it does exist, however,
you must return 1 in case of successful initialization, and 0 if it failed (it will be unloaded then). Print out status
or error messages to out
(see Module API). Most likely you will register your trigger here.
int ep_parse(MSG *msg)
is a function that will be called after a line from the server
has been parsed. In the MSG struct you can find the Message from the IRC server parsed (see Eiwic structs).
Also see modules/ctcp.c where ep_parse
is used.
int ep_trigger(char *param, OUTPUT *out, MSG *msg)
will be called whenever a trigger is called. You
won't normally need this.
int ep_help(OUTPUT *out)
is the help function to give the user some help. If the "info" module is
loaded, users can read your help output with !help yourmodule
or !help !oneofyourtriggers
.
Write your help text to out
.
Okay, your module can start functions from Eiwic's module API by using the global eiwic
structure (which is
the same as the mlink
struct), which holds the function pointers to the functions. I will not speak
about every function here, just the most important:
plug_trigger_reg(char *call, u_int kind, e_trigger_f callback)
- registers a trigger to Eiwic. call is the trigger string itsself. kind is TRIG_PUBLIC for public triggers and
TRIG_ADMIN for trigger that are only accessible by the admin. callback is a callback function, which must look like
this: int callback(char *parameter, OUTPUT *out, MSG *ircmsg)
. Send output to out
and
return 1, please.
Example: eiwic->plug_trigger_reg("!conv", TRIG_PUBLIC, convert);
output_printf(OUTPUT *out, char *fmt, ...)
- outputs something to out
.
Example: eiwic->output_printf(out, "Sorry, no help available for '%s'.\n", param);
conn_http_get(char *url, e_conn_http_f callback, void *data)
- gets a page from a http server. data
is user-defined data which will also be passed to the callback.
Example: please see modules/google.c or modules/conv.c
Yea, well. Thats about it. You will figure out the rest by yourself :)
plug_sendf - send text to the server
plug_timer_reg - register a timer
conn_connect - create a socket and connect to somewhere
conn_listen - create a socket and listen on a port (see modules/stream.c)
log - write things to the log file
set_get_string, set_get_int, ... - get eiwic settings
....
see eiwic.h
please.
TODO
Well, to get information about a module, try !help
, !help !triggername
or !help module
.
You can contact me here: Homepage of eiwic.