source: global.c @ e22f27c

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