1 | /* Copyright (c) 2006-2008 The BarnOwl Developers. All rights reserved. |
---|
2 | * Copyright (c) 2004 James Kretchmar. All rights reserved. |
---|
3 | * |
---|
4 | * This program is free software. You can redistribute it and/or |
---|
5 | * modify under the terms of the Sleepycat License. See the COPYING |
---|
6 | * file included with the distribution for more information. |
---|
7 | */ |
---|
8 | |
---|
9 | #ifndef INC_OWL_H |
---|
10 | #define INC_OWL_H |
---|
11 | |
---|
12 | #ifndef OWL_PERL |
---|
13 | #include <curses.h> |
---|
14 | #endif |
---|
15 | #include <sys/param.h> |
---|
16 | #include <EXTERN.h> |
---|
17 | #include <netdb.h> |
---|
18 | #include <regex.h> |
---|
19 | #include <time.h> |
---|
20 | #include <signal.h> |
---|
21 | #include <termios.h> |
---|
22 | #include "libfaim/aim.h" |
---|
23 | #include <wchar.h> |
---|
24 | #include "config.h" |
---|
25 | #include "glib.h" |
---|
26 | #ifdef HAVE_LIBZEPHYR |
---|
27 | #include <zephyr/zephyr.h> |
---|
28 | #endif |
---|
29 | #ifdef HAVE_COM_ERR_H |
---|
30 | #include <com_err.h> |
---|
31 | #endif |
---|
32 | |
---|
33 | /* Perl and curses don't play nice. */ |
---|
34 | #ifdef OWL_PERL |
---|
35 | typedef void WINDOW; |
---|
36 | /* logout is defined in FreeBSD. */ |
---|
37 | #define logout logout_ |
---|
38 | /* aim.h defines bool */ |
---|
39 | #define HAS_BOOL |
---|
40 | #include <perl.h> |
---|
41 | #include "owl_perl.h" |
---|
42 | #undef logout |
---|
43 | #include "XSUB.h" |
---|
44 | #else |
---|
45 | typedef void SV; |
---|
46 | #endif |
---|
47 | |
---|
48 | static const char owl_h_fileIdent[] = "$Id$"; |
---|
49 | |
---|
50 | #define BARNOWL_STRINGIFY(x) _STRINGIFY(x) |
---|
51 | #define _STRINGIFY(x) #x |
---|
52 | |
---|
53 | #ifndef OWL_VERSION_STRING |
---|
54 | #define OWL_VERSION_STRING "1.0.3" |
---|
55 | #endif |
---|
56 | |
---|
57 | /* Feature that is being tested to redirect stderr through a pipe. |
---|
58 | * There may still be some portability problems with this. */ |
---|
59 | #define OWL_STDERR_REDIR 1 |
---|
60 | |
---|
61 | #define OWL_DEBUG 0 |
---|
62 | #define OWL_DEBUG_FILE "/var/tmp/owldebug" |
---|
63 | |
---|
64 | #define OWL_CONFIG_DIR "/.owl" /* this is relative to the user's home directory */ |
---|
65 | #define OWL_STARTUP_FILE "/.owl/startup" /* this is relative to the user's home directory */ |
---|
66 | |
---|
67 | #define OWL_FMTEXT_ATTR_NONE 0 |
---|
68 | #define OWL_FMTEXT_ATTR_BOLD 1 |
---|
69 | #define OWL_FMTEXT_ATTR_REVERSE 2 |
---|
70 | #define OWL_FMTEXT_ATTR_UNDERLINE 4 |
---|
71 | |
---|
72 | #define OWL_FMTEXT_UC_BASE 0x100000 /* Unicode Plane 16 - Supplementary Private Use Area-B*/ |
---|
73 | #define OWL_FMTEXT_UC_ATTR ( OWL_FMTEXT_UC_BASE | 0x800 ) |
---|
74 | #define OWL_FMTEXT_UC_ATTR_MASK 0x7 |
---|
75 | #define OWL_FMTEXT_UC_COLOR_BASE ( OWL_FMTEXT_UC_BASE | 0x400 ) |
---|
76 | #define OWL_FMTEXT_UC_FGCOLOR OWL_FMTEXT_UC_COLOR_BASE |
---|
77 | #define OWL_FMTEXT_UC_BGCOLOR ( OWL_FMTEXT_UC_COLOR_BASE | 0x200 ) |
---|
78 | #define OWL_FMTEXT_UC_DEFAULT_COLOR 0x100 |
---|
79 | #define OWL_FMTEXT_UC_FGDEFAULT ( OWL_FMTEXT_UC_FGCOLOR | OWL_FMTEXT_UC_DEFAULT_COLOR ) |
---|
80 | #define OWL_FMTEXT_UC_BGDEFAULT ( OWL_FMTEXT_UC_BGCOLOR | OWL_FMTEXT_UC_DEFAULT_COLOR ) |
---|
81 | #define OWL_FMTEXT_UC_COLOR_MASK 0xFF |
---|
82 | #define OWL_FMTEXT_UC_ALLCOLOR_MASK ( OWL_FMTEXT_UC_COLOR_MASK | OWL_FMTEXT_UC_DEFAULT_COLOR | 0x200) |
---|
83 | #define OWL_FMTEXT_UC_STARTBYTE_UTF8 '\xf4' |
---|
84 | |
---|
85 | #define OWL_FMTEXT_UTF8_ATTR_NONE "\xf4\x80\xa0\x80" |
---|
86 | #define OWL_FMTEXT_UTF8_FGDEFAULT "\xf4\x80\x94\x80" |
---|
87 | #define OWL_FMTEXT_UTF8_BGDEFAULT "\xf4\x80\x9C\x80" |
---|
88 | |
---|
89 | #define OWL_COLOR_BLACK 0 |
---|
90 | #define OWL_COLOR_RED 1 |
---|
91 | #define OWL_COLOR_GREEN 2 |
---|
92 | #define OWL_COLOR_YELLOW 3 |
---|
93 | #define OWL_COLOR_BLUE 4 |
---|
94 | #define OWL_COLOR_MAGENTA 5 |
---|
95 | #define OWL_COLOR_CYAN 6 |
---|
96 | #define OWL_COLOR_WHITE 7 |
---|
97 | #define OWL_COLOR_DEFAULT -1 |
---|
98 | #define OWL_COLOR_INVALID -2 |
---|
99 | |
---|
100 | #define OWL_EDITWIN_STYLE_MULTILINE 0 |
---|
101 | #define OWL_EDITWIN_STYLE_ONELINE 1 |
---|
102 | |
---|
103 | #define OWL_PROTOCOL_ZEPHYR 0 |
---|
104 | #define OWL_PROTOCOL_AIM 1 |
---|
105 | #define OWL_PROTOCOL_JABBER 2 |
---|
106 | #define OWL_PROTOCOL_ICQ 3 |
---|
107 | #define OWL_PROTOCOL_YAHOO 4 |
---|
108 | #define OWL_PROTOCOL_MSN 5 |
---|
109 | |
---|
110 | #define OWL_MESSAGE_DIRECTION_NONE 0 |
---|
111 | #define OWL_MESSAGE_DIRECTION_IN 1 |
---|
112 | #define OWL_MESSAGE_DIRECTION_OUT 2 |
---|
113 | |
---|
114 | #define OWL_MUX_READ 1 |
---|
115 | #define OWL_MUX_WRITE 2 |
---|
116 | #define OWL_MUX_EXCEPT 4 |
---|
117 | |
---|
118 | #define OWL_DIRECTION_NONE 0 |
---|
119 | #define OWL_DIRECTION_DOWNWARDS 1 |
---|
120 | #define OWL_DIRECTION_UPWARDS 2 |
---|
121 | |
---|
122 | #define OWL_LOGGING_DIRECTION_BOTH 0 |
---|
123 | #define OWL_LOGGING_DIRECTION_IN 1 |
---|
124 | #define OWL_LOGGING_DIRECTION_OUT 2 |
---|
125 | |
---|
126 | #define OWL_SCROLLMODE_NORMAL 0 |
---|
127 | #define OWL_SCROLLMODE_TOP 1 |
---|
128 | #define OWL_SCROLLMODE_NEARTOP 2 |
---|
129 | #define OWL_SCROLLMODE_CENTER 3 |
---|
130 | #define OWL_SCROLLMODE_PAGED 4 |
---|
131 | #define OWL_SCROLLMODE_PAGEDCENTER 5 |
---|
132 | |
---|
133 | #define OWL_TAB 3 /* This *HAS* to be the size of TABSTR below */ |
---|
134 | #define OWL_TABSTR " " |
---|
135 | #define OWL_MSGTAB 7 |
---|
136 | #define OWL_TYPWIN_SIZE 8 |
---|
137 | #define OWL_HISTORYSIZE 50 |
---|
138 | |
---|
139 | /* Indicate current state, as well as what is allowed */ |
---|
140 | #define OWL_CTX_ANY 0xffff |
---|
141 | /* Only one of these may be active at a time... */ |
---|
142 | #define OWL_CTX_MODE_BITS 0x000f |
---|
143 | #define OWL_CTX_STARTUP 0x0001 |
---|
144 | #define OWL_CTX_READCONFIG 0x0002 |
---|
145 | #define OWL_CTX_INTERACTIVE 0x0004 |
---|
146 | /* Only one of these may be active at a time... */ |
---|
147 | #define OWL_CTX_ACTIVE_BITS 0xfff0 |
---|
148 | #define OWL_CTX_POPWIN 0x00f0 |
---|
149 | #define OWL_CTX_POPLESS 0x0010 |
---|
150 | #define OWL_CTX_RECWIN 0x0f00 |
---|
151 | #define OWL_CTX_RECV 0x0100 |
---|
152 | #define OWL_CTX_TYPWIN 0xf000 |
---|
153 | #define OWL_CTX_EDIT 0x7000 |
---|
154 | #define OWL_CTX_EDITLINE 0x1000 |
---|
155 | #define OWL_CTX_EDITMULTI 0x2000 |
---|
156 | #define OWL_CTX_EDITRESPONSE 0x4000 |
---|
157 | |
---|
158 | #define OWL_USERCLUE_NONE 0 |
---|
159 | #define OWL_USERCLUE_CLASSES 1 |
---|
160 | #define OWL_USERCLUE_FOOBAR 2 |
---|
161 | #define OWL_USERCLUE_BAZ 4 |
---|
162 | |
---|
163 | #define OWL_WEBBROWSER_NONE 0 |
---|
164 | #define OWL_WEBBROWSER_NETSCAPE 1 |
---|
165 | #define OWL_WEBBROWSER_GALEON 2 |
---|
166 | #define OWL_WEBBROWSER_OPERA 3 |
---|
167 | |
---|
168 | #define OWL_VARIABLE_OTHER 0 |
---|
169 | #define OWL_VARIABLE_INT 1 |
---|
170 | #define OWL_VARIABLE_BOOL 2 |
---|
171 | #define OWL_VARIABLE_STRING 3 |
---|
172 | |
---|
173 | #define OWL_FILTER_MAX_DEPTH 300 |
---|
174 | |
---|
175 | #define OWL_KEYMAP_MAXSTACK 20 |
---|
176 | |
---|
177 | #define OWL_KEYBINDING_COMMAND 1 /* command string */ |
---|
178 | #define OWL_KEYBINDING_FUNCTION 2 /* function taking no args */ |
---|
179 | |
---|
180 | #define OWL_DEFAULT_ZAWAYMSG "I'm sorry, but I am currently away from the terminal and am\nnot able to receive your message.\n" |
---|
181 | #define OWL_DEFAULT_AAWAYMSG "I'm sorry, but I am currently away from the terminal and am\nnot able to receive your message.\n" |
---|
182 | |
---|
183 | #define OWL_INCLUDE_REG_TESTS 1 /* whether to build in regression tests */ |
---|
184 | |
---|
185 | #define OWL_CMD_ALIAS_SUMMARY_PREFIX "command alias to: " |
---|
186 | |
---|
187 | #define OWL_WEBZEPHYR_PRINCIPAL "daemon.webzephyr" |
---|
188 | #define OWL_WEBZEPHYR_CLASS "webzephyr" |
---|
189 | #define OWL_WEBZEPHYR_OPCODE "webzephyr" |
---|
190 | |
---|
191 | #define OWL_REGEX_QUOTECHARS "+*.?[]^\\${}()" |
---|
192 | #define OWL_REGEX_QUOTEWITH "\\" |
---|
193 | |
---|
194 | #if defined(HAVE_DES_STRING_TO_KEY) && defined(HAVE_DES_KEY_SCHED) && defined(HAVE_DES_ECB_ENCRYPT) |
---|
195 | #define OWL_ENABLE_ZCRYPT 1 |
---|
196 | #endif |
---|
197 | |
---|
198 | #define OWL_META(key) ((key)|010000) |
---|
199 | /* OWL_CTRL is definied in kepress.c */ |
---|
200 | |
---|
201 | #define LINE 2048 |
---|
202 | |
---|
203 | typedef struct _owl_variable { |
---|
204 | char *name; |
---|
205 | int type; /* OWL_VARIABLE_* */ |
---|
206 | void *pval_default; /* for types other and string */ |
---|
207 | int ival_default; /* for types int and bool */ |
---|
208 | char *validsettings; /* documentation of valid settings */ |
---|
209 | char *summary; /* summary of usage */ |
---|
210 | char *description; /* detailed description */ |
---|
211 | void *val; /* current value */ |
---|
212 | int (*validate_fn)(struct _owl_variable *v, void *newval); |
---|
213 | /* returns 1 if newval is valid */ |
---|
214 | int (*set_fn)(struct _owl_variable *v, void *newval); |
---|
215 | /* sets the variable to a value |
---|
216 | * of the appropriate type. |
---|
217 | * unless documented, this |
---|
218 | * should make a copy. |
---|
219 | * returns 0 on success. */ |
---|
220 | int (*set_fromstring_fn)(struct _owl_variable *v, char *newval); |
---|
221 | /* sets the variable to a value |
---|
222 | * of the appropriate type. |
---|
223 | * unless documented, this |
---|
224 | * should make a copy. |
---|
225 | * returns 0 on success. */ |
---|
226 | void *(*get_fn)(struct _owl_variable *v); |
---|
227 | /* returns a reference to the current value. |
---|
228 | * WARNING: this approach is hard to make |
---|
229 | * thread-safe... */ |
---|
230 | int (*get_tostring_fn)(struct _owl_variable *v, |
---|
231 | char *buf, int bufsize, void *val); |
---|
232 | /* converts val to a string |
---|
233 | * and puts into buf */ |
---|
234 | void (*free_fn)(struct _owl_variable *v); |
---|
235 | /* frees val as needed */ |
---|
236 | } owl_variable; |
---|
237 | |
---|
238 | typedef struct _owl_input { |
---|
239 | int ch; |
---|
240 | gunichar uch; |
---|
241 | } owl_input; |
---|
242 | |
---|
243 | typedef struct _owl_fmtext { |
---|
244 | int textlen; |
---|
245 | int bufflen; |
---|
246 | char *textbuff; |
---|
247 | char default_attrs; |
---|
248 | short default_fgcolor; |
---|
249 | short default_bgcolor; |
---|
250 | } owl_fmtext; |
---|
251 | |
---|
252 | typedef struct _owl_list { |
---|
253 | int size; |
---|
254 | int avail; |
---|
255 | void **list; |
---|
256 | } owl_list; |
---|
257 | |
---|
258 | typedef struct _owl_dict_el { |
---|
259 | char *k; /* key */ |
---|
260 | void *v; /* value */ |
---|
261 | } owl_dict_el; |
---|
262 | |
---|
263 | typedef struct _owl_dict { |
---|
264 | int size; |
---|
265 | int avail; |
---|
266 | owl_dict_el *els; /* invariant: sorted by k */ |
---|
267 | } owl_dict; |
---|
268 | typedef owl_dict owl_vardict; /* dict of variables */ |
---|
269 | typedef owl_dict owl_cmddict; /* dict of commands */ |
---|
270 | |
---|
271 | typedef struct _owl_context { |
---|
272 | int mode; |
---|
273 | void *data; /* determined by mode */ |
---|
274 | } owl_context; |
---|
275 | |
---|
276 | typedef struct _owl_cmd { /* command */ |
---|
277 | char *name; |
---|
278 | |
---|
279 | char *summary; /* one line summary of command */ |
---|
280 | char *usage; /* usage synopsis */ |
---|
281 | char *description; /* long description of command */ |
---|
282 | |
---|
283 | int validctx; /* bitmask of valid contexts */ |
---|
284 | |
---|
285 | /* we should probably have a type here that says which of |
---|
286 | * the following is valid, and maybe make the below into a union... */ |
---|
287 | |
---|
288 | /* Only one of these may be non-NULL ... */ |
---|
289 | |
---|
290 | char *cmd_aliased_to; /* what this command is aliased to... */ |
---|
291 | |
---|
292 | /* These don't take any context */ |
---|
293 | char *(*cmd_args_fn)(int argc, char **argv, char *buff); |
---|
294 | /* takes argv and the full command as buff. |
---|
295 | * caller must free return value if !NULL */ |
---|
296 | void (*cmd_v_fn)(void); /* takes no args */ |
---|
297 | void (*cmd_i_fn)(int i); /* takes an int as an arg */ |
---|
298 | |
---|
299 | /* The following also take the active context if it's valid */ |
---|
300 | char *(*cmd_ctxargs_fn)(void *ctx, int argc, char **argv, char *buff); |
---|
301 | /* takes argv and the full command as buff. |
---|
302 | * caller must free return value if !NULL */ |
---|
303 | void (*cmd_ctxv_fn)(void *ctx); /* takes no args */ |
---|
304 | void (*cmd_ctxi_fn)(void *ctx, int i); /* takes an int as an arg */ |
---|
305 | SV *cmd_perl; /* Perl closure that takes a list of args */ |
---|
306 | } owl_cmd; |
---|
307 | |
---|
308 | |
---|
309 | typedef struct _owl_zwrite { |
---|
310 | char *class; |
---|
311 | char *inst; |
---|
312 | char *realm; |
---|
313 | char *opcode; |
---|
314 | char *zsig; |
---|
315 | char *message; |
---|
316 | owl_list recips; |
---|
317 | int cc; |
---|
318 | int noping; |
---|
319 | } owl_zwrite; |
---|
320 | |
---|
321 | typedef struct _owl_pair { |
---|
322 | char *key; |
---|
323 | char *value; |
---|
324 | } owl_pair; |
---|
325 | |
---|
326 | struct _owl_fmtext_cache; |
---|
327 | |
---|
328 | typedef struct _owl_message { |
---|
329 | int id; |
---|
330 | int direction; |
---|
331 | #ifdef HAVE_LIBZEPHYR |
---|
332 | ZNotice_t notice; |
---|
333 | #endif |
---|
334 | struct _owl_fmtext_cache * fmtext; |
---|
335 | int delete; |
---|
336 | char *hostname; |
---|
337 | owl_list attributes; /* this is a list of pairs */ |
---|
338 | char *timestr; |
---|
339 | time_t time; |
---|
340 | } owl_message; |
---|
341 | |
---|
342 | #define OWL_FMTEXT_CACHE_SIZE 1000 |
---|
343 | /* We cache the saved fmtexts for the last bunch of messages we |
---|
344 | rendered */ |
---|
345 | typedef struct _owl_fmtext_cache { |
---|
346 | owl_message * message; |
---|
347 | owl_fmtext fmtext; |
---|
348 | } owl_fmtext_cache; |
---|
349 | |
---|
350 | typedef struct _owl_style { |
---|
351 | char *name; |
---|
352 | SV *perlobj; |
---|
353 | } owl_style; |
---|
354 | |
---|
355 | typedef struct _owl_mainwin { |
---|
356 | int curtruncated; |
---|
357 | int lasttruncated; |
---|
358 | int lastdisplayed; |
---|
359 | } owl_mainwin; |
---|
360 | |
---|
361 | typedef struct _owl_viewwin { |
---|
362 | owl_fmtext fmtext; |
---|
363 | int textlines; |
---|
364 | int topline; |
---|
365 | int rightshift; |
---|
366 | int winlines, wincols; |
---|
367 | WINDOW *curswin; |
---|
368 | void (*onclose_hook) (struct _owl_viewwin *vwin, void *data); |
---|
369 | void *onclose_hook_data; |
---|
370 | } owl_viewwin; |
---|
371 | |
---|
372 | typedef struct _owl_popwin { |
---|
373 | WINDOW *borderwin; |
---|
374 | WINDOW *popwin; |
---|
375 | int lines; |
---|
376 | int cols; |
---|
377 | int active; |
---|
378 | int needsfirstrefresh; |
---|
379 | void (*handler) (int ch); |
---|
380 | } owl_popwin; |
---|
381 | |
---|
382 | typedef struct _owl_popexec { |
---|
383 | int refcount; |
---|
384 | owl_viewwin *vwin; |
---|
385 | int winactive; |
---|
386 | int pid; /* or 0 if it has terminated */ |
---|
387 | int rfd; |
---|
388 | } owl_popexec; |
---|
389 | |
---|
390 | typedef struct _owl_messagelist { |
---|
391 | owl_list list; |
---|
392 | } owl_messagelist; |
---|
393 | |
---|
394 | typedef struct _owl_regex { |
---|
395 | int negate; |
---|
396 | char *string; |
---|
397 | regex_t re; |
---|
398 | } owl_regex; |
---|
399 | |
---|
400 | typedef struct _owl_filterelement { |
---|
401 | int (*match_message)(struct _owl_filterelement *fe, owl_message *m); |
---|
402 | /* Append a string representation of the filterelement onto buf*/ |
---|
403 | void (*print_elt)(struct _owl_filterelement *fe, GString *buf); |
---|
404 | /* Operands for and,or,not*/ |
---|
405 | struct _owl_filterelement *left, *right; |
---|
406 | /* For regex filters*/ |
---|
407 | owl_regex re; |
---|
408 | /* Used by regexes, filter references, and perl */ |
---|
409 | char *field; |
---|
410 | } owl_filterelement; |
---|
411 | |
---|
412 | typedef struct _owl_filter { |
---|
413 | char *name; |
---|
414 | int polarity; |
---|
415 | owl_filterelement * root; |
---|
416 | int fgcolor; |
---|
417 | int bgcolor; |
---|
418 | int cachedmsgid; /* cached msgid: should move into view eventually */ |
---|
419 | } owl_filter; |
---|
420 | |
---|
421 | typedef struct _owl_view { |
---|
422 | char *name; |
---|
423 | owl_filter *filter; |
---|
424 | owl_messagelist ml; |
---|
425 | owl_style *style; |
---|
426 | } owl_view; |
---|
427 | |
---|
428 | typedef struct _owl_history { |
---|
429 | owl_list hist; |
---|
430 | int cur; |
---|
431 | int touched; |
---|
432 | int partial; |
---|
433 | int repeats; |
---|
434 | } owl_history; |
---|
435 | |
---|
436 | typedef struct _owl_editwin { |
---|
437 | char *buff; |
---|
438 | owl_history *hist; |
---|
439 | int bufflen; |
---|
440 | int allocated; |
---|
441 | int buffx, buffy; |
---|
442 | int topline; |
---|
443 | int winlines, wincols, fillcol, wrapcol; |
---|
444 | WINDOW *curswin; |
---|
445 | int style; |
---|
446 | int lock; |
---|
447 | int dotsend; |
---|
448 | int echochar; |
---|
449 | |
---|
450 | char *command; |
---|
451 | void (*callback)(struct _owl_editwin*); |
---|
452 | void *cbdata; |
---|
453 | } owl_editwin; |
---|
454 | |
---|
455 | typedef struct _owl_mux { |
---|
456 | int handle; /* for referencing this */ |
---|
457 | int active; /* has this been deleted? */ |
---|
458 | int fd; |
---|
459 | int eventmask; /* bitmask of OWL_MUX_* */ |
---|
460 | void (*handler_fn)(int handle, int fd, int eventmask, void *data); |
---|
461 | void *data; /* data reference to pass to callback */ |
---|
462 | } owl_mux; |
---|
463 | typedef owl_list owl_muxevents; |
---|
464 | |
---|
465 | typedef struct _owl_keybinding { |
---|
466 | int *j; /* keypress stack (0-terminated) */ |
---|
467 | int type; /* command or function? */ |
---|
468 | char *desc; /* description (or "*user*") */ |
---|
469 | char *command; /* command, if of type command */ |
---|
470 | void (*function_fn)(void); /* function ptr, if of type function */ |
---|
471 | } owl_keybinding; |
---|
472 | |
---|
473 | typedef struct _owl_keymap { |
---|
474 | char *name; /* name of keymap */ |
---|
475 | char *desc; /* description */ |
---|
476 | owl_list bindings; /* key bindings */ |
---|
477 | struct _owl_keymap *submap; /* submap */ |
---|
478 | void (*default_fn)(owl_input j); /* default action (takes a keypress) */ |
---|
479 | void (*prealways_fn)(owl_input j); /* always called before a keypress is received */ |
---|
480 | void (*postalways_fn)(owl_input j); /* always called after keypress is processed */ |
---|
481 | } owl_keymap; |
---|
482 | |
---|
483 | typedef struct _owl_keyhandler { |
---|
484 | owl_dict keymaps; /* dictionary of keymaps */ |
---|
485 | owl_keymap *active; /* currently active keymap */ |
---|
486 | int in_esc; /* escape pressed? */ |
---|
487 | int kpstack[OWL_KEYMAP_MAXSTACK+1]; /* current stack of keypresses */ |
---|
488 | int kpstackpos; /* location in stack (-1 = none) */ |
---|
489 | } owl_keyhandler; |
---|
490 | |
---|
491 | typedef struct _owl_buddy { |
---|
492 | int proto; |
---|
493 | char *name; |
---|
494 | int isidle; |
---|
495 | int idlesince; |
---|
496 | } owl_buddy; |
---|
497 | |
---|
498 | typedef struct _owl_buddylist { |
---|
499 | owl_list buddies; |
---|
500 | } owl_buddylist; |
---|
501 | |
---|
502 | typedef struct _owl_zbuddylist { |
---|
503 | owl_list zusers; |
---|
504 | } owl_zbuddylist; |
---|
505 | |
---|
506 | typedef struct _owl_timer { |
---|
507 | time_t time; |
---|
508 | int interval; |
---|
509 | void (*callback)(struct _owl_timer *, void *); |
---|
510 | void (*destroy)(struct _owl_timer *); |
---|
511 | void *data; |
---|
512 | } owl_timer; |
---|
513 | |
---|
514 | typedef struct _owl_errqueue { |
---|
515 | owl_list errlist; |
---|
516 | } owl_errqueue; |
---|
517 | |
---|
518 | typedef struct _owl_colorpair_mgr { |
---|
519 | int next; |
---|
520 | short **pairs; |
---|
521 | } owl_colorpair_mgr; |
---|
522 | |
---|
523 | typedef struct _owl_obarray { |
---|
524 | owl_list strings; |
---|
525 | } owl_obarray; |
---|
526 | |
---|
527 | typedef struct _owl_dispatch { |
---|
528 | int fd; /* FD to watch for dispatch. */ |
---|
529 | int needs_gc; |
---|
530 | void (*cfunc)(struct _owl_dispatch*); /* C function to dispatch to. */ |
---|
531 | void (*destroy)(struct _owl_dispatch*); /* Destructor */ |
---|
532 | void *data; |
---|
533 | } owl_dispatch; |
---|
534 | |
---|
535 | typedef struct _owl_global { |
---|
536 | owl_mainwin mw; |
---|
537 | owl_popwin pw; |
---|
538 | owl_history cmdhist; /* command history */ |
---|
539 | owl_history msghist; /* outgoing message history */ |
---|
540 | owl_keyhandler kh; |
---|
541 | owl_list filterlist; |
---|
542 | owl_list puntlist; |
---|
543 | owl_muxevents muxevents; /* fds to dispatch on */ |
---|
544 | owl_vardict vars; |
---|
545 | owl_cmddict cmds; |
---|
546 | owl_context ctx; |
---|
547 | owl_errqueue errqueue; |
---|
548 | int lines, cols; |
---|
549 | int curmsg, topmsg; |
---|
550 | int curmsg_vert_offset; |
---|
551 | owl_view current_view; |
---|
552 | owl_messagelist msglist; |
---|
553 | WINDOW *recwin, *sepwin, *msgwin, *typwin; |
---|
554 | int needrefresh; |
---|
555 | int rightshift; |
---|
556 | int resizepending; |
---|
557 | int recwinlines; |
---|
558 | int typwinactive; |
---|
559 | char *thishost; |
---|
560 | char *homedir; |
---|
561 | char *confdir; |
---|
562 | char *startupfile; |
---|
563 | int direction; |
---|
564 | int zaway; |
---|
565 | char *cur_zaway_msg; |
---|
566 | int haveconfig; |
---|
567 | int config_format; |
---|
568 | void *buffercbdata; |
---|
569 | owl_editwin tw; |
---|
570 | owl_viewwin vw; |
---|
571 | void *perl; |
---|
572 | int debug; |
---|
573 | time_t starttime; |
---|
574 | time_t lastinputtime; |
---|
575 | char *startupargs; |
---|
576 | int userclue; |
---|
577 | int nextmsgid; |
---|
578 | int hascolors; |
---|
579 | int colorpairs; |
---|
580 | owl_colorpair_mgr cpmgr; |
---|
581 | int searchactive; |
---|
582 | int newmsgproc_pid; |
---|
583 | int malloced, freed; |
---|
584 | char *searchstring; |
---|
585 | aim_session_t aimsess; |
---|
586 | aim_conn_t bosconn; |
---|
587 | owl_timer aim_noop_timer; |
---|
588 | owl_timer aim_ignorelogin_timer; |
---|
589 | int aim_loggedin; /* true if currently logged into AIM */ |
---|
590 | int aim_doprocessing; /* true if we should process AIM events (like pending login) */ |
---|
591 | char *aim_screenname; /* currently logged in AIM screen name */ |
---|
592 | char *aim_screenname_for_filters; /* currently logged in AIM screen name */ |
---|
593 | owl_buddylist buddylist; /* list of logged in AIM buddies */ |
---|
594 | owl_list messagequeue; /* for queueing up aim and other messages */ |
---|
595 | owl_dict styledict; /* global dictionary of available styles */ |
---|
596 | char *response; /* response to the last question asked */ |
---|
597 | int havezephyr; |
---|
598 | int haveaim; |
---|
599 | int ignoreaimlogin; |
---|
600 | int got_err_signal; /* 1 if we got an unexpected signal */ |
---|
601 | siginfo_t err_signal_info; |
---|
602 | owl_zbuddylist zbuddies; |
---|
603 | owl_timer zephyr_buddycheck_timer; |
---|
604 | struct termios startup_tio; |
---|
605 | owl_obarray obarray; |
---|
606 | owl_list dispatchlist; |
---|
607 | GList *timerlist; |
---|
608 | owl_timer *aim_nop_timer; |
---|
609 | } owl_global; |
---|
610 | |
---|
611 | /* globals */ |
---|
612 | extern owl_global g; |
---|
613 | |
---|
614 | #include "owl_prototypes.h" |
---|
615 | |
---|
616 | /* these are missing from the zephyr includes for some reason */ |
---|
617 | #ifdef HAVE_LIBZEPHYR |
---|
618 | int ZGetSubscriptions(ZSubscription_t *, int *); |
---|
619 | int ZGetLocations(ZLocations_t *,int *); |
---|
620 | #endif |
---|
621 | |
---|
622 | #endif /* INC_OWL_H */ |
---|