source: global.c @ 6df381b

barnowl_perlaimdebianrelease-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
Last change on this file since 6df381b was db8b00b, checked in by Nelson Elhage <nelhage@mit.edu>, 15 years ago
Exposing edit window hooks to perl
  • Property mode set to 100644
File size: 18.2 KB
Line 
1#include <stdio.h>
2#include <unistd.h>
3#include <stdlib.h>
4#include <string.h>
5#include <netdb.h>
6#include <termios.h>
7#include <sys/ioctl.h>
8#include <time.h>
9#include "owl.h"
10
11static const char fileIdent[] = "$Id$";
12
13#ifndef MAXHOSTNAMELEN
14#define MAXHOSTNAMELEN 256
15#endif
16
17void owl_global_init(owl_global *g) {
18  struct hostent *hent;
19  char hostname[MAXHOSTNAMELEN];
20
21  g->malloced=0;
22  g->freed=0;
23
24  gethostname(hostname, MAXHOSTNAMELEN);
25  hent=gethostbyname(hostname);
26  if (!hent) {
27    g->thishost=owl_strdup("localhost");
28  } else {
29    g->thishost=owl_strdup(hent->h_name);
30  }
31
32  owl_context_init(&g->ctx);
33  owl_context_set_startup(&g->ctx);
34  g->curmsg=0;
35  g->topmsg=0;
36  g->needrefresh=1;
37  g->startupargs=NULL;
38
39  owl_variable_dict_setup(&(g->vars));
40  owl_cmddict_setup(&(g->cmds));
41
42  g->lines=LINES;
43  g->cols=COLS;
44
45  g->rightshift=0;
46
47  owl_editwin_init(&(g->tw), NULL, owl_global_get_typwin_lines(g), g->cols, OWL_EDITWIN_STYLE_ONELINE, NULL);
48
49  owl_keyhandler_init(&g->kh);
50  owl_keys_setup_keymaps(&g->kh);
51
52  owl_list_create(&(g->muxevents));
53  owl_list_create(&(g->filterlist));
54  owl_list_create(&(g->puntlist));
55  owl_list_create(&(g->messagequeue));
56  owl_dict_create(&(g->styledict));
57  g->curmsg_vert_offset=0;
58  g->resizepending=0;
59  g->typwinactive=0;
60  g->direction=OWL_DIRECTION_DOWNWARDS;
61  g->zaway=0;
62  if (has_colors()) {
63    g->hascolors=1;
64  }
65  g->colorpairs=COLOR_PAIRS;
66  g->debug=OWL_DEBUG;
67  g->searchactive=0;
68  g->searchstring=NULL;
69  g->starttime=time(NULL); /* assumes we call init only a start time */
70  g->newmsgproc_pid=0;
71 
72  owl_global_set_config_format(g, 0);
73  owl_global_set_userclue(g, OWL_USERCLUE_NONE);
74  owl_global_set_no_have_config(g);
75  owl_history_init(&(g->msghist));
76  owl_history_init(&(g->cmdhist));
77  owl_history_set_norepeats(&(g->cmdhist));
78  g->nextmsgid=0;
79
80  owl_filterelement_create_true(&(g->fe_true));
81  owl_filterelement_create_false(&(g->fe_false));
82  owl_filterelement_create_null(&(g->fe_null));
83
84  _owl_global_setup_windows(g);
85
86  /* Fill in some variables which don't have constant defaults */
87  /* TODO: come back later and check passwd file first */
88  g->homedir=owl_strdup(getenv("HOME"));
89
90  owl_messagelist_create(&(g->msglist));
91  owl_mainwin_init(&(g->mw));
92  owl_popwin_init(&(g->pw));
93
94  g->aim_screenname=NULL;
95  g->aim_loggedin=0;
96  owl_timer_create_countdown(&(g->aim_noop_timer), 30);
97  owl_timer_create_countdown(&(g->aim_ignorelogin_timer), 0);
98  owl_timer_create_countdown(&(g->aim_buddyinfo_timer), 60);
99  owl_buddylist_init(&(g->buddylist));
100   
101  g->havezephyr=0;
102  g->haveaim=0;
103  owl_global_set_no_doaimevents(g);
104
105  owl_errqueue_init(&(g->errqueue));
106  g->got_err_signal=0;
107
108  owl_zbuddylist_create(&(g->zbuddies));
109  owl_timer_create_countdown(&(g->zephyr_buddycheck_timer), 60*3);
110}
111
112void _owl_global_setup_windows(owl_global *g) {
113  int cols, typwin_lines;
114
115  cols=g->cols;
116  typwin_lines=owl_global_get_typwin_lines(g);
117
118  /* set the new window sizes */
119  g->recwinlines=g->lines-(typwin_lines+2);
120  if (g->recwinlines<0) {
121    /* gotta deal with this */
122    g->recwinlines=0;
123  }
124
125  owl_function_debugmsg("_owl_global_setup_windows: about to call newwin(%i, %i, 0, 0)\n", g->recwinlines, cols);
126
127  /* create the new windows */
128  g->recwin=newwin(g->recwinlines, cols, 0, 0);
129  if (g->recwin==NULL) {
130    owl_function_debugmsg("_owl_global_setup_windows: newwin returned NULL\n", g->recwinlines, cols);
131    endwin();
132    exit(50);
133  }
134     
135  g->sepwin=newwin(1, cols, g->recwinlines, 0);
136  g->msgwin=newwin(1, cols, g->recwinlines+1, 0);
137  g->typwin=newwin(typwin_lines, cols, g->recwinlines+2, 0);
138
139  owl_editwin_set_curswin(&(g->tw), g->typwin, typwin_lines, g->cols);
140
141  idlok(g->typwin, FALSE);
142  idlok(g->recwin, FALSE);
143  idlok(g->sepwin, FALSE);
144  idlok(g->msgwin, FALSE);
145
146  nodelay(g->typwin, 1);
147  keypad(g->typwin, TRUE);
148  wmove(g->typwin, 0, 0);
149
150  meta(g->typwin, TRUE);
151}
152
153owl_context *owl_global_get_context(owl_global *g) {
154  return(&g->ctx);
155}
156                         
157int owl_global_get_lines(owl_global *g) {
158  return(g->lines);
159}
160
161int owl_global_get_cols(owl_global *g) {
162  return(g->cols);
163}
164
165int owl_global_get_recwin_lines(owl_global *g) {
166  return(g->recwinlines);
167}
168
169/* curmsg */
170
171int owl_global_get_curmsg(owl_global *g) {
172  return(g->curmsg);
173}
174
175void owl_global_set_curmsg(owl_global *g, int i) {
176  g->curmsg=i;
177  /* we will reset the vertical offset from here */
178  /* we might want to move this out to the functions later */
179  owl_global_set_curmsg_vert_offset(g, 0);
180}
181
182/* topmsg */
183
184int owl_global_get_topmsg(owl_global *g) {
185  return(g->topmsg);
186}
187
188void owl_global_set_topmsg(owl_global *g, int i) {
189  g->topmsg=i;
190}
191
192/* windows */
193
194owl_mainwin *owl_global_get_mainwin(owl_global *g) {
195  return(&(g->mw));
196}
197
198owl_popwin *owl_global_get_popwin(owl_global *g) {
199  return(&(g->pw));
200}
201
202/* msglist */
203
204owl_messagelist *owl_global_get_msglist(owl_global *g) {
205  return(&(g->msglist));
206}
207
208/* keyhandler */
209
210owl_keyhandler *owl_global_get_keyhandler(owl_global *g) {
211  return(&(g->kh));
212}
213
214/* curses windows */
215
216WINDOW *owl_global_get_curs_recwin(owl_global *g) {
217  return(g->recwin);
218}
219
220WINDOW *owl_global_get_curs_sepwin(owl_global *g) {
221  return(g->sepwin);
222}
223
224WINDOW *owl_global_get_curs_msgwin(owl_global *g) {
225  return(g->msgwin);
226}
227
228WINDOW *owl_global_get_curs_typwin(owl_global *g) {
229  return(g->typwin);
230}
231
232/* typwin */
233
234owl_editwin *owl_global_get_typwin(owl_global *g) {
235  return(&(g->tw));
236}
237
238/* buffercommand */
239
240void owl_global_set_buffercommand(owl_global *g, char *command) {
241  owl_editwin_set_command(owl_global_get_typwin(g), command);
242}
243
244char *owl_global_get_buffercommand(owl_global *g) {
245  return owl_editwin_get_command(owl_global_get_typwin(g));
246}
247
248void owl_global_set_buffercallback(owl_global *g, void (*cb)(owl_editwin*)) {
249  owl_editwin_set_callback(owl_global_get_typwin(g), cb);
250}
251
252void (*owl_global_get_buffercallback(owl_global *g))(owl_editwin*) {
253  return owl_editwin_get_callback(owl_global_get_typwin(g));
254}
255
256/* refresh */
257
258int owl_global_is_needrefresh(owl_global *g) {
259  if (g->needrefresh==1) return(1);
260  return(0);
261}
262
263void owl_global_set_needrefresh(owl_global *g) {
264  g->needrefresh=1;
265}
266
267void owl_global_set_noneedrefresh(owl_global *g) {
268  g->needrefresh=0;
269}
270
271/* variable dictionary */
272
273owl_vardict *owl_global_get_vardict(owl_global *g) {
274  return &(g->vars);
275}
276
277/* command dictionary */
278
279owl_cmddict *owl_global_get_cmddict(owl_global *g) {
280  return &(g->cmds);
281}
282
283/* rightshift */
284
285void owl_global_set_rightshift(owl_global *g, int i) {
286  g->rightshift=i;
287}
288
289int owl_global_get_rightshift(owl_global *g) {
290  return(g->rightshift);
291}
292
293/* typwin */
294
295int owl_global_is_typwin_active(owl_global *g) {
296  if (g->typwinactive==1) return(1);
297  return(0);
298}
299
300void owl_global_set_typwin_active(owl_global *g) {
301  g->typwinactive=1;
302}
303
304void owl_global_set_typwin_inactive(owl_global *g) {
305  g->typwinactive=0;
306}
307
308/* resize */
309
310void owl_global_set_resize_pending(owl_global *g) {
311  g->resizepending=1;
312}
313
314char *owl_global_get_homedir(owl_global *g) {
315  if (g->homedir) return(g->homedir);
316  return("/");
317}
318
319int owl_global_get_direction(owl_global *g) {
320  return(g->direction);
321}
322
323void owl_global_set_direction_downwards(owl_global *g) {
324  g->direction=OWL_DIRECTION_DOWNWARDS;
325}
326
327void owl_global_set_direction_upwards(owl_global *g) {
328  g->direction=OWL_DIRECTION_UPWARDS;
329}
330
331/* perl stuff */
332
333void owl_global_set_perlinterp(owl_global *g, void *p) {
334  g->perl=p;
335}
336
337void *owl_global_get_perlinterp(owl_global *g) {
338  return(g->perl);
339}
340
341int owl_global_is_config_format(owl_global *g) {
342  if (g->config_format) return(1);
343  return(0);
344}
345
346void owl_global_set_config_format(owl_global *g, int state) {
347  if (state==1) {
348    g->config_format=1;
349  } else {
350    g->config_format=0;
351  }
352}
353
354void owl_global_set_have_config(owl_global *g) {
355  g->haveconfig=1;
356}
357
358void owl_global_set_no_have_config(owl_global *g) {
359  g->haveconfig=0;
360}
361
362int owl_global_have_config(owl_global *g) {
363  if (g->haveconfig) return(1);
364  return(0);
365}
366
367void owl_global_resize(owl_global *g, int x, int y) {
368  /* resize the screen.  If x or y is 0 use the terminal size */
369  struct winsize size;
370   
371  if (!g->resizepending) return;
372
373  /* delete the current windows */
374  delwin(g->recwin);
375  delwin(g->sepwin);
376  delwin(g->msgwin);
377  delwin(g->typwin);
378  if (!isendwin()) {
379    endwin();
380  }
381
382  refresh();
383
384  /* get the new size */
385  ioctl(STDIN_FILENO, TIOCGWINSZ, &size);
386  if (x==0) {
387    g->lines=size.ws_row;
388  } else {
389    g->lines=x;
390  }
391
392  if (y==0) {
393    g->cols=size.ws_col;
394  } else {
395    g->cols=y;
396  }
397
398  resizeterm(size.ws_row, size.ws_col);
399
400  /* re-initialize the windows */
401  _owl_global_setup_windows(g);
402
403  /* in case any styles rely on the current width */
404  owl_messagelist_invalidate_formats(owl_global_get_msglist(g));
405
406  /* refresh stuff */
407  g->needrefresh=1;
408  owl_mainwin_redisplay(&(g->mw));
409  sepbar(NULL);
410
411  if (owl_global_is_typwin_active(g)) {
412    owl_editwin_redisplay(&(g->tw), 0);
413  }     
414  /* TODO: this should handle other forms of popwins */
415  if (owl_popwin_is_active(owl_global_get_popwin(g)) 
416      && owl_global_get_viewwin(g)) {
417    owl_popwin_refresh(owl_global_get_popwin(g));
418    owl_viewwin_redisplay(owl_global_get_viewwin(g), 0);
419  }
420
421  owl_function_debugmsg("New size is %i lines, %i cols.", size.ws_row, size.ws_col);
422  owl_function_makemsg("");
423  g->resizepending=0;
424}
425
426/* debug */
427
428int owl_global_is_debug_fast(owl_global *g) {
429  if (g->debug) return(1);
430  return(0);
431}
432
433/* starttime */
434
435time_t owl_global_get_starttime(owl_global *g) {
436  return(g->starttime);
437}
438
439time_t owl_global_get_runtime(owl_global *g) {
440  return(time(NULL)-g->starttime);
441}
442
443void owl_global_get_runtime_string(owl_global *g, char *buff) {
444  time_t diff;
445
446  diff=time(NULL)-owl_global_get_starttime(g);
447
448  /* print something nicer later */   
449  sprintf(buff, "%i seconds", (int) diff);
450}
451
452char *owl_global_get_hostname(owl_global *g) {
453  if (g->thishost) return(g->thishost);
454  return("");
455}
456
457/* userclue */
458
459void owl_global_set_userclue(owl_global *g, int clue) {
460  g->userclue=clue;
461}
462
463void owl_global_add_userclue(owl_global *g, int clue) {
464  g->userclue|=clue;
465}
466
467int owl_global_get_userclue(owl_global *g) {
468  return(g->userclue);
469}
470
471int owl_global_is_userclue(owl_global *g, int clue) {
472  if (g->userclue & clue) return(1);
473  return(0);
474}
475
476/* viewwin */
477
478owl_viewwin *owl_global_get_viewwin(owl_global *g) {
479  return(&(g->vw));
480}
481
482
483/* vert offset */
484
485int owl_global_get_curmsg_vert_offset(owl_global *g) {
486  return(g->curmsg_vert_offset);
487}
488
489void owl_global_set_curmsg_vert_offset(owl_global *g, int i) {
490  g->curmsg_vert_offset=i;
491}
492
493/* startup args */
494
495void owl_global_set_startupargs(owl_global *g, int argc, char **argv) {
496  int i, len;
497
498  if (g->startupargs) owl_free(g->startupargs);
499 
500  len=0;
501  for (i=0; i<argc; i++) {
502    len+=strlen(argv[i])+5;
503  }
504  g->startupargs=malloc(len+5);
505
506  strcpy(g->startupargs, "");
507  for (i=0; i<argc; i++) {
508    sprintf(g->startupargs, "%s%s ", g->startupargs, argv[i]);
509  }
510  g->startupargs[strlen(g->startupargs)-1]='\0';
511}
512
513char *owl_global_get_startupargs(owl_global *g) {
514  if (g->startupargs) return(g->startupargs);
515  return("");
516}
517
518/* history */
519
520owl_history *owl_global_get_msg_history(owl_global *g) {
521  return(&(g->msghist));
522}
523
524owl_history *owl_global_get_cmd_history(owl_global *g) {
525  return(&(g->cmdhist));
526}
527
528/* muxevents */
529
530owl_muxevents *owl_global_get_muxevents(owl_global *g) {
531  return(&(g->muxevents));
532}
533
534/* filterlist */
535
536owl_list *owl_global_get_filterlist(owl_global *g) {
537  return(&(g->filterlist));
538}
539
540owl_filter *owl_global_get_filter(owl_global *g, char *name) {
541  int i, j;
542  owl_filter *f;
543
544  j=owl_list_get_size(&(g->filterlist));
545  for (i=0; i<j; i++) {
546    f=owl_list_get_element(&(g->filterlist), i);
547    if (!strcmp(name, owl_filter_get_name(f))) {
548      return(f);
549    }
550  }
551  return(NULL);
552}
553
554void owl_global_add_filter(owl_global *g, owl_filter *f) {
555  owl_list_append_element(&(g->filterlist), f);
556}
557
558void owl_global_remove_filter(owl_global *g, char *name) {
559  int i, j;
560  owl_filter *f;
561
562  j=owl_list_get_size(&(g->filterlist));
563  for (i=0; i<j; i++) {
564    f=owl_list_get_element(&(g->filterlist), i);
565    if (!strcmp(name, owl_filter_get_name(f))) {
566      owl_filter_free(f);
567      owl_list_remove_element(&(g->filterlist), i);
568      break;
569    }
570  }
571}
572
573/* nextmsgid */
574
575int owl_global_get_nextmsgid(owl_global *g) {
576  return(g->nextmsgid++);
577}
578
579/* current view */
580
581owl_view *owl_global_get_current_view(owl_global *g) {
582  return(&(g->current_view));
583}
584
585owl_filterelement *owl_global_get_filterelement_true(owl_global *g) {
586  return(&(g->fe_true));
587}
588
589owl_filterelement *owl_global_get_filterelement_false(owl_global *g) {
590  return(&(g->fe_false));
591}
592
593owl_filterelement *owl_global_get_filterelement_null(owl_global *g) {
594  return(&(g->fe_null));
595}
596
597/* has colors */
598
599int owl_global_get_hascolors(owl_global *g) {
600  if (g->hascolors) return(1);
601  return(0);
602}
603
604/* color pairs */
605
606int owl_global_get_colorpairs(owl_global *g) {
607  return(g->colorpairs);
608}
609
610/* puntlist */
611
612owl_list *owl_global_get_puntlist(owl_global *g) {
613  return(&(g->puntlist));
614}
615
616int owl_global_message_is_puntable(owl_global *g, owl_message *m) {
617  owl_list *pl;
618  int i, j;
619
620  pl=owl_global_get_puntlist(g);
621  j=owl_list_get_size(pl);
622  for (i=0; i<j; i++) {
623    if (owl_filter_message_match(owl_list_get_element(pl, i), m)) return(1);
624  }
625  return(0);
626}
627
628int owl_global_should_followlast(owl_global *g) {
629  owl_view *v;
630 
631  if (!owl_global_is__followlast(g)) return(0);
632 
633  v=owl_global_get_current_view(g);
634 
635  if (owl_global_get_curmsg(g)==owl_view_get_size(v)-1) return(1);
636  return(0);
637}
638
639int owl_global_is_search_active(owl_global *g) {
640  if (g->searchactive) return(1);
641  return(0);
642}
643
644void owl_global_set_search_active(owl_global *g, char *string) {
645  g->searchactive=1;
646  if (g->searchstring != NULL) owl_free(g->searchstring);
647  g->searchstring=owl_strdup(string);
648}
649
650void owl_global_set_search_inactive(owl_global *g) {
651  g->searchactive=0;
652}
653
654char *owl_global_get_search_string(owl_global *g) {
655  if (g->searchstring==NULL) return("");
656  return(g->searchstring);
657}
658
659void owl_global_set_newmsgproc_pid(owl_global *g, int i) {
660  g->newmsgproc_pid=i;
661}
662
663int owl_global_get_newmsgproc_pid(owl_global *g) {
664  return(g->newmsgproc_pid);
665}
666
667void owl_global_add_to_malloced(owl_global *g, int i) {
668  g->malloced+=i;
669}
670
671void owl_global_add_to_freed(owl_global *g, int i) {
672  g->freed+=1;
673}
674
675int owl_global_get_malloced(owl_global *g) {
676  return(g->malloced);
677}
678
679int owl_global_get_freed(owl_global *g) {
680  return(g->freed);
681}
682
683int owl_global_get_meminuse(owl_global *g) {
684  return(g->malloced-g->freed);
685}
686
687/* AIM stuff */
688
689int owl_global_is_aimloggedin(owl_global *g)
690{
691  if (g->aim_loggedin) return(1);
692  return(0);
693}
694
695char *owl_global_get_aim_screenname(owl_global *g)
696{
697  if (owl_global_is_aimloggedin(g)) {
698    return (g->aim_screenname);
699  }
700  return("");
701}
702
703void owl_global_set_aimloggedin(owl_global *g, char *screenname)
704{
705  g->aim_loggedin=1;
706  if (g->aim_screenname) owl_free(g->aim_screenname);
707  g->aim_screenname=owl_strdup(screenname);
708}
709
710void owl_global_set_aimnologgedin(owl_global *g)
711{
712  g->aim_loggedin=0;
713}
714
715int owl_global_is_doaimevents(owl_global *g)
716{
717  if (g->aim_doprocessing) return(1);
718  return(0);
719}
720
721void owl_global_set_doaimevents(owl_global *g)
722{
723  g->aim_doprocessing=1;
724}
725
726void owl_global_set_no_doaimevents(owl_global *g)
727{
728  g->aim_doprocessing=0;
729}
730
731aim_session_t *owl_global_get_aimsess(owl_global *g)
732{
733  return(&(g->aimsess));
734}
735
736aim_conn_t *owl_global_get_bosconn(owl_global *g)
737{
738  return(&(g->bosconn));
739}
740
741void owl_global_set_bossconn(owl_global *g, aim_conn_t *conn)
742{
743  g->bosconn=*conn;
744}
745
746int owl_global_is_aimnop_time(owl_global *g)
747{
748  if (owl_timer_is_expired(&(g->aim_noop_timer))) return(1);
749  return(0);
750}
751
752void owl_global_aimnop_sent(owl_global *g)
753{
754  owl_timer_reset(&(g->aim_noop_timer));
755}
756
757owl_timer *owl_global_get_aim_login_timer(owl_global *g)
758{
759  return(&(g->aim_ignorelogin_timer));
760}
761
762/* message queue */
763
764void owl_global_messagequeue_addmsg(owl_global *g, owl_message *m)
765{
766  owl_list_append_element(&(g->messagequeue), m);
767}
768
769/* pop off the first message and return it.  Return NULL if the queue
770 * is empty.  The caller should free the message after using it, if
771 * necessary.
772 */
773owl_message *owl_global_messageuque_popmsg(owl_global *g)
774{
775  owl_message *out;
776
777  if (owl_list_get_size(&(g->messagequeue))==0) return(NULL);
778  out=owl_list_get_element(&(g->messagequeue), 0);
779  owl_list_remove_element(&(g->messagequeue), 0);
780  return(out);
781}
782
783int owl_global_messagequeue_pending(owl_global *g)
784{
785  if (owl_list_get_size(&(g->messagequeue))==0) return(0);
786  return(1);
787}
788
789owl_buddylist *owl_global_get_buddylist(owl_global *g)
790{
791  return(&(g->buddylist));
792}
793 
794/* style */
795
796/* Return the style with name 'name'.  If it does not exist return
797 * NULL */
798owl_style *owl_global_get_style_by_name(owl_global *g, char *name)
799{
800  return owl_dict_find_element(&(g->styledict), name);
801}
802
803/* creates a list and fills it in with keys.  duplicates the keys,
804 * so they will need to be freed by the caller. */
805int owl_global_get_style_names(owl_global *g, owl_list *l) {
806  return owl_dict_get_keys(&(g->styledict), l);
807}
808
809void owl_global_add_style(owl_global *g, owl_style *s)
810{
811  owl_dict_insert_element(&(g->styledict), owl_style_get_name(s), 
812                          s, (void(*)(void*))owl_style_free);
813}
814
815void owl_global_set_haveaim(owl_global *g)
816{
817  g->haveaim=1;
818}
819
820int owl_global_is_haveaim(owl_global *g)
821{
822  if (g->haveaim) return(1);
823  return(0);
824}
825
826void owl_global_set_havezephyr(owl_global *g)
827{
828  g->havezephyr=1;
829}
830
831int owl_global_is_havezephyr(owl_global *g)
832{
833  if (g->havezephyr) return(1);
834  return(0);
835}
836
837owl_timer *owl_global_get_aim_buddyinfo_timer(owl_global *g)
838{
839  return(&(g->aim_buddyinfo_timer));
840}
841
842owl_errqueue *owl_global_get_errqueue(owl_global *g)
843{
844  return(&(g->errqueue));
845}
846
847void owl_global_set_errsignal(owl_global *g, int signum, siginfo_t *siginfo)
848{
849  g->got_err_signal = signum;
850  if (siginfo) {
851    g->err_signal_info = *siginfo;
852  } else {
853    memset(&(g->err_signal_info), 0, sizeof(siginfo_t));
854  }
855}
856
857int owl_global_get_errsignal_and_clear(owl_global *g, siginfo_t *siginfo)
858{
859  int signum;
860  if (siginfo && g->got_err_signal) {
861    *siginfo = g->err_signal_info;
862  } 
863  signum = g->got_err_signal;
864  g->got_err_signal = 0;
865  return signum;
866}
867
868owl_timer *owl_global_get_zephyr_buddycheck_timer(owl_global *g)
869{
870  return(&(g->zephyr_buddycheck_timer));
871}
872
873owl_zbuddylist *owl_global_get_zephyr_buddylist(owl_global *g)
874{
875  return(&(g->zbuddies));
876}
877
878struct termios *owl_global_get_startup_tio(owl_global *g)
879{
880  return(&(g->startup_tio));
881}
Note: See TracBrowser for help on using the repository browser.