source: owl.h @ 93ee554

barnowl_perlaimdebianrelease-1.10release-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
Last change on this file since 93ee554 was 93ee554, checked in by Alejandro R. Sedeño <asedeno@mit.edu>, 16 years ago
Merged revisions 734-776 via svnmerge from file:///afs/sipb.mit.edu/project/barnowl/src/svn/trunk ........ r738 | nelhage | 2007-07-07 17:42:45 -0400 (Sat, 07 Jul 2007) | 3 lines Make the built-in regression tests output TAP and add a perl wrapper to call it. ........ r739 | nelhage | 2007-07-07 17:43:22 -0400 (Sat, 07 Jul 2007) | 2 lines Forgot these in the last commit; Make all the tests output TAP ........ r740 | nelhage | 2007-07-07 19:46:16 -0400 (Sat, 07 Jul 2007) | 2 lines Clean up an unused var warning. ........ r741 | nelhage | 2007-07-08 15:37:43 -0400 (Sun, 08 Jul 2007) | 2 lines Adding a -s switch to change the location of the config dir (~/.owl) ........ r742 | nelhage | 2007-07-08 15:39:57 -0400 (Sun, 08 Jul 2007) | 2 lines I don't understand why this didn't commit last time. I blame psvn. ........ r743 | nelhage | 2007-07-11 22:37:16 -0400 (Wed, 11 Jul 2007) | 3 lines Don't allow you to go off the end of an empty message list. [fixes: #9] ........ r744 | nelhage | 2007-07-30 18:47:39 -0400 (Mon, 30 Jul 2007) | 2 lines Fix sending to -c message -i personal ........ r745 | chmrr | 2007-07-30 20:21:18 -0400 (Mon, 30 Jul 2007) | 3 lines r20981@zoq-fot-pik: chmrr | 2007-07-30 20:20:44 -0400 * message length 0 means no fields ........ r746 | nelhage | 2007-07-30 20:25:59 -0400 (Mon, 30 Jul 2007) | 4 lines * zero-len message means no fields * Actually use owl_zephyr_get_zsig to get the zsig, which handles 0- and 1- field zephyrs correctly. ........ r747 | nelhage | 2007-07-30 20:29:36 -0400 (Mon, 30 Jul 2007) | 2 lines Making that last patch actually compile. Bad me. ........ r748 | nelhage | 2007-08-01 01:42:53 -0400 (Wed, 01 Aug 2007) | 3 lines owl_message_get_text needs to make sure there's text to return before returning it. fixes: #15 ........ r749 | nelhage | 2007-08-01 01:52:08 -0400 (Wed, 01 Aug 2007) | 5 lines zephyr smartnarrow now uses the ``personal'' filter to decide whether to narrow to user or not, and the zephyr-user filter now checks for `filter personal' instead of <message,personal,*>. closes #2 ........ r750 | nelhage | 2007-08-01 02:27:30 -0400 (Wed, 01 Aug 2007) | 5 lines Changing the default personal filter to <message,personal,*> for zephyr. refs 2 ........ r751 | nelhage | 2007-08-01 22:58:31 -0400 (Wed, 01 Aug 2007) | 2 lines Display opcodes with the default style ........ r752 | nelhage | 2007-08-08 18:01:51 -0400 (Wed, 08 Aug 2007) | 2 lines Applying ctl's variable shuffling patch for better ANSI C-ness. closes #18 ........ r753 | nelhage | 2007-08-11 01:04:07 -0400 (Sat, 11 Aug 2007) | 3 lines Implement :punt and :unpunt to punt arbitrary filters, rather than just z-triplets. closes #6 ........ r754 | nelhage | 2007-08-11 01:18:37 -0400 (Sat, 11 Aug 2007) | 2 lines Show non-personal pings like stock owl does. closes #12 ........ r756 | asedeno | 2007-08-17 12:48:37 -0400 (Fri, 17 Aug 2007) | 8 lines Apply patch from: http://rt.cpan.org/Public/Bug/Display.html?id=17484 Fixing problems with jabber servers keeping the same stream id when negotiating TLS. Thanks to ghudson for tracking this down. ........ r757 | nelhage | 2007-08-17 17:26:44 -0400 (Fri, 17 Aug 2007) | 4 lines When we're narrowing to an instance, properly include un-instances. This fixes narrowing to any instance that starts with ``un-'' ........ r758 | nelhage | 2007-08-27 19:17:20 -0400 (Mon, 27 Aug 2007) | 2 lines Don't read before the start of the string for an instance ........ r759 | nelhage | 2007-09-07 00:13:45 -0400 (Fri, 07 Sep 2007) | 3 lines Adding an explicit -f - to the tar commands for FreeBSD compatibility (reported by ecprice) ........ r760 | ecprice | 2007-09-08 17:33:34 -0400 (Sat, 08 Sep 2007) | 3 lines Fixes for FreeBSD. ........ r761 | nelhage | 2007-09-10 20:00:45 -0400 (Mon, 10 Sep 2007) | 3 lines Use "" instead of `undef' as a default for messages with no reply command to hopefully squelch perl warnings. ........ r762 | nelhage | 2007-09-12 21:37:41 -0400 (Wed, 12 Sep 2007) | 2 lines Do ~-expansion in :loadsubs. closes #26 ........ r763 | nelhage | 2007-09-12 21:54:51 -0400 (Wed, 12 Sep 2007) | 2 lines Validate JIDs passed to jmuc join. closes #25 ........ r764 | nelhage | 2007-09-12 22:46:17 -0400 (Wed, 12 Sep 2007) | 2 lines Show full JIDs for users in non-anonymous JIDs in :jmuc presence. closes #24 ........ r766 | nelhage | 2007-10-02 00:38:49 -0400 (Tue, 02 Oct 2007) | 3 lines Don't crash if we hit `i' on iso-8859-*. This is not the right solution, but at least it doesn't SEGV. ........ r767 | asedeno | 2007-10-10 15:21:13 -0400 (Wed, 10 Oct 2007) | 1 line Fixing a typo pointed out by kchen. ........ r768 | matt | 2007-10-14 17:16:35 -0400 (Sun, 14 Oct 2007) | 1 line added -m flag to aimwrite ........ r769 | austein | 2007-10-14 18:16:44 -0400 (Sun, 14 Oct 2007) | 1 line aimwrite -m displays according to displayoutgoing ........ r770 | asedeno | 2007-12-06 14:38:05 -0500 (Thu, 06 Dec 2007) | 3 lines Making usleep call more reasonable. Responsiveness seems okay on linerva, no-knife, and darkmatter, and reported good on zephyr. ........ r771 | nelhage | 2007-12-10 21:34:46 -0500 (Mon, 10 Dec 2007) | 2 lines Add zip as build-depends ........ r772 | nelhage | 2007-12-10 21:36:25 -0500 (Mon, 10 Dec 2007) | 2 lines We're not ktools ........ r773 | nelhage | 2007-12-23 11:32:02 -0500 (Sun, 23 Dec 2007) | 2 lines bind END in popless windows. closes #41 ........ r774 | chmrr | 2007-12-23 15:16:26 -0500 (Sun, 23 Dec 2007) | 3 lines r1805@utwig: chmrr | 2007-12-23 15:15:33 -0500 * Allow C-r on outgoing messages (useful for CCs) ........ r775 | chmrr | 2007-12-23 15:16:29 -0500 (Sun, 23 Dec 2007) | 3 lines r1806@utwig: chmrr | 2007-12-23 15:15:50 -0500 * Identify ourselves as barnowl in a couple more places ........
  • Property mode set to 100644
File size: 17.5 KB
Line 
1/*  Copyright (c) 2004 James Kretchmar. All rights reserved.
2 *
3 *  Redistribution and use in source and binary forms, with or without
4 *  modification, are permitted provided that the following conditions are
5 *  met:
6 * 
7 *    * Redistributions of source code must retain the above copyright
8 *      notice, this list of conditions and the following disclaimer.
9 * 
10 *    * Redistributions in binary form must reproduce the above copyright
11 *      notice, this list of conditions and the following disclaimer in
12 *      the documentation and/or other materials provided with the
13 *      distribution.
14 * 
15 *    * Redistributions in any form must be accompanied by information on
16 *      how to obtain complete source code for the Owl software and any
17 *      accompanying software that uses the Owl software. The source code
18 *      must either be included in the distribution or be available for no
19 *      more than the cost of distribution plus a nominal fee, and must be
20 *      freely redistributable under reasonable conditions. For an
21 *      executable file, complete source code means the source code for
22 *      all modules it contains. It does not include source code for
23 *      modules or files that typically accompany the major components of
24 *      the operating system on which the executable file runs.
25 * 
26 *
27 *  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
28 *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
29 *  WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
30 *  NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
31 *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
34 *  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
35 *  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
36 *  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
37 *  IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 */
39
40#ifndef INC_OWL_H
41#define INC_OWL_H
42
43#ifndef OWL_PERL
44#include <curses.h>
45#endif
46#include <sys/param.h>
47#include <EXTERN.h>
48#include <netdb.h>
49#include <regex.h>
50#include <time.h>
51#include <signal.h>
52#include <termios.h>
53#include <libfaim/aim.h>
54#include "config.h"
55#include "glib.h"
56#ifdef HAVE_LIBZEPHYR
57#include <zephyr/zephyr.h>
58#endif
59#ifdef HAVE_COM_ERR_H
60#include <com_err.h>
61#endif
62
63/* Perl and curses don't play nice. */
64#ifdef OWL_PERL
65typedef void WINDOW;
66/* logout is defined in FreeBSD. */
67#define logout logout_
68#include <perl.h>
69#undef logout
70#include "XSUB.h"
71#else
72typedef void SV;
73#endif
74
75static const char owl_h_fileIdent[] = "$Id$";
76
77#define STRINGIFY(x) _STRINGIFY(x)
78#define _STRINGIFY(x) #x
79
80#ifndef OWL_SVN_REVNO
81#define OWL_SVN_REVNO ????
82#endif
83
84#define OWL_VERSION_STRING "r" STRINGIFY(OWL_SVN_REVNO)
85
86
87/* Feature that is being tested to redirect stderr through a pipe.
88 * There may still be some portability problems with this. */
89#define OWL_STDERR_REDIR 1
90
91#define OWL_DEBUG 0
92#define OWL_DEBUG_FILE "/var/tmp/owldebug"
93
94#define OWL_CONFIG_DIR "/.owl"             /* this is relative to the user's home directory */
95#define OWL_STARTUP_FILE "/.owl/startup"   /* this is relative to the user's home directory */
96
97#define OWL_FMTEXT_ATTR_NONE      0
98#define OWL_FMTEXT_ATTR_BOLD      1
99#define OWL_FMTEXT_ATTR_REVERSE   2
100#define OWL_FMTEXT_ATTR_UNDERLINE 4
101
102#define OWL_COLOR_BLACK     0
103#define OWL_COLOR_RED       1
104#define OWL_COLOR_GREEN     2
105#define OWL_COLOR_YELLOW    3
106#define OWL_COLOR_BLUE      4
107#define OWL_COLOR_MAGENTA   5
108#define OWL_COLOR_CYAN      6
109#define OWL_COLOR_WHITE     7
110#define OWL_COLOR_DEFAULT   -1
111
112#define OWL_EDITWIN_STYLE_MULTILINE 0
113#define OWL_EDITWIN_STYLE_ONELINE   1
114
115#define OWL_PROTOCOL_ZEPHYR         0
116#define OWL_PROTOCOL_AIM            1
117#define OWL_PROTOCOL_JABBER         2
118#define OWL_PROTOCOL_ICQ            3
119#define OWL_PROTOCOL_YAHOO          4
120#define OWL_PROTOCOL_MSN            5
121
122#define OWL_MESSAGE_DIRECTION_NONE  0
123#define OWL_MESSAGE_DIRECTION_IN    1
124#define OWL_MESSAGE_DIRECTION_OUT   2
125
126#define OWL_MUX_READ   1
127#define OWL_MUX_WRITE  2
128#define OWL_MUX_EXCEPT 4
129
130#define OWL_DIRECTION_NONE      0
131#define OWL_DIRECTION_DOWNWARDS 1
132#define OWL_DIRECTION_UPWARDS   2
133
134#define OWL_LOGGING_DIRECTION_BOTH 0
135#define OWL_LOGGING_DIRECTION_IN   1
136#define OWL_LOGGING_DIRECTION_OUT  2
137
138#define OWL_SCROLLMODE_NORMAL      0
139#define OWL_SCROLLMODE_TOP         1
140#define OWL_SCROLLMODE_NEARTOP     2
141#define OWL_SCROLLMODE_CENTER      3
142#define OWL_SCROLLMODE_PAGED       4
143#define OWL_SCROLLMODE_PAGEDCENTER 5
144
145#define OWL_STYLE_TYPE_INTERNAL  0
146#define OWL_STYLE_TYPE_PERL      1
147
148#define OWL_TAB               3  /* This *HAS* to be the size of TABSTR below */
149#define OWL_TABSTR        "   "
150#define OWL_MSGTAB            7
151#define OWL_TYPWIN_SIZE       8
152#define OWL_HISTORYSIZE       50
153
154/* Indicate current state, as well as what is allowed */
155#define OWL_CTX_ANY          0xffff
156/* Only one of these may be active at a time... */
157#define OWL_CTX_MODE_BITS    0x000f
158#define OWL_CTX_STARTUP      0x0001
159#define OWL_CTX_READCONFIG   0x0002
160#define OWL_CTX_INTERACTIVE  0x0004
161/* Only one of these may be active at a time... */
162#define OWL_CTX_ACTIVE_BITS  0xfff0
163#define OWL_CTX_POPWIN       0x00f0
164#define OWL_CTX_POPLESS      0x0010
165#define OWL_CTX_RECWIN       0x0f00
166#define OWL_CTX_RECV         0x0100
167#define OWL_CTX_TYPWIN       0xf000
168#define OWL_CTX_EDIT         0x7000
169#define OWL_CTX_EDITLINE     0x1000
170#define OWL_CTX_EDITMULTI    0x2000
171#define OWL_CTX_EDITRESPONSE 0x4000
172
173#define OWL_USERCLUE_NONE       0
174#define OWL_USERCLUE_CLASSES    1
175#define OWL_USERCLUE_FOOBAR     2
176#define OWL_USERCLUE_BAZ        4
177
178#define OWL_WEBBROWSER_NONE     0
179#define OWL_WEBBROWSER_NETSCAPE 1
180#define OWL_WEBBROWSER_GALEON   2
181#define OWL_WEBBROWSER_OPERA    3
182
183#define OWL_VARIABLE_OTHER      0
184#define OWL_VARIABLE_INT        1
185#define OWL_VARIABLE_BOOL       2
186#define OWL_VARIABLE_STRING     3
187
188#define OWL_FILTER_MAX_DEPTH    300
189
190#define OWL_KEYMAP_MAXSTACK     20
191
192#define OWL_KEYBINDING_COMMAND  1   /* command string */
193#define OWL_KEYBINDING_FUNCTION 2   /* function taking no args */
194
195#define OWL_DEFAULT_ZAWAYMSG    "I'm sorry, but I am currently away from the terminal and am\nnot able to receive your message.\n"
196#define OWL_DEFAULT_AAWAYMSG    "I'm sorry, but I am currently away from the terminal and am\nnot able to receive your message.\n"
197
198#define OWL_INCLUDE_REG_TESTS   1  /* whether to build in regression tests */
199
200#define OWL_CMD_ALIAS_SUMMARY_PREFIX "command alias to: "
201
202#define OWL_WEBZEPHYR_PRINCIPAL "daemon.webzephyr"
203#define OWL_WEBZEPHYR_CLASS     "webzephyr"
204#define OWL_WEBZEPHYR_OPCODE    "webzephyr"
205
206#define OWL_REGEX_QUOTECHARS    "+*.?[]^\\${}()"
207#define OWL_REGEX_QUOTEWITH     "\\"
208
209#if defined(HAVE_DES_STRING_TO_KEY) && defined(HAVE_DES_KEY_SCHED) && defined(HAVE_DES_ECB_ENCRYPT)
210#define OWL_ENABLE_ZCRYPT 1
211#endif
212
213#define OWL_META(key) ((key)|0200)
214/* OWL_CTRL is definied in kepress.c */
215
216#define LINE 2048
217
218typedef struct _owl_variable {
219  char *name;
220  int   type;  /* OWL_VARIABLE_* */
221  void *pval_default;  /* for types other and string */
222  int   ival_default;  /* for types int and bool     */
223  char *validsettings;          /* documentation of valid settings */
224  char *summary;                /* summary of usage */
225  char *description;            /* detailed description */
226  void *val;                    /* current value */
227  int  (*validate_fn)(struct _owl_variable *v, void *newval);
228                                /* returns 1 if newval is valid */
229  int  (*set_fn)(struct _owl_variable *v, void *newval); 
230                                /* sets the variable to a value
231                                 * of the appropriate type.
232                                 * unless documented, this
233                                 * should make a copy.
234                                 * returns 0 on success. */
235  int  (*set_fromstring_fn)(struct _owl_variable *v, char *newval);
236                                /* sets the variable to a value
237                                 * of the appropriate type.
238                                 * unless documented, this
239                                 * should make a copy.
240                                 * returns 0 on success. */
241  void *(*get_fn)(struct _owl_variable *v);
242                                /* returns a reference to the current value.
243                                 * WARNING:  this approach is hard to make
244                                 * thread-safe... */
245  int  (*get_tostring_fn)(struct _owl_variable *v, 
246                          char *buf, int bufsize, void *val); 
247                                /* converts val to a string
248                                 * and puts into buf */
249  void  (*free_fn)(struct _owl_variable *v);
250                                /* frees val as needed */
251} owl_variable;
252
253typedef struct _owl_fmtext {
254  int textlen;
255  int bufflen;
256  char *textbuff;
257  char *fmbuff;
258  short *fgcolorbuff;
259  short *bgcolorbuff;
260} owl_fmtext;
261
262typedef struct _owl_list {
263  int size;
264  int avail;
265  void **list;
266} owl_list;
267
268typedef struct _owl_dict_el {
269  char *k;                      /* key   */
270  void *v;                      /* value */
271} owl_dict_el;
272
273typedef struct _owl_dict {
274  int size;
275  int avail;
276  owl_dict_el *els;             /* invariant: sorted by k */
277} owl_dict;
278typedef owl_dict owl_vardict;   /* dict of variables */
279typedef owl_dict owl_cmddict;   /* dict of commands */
280
281typedef struct _owl_context {
282  int   mode;
283  void *data;           /* determined by mode */
284} owl_context;
285
286typedef struct _owl_cmd {       /* command */
287  char *name;
288
289  char *summary;                /* one line summary of command */
290  char *usage;                  /* usage synopsis */
291  char *description;            /* long description of command */
292
293  int validctx;                 /* bitmask of valid contexts */
294
295  /* we should probably have a type here that says which of
296   * the following is valid, and maybe make the below into a union... */
297
298  /* Only one of these may be non-NULL ... */
299
300  char *cmd_aliased_to;         /* what this command is aliased to... */
301 
302  /* These don't take any context */
303  char *(*cmd_args_fn)(int argc, char **argv, char *buff); 
304                                /* takes argv and the full command as buff.
305                                 * caller must free return value if !NULL */
306  void (*cmd_v_fn)(void);       /* takes no args */
307  void (*cmd_i_fn)(int i);      /* takes an int as an arg */
308
309  /* The following also take the active context if it's valid */
310  char *(*cmd_ctxargs_fn)(void *ctx, int argc, char **argv, char *buff); 
311                                /* takes argv and the full command as buff.
312                                 * caller must free return value if !NULL */
313  void (*cmd_ctxv_fn)(void *ctx);               /* takes no args */
314  void (*cmd_ctxi_fn)(void *ctx, int i);        /* takes an int as an arg */
315  SV *cmd_perl;                                /* Perl closure that takes a list of args */
316} owl_cmd;
317
318
319typedef struct _owl_zwrite {
320  char *class;
321  char *inst;
322  char *realm;
323  char *opcode;
324  char *zsig;
325  char *message;
326  owl_list recips;
327  int cc;
328  int noping;
329} owl_zwrite;
330
331typedef struct _owl_pair {
332  void *key;
333  void *value;
334} owl_pair;
335
336struct _owl_fmtext_cache;
337
338typedef struct _owl_message {
339  int id;
340  int direction;
341#ifdef HAVE_LIBZEPHYR
342  ZNotice_t notice;
343#endif
344  struct _owl_fmtext_cache * fmtext;
345  int delete;
346  char *hostname;
347  owl_list attributes;            /* this is a list of pairs */
348  char *timestr;
349  time_t time;
350  char *zwriteline;
351} owl_message;
352
353#define OWL_FMTEXT_CACHE_SIZE 1000
354/* We cache the saved fmtexts for the last bunch of messages we
355   rendered */
356typedef struct _owl_fmtext_cache {
357    owl_message * message;
358    owl_fmtext fmtext;
359} owl_fmtext_cache;
360
361typedef struct _owl_style {
362  char *name;
363  char *description;
364  int type;
365  char *perlfuncname;
366  void (*formatfunc) (owl_fmtext *fm, owl_message *m);
367} owl_style;
368
369typedef struct _owl_mainwin {
370  int curtruncated;
371  int lasttruncated;
372  int lastdisplayed;
373} owl_mainwin;
374
375typedef struct _owl_viewwin {
376  owl_fmtext fmtext;
377  int textlines;
378  int topline;
379  int rightshift;
380  int winlines, wincols;
381  WINDOW *curswin;
382  void (*onclose_hook) (struct _owl_viewwin *vwin, void *data);
383  void *onclose_hook_data;
384} owl_viewwin;
385 
386typedef struct _owl_popwin {
387  WINDOW *borderwin;
388  WINDOW *popwin;
389  int lines;
390  int cols;
391  int active;
392  int needsfirstrefresh;
393  void (*handler) (int ch);
394} owl_popwin;
395
396typedef struct _owl_popexec {
397  int refcount;
398  owl_viewwin *vwin;
399  int winactive;
400  int pid;                      /* or 0 if it has terminated */
401  int rfd; 
402} owl_popexec;
403
404typedef struct _owl_messagelist {
405  owl_list list;
406} owl_messagelist;
407
408typedef struct _owl_regex {
409  int negate;
410  char *string;
411  regex_t re;
412} owl_regex;
413
414typedef struct _owl_filterelement {
415  int (*match_message)(struct _owl_filterelement *fe, owl_message *m);
416  /* Append a string representation of the filterelement onto buf*/
417  void (*print_elt)(struct _owl_filterelement *fe, char * buf);
418  /* Operands for and,or,not*/
419  struct _owl_filterelement *left, *right;
420  /* For regex filters*/
421  owl_regex re;
422  /* Used by regexes, filter references, and perl */
423  char *field;
424} owl_filterelement;
425
426typedef struct _owl_filter {
427  char *name;
428  int polarity;
429  owl_filterelement * root;
430  int fgcolor;
431  int bgcolor;
432  int cachedmsgid;  /* cached msgid: should move into view eventually */
433} owl_filter;
434
435typedef struct _owl_view {
436  char *name;
437  owl_filter *filter;
438  owl_messagelist ml;
439  owl_style *style;
440} owl_view;
441
442typedef struct _owl_history {
443  owl_list hist;
444  int cur;
445  int touched;
446  int partial;
447  int repeats;
448} owl_history;
449
450typedef struct _owl_editwin {
451  char *buff;
452  owl_history *hist;
453  int bufflen;
454  int allocated;
455  int buffx, buffy;
456  int topline;
457  int winlines, wincols, fillcol, wrapcol;
458  WINDOW *curswin;
459  int style;
460  int lock;
461  int dotsend;
462  int echochar;
463
464  char *command;
465  void (*callback)(struct _owl_editwin*);
466  void *cbdata;
467} owl_editwin;
468
469typedef struct _owl_mux {
470  int handle;                   /* for referencing this */
471  int active;                   /* has this been deleted? */
472  int fd;                     
473  int eventmask;                /* bitmask of OWL_MUX_* */
474  void (*handler_fn)(int handle, int fd, int eventmask, void *data);
475  void *data;                   /* data reference to pass to callback */
476} owl_mux;
477typedef owl_list owl_muxevents;
478
479typedef struct _owl_keybinding {
480  int  *j;                      /* keypress stack (0-terminated) */ 
481  int   type;                   /* command or function? */
482  char *desc;                   /* description (or "*user*") */
483  char *command;                /* command, if of type command */
484  void (*function_fn)(void);    /* function ptr, if of type function */
485} owl_keybinding;
486
487typedef struct _owl_keymap {
488  char     *name;               /* name of keymap */
489  char     *desc;               /* description */
490  owl_list  bindings;           /* key bindings */
491  struct _owl_keymap *submap;   /* submap */
492  void (*default_fn)(int j);    /* default action (takes a keypress) */
493  void (*prealways_fn)(int j);  /* always called before a keypress is received */
494  void (*postalways_fn)(int j); /* always called after keypress is processed */
495} owl_keymap;
496
497typedef struct _owl_keyhandler {
498  owl_dict  keymaps;            /* dictionary of keymaps */
499  owl_keymap *active;           /* currently active keymap */
500  int       in_esc;             /* escape pressed? */
501  int       kpstack[OWL_KEYMAP_MAXSTACK+1]; /* current stack of keypresses */
502  int       kpstackpos;         /* location in stack (-1 = none) */
503} owl_keyhandler;
504
505typedef struct _owl_buddy {
506  int proto;
507  char *name;
508  int isidle;
509  int idlesince;
510} owl_buddy;
511
512typedef struct _owl_buddylist {
513  owl_list buddies;
514} owl_buddylist;
515
516typedef struct _owl_zbuddylist {
517  owl_list zusers;
518} owl_zbuddylist;
519
520typedef struct _owl_timer {
521  int direction;
522  time_t starttime;
523  int start;
524} owl_timer;
525
526typedef struct _owl_errqueue {
527  owl_list errlist;
528} owl_errqueue;
529
530typedef struct _owl_colorpair_mgr {
531  int next;
532  short **pairs;
533} owl_colorpair_mgr;
534
535typedef struct _owl_obarray {
536  owl_list strings;
537} owl_obarray;
538
539typedef struct _owl_global {
540  owl_mainwin mw;
541  owl_popwin pw;
542  owl_history cmdhist;          /* command history */
543  owl_history msghist;          /* outgoing message history */
544  owl_keyhandler kh;
545  owl_list filterlist;
546  owl_list puntlist;
547  owl_muxevents muxevents;      /* fds to dispatch on */
548  owl_vardict vars;
549  owl_cmddict cmds;
550  owl_context ctx;
551  owl_errqueue errqueue;
552  int lines, cols;
553  int curmsg, topmsg;
554  int curmsg_vert_offset;
555  owl_view current_view;
556  owl_messagelist msglist;
557  WINDOW *recwin, *sepwin, *msgwin, *typwin;
558  int needrefresh;
559  int rightshift;
560  int resizepending;
561  int recwinlines;
562  int typwinactive;
563  char *thishost;
564  char *homedir;
565  char *confdir;
566  char *startupfile;
567  int direction;
568  int zaway;
569  char *cur_zaway_msg;
570  int haveconfig;
571  int config_format;
572  void *buffercbdata;
573  owl_editwin tw;
574  owl_viewwin vw;
575  void *perl;
576  int debug;
577  time_t starttime;
578  time_t lastinputtime;
579  char *startupargs;
580  int userclue;
581  int nextmsgid;
582  int hascolors;
583  int colorpairs;
584  owl_colorpair_mgr cpmgr;
585  int searchactive;
586  int newmsgproc_pid;
587  int malloced, freed;
588  char *searchstring;
589  aim_session_t aimsess;
590  aim_conn_t bosconn;
591  owl_timer aim_noop_timer;
592  owl_timer aim_ignorelogin_timer;
593  owl_timer aim_buddyinfo_timer;
594  int aim_loggedin;         /* true if currently logged into AIM */
595  int aim_doprocessing;     /* true if we should process AIM events (like pending login) */
596  char *aim_screenname;     /* currently logged in AIM screen name */
597  owl_buddylist buddylist;  /* list of logged in AIM buddies */
598  owl_list messagequeue;    /* for queueing up aim and other messages */
599  owl_dict styledict;       /* global dictionary of available styles */
600  char *response;           /* response to the last question asked */
601  int havezephyr;
602  int haveaim;
603  int got_err_signal;       /* 1 if we got an unexpected signal */
604  siginfo_t err_signal_info;
605  owl_zbuddylist zbuddies;
606  owl_timer zephyr_buddycheck_timer;
607  struct termios startup_tio;
608  owl_obarray obarray;
609} owl_global;
610
611/* globals */
612extern 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
618int ZGetSubscriptions(ZSubscription_t *, int *);
619int ZGetLocations(ZLocations_t *,int *);
620#endif
621
622#endif /* INC_OWL_H */
Note: See TracBrowser for help on using the repository browser.