21 |
#ifndef __WEECHAT_PLUGINS_H |
#ifndef __WEECHAT_PLUGINS_H |
22 |
#define __WEECHAT_PLUGINS_H 1 |
#define __WEECHAT_PLUGINS_H 1 |
23 |
|
|
24 |
|
#include "weechat-plugin.h" |
25 |
#include "../gui/gui.h" |
#include "../gui/gui.h" |
26 |
|
|
27 |
#define PLUGIN_TYPE_PERL 0 |
typedef int (t_weechat_init_func) (t_weechat_plugin *); |
28 |
#define PLUGIN_TYPE_PYTHON 1 |
typedef void (t_weechat_end_func) (t_weechat_plugin *); |
|
#define PLUGIN_TYPE_RUBY 2 |
|
29 |
|
|
30 |
typedef struct t_plugin_script t_plugin_script; |
extern t_weechat_plugin *weechat_plugins; |
31 |
|
extern t_weechat_plugin *last_weechat_plugin; |
32 |
|
|
33 |
struct t_plugin_script |
extern t_weechat_plugin *plugin_search (char *); |
34 |
{ |
extern int plugin_msg_handler_exec (char *, char *, char *); |
35 |
char *name; /* name of script */ |
extern int plugin_cmd_handler_exec (char *, char *, char *); |
36 |
char *version; /* version of script */ |
extern t_weechat_plugin *plugin_load (char *); |
37 |
char *shutdown_func; /* function when script ends */ |
extern void plugin_remove (t_weechat_plugin *); |
38 |
char *description; /* description of script */ |
extern void plugin_unload (t_weechat_plugin *); |
39 |
t_plugin_script *prev_script; /* link to previous Perl script */ |
extern void plugin_unload_name (char *); |
40 |
t_plugin_script *next_script; /* link to next Perl script */ |
extern void plugin_unload_all (); |
|
}; |
|
|
|
|
|
typedef struct t_plugin_handler t_plugin_handler; |
|
|
|
|
|
struct t_plugin_handler |
|
|
{ |
|
|
int plugin_type; /* plugin type (Perl, Python, Ruby) */ |
|
|
char *name; /* name of IRC command (PRIVMSG, ..) |
|
|
or command (without first '/') */ |
|
|
char *function_name; /* name of function (handler) */ |
|
|
int running; /* 1 if currently running */ |
|
|
/* (used to prevent circular call) */ |
|
|
t_plugin_handler *prev_handler; /* link to previous handler */ |
|
|
t_plugin_handler *next_handler; /* link to next handler */ |
|
|
}; |
|
|
|
|
|
extern t_plugin_handler *plugin_msg_handlers; |
|
|
extern t_plugin_handler *last_plugin_msg_handler; |
|
|
|
|
|
extern t_plugin_handler *plugin_cmd_handlers; |
|
|
extern t_plugin_handler *last_plugin_cmd_handler; |
|
|
|
|
|
#ifdef PLUGIN_PERL |
|
|
extern t_plugin_script *perl_scripts; |
|
|
#endif |
|
|
|
|
|
#ifdef PLUGIN_PYTHON |
|
|
extern t_plugin_script *python_scripts; |
|
|
#endif |
|
|
|
|
|
#ifdef PLUGIN_RUBY |
|
|
extern t_plugin_script *ruby_scripts; |
|
|
#endif |
|
|
|
|
|
extern void plugin_auto_load (int, char *); |
|
41 |
extern void plugin_init (); |
extern void plugin_init (); |
|
extern void plugin_load (int, char *); |
|
|
extern void plugin_unload (int, char *); |
|
|
extern t_plugin_handler *plugin_handler_search (t_plugin_handler *, char *); |
|
|
extern void plugin_handler_add (t_plugin_handler **, t_plugin_handler **, |
|
|
int, char *, char *); |
|
|
extern void plugin_handler_free_all_type (t_plugin_handler **, |
|
|
t_plugin_handler **, int); |
|
|
extern void plugin_event_msg (char *, char *, char *); |
|
|
extern int plugin_exec_command (char *, char *, char *); |
|
|
extern t_gui_buffer *plugin_find_buffer (char *, char *); |
|
42 |
extern void plugin_end (); |
extern void plugin_end (); |
43 |
|
|
44 |
#endif /* plugins.h */ |
#endif /* plugins.h */ |