remove all remaining WIN32 code
[rofl0r-ixchat.git] / plugins / xchat-plugin.h
blob43f9ea2f73b9f5a4172535cc5f398d5955401e57
1 /* You can distribute this header with your plugins for easy compilation */
2 #ifndef XCHAT_PLUGIN_H
3 #define XCHAT_PLUGIN_H
5 #include <time.h>
7 #define XCHAT_IFACE_MAJOR 1
8 #define XCHAT_IFACE_MINOR 9
9 #define XCHAT_IFACE_MICRO 11
10 #define XCHAT_IFACE_VERSION ((XCHAT_IFACE_MAJOR * 10000) + \
11 (XCHAT_IFACE_MINOR * 100) + \
12 (XCHAT_IFACE_MICRO))
14 #define XCHAT_PRI_HIGHEST 127
15 #define XCHAT_PRI_HIGH 64
16 #define XCHAT_PRI_NORM 0
17 #define XCHAT_PRI_LOW (-64)
18 #define XCHAT_PRI_LOWEST (-128)
20 #define XCHAT_FD_READ 1
21 #define XCHAT_FD_WRITE 2
22 #define XCHAT_FD_EXCEPTION 4
23 #define XCHAT_FD_NOTSOCKET 8
25 #define XCHAT_EAT_NONE 0 /* pass it on through! */
26 #define XCHAT_EAT_XCHAT 1 /* don't let xchat see this event */
27 #define XCHAT_EAT_PLUGIN 2 /* don't let other plugins see this event */
28 #define XCHAT_EAT_ALL (XCHAT_EAT_XCHAT|XCHAT_EAT_PLUGIN) /* don't let anything see this event */
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
34 typedef struct _xchat_plugin xchat_plugin;
35 typedef struct _xchat_list xchat_list;
36 typedef struct _xchat_hook xchat_hook;
37 #ifndef PLUGIN_C
38 typedef struct _xchat_context xchat_context;
39 #endif
41 #ifndef PLUGIN_C
42 struct _xchat_plugin
44 /* these are only used on win32 */
45 xchat_hook *(*xchat_hook_command) (xchat_plugin *ph,
46 const char *name,
47 int pri,
48 int (*callback) (char *word[], char *word_eol[], void *user_data),
49 const char *help_text,
50 void *userdata);
51 xchat_hook *(*xchat_hook_server) (xchat_plugin *ph,
52 const char *name,
53 int pri,
54 int (*callback) (char *word[], char *word_eol[], void *user_data),
55 void *userdata);
56 xchat_hook *(*xchat_hook_print) (xchat_plugin *ph,
57 const char *name,
58 int pri,
59 int (*callback) (char *word[], void *user_data),
60 void *userdata);
61 xchat_hook *(*xchat_hook_timer) (xchat_plugin *ph,
62 int timeout,
63 int (*callback) (void *user_data),
64 void *userdata);
65 xchat_hook *(*xchat_hook_fd) (xchat_plugin *ph,
66 int fd,
67 int flags,
68 int (*callback) (int fd, int flags, void *user_data),
69 void *userdata);
70 void *(*xchat_unhook) (xchat_plugin *ph,
71 xchat_hook *hook);
72 void (*xchat_print) (xchat_plugin *ph,
73 const char *text);
74 void (*xchat_printf) (xchat_plugin *ph,
75 const char *format, ...);
76 void (*xchat_command) (xchat_plugin *ph,
77 const char *command);
78 void (*xchat_commandf) (xchat_plugin *ph,
79 const char *format, ...);
80 int (*xchat_nickcmp) (xchat_plugin *ph,
81 const char *s1,
82 const char *s2);
83 int (*xchat_set_context) (xchat_plugin *ph,
84 xchat_context *ctx);
85 xchat_context *(*xchat_find_context) (xchat_plugin *ph,
86 const char *servname,
87 const char *channel);
88 xchat_context *(*xchat_get_context) (xchat_plugin *ph);
89 const char *(*xchat_get_info) (xchat_plugin *ph,
90 const char *id);
91 int (*xchat_get_prefs) (xchat_plugin *ph,
92 const char *name,
93 const char **string,
94 int *integer);
95 xchat_list * (*xchat_list_get) (xchat_plugin *ph,
96 const char *name);
97 void (*xchat_list_free) (xchat_plugin *ph,
98 xchat_list *xlist);
99 const char * const * (*xchat_list_fields) (xchat_plugin *ph,
100 const char *name);
101 int (*xchat_list_next) (xchat_plugin *ph,
102 xchat_list *xlist);
103 const char * (*xchat_list_str) (xchat_plugin *ph,
104 xchat_list *xlist,
105 const char *name);
106 int (*xchat_list_int) (xchat_plugin *ph,
107 xchat_list *xlist,
108 const char *name);
109 void * (*xchat_plugingui_add) (xchat_plugin *ph,
110 const char *filename,
111 const char *name,
112 const char *desc,
113 const char *version,
114 char *reserved);
115 void (*xchat_plugingui_remove) (xchat_plugin *ph,
116 void *handle);
117 int (*xchat_emit_print) (xchat_plugin *ph,
118 const char *event_name, ...);
119 int (*xchat_read_fd) (xchat_plugin *ph,
120 void *src,
121 char *buf,
122 int *len);
123 time_t (*xchat_list_time) (xchat_plugin *ph,
124 xchat_list *xlist,
125 const char *name);
126 char *(*xchat_gettext) (xchat_plugin *ph,
127 const char *msgid);
128 void (*xchat_send_modes) (xchat_plugin *ph,
129 const char **targets,
130 int ntargets,
131 int modes_per_line,
132 char sign,
133 char mode);
134 char *(*xchat_strip) (xchat_plugin *ph,
135 const char *str,
136 int len,
137 int flags);
138 void (*xchat_free) (xchat_plugin *ph,
139 void *ptr);
141 #endif
144 xchat_hook *
145 xchat_hook_command (xchat_plugin *ph,
146 const char *name,
147 int pri,
148 int (*callback) (char *word[], char *word_eol[], void *user_data),
149 const char *help_text,
150 void *userdata);
152 xchat_hook *
153 xchat_hook_server (xchat_plugin *ph,
154 const char *name,
155 int pri,
156 int (*callback) (char *word[], char *word_eol[], void *user_data),
157 void *userdata);
159 xchat_hook *
160 xchat_hook_print (xchat_plugin *ph,
161 const char *name,
162 int pri,
163 int (*callback) (char *word[], void *user_data),
164 void *userdata);
166 xchat_hook *
167 xchat_hook_timer (xchat_plugin *ph,
168 int timeout,
169 int (*callback) (void *user_data),
170 void *userdata);
172 xchat_hook *
173 xchat_hook_fd (xchat_plugin *ph,
174 int fd,
175 int flags,
176 int (*callback) (int fd, int flags, void *user_data),
177 void *userdata);
179 void *
180 xchat_unhook (xchat_plugin *ph,
181 xchat_hook *hook);
183 void
184 xchat_print (xchat_plugin *ph,
185 const char *text);
187 void
188 xchat_printf (xchat_plugin *ph,
189 const char *format, ...);
191 void
192 xchat_command (xchat_plugin *ph,
193 const char *command);
195 void
196 xchat_commandf (xchat_plugin *ph,
197 const char *format, ...);
200 xchat_nickcmp (xchat_plugin *ph,
201 const char *s1,
202 const char *s2);
205 xchat_set_context (xchat_plugin *ph,
206 xchat_context *ctx);
208 xchat_context *
209 xchat_find_context (xchat_plugin *ph,
210 const char *servname,
211 const char *channel);
213 xchat_context *
214 xchat_get_context (xchat_plugin *ph);
216 const char *
217 xchat_get_info (xchat_plugin *ph,
218 const char *id);
221 xchat_get_prefs (xchat_plugin *ph,
222 const char *name,
223 const char **string,
224 int *integer);
226 xchat_list *
227 xchat_list_get (xchat_plugin *ph,
228 const char *name);
230 void
231 xchat_list_free (xchat_plugin *ph,
232 xchat_list *xlist);
234 const char * const *
235 xchat_list_fields (xchat_plugin *ph,
236 const char *name);
239 xchat_list_next (xchat_plugin *ph,
240 xchat_list *xlist);
242 const char *
243 xchat_list_str (xchat_plugin *ph,
244 xchat_list *xlist,
245 const char *name);
248 xchat_list_int (xchat_plugin *ph,
249 xchat_list *xlist,
250 const char *name);
252 time_t
253 xchat_list_time (xchat_plugin *ph,
254 xchat_list *xlist,
255 const char *name);
257 void *
258 xchat_plugingui_add (xchat_plugin *ph,
259 const char *filename,
260 const char *name,
261 const char *desc,
262 const char *version,
263 char *reserved);
265 void
266 xchat_plugingui_remove (xchat_plugin *ph,
267 void *handle);
269 int
270 xchat_emit_print (xchat_plugin *ph,
271 const char *event_name, ...);
273 char *
274 xchat_gettext (xchat_plugin *ph,
275 const char *msgid);
277 void
278 xchat_send_modes (xchat_plugin *ph,
279 const char **targets,
280 int ntargets,
281 int modes_per_line,
282 char sign,
283 char mode);
285 char *
286 xchat_strip (xchat_plugin *ph,
287 const char *str,
288 int len,
289 int flags);
291 void
292 xchat_free (xchat_plugin *ph,
293 void *ptr);
296 #ifdef __cplusplus
298 #endif
300 #endif