Now inbound_cap_ls() can enable extensions when a bouncer uses a namespace for the...
[rofl0r-ixchat.git] / src / common / plugin.h
blobb0c89d1b222fedb62ac83d251a1e6468e387434f
1 #ifndef XCHAT_COMMONPLUGIN_H
2 #define XCHAT_COMMONPLUGIN_H
4 #ifdef PLUGIN_C
5 struct _xchat_plugin
7 /* Keep these insync with xchat-plugin.h */
8 /* !!don't change the order, to keep binary compat!! */
9 xchat_hook *(*xchat_hook_command) (xchat_plugin *ph,
10 const char *name,
11 int pri,
12 int (*callback) (char *word[], char *word_eol[], void *user_data),
13 const char *help_text,
14 void *userdata);
15 xchat_hook *(*xchat_hook_server) (xchat_plugin *ph,
16 const char *name,
17 int pri,
18 int (*callback) (char *word[], char *word_eol[], void *user_data),
19 void *userdata);
20 xchat_hook *(*xchat_hook_print) (xchat_plugin *ph,
21 const char *name,
22 int pri,
23 int (*callback) (char *word[], void *user_data),
24 void *userdata);
25 xchat_hook *(*xchat_hook_timer) (xchat_plugin *ph,
26 int timeout,
27 int (*callback) (void *user_data),
28 void *userdata);
29 xchat_hook *(*xchat_hook_fd) (xchat_plugin *ph,
30 int fd,
31 int flags,
32 int (*callback) (int fd, int flags, void *user_data),
33 void *userdata);
34 void *(*xchat_unhook) (xchat_plugin *ph,
35 xchat_hook *hook);
36 void (*xchat_print) (xchat_plugin *ph,
37 const char *text);
38 void (*xchat_printf) (xchat_plugin *ph,
39 const char *format, ...);
40 void (*xchat_command) (xchat_plugin *ph,
41 const char *command);
42 void (*xchat_commandf) (xchat_plugin *ph,
43 const char *format, ...);
44 int (*xchat_nickcmp) (xchat_plugin *ph,
45 const char *s1,
46 const char *s2);
47 int (*xchat_set_context) (xchat_plugin *ph,
48 xchat_context *ctx);
49 xchat_context *(*xchat_find_context) (xchat_plugin *ph,
50 const char *servname,
51 const char *channel);
52 xchat_context *(*xchat_get_context) (xchat_plugin *ph);
53 const char *(*xchat_get_info) (xchat_plugin *ph,
54 const char *id);
55 int (*xchat_get_prefs) (xchat_plugin *ph,
56 const char *name,
57 const char **string,
58 int *integer);
59 xchat_list * (*xchat_list_get) (xchat_plugin *ph,
60 const char *name);
61 void (*xchat_list_free) (xchat_plugin *ph,
62 xchat_list *xlist);
63 const char * const * (*xchat_list_fields) (xchat_plugin *ph,
64 const char *name);
65 int (*xchat_list_next) (xchat_plugin *ph,
66 xchat_list *xlist);
67 const char * (*xchat_list_str) (xchat_plugin *ph,
68 xchat_list *xlist,
69 const char *name);
70 int (*xchat_list_int) (xchat_plugin *ph,
71 xchat_list *xlist,
72 const char *name);
73 void * (*xchat_plugingui_add) (xchat_plugin *ph,
74 const char *filename,
75 const char *name,
76 const char *desc,
77 const char *version,
78 char *reserved);
79 void (*xchat_plugingui_remove) (xchat_plugin *ph,
80 void *handle);
81 int (*xchat_emit_print) (xchat_plugin *ph,
82 const char *event_name, ...);
83 void *(*xchat_read_fd) (xchat_plugin *ph);
84 time_t (*xchat_list_time) (xchat_plugin *ph,
85 xchat_list *xlist,
86 const char *name);
87 char *(*xchat_gettext) (xchat_plugin *ph,
88 const char *msgid);
89 void (*xchat_send_modes) (xchat_plugin *ph,
90 const char **targets,
91 int ntargets,
92 int modes_per_line,
93 char sign,
94 char mode);
95 char *(*xchat_strip) (xchat_plugin *ph,
96 const char *str,
97 int len,
98 int flags);
99 void (*xchat_free) (xchat_plugin *ph,
100 void *ptr);
101 void *(*xchat_dummy4) (xchat_plugin *ph);
102 void *(*xchat_dummy3) (xchat_plugin *ph);
103 void *(*xchat_dummy2) (xchat_plugin *ph);
104 void *(*xchat_dummy1) (xchat_plugin *ph);
105 /* PRIVATE FIELDS! */
106 void *handle; /* from dlopen */
107 char *filename; /* loaded from */
108 char *name;
109 char *desc;
110 char *version;
111 session *context;
112 void *deinit_callback; /* pointer to xchat_plugin_deinit */
113 unsigned int fake:1; /* fake plugin. Added by xchat_plugingui_add() */
114 unsigned int free_strings:1; /* free name,desc,version? */
116 #endif
118 char *plugin_load (session *sess, char *filename, char *arg);
119 void plugin_add (session *sess, char *filename, void *handle, void *init_func, void *deinit_func, char *arg, int fake);
120 int plugin_kill (char *name, int by_filename);
121 void plugin_kill_all (void);
122 void plugin_auto_load (session *sess);
123 int plugin_emit_command (session *sess, char *name, char *word[], char *word_eol[]);
124 int plugin_emit_server (session *sess, char *name, char *word[], char *word_eol[]);
125 int plugin_emit_print (session *sess, char *word[]);
126 int plugin_emit_dummy_print (session *sess, char *name);
127 int plugin_emit_keypress (session *sess, unsigned int state, unsigned int keyval, int len, char *string);
128 GList* plugin_command_list(GList *tmp_list);
129 int plugin_show_help (session *sess, char *cmd);
130 void plugin_command_foreach (session *sess, void *userdata, void (*cb) (session *sess, void *userdata, char *name, char *usage));
132 #endif