source: global.c @ 3f21b8e

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