source: owl.h @ db0ac7e

barnowl_perlaimdebianrelease-1.10release-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
Last change on this file since db0ac7e was db0ac7e, checked in by Alejandro R. Sedeño <asedeno@mit.edu>, 16 years ago
Merged revisions 983-1032 via svnmerge from file:///afs/sipb.mit.edu/project/barnowl/src/svn/trunk ........ r985 | nelhage | 2008-03-11 12:38:20 -0400 (Tue, 11 Mar 2008) | 2 lines Generate less ugly error spew if a module fails to load ........ r986 | geofft | 2008-03-13 15:56:20 -0400 (Thu, 13 Mar 2008) | 1 line Added :webzephyr command with keybinding W. ........ r987 | asedeno | 2008-03-18 23:57:24 -0400 (Tue, 18 Mar 2008) | 2 lines Fix a race condition in which zephyrs received during init are not noticed until the next zephyr after entering the mainloop. ........ r988 | geofft | 2008-03-19 15:46:43 -0400 (Wed, 19 Mar 2008) | 6 lines IRC: explicitly include the network (-a $alias) in reply commands. This may be unnecessary because :irc-msg looks at getcurmsg() if it cannot automatically determine the network. ........ r989 | geofft | 2008-03-21 14:47:51 -0400 (Fri, 21 Mar 2008) | 1 line syntax error. ........ r990 | nelhage | 2008-03-26 02:24:26 -0400 (Wed, 26 Mar 2008) | 2 lines Fix sending jabbers to JIDs beginning with `+' ........ r994 | nelhage | 2008-03-29 17:02:05 -0400 (Sat, 29 Mar 2008) | 3 lines Compile zcrypt.c with -w so I don't get all these warnings in my compile output whenever I change any headers ........ r998 | geofft | 2008-03-31 01:59:47 -0400 (Mon, 31 Mar 2008) | 1 line Implement /me for outgoing IRC messages ........ r999 | geofft | 2008-03-31 09:58:56 -0400 (Mon, 31 Mar 2008) | 1 line I think this fixes the resizing bug. ........ r1000 | nelhage | 2008-03-31 11:29:29 -0400 (Mon, 31 Mar 2008) | 2 lines Make `svkversion' handle exported trees better ........ r1001 | nelhage | 2008-03-31 11:52:39 -0400 (Mon, 31 Mar 2008) | 2 lines Add a makefile rule to support emacs flymake-mode ........ r1015 | nelhage | 2008-04-04 14:58:45 -0400 (Fri, 04 Apr 2008) | 3 lines Bind the combinations the iPhone sends for arrow keys [probably other terminals, too] ........ r1018 | shadow | 2008-04-08 13:57:49 -0400 (Tue, 08 Apr 2008) | 2 lines avoid null pointer dereference if msg is NULL (or a 0 length is claimed) ........ r1019 | nelhage | 2008-04-09 18:08:26 -0400 (Wed, 09 Apr 2008) | 2 lines Fix some stupid typos ........ r1020 | chmrr | 2008-04-09 18:16:02 -0400 (Wed, 09 Apr 2008) | 3 lines r29300@kohr-ah: chmrr | 2008-04-09 18:14:37 -0400 * It's apparently a popular typo ........ r1022 | asedeno | 2008-04-16 17:05:36 -0400 (Wed, 16 Apr 2008) | 2 lines Jabber reply bugfix. Reported by several people, resolved by arolfe. ........ r1023 | nelhage | 2008-04-28 23:33:03 -0400 (Mon, 28 Apr 2008) | 3 lines Initialized merge tracking via "svnmerge" with revisions "735" from svn+ssh://lunatique.mit.edu/mit/barnowl/src/svn/branches/barnowl_unicode ........ r1024 | nelhage | 2008-04-28 23:33:12 -0400 (Mon, 28 Apr 2008) | 3 lines Initialized merge tracking via "svnmerge" with revisions "735" from svn+ssh://lunatique.mit.edu/mit/barnowl/src/svn/branches/barnowl_sqlite ........ r1025 | nelhage | 2008-04-29 01:21:12 -0400 (Tue, 29 Apr 2008) | 2 lines Clone owl_perl from the sqlite branch because I'm about to make use of it. ........ r1026 | nelhage | 2008-04-29 01:21:13 -0400 (Tue, 29 Apr 2008) | 4 lines Initial step of moving styles from the current mishmash of different options to a unified object interface. No backwards-compatibility support yet. ........ r1027 | nelhage | 2008-04-29 01:21:15 -0400 (Tue, 29 Apr 2008) | 2 lines Implement back-compat with old-style owl::format_msg() styles ........ r1028 | nelhage | 2008-04-29 01:21:16 -0400 (Tue, 29 Apr 2008) | 2 lines Remove nearly all references to the "basic" style. ........ r1029 | nelhage | 2008-04-29 01:21:17 -0400 (Tue, 29 Apr 2008) | 2 lines Support the `style' command again. Note that it is deprecated. ........ r1031 | nelhage | 2008-04-30 13:29:45 -0400 (Wed, 30 Apr 2008) | 2 lines Refactor default style code somewhat to be more easily extensible ........
  • Property mode set to 100644
File size: 18.6 KB
RevLine 
[5ca5f8e]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
[7d4fbcd]40#ifndef INC_OWL_H
41#define INC_OWL_H
42
[1bdffcb]43#ifndef OWL_PERL
44#include <curses.h>
45#endif
[7d4fbcd]46#include <sys/param.h>
47#include <EXTERN.h>
48#include <netdb.h>
49#include <regex.h>
[d09e5a1]50#include <time.h>
[c9e72d1]51#include <signal.h>
[8232149]52#include <termios.h>
[d09e5a1]53#include <libfaim/aim.h>
[dd24b6a]54#include <wchar.h>
[7d4fbcd]55#include "config.h"
[34509d5]56#include "glib.h"
[be0a79f]57#ifdef HAVE_LIBZEPHYR
[373b7e7]58#include <zephyr/zephyr.h>
[be0a79f]59#endif
[e6449bc]60#ifdef HAVE_COM_ERR_H
61#include <com_err.h>
62#endif
63
[6922edd]64/* Perl and curses don't play nice. */
65#ifdef OWL_PERL
66typedef void WINDOW;
[18e28a4]67/* logout is defined in FreeBSD. */
68#define logout logout_
[88dc766]69/* aim.h defines bool */
70#define HAS_BOOL
[6922edd]71#include <perl.h>
[120291c]72#include "owl_perl.h"
[18e28a4]73#undef logout
[6922edd]74#include "XSUB.h"
75#else
76typedef void SV;
77#endif
78
[1aee7d9]79static const char owl_h_fileIdent[] = "$Id$";
80
[88dc766]81#define BARNOWL_STRINGIFY(x) _STRINGIFY(x)
[d08162a]82#define _STRINGIFY(x) #x
83
84#ifndef OWL_SVN_REVNO
85#define OWL_SVN_REVNO ????
86#endif
87
[88dc766]88#define OWL_VERSION_STRING "r" BARNOWL_STRINGIFY(OWL_SVN_REVNO)
[d08162a]89
[2a2bb60]90
91/* Feature that is being tested to redirect stderr through a pipe.
92 * There may still be some portability problems with this. */
93#define OWL_STDERR_REDIR 1
[7d4fbcd]94
95#define OWL_DEBUG 0
96#define OWL_DEBUG_FILE "/var/tmp/owldebug"
97
[bd3f232]98#define OWL_CONFIG_DIR "/.owl"             /* this is relative to the user's home directory */
[38cf544c]99#define OWL_STARTUP_FILE "/.owl/startup"   /* this is relative to the user's home directory */
100
[7d4fbcd]101#define OWL_FMTEXT_ATTR_NONE      0
102#define OWL_FMTEXT_ATTR_BOLD      1
103#define OWL_FMTEXT_ATTR_REVERSE   2
104#define OWL_FMTEXT_ATTR_UNDERLINE 4
105
[9866c3a]106#define OWL_FMTEXT_UC_BASE 0x100000 /* Unicode Plane 16 - Supplementary Private Use Area-B*/
107#define OWL_FMTEXT_UC_ATTR ( OWL_FMTEXT_UC_BASE | 0x800 )
108#define OWL_FMTEXT_UC_ATTR_MASK 0x7
109#define OWL_FMTEXT_UC_COLOR_BASE ( OWL_FMTEXT_UC_BASE | 0x400 )
110#define OWL_FMTEXT_UC_FGCOLOR OWL_FMTEXT_UC_COLOR_BASE
111#define OWL_FMTEXT_UC_BGCOLOR ( OWL_FMTEXT_UC_COLOR_BASE | 0x200 )
112#define OWL_FMTEXT_UC_DEFAULT_COLOR 0x100
113#define OWL_FMTEXT_UC_FGDEFAULT ( OWL_FMTEXT_UC_FGCOLOR | OWL_FMTEXT_UC_DEFAULT_COLOR )
114#define OWL_FMTEXT_UC_BGDEFAULT ( OWL_FMTEXT_UC_BGCOLOR | OWL_FMTEXT_UC_DEFAULT_COLOR )
115#define OWL_FMTEXT_UC_COLOR_MASK 0xFF
116#define OWL_FMTEXT_UC_ALLCOLOR_MASK ( OWL_FMTEXT_UC_COLOR_MASK | OWL_FMTEXT_UC_DEFAULT_COLOR | 0x200)
117#define OWL_FMTEXT_UC_STARTBYTE_UTF8 '\xf4'
118
119#define OWL_FMTEXT_UTF8_ATTR_NONE "\xf4\x80\xa0\x80"
120#define OWL_FMTEXT_UTF8_FGDEFAULT "\xf4\x80\x94\x80"
[6f6330b]121#define OWL_FMTEXT_UTF8_BGDEFAULT "\xf4\x80\x9C\x80"
[9866c3a]122
[7d4fbcd]123#define OWL_COLOR_BLACK     0
124#define OWL_COLOR_RED       1
125#define OWL_COLOR_GREEN     2
126#define OWL_COLOR_YELLOW    3
127#define OWL_COLOR_BLUE      4
128#define OWL_COLOR_MAGENTA   5
129#define OWL_COLOR_CYAN      6
130#define OWL_COLOR_WHITE     7
[c2c5c77]131#define OWL_COLOR_DEFAULT   -1
[7d4fbcd]132
133#define OWL_EDITWIN_STYLE_MULTILINE 0
134#define OWL_EDITWIN_STYLE_ONELINE   1
135
[f4d0975]136#define OWL_PROTOCOL_ZEPHYR         0
137#define OWL_PROTOCOL_AIM            1
138#define OWL_PROTOCOL_JABBER         2
139#define OWL_PROTOCOL_ICQ            3
140#define OWL_PROTOCOL_YAHOO          4
141#define OWL_PROTOCOL_MSN            5
142
[4b464a4]143#define OWL_MESSAGE_DIRECTION_NONE  0
144#define OWL_MESSAGE_DIRECTION_IN    1
145#define OWL_MESSAGE_DIRECTION_OUT   2
[7d4fbcd]146
[afbf668]147#define OWL_MUX_READ   1
148#define OWL_MUX_WRITE  2
149#define OWL_MUX_EXCEPT 4
150
[7d4fbcd]151#define OWL_DIRECTION_NONE      0
152#define OWL_DIRECTION_DOWNWARDS 1
153#define OWL_DIRECTION_UPWARDS   2
154
[12c35df]155#define OWL_LOGGING_DIRECTION_BOTH 0
156#define OWL_LOGGING_DIRECTION_IN   1
157#define OWL_LOGGING_DIRECTION_OUT  2
158
[88736cb]159#define OWL_SCROLLMODE_NORMAL      0
160#define OWL_SCROLLMODE_TOP         1
161#define OWL_SCROLLMODE_NEARTOP     2
162#define OWL_SCROLLMODE_CENTER      3
163#define OWL_SCROLLMODE_PAGED       4
[aa2f33b3]164#define OWL_SCROLLMODE_PAGEDCENTER 5
165
[7d4fbcd]166#define OWL_TAB               3  /* This *HAS* to be the size of TABSTR below */
167#define OWL_TABSTR        "   "
168#define OWL_MSGTAB            7
169#define OWL_TYPWIN_SIZE       8
170#define OWL_HISTORYSIZE       50
171
172/* Indicate current state, as well as what is allowed */
173#define OWL_CTX_ANY          0xffff
174/* Only one of these may be active at a time... */
175#define OWL_CTX_MODE_BITS    0x000f
176#define OWL_CTX_STARTUP      0x0001
177#define OWL_CTX_READCONFIG   0x0002
178#define OWL_CTX_INTERACTIVE  0x0004
179/* Only one of these may be active at a time... */
180#define OWL_CTX_ACTIVE_BITS  0xfff0
181#define OWL_CTX_POPWIN       0x00f0
182#define OWL_CTX_POPLESS      0x0010
183#define OWL_CTX_RECWIN       0x0f00
184#define OWL_CTX_RECV         0x0100
185#define OWL_CTX_TYPWIN       0xf000
[cf83b7a]186#define OWL_CTX_EDIT         0x7000
[7d4fbcd]187#define OWL_CTX_EDITLINE     0x1000
188#define OWL_CTX_EDITMULTI    0x2000
[cf83b7a]189#define OWL_CTX_EDITRESPONSE 0x4000
[7d4fbcd]190
191#define OWL_USERCLUE_NONE       0
192#define OWL_USERCLUE_CLASSES    1
193#define OWL_USERCLUE_FOOBAR     2
194#define OWL_USERCLUE_BAZ        4
195
196#define OWL_WEBBROWSER_NONE     0
197#define OWL_WEBBROWSER_NETSCAPE 1
198#define OWL_WEBBROWSER_GALEON   2
[ae9e6be]199#define OWL_WEBBROWSER_OPERA    3
[7d4fbcd]200
201#define OWL_VARIABLE_OTHER      0
202#define OWL_VARIABLE_INT        1
203#define OWL_VARIABLE_BOOL       2
204#define OWL_VARIABLE_STRING     3
205
206#define OWL_FILTER_MAX_DEPTH    300
207
[4b464a4]208#define OWL_KEYMAP_MAXSTACK     20
[7d4fbcd]209
[4b464a4]210#define OWL_KEYBINDING_COMMAND  1   /* command string */
211#define OWL_KEYBINDING_FUNCTION 2   /* function taking no args */
[7d4fbcd]212
[4b464a4]213#define OWL_DEFAULT_ZAWAYMSG    "I'm sorry, but I am currently away from the terminal and am\nnot able to receive your message.\n"
[4b660cc]214#define OWL_DEFAULT_AAWAYMSG    "I'm sorry, but I am currently away from the terminal and am\nnot able to receive your message.\n"
[7d4fbcd]215
[4b464a4]216#define OWL_INCLUDE_REG_TESTS   1  /* whether to build in regression tests */
[7d4fbcd]217
[1c7a4e0]218#define OWL_CMD_ALIAS_SUMMARY_PREFIX "command alias to: "
[7d4fbcd]219
[e7cc1c3]220#define OWL_WEBZEPHYR_PRINCIPAL "daemon.webzephyr"
[1d3e925]221#define OWL_WEBZEPHYR_CLASS     "webzephyr"
222#define OWL_WEBZEPHYR_OPCODE    "webzephyr"
[e7cc1c3]223
[80e54a7]224#define OWL_REGEX_QUOTECHARS    "+*.?[]^\\${}()"
[bc08664]225#define OWL_REGEX_QUOTEWITH     "\\"
226
[0435c7d]227#if defined(HAVE_DES_STRING_TO_KEY) && defined(HAVE_DES_KEY_SCHED) && defined(HAVE_DES_ECB_ENCRYPT)
[c86a35c]228#define OWL_ENABLE_ZCRYPT 1
[c269e22]229#endif
230
[62fdd29]231#define OWL_META(key) ((key)|010000)
[f87c490]232/* OWL_CTRL is definied in kepress.c */
[7d4fbcd]233
234#define LINE 2048
235
236typedef struct _owl_variable {
237  char *name;
238  int   type;  /* OWL_VARIABLE_* */
239  void *pval_default;  /* for types other and string */
240  int   ival_default;  /* for types int and bool     */
241  char *validsettings;          /* documentation of valid settings */
[aa2f33b3]242  char *summary;                /* summary of usage */
243  char *description;            /* detailed description */
[7d4fbcd]244  void *val;                    /* current value */
245  int  (*validate_fn)(struct _owl_variable *v, void *newval);
246                                /* returns 1 if newval is valid */
247  int  (*set_fn)(struct _owl_variable *v, void *newval); 
248                                /* sets the variable to a value
249                                 * of the appropriate type.
250                                 * unless documented, this
251                                 * should make a copy.
252                                 * returns 0 on success. */
253  int  (*set_fromstring_fn)(struct _owl_variable *v, char *newval);
254                                /* sets the variable to a value
255                                 * of the appropriate type.
256                                 * unless documented, this
257                                 * should make a copy.
258                                 * returns 0 on success. */
259  void *(*get_fn)(struct _owl_variable *v);
260                                /* returns a reference to the current value.
261                                 * WARNING:  this approach is hard to make
262                                 * thread-safe... */
263  int  (*get_tostring_fn)(struct _owl_variable *v, 
264                          char *buf, int bufsize, void *val); 
265                                /* converts val to a string
266                                 * and puts into buf */
267  void  (*free_fn)(struct _owl_variable *v);
268                                /* frees val as needed */
269} owl_variable;
270
[428834d]271typedef struct _owl_input {
272  int ch;
273  gunichar uch;
274} owl_input;
275
[7d4fbcd]276typedef struct _owl_fmtext {
277  int textlen;
[a387d12e]278  int bufflen;
[7d4fbcd]279  char *textbuff;
[9866c3a]280  char default_attrs;
281  short default_fgcolor;
282  short default_bgcolor;
[7d4fbcd]283} owl_fmtext;
284
285typedef struct _owl_list {
286  int size;
287  int avail;
288  void **list;
289} owl_list;
290
291typedef struct _owl_dict_el {
292  char *k;                      /* key   */
293  void *v;                      /* value */
294} owl_dict_el;
295
296typedef struct _owl_dict {
297  int size;
298  int avail;
299  owl_dict_el *els;             /* invariant: sorted by k */
300} owl_dict;
301typedef owl_dict owl_vardict;   /* dict of variables */
302typedef owl_dict owl_cmddict;   /* dict of commands */
303
304typedef struct _owl_context {
305  int   mode;
306  void *data;           /* determined by mode */
307} owl_context;
308
309typedef struct _owl_cmd {       /* command */
310  char *name;
311
312  char *summary;                /* one line summary of command */
313  char *usage;                  /* usage synopsis */
314  char *description;            /* long description of command */
315
316  int validctx;                 /* bitmask of valid contexts */
317
318  /* we should probably have a type here that says which of
319   * the following is valid, and maybe make the below into a union... */
320
321  /* Only one of these may be non-NULL ... */
322
323  char *cmd_aliased_to;         /* what this command is aliased to... */
324 
325  /* These don't take any context */
326  char *(*cmd_args_fn)(int argc, char **argv, char *buff); 
327                                /* takes argv and the full command as buff.
328                                 * caller must free return value if !NULL */
329  void (*cmd_v_fn)(void);       /* takes no args */
330  void (*cmd_i_fn)(int i);      /* takes an int as an arg */
331
332  /* The following also take the active context if it's valid */
333  char *(*cmd_ctxargs_fn)(void *ctx, int argc, char **argv, char *buff); 
334                                /* takes argv and the full command as buff.
335                                 * caller must free return value if !NULL */
336  void (*cmd_ctxv_fn)(void *ctx);               /* takes no args */
337  void (*cmd_ctxi_fn)(void *ctx, int i);        /* takes an int as an arg */
[6922edd]338  SV *cmd_perl;                                /* Perl closure that takes a list of args */
[7d4fbcd]339} owl_cmd;
340
341
342typedef struct _owl_zwrite {
[ce7db4d]343  char *class;
344  char *inst;
345  char *realm;
346  char *opcode;
[56330ff]347  char *zsig;
[ce7db4d]348  char *message;
[7d4fbcd]349  owl_list recips;
350  int cc;
351  int noping;
352} owl_zwrite;
353
[d0d65df]354typedef struct _owl_pair {
355  void *key;
356  void *value;
357} owl_pair;
358
[a387d12e]359struct _owl_fmtext_cache;
360
[7d4fbcd]361typedef struct _owl_message {
362  int id;
[4b464a4]363  int direction;
[be0a79f]364#ifdef HAVE_LIBZEPHYR
[7d4fbcd]365  ZNotice_t notice;
[be0a79f]366#endif
[a387d12e]367  struct _owl_fmtext_cache * fmtext;
[7d4fbcd]368  int delete;
[8298425]369  char *hostname;
[65ad073]370  owl_list attributes;            /* this is a list of pairs */
[25dd31a]371  char *timestr;
372  time_t time;
[7d4fbcd]373  char *zwriteline;
374} owl_message;
375
[a387d12e]376#define OWL_FMTEXT_CACHE_SIZE 1000
377/* We cache the saved fmtexts for the last bunch of messages we
378   rendered */
379typedef struct _owl_fmtext_cache {
380    owl_message * message;
381    owl_fmtext fmtext;
382} owl_fmtext_cache;
383
[bd3f232]384typedef struct _owl_style {
385  char *name;
[120291c]386  SV *perlobj;
[bd3f232]387} owl_style;
388
[7d4fbcd]389typedef struct _owl_mainwin {
390  int curtruncated;
[f2e36b5]391  int lasttruncated;
[7d4fbcd]392  int lastdisplayed;
393} owl_mainwin;
394
395typedef struct _owl_viewwin {
396  owl_fmtext fmtext;
397  int textlines;
398  int topline;
399  int rightshift;
400  int winlines, wincols;
401  WINDOW *curswin;
[afbf668]402  void (*onclose_hook) (struct _owl_viewwin *vwin, void *data);
403  void *onclose_hook_data;
[7d4fbcd]404} owl_viewwin;
405 
406typedef struct _owl_popwin {
407  WINDOW *borderwin;
408  WINDOW *popwin;
409  int lines;
410  int cols;
411  int active;
412  int needsfirstrefresh;
413  void (*handler) (int ch);
414} owl_popwin;
415
[afbf668]416typedef struct _owl_popexec {
417  int refcount;
418  owl_viewwin *vwin;
419  int winactive;
420  int pid;                      /* or 0 if it has terminated */
421  int rfd; 
422} owl_popexec;
423
[7d4fbcd]424typedef struct _owl_messagelist {
425  owl_list list;
426} owl_messagelist;
427
428typedef struct _owl_regex {
429  int negate;
430  char *string;
431  regex_t re;
432} owl_regex;
433
434typedef struct _owl_filterelement {
[cb769bb]435  int (*match_message)(struct _owl_filterelement *fe, owl_message *m);
436  /* Append a string representation of the filterelement onto buf*/
437  void (*print_elt)(struct _owl_filterelement *fe, char * buf);
438  /* Operands for and,or,not*/
439  struct _owl_filterelement *left, *right;
440  /* For regex filters*/
[7d4fbcd]441  owl_regex re;
[cb769bb]442  /* Used by regexes, filter references, and perl */
443  char *field;
[7d4fbcd]444} owl_filterelement;
445
446typedef struct _owl_filter {
447  char *name;
448  int polarity;
[cb769bb]449  owl_filterelement * root;
[8fa9562]450  int fgcolor;
451  int bgcolor;
[59cf91c]452  int cachedmsgid;  /* cached msgid: should move into view eventually */
[7d4fbcd]453} owl_filter;
454
455typedef struct _owl_view {
[c3ab155]456  char *name;
[7d4fbcd]457  owl_filter *filter;
458  owl_messagelist ml;
[c3ab155]459  owl_style *style;
[7d4fbcd]460} owl_view;
461
462typedef struct _owl_history {
463  owl_list hist;
464  int cur;
465  int touched;
466  int partial;
[12c35df]467  int repeats;
[7d4fbcd]468} owl_history;
469
[10b866d]470typedef struct _owl_editwin {
471  char *buff;
472  owl_history *hist;
473  int bufflen;
474  int allocated;
475  int buffx, buffy;
476  int topline;
477  int winlines, wincols, fillcol, wrapcol;
478  WINDOW *curswin;
479  int style;
480  int lock;
481  int dotsend;
[c9334b1]482  int echochar;
[1b6b2f3]483
484  char *command;
485  void (*callback)(struct _owl_editwin*);
486  void *cbdata;
[10b866d]487} owl_editwin;
488
[afbf668]489typedef struct _owl_mux {
490  int handle;                   /* for referencing this */
491  int active;                   /* has this been deleted? */
492  int fd;                     
493  int eventmask;                /* bitmask of OWL_MUX_* */
494  void (*handler_fn)(int handle, int fd, int eventmask, void *data);
495  void *data;                   /* data reference to pass to callback */
496} owl_mux;
497typedef owl_list owl_muxevents;
498
[7d4fbcd]499typedef struct _owl_keybinding {
500  int  *j;                      /* keypress stack (0-terminated) */ 
501  int   type;                   /* command or function? */
502  char *desc;                   /* description (or "*user*") */
503  char *command;                /* command, if of type command */
504  void (*function_fn)(void);    /* function ptr, if of type function */
505} owl_keybinding;
506
507typedef struct _owl_keymap {
508  char     *name;               /* name of keymap */
509  char     *desc;               /* description */
510  owl_list  bindings;           /* key bindings */
511  struct _owl_keymap *submap;   /* submap */
[428834d]512  void (*default_fn)(owl_input j);      /* default action (takes a keypress) */
513  void (*prealways_fn)(owl_input  j);   /* always called before a keypress is received */
514  void (*postalways_fn)(owl_input  j);  /* always called after keypress is processed */
[7d4fbcd]515} owl_keymap;
516
517typedef struct _owl_keyhandler {
518  owl_dict  keymaps;            /* dictionary of keymaps */
519  owl_keymap *active;           /* currently active keymap */
520  int       in_esc;             /* escape pressed? */
521  int       kpstack[OWL_KEYMAP_MAXSTACK+1]; /* current stack of keypresses */
522  int       kpstackpos;         /* location in stack (-1 = none) */
523} owl_keyhandler;
524
[f4d0975]525typedef struct _owl_buddy {
526  int proto;
527  char *name;
528  int isidle;
529  int idlesince;
530} owl_buddy;
531
[aa5f725]532typedef struct _owl_buddylist {
533  owl_list buddies;
534} owl_buddylist;
535
[5a95b69]536typedef struct _owl_zbuddylist {
537  owl_list zusers;
538} owl_zbuddylist;
539
[6a415e9]540typedef struct _owl_timer {
541  int direction;
542  time_t starttime;
543  int start;
544} owl_timer;
[aa5f725]545
[ec6ff52]546typedef struct _owl_errqueue {
547  owl_list errlist;
548} owl_errqueue;
549
[8fa9562]550typedef struct _owl_colorpair_mgr {
[99c7549]551  int next;
[c2c5c77]552  short **pairs;
[8fa9562]553} owl_colorpair_mgr;
554
[124aebc]555typedef struct _owl_obarray {
556  owl_list strings;
557} owl_obarray;
558
[9c7a701]559typedef struct _owl_dispatch {
560  int fd;           /* FD to watch for dispatch. */
561  void (*cfunc)();  /* C function to dispatch to. */
562  SV *pfunc;        /* Perl function to dispatch to. */
563} owl_dispatch;
564
[7d4fbcd]565typedef struct _owl_global {
566  owl_mainwin mw;
567  owl_popwin pw;
[10b866d]568  owl_history cmdhist;          /* command history */
569  owl_history msghist;          /* outgoing message history */
[7d4fbcd]570  owl_keyhandler kh;
571  owl_list filterlist;
572  owl_list puntlist;
[afbf668]573  owl_muxevents muxevents;      /* fds to dispatch on */
[7d4fbcd]574  owl_vardict vars;
575  owl_cmddict cmds;
576  owl_context ctx;
[ec6ff52]577  owl_errqueue errqueue;
[7d4fbcd]578  int lines, cols;
579  int curmsg, topmsg;
580  int curmsg_vert_offset;
581  owl_view current_view;
582  owl_messagelist msglist;
583  WINDOW *recwin, *sepwin, *msgwin, *typwin;
584  int needrefresh;
585  int rightshift;
586  int resizepending;
587  int recwinlines;
588  int typwinactive;
[a8938c7]589  char *thishost;
590  char *homedir;
[b363d83]591  char *confdir;
592  char *startupfile;
[7d4fbcd]593  int direction;
594  int zaway;
595  char *cur_zaway_msg;
596  int haveconfig;
597  int config_format;
[1b6b2f3]598  void *buffercbdata;
[7d4fbcd]599  owl_editwin tw;
600  owl_viewwin vw;
601  void *perl;
602  int debug;
[7f792c1]603  time_t starttime;
604  time_t lastinputtime;
[a8938c7]605  char *startupargs;
[7d4fbcd]606  int userclue;
607  int nextmsgid;
608  int hascolors;
609  int colorpairs;
[8fa9562]610  owl_colorpair_mgr cpmgr;
[1fd0b25]611  int searchactive;
[700c712]612  int newmsgproc_pid;
[8262340]613  int malloced, freed;
[1fd0b25]614  char *searchstring;
[d09e5a1]615  aim_session_t aimsess;
[c15bbfb]616  aim_conn_t bosconn;
[6a415e9]617  owl_timer aim_noop_timer;
618  owl_timer aim_ignorelogin_timer;
[de03334]619  owl_timer aim_buddyinfo_timer;
[bd3f232]620  int aim_loggedin;         /* true if currently logged into AIM */
[a352335c]621  int aim_doprocessing;     /* true if we should process AIM events (like pending login) */
[bd3f232]622  char *aim_screenname;     /* currently logged in AIM screen name */
623  owl_buddylist buddylist;  /* list of logged in AIM buddies */
624  owl_list messagequeue;    /* for queueing up aim and other messages */
[f1e629d]625  owl_dict styledict;       /* global dictionary of available styles */
[cf83b7a]626  char *response;           /* response to the last question asked */
[09489b89]627  int havezephyr;
628  int haveaim;
[c9e72d1]629  int got_err_signal;       /* 1 if we got an unexpected signal */
[5a95b69]630  siginfo_t err_signal_info;
631  owl_zbuddylist zbuddies;
632  owl_timer zephyr_buddycheck_timer;
[8232149]633  struct termios startup_tio;
[8e401cae]634  owl_obarray obarray;
[9c7a701]635  owl_list dispatchlist;
[7d4fbcd]636} owl_global;
637
638/* globals */
[b2b0773]639extern owl_global g;
[7d4fbcd]640
641#include "owl_prototypes.h"
642
643/* these are missing from the zephyr includes for some reason */
[be0a79f]644#ifdef HAVE_LIBZEPHYR
[7d4fbcd]645int ZGetSubscriptions(ZSubscription_t *, int *);
646int ZGetLocations(ZLocations_t *,int *);
[be0a79f]647#endif
[7d4fbcd]648
649#endif /* INC_OWL_H */
Note: See TracBrowser for help on using the repository browser.