[7d4fbcd] | 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" |
---|
[e20dd769] | 10 | #include "globalnotifier.h" |
---|
[7d4fbcd] | 11 | |
---|
| 12 | #ifndef MAXHOSTNAMELEN |
---|
| 13 | #define MAXHOSTNAMELEN 256 |
---|
| 14 | #endif |
---|
| 15 | |
---|
[571fab7] | 16 | static void _owl_global_init_windows(owl_global *g); |
---|
| 17 | |
---|
[7d4fbcd] | 18 | void owl_global_init(owl_global *g) { |
---|
| 19 | struct hostent *hent; |
---|
| 20 | char hostname[MAXHOSTNAMELEN]; |
---|
[ad15610] | 21 | char *cd; |
---|
[e20dd769] | 22 | g->gn = owl_global_notifier_new(g); |
---|
[7d4fbcd] | 23 | |
---|
[8262340] | 24 | g->malloced=0; |
---|
| 25 | g->freed=0; |
---|
| 26 | |
---|
[7d4fbcd] | 27 | gethostname(hostname, MAXHOSTNAMELEN); |
---|
| 28 | hent=gethostbyname(hostname); |
---|
| 29 | if (!hent) { |
---|
[a8938c7] | 30 | g->thishost=owl_strdup("localhost"); |
---|
[7d4fbcd] | 31 | } else { |
---|
[a8938c7] | 32 | g->thishost=owl_strdup(hent->h_name); |
---|
[7d4fbcd] | 33 | } |
---|
| 34 | |
---|
[a999d9e] | 35 | g->context_stack = NULL; |
---|
| 36 | owl_global_push_context(g, OWL_CTX_STARTUP, NULL, NULL); |
---|
| 37 | |
---|
[7d4fbcd] | 38 | g->curmsg=0; |
---|
| 39 | g->topmsg=0; |
---|
[bd783db] | 40 | g->markedmsgid=-1; |
---|
[7d4fbcd] | 41 | g->needrefresh=1; |
---|
[a8938c7] | 42 | g->startupargs=NULL; |
---|
[7d4fbcd] | 43 | |
---|
| 44 | owl_variable_dict_setup(&(g->vars)); |
---|
| 45 | |
---|
| 46 | g->lines=LINES; |
---|
| 47 | g->cols=COLS; |
---|
| 48 | |
---|
| 49 | g->rightshift=0; |
---|
| 50 | |
---|
[38cc669] | 51 | g->tw = NULL; |
---|
[7d4fbcd] | 52 | |
---|
| 53 | owl_keyhandler_init(&g->kh); |
---|
| 54 | owl_keys_setup_keymaps(&g->kh); |
---|
| 55 | |
---|
[129e609] | 56 | owl_dict_create(&(g->filters)); |
---|
| 57 | g->filterlist = NULL; |
---|
[7d4fbcd] | 58 | owl_list_create(&(g->puntlist)); |
---|
[20aced3] | 59 | g->messagequeue = g_queue_new(); |
---|
[f1e629d] | 60 | owl_dict_create(&(g->styledict)); |
---|
[7d4fbcd] | 61 | g->curmsg_vert_offset=0; |
---|
| 62 | g->resizepending=0; |
---|
| 63 | g->direction=OWL_DIRECTION_DOWNWARDS; |
---|
| 64 | g->zaway=0; |
---|
| 65 | if (has_colors()) { |
---|
| 66 | g->hascolors=1; |
---|
| 67 | } |
---|
| 68 | g->colorpairs=COLOR_PAIRS; |
---|
[8fa9562] | 69 | owl_fmtext_init_colorpair_mgr(&(g->cpmgr)); |
---|
[7d4fbcd] | 70 | g->debug=OWL_DEBUG; |
---|
[41c9a96] | 71 | owl_regex_init(&g->search_re); |
---|
[7d4fbcd] | 72 | g->starttime=time(NULL); /* assumes we call init only a start time */ |
---|
[7f792c1] | 73 | g->lastinputtime=g->starttime; |
---|
[700c712] | 74 | g->newmsgproc_pid=0; |
---|
[61e79a9] | 75 | |
---|
[7d4fbcd] | 76 | owl_global_set_config_format(g, 0); |
---|
| 77 | owl_global_set_userclue(g, OWL_USERCLUE_NONE); |
---|
| 78 | owl_global_set_no_have_config(g); |
---|
[10b866d] | 79 | owl_history_init(&(g->msghist)); |
---|
| 80 | owl_history_init(&(g->cmdhist)); |
---|
[5a9f6fe] | 81 | owl_history_set_norepeats(&(g->cmdhist)); |
---|
[7d4fbcd] | 82 | g->nextmsgid=0; |
---|
| 83 | |
---|
| 84 | /* Fill in some variables which don't have constant defaults */ |
---|
| 85 | /* TODO: come back later and check passwd file first */ |
---|
[a8938c7] | 86 | g->homedir=owl_strdup(getenv("HOME")); |
---|
[7d4fbcd] | 87 | |
---|
[b363d83] | 88 | g->confdir = NULL; |
---|
| 89 | g->startupfile = NULL; |
---|
[ad15610] | 90 | cd = owl_sprintf("%s/%s", g->homedir, OWL_CONFIG_DIR); |
---|
[b363d83] | 91 | owl_global_set_confdir(g, cd); |
---|
| 92 | owl_free(cd); |
---|
| 93 | |
---|
[7d4fbcd] | 94 | owl_messagelist_create(&(g->msglist)); |
---|
[571fab7] | 95 | |
---|
| 96 | _owl_global_init_windows(g); |
---|
[d09e5a1] | 97 | |
---|
| 98 | g->aim_screenname=NULL; |
---|
[81655f8] | 99 | g->aim_screenname_for_filters=NULL; |
---|
[d09e5a1] | 100 | g->aim_loggedin=0; |
---|
[aa5f725] | 101 | owl_buddylist_init(&(g->buddylist)); |
---|
[b7bb454] | 102 | |
---|
[09489b89] | 103 | g->havezephyr=0; |
---|
| 104 | g->haveaim=0; |
---|
[b7bb454] | 105 | g->ignoreaimlogin=0; |
---|
[a352335c] | 106 | owl_global_set_no_doaimevents(g); |
---|
[ec6ff52] | 107 | |
---|
| 108 | owl_errqueue_init(&(g->errqueue)); |
---|
[c9e72d1] | 109 | g->got_err_signal=0; |
---|
[5a95b69] | 110 | |
---|
| 111 | owl_zbuddylist_create(&(g->zbuddies)); |
---|
[8e401cae] | 112 | |
---|
[f25812b] | 113 | g->zaldlist = NULL; |
---|
| 114 | g->pseudologin_notify = 0; |
---|
| 115 | |
---|
[a387d12e] | 116 | owl_message_init_fmtext_cache(); |
---|
[df0138f] | 117 | owl_list_create(&(g->io_dispatch_list)); |
---|
[4f2166b] | 118 | owl_list_create(&(g->psa_list)); |
---|
[58d1f8a] | 119 | g->timerlist = NULL; |
---|
[adee9cc] | 120 | g->interrupted = FALSE; |
---|
[571fab7] | 121 | } |
---|
| 122 | |
---|
| 123 | static void _owl_global_init_windows(owl_global *g) |
---|
| 124 | { |
---|
| 125 | /* Create the main window */ |
---|
| 126 | owl_mainpanel_init(&(g->mainpanel)); |
---|
| 127 | |
---|
| 128 | /* Create the widgets */ |
---|
| 129 | owl_mainwin_init(&(g->mw), g->mainpanel.recwin); |
---|
| 130 | owl_popwin_init(&(g->pw)); |
---|
| 131 | owl_msgwin_init(&(g->msgwin), g->mainpanel.msgwin); |
---|
| 132 | owl_sepbar_init(g->mainpanel.sepwin); |
---|
[0881cdd] | 133 | |
---|
| 134 | /* set up a pad for input */ |
---|
| 135 | g->input_pad = newpad(1, 1); |
---|
| 136 | nodelay(g->input_pad, 1); |
---|
| 137 | keypad(g->input_pad, 1); |
---|
| 138 | meta(g->input_pad, 1); |
---|
[7d4fbcd] | 139 | } |
---|
| 140 | |
---|
[eb6cedc] | 141 | /* Called once perl has been initialized */ |
---|
| 142 | void owl_global_complete_setup(owl_global *g) |
---|
| 143 | { |
---|
| 144 | owl_cmddict_setup(&(g->cmds)); |
---|
| 145 | } |
---|
| 146 | |
---|
[8ae2de9] | 147 | /* If *pan does not exist, we create a new panel, otherwise we replace the |
---|
| 148 | window in *pan with win. |
---|
| 149 | |
---|
| 150 | libpanel PANEL objects cannot exist without owner a valid window. This |
---|
| 151 | maintains the invariant for _owl_global_setup_windows. */ |
---|
| 152 | void _owl_panel_set_window(PANEL **pan, WINDOW *win) |
---|
| 153 | { |
---|
| 154 | WINDOW *oldwin; |
---|
[b3adfb5] | 155 | |
---|
| 156 | if (win == NULL) { |
---|
[0e3cdf1] | 157 | owl_function_debugmsg("_owl_panel_set_window: passed NULL win (failed to allocate?)"); |
---|
[b3adfb5] | 158 | endwin(); |
---|
| 159 | exit(50); |
---|
| 160 | } |
---|
| 161 | |
---|
[8ae2de9] | 162 | if (*pan) { |
---|
| 163 | oldwin = panel_window(*pan); |
---|
| 164 | replace_panel(*pan, win); |
---|
| 165 | delwin(oldwin); |
---|
| 166 | } else { |
---|
| 167 | *pan = new_panel(win); |
---|
| 168 | } |
---|
| 169 | } |
---|
| 170 | |
---|
[7d4fbcd] | 171 | owl_context *owl_global_get_context(owl_global *g) { |
---|
[a999d9e] | 172 | if (!g->context_stack) |
---|
| 173 | return NULL; |
---|
| 174 | return g->context_stack->data; |
---|
| 175 | } |
---|
| 176 | |
---|
| 177 | static void owl_global_lookup_keymap(owl_global *g) { |
---|
| 178 | owl_context *c = owl_global_get_context(g); |
---|
| 179 | if (!c || !c->keymap) |
---|
| 180 | return; |
---|
| 181 | |
---|
| 182 | if (!owl_keyhandler_activate(owl_global_get_keyhandler(g), c->keymap)) { |
---|
| 183 | owl_function_error("Unable to activate keymap '%s'", c->keymap); |
---|
| 184 | } |
---|
[7d4fbcd] | 185 | } |
---|
[a999d9e] | 186 | |
---|
| 187 | void owl_global_push_context(owl_global *g, int mode, void *data, const char *keymap) { |
---|
| 188 | owl_context *c; |
---|
| 189 | if (!(mode & OWL_CTX_MODE_BITS)) |
---|
| 190 | mode |= OWL_CTX_INTERACTIVE; |
---|
| 191 | c = owl_malloc(sizeof *c); |
---|
| 192 | c->mode = mode; |
---|
| 193 | c->data = data; |
---|
| 194 | c->keymap = owl_strdup(keymap); |
---|
| 195 | g->context_stack = g_list_prepend(g->context_stack, c); |
---|
| 196 | owl_global_lookup_keymap(g); |
---|
| 197 | } |
---|
| 198 | |
---|
| 199 | void owl_global_pop_context(owl_global *g) { |
---|
| 200 | owl_context *c; |
---|
| 201 | if (!g->context_stack) |
---|
| 202 | return; |
---|
| 203 | c = owl_global_get_context(g); |
---|
| 204 | g->context_stack = g_list_delete_link(g->context_stack, |
---|
| 205 | g->context_stack); |
---|
| 206 | owl_free(c->keymap); |
---|
| 207 | owl_free(c); |
---|
| 208 | owl_global_lookup_keymap(g); |
---|
| 209 | } |
---|
| 210 | |
---|
[8742840] | 211 | int owl_global_get_lines(const owl_global *g) { |
---|
[7d4fbcd] | 212 | return(g->lines); |
---|
| 213 | } |
---|
| 214 | |
---|
[8742840] | 215 | int owl_global_get_cols(const owl_global *g) { |
---|
[7d4fbcd] | 216 | return(g->cols); |
---|
| 217 | } |
---|
| 218 | |
---|
[8742840] | 219 | int owl_global_get_recwin_lines(const owl_global *g) { |
---|
[d2a4534] | 220 | return g->mainpanel.recwinlines; |
---|
[7d4fbcd] | 221 | } |
---|
| 222 | |
---|
| 223 | /* curmsg */ |
---|
| 224 | |
---|
[8742840] | 225 | int owl_global_get_curmsg(const owl_global *g) { |
---|
[7d4fbcd] | 226 | return(g->curmsg); |
---|
| 227 | } |
---|
| 228 | |
---|
| 229 | void owl_global_set_curmsg(owl_global *g, int i) { |
---|
| 230 | g->curmsg=i; |
---|
[608681f] | 231 | g_object_notify(G_OBJECT(g->gn), "curmsg"); |
---|
[7d4fbcd] | 232 | /* we will reset the vertical offset from here */ |
---|
| 233 | /* we might want to move this out to the functions later */ |
---|
| 234 | owl_global_set_curmsg_vert_offset(g, 0); |
---|
| 235 | } |
---|
| 236 | |
---|
| 237 | /* topmsg */ |
---|
| 238 | |
---|
[8742840] | 239 | int owl_global_get_topmsg(const owl_global *g) { |
---|
[7d4fbcd] | 240 | return(g->topmsg); |
---|
| 241 | } |
---|
| 242 | |
---|
| 243 | void owl_global_set_topmsg(owl_global *g, int i) { |
---|
| 244 | g->topmsg=i; |
---|
| 245 | } |
---|
| 246 | |
---|
[70110286] | 247 | /* markedmsgid */ |
---|
| 248 | |
---|
[8742840] | 249 | int owl_global_get_markedmsgid(const owl_global *g) { |
---|
[70110286] | 250 | return(g->markedmsgid); |
---|
| 251 | } |
---|
| 252 | |
---|
| 253 | void owl_global_set_markedmsgid(owl_global *g, int i) { |
---|
| 254 | g->markedmsgid=i; |
---|
| 255 | /* i; index of message in the current view. |
---|
[c08c70a] | 256 | const owl_message *m; |
---|
[70110286] | 257 | owl_view *v; |
---|
| 258 | |
---|
| 259 | v = owl_global_get_current_view(&g); |
---|
| 260 | m = owl_view_get_element(v, i); |
---|
| 261 | g->markedmsgid = m ? owl_message_get_id(m) : 0; |
---|
| 262 | */ |
---|
| 263 | } |
---|
| 264 | |
---|
[7d4fbcd] | 265 | /* windows */ |
---|
| 266 | |
---|
| 267 | owl_mainwin *owl_global_get_mainwin(owl_global *g) { |
---|
| 268 | return(&(g->mw)); |
---|
| 269 | } |
---|
| 270 | |
---|
| 271 | owl_popwin *owl_global_get_popwin(owl_global *g) { |
---|
| 272 | return(&(g->pw)); |
---|
| 273 | } |
---|
| 274 | |
---|
| 275 | /* msglist */ |
---|
| 276 | |
---|
| 277 | owl_messagelist *owl_global_get_msglist(owl_global *g) { |
---|
| 278 | return(&(g->msglist)); |
---|
| 279 | } |
---|
| 280 | |
---|
| 281 | /* keyhandler */ |
---|
| 282 | |
---|
| 283 | owl_keyhandler *owl_global_get_keyhandler(owl_global *g) { |
---|
| 284 | return(&(g->kh)); |
---|
| 285 | } |
---|
| 286 | |
---|
| 287 | /* curses windows */ |
---|
| 288 | |
---|
[385fda9] | 289 | owl_window *owl_global_get_curs_sepwin(const owl_global *g) { |
---|
| 290 | return g->mainpanel.sepwin; |
---|
[7d4fbcd] | 291 | } |
---|
| 292 | |
---|
[f6fae8d] | 293 | owl_window *owl_global_get_curs_typwin(const owl_global *g) { |
---|
| 294 | return g->mainpanel.typwin; |
---|
[7d4fbcd] | 295 | } |
---|
| 296 | |
---|
| 297 | /* typwin */ |
---|
| 298 | |
---|
[8742840] | 299 | owl_editwin *owl_global_get_typwin(const owl_global *g) { |
---|
[a556caa] | 300 | return(g->tw); |
---|
[7d4fbcd] | 301 | } |
---|
| 302 | |
---|
| 303 | /* refresh */ |
---|
| 304 | |
---|
[8742840] | 305 | int owl_global_is_needrefresh(const owl_global *g) { |
---|
[7d4fbcd] | 306 | if (g->needrefresh==1) return(1); |
---|
| 307 | return(0); |
---|
| 308 | } |
---|
| 309 | |
---|
| 310 | void owl_global_set_needrefresh(owl_global *g) { |
---|
| 311 | g->needrefresh=1; |
---|
| 312 | } |
---|
| 313 | |
---|
| 314 | void owl_global_set_noneedrefresh(owl_global *g) { |
---|
| 315 | g->needrefresh=0; |
---|
| 316 | } |
---|
| 317 | |
---|
| 318 | /* variable dictionary */ |
---|
| 319 | |
---|
| 320 | owl_vardict *owl_global_get_vardict(owl_global *g) { |
---|
| 321 | return &(g->vars); |
---|
| 322 | } |
---|
| 323 | |
---|
| 324 | /* command dictionary */ |
---|
| 325 | |
---|
| 326 | owl_cmddict *owl_global_get_cmddict(owl_global *g) { |
---|
| 327 | return &(g->cmds); |
---|
| 328 | } |
---|
| 329 | |
---|
| 330 | /* rightshift */ |
---|
| 331 | |
---|
| 332 | void owl_global_set_rightshift(owl_global *g, int i) { |
---|
[5b80b87] | 333 | g->rightshift = i; |
---|
| 334 | g_object_notify(G_OBJECT(g->gn), "rightshift"); |
---|
[7d4fbcd] | 335 | } |
---|
| 336 | |
---|
[8742840] | 337 | int owl_global_get_rightshift(const owl_global *g) { |
---|
[7d4fbcd] | 338 | return(g->rightshift); |
---|
| 339 | } |
---|
| 340 | |
---|
| 341 | /* typwin */ |
---|
| 342 | |
---|
[58d47ca] | 343 | owl_editwin *owl_global_set_typwin_active(owl_global *g, int style, owl_history *hist) { |
---|
[38cc669] | 344 | int d; |
---|
| 345 | d = owl_global_get_typewindelta(g); |
---|
[73eda8c] | 346 | if (d > 0 && style == OWL_EDITWIN_STYLE_MULTILINE) |
---|
[da466e0] | 347 | owl_function_resize_typwin(owl_global_get_typwin_lines(g) + d); |
---|
| 348 | |
---|
[f6fae8d] | 349 | if (g->typwin_erase_id) { |
---|
| 350 | g_signal_handler_disconnect(owl_global_get_curs_typwin(g), g->typwin_erase_id); |
---|
| 351 | g->typwin_erase_id = 0; |
---|
| 352 | } |
---|
| 353 | |
---|
[38cc669] | 354 | g->tw = owl_editwin_new(owl_global_get_curs_typwin(g), |
---|
| 355 | owl_global_get_typwin_lines(g), |
---|
| 356 | g->cols, |
---|
| 357 | style, |
---|
| 358 | hist); |
---|
[58d47ca] | 359 | return g->tw; |
---|
[7d4fbcd] | 360 | } |
---|
| 361 | |
---|
| 362 | void owl_global_set_typwin_inactive(owl_global *g) { |
---|
[da466e0] | 363 | int d = owl_global_get_typewindelta(g); |
---|
[73eda8c] | 364 | if (d > 0 && owl_editwin_get_style(g->tw) == OWL_EDITWIN_STYLE_MULTILINE) |
---|
[da466e0] | 365 | owl_function_resize_typwin(owl_global_get_typwin_lines(g) - d); |
---|
| 366 | |
---|
[f6fae8d] | 367 | if (!g->typwin_erase_id) { |
---|
| 368 | g->typwin_erase_id = |
---|
| 369 | g_signal_connect(owl_global_get_curs_typwin(g), "redraw", G_CALLBACK(owl_window_erase_cb), NULL); |
---|
| 370 | } |
---|
| 371 | owl_window_dirty(owl_global_get_curs_typwin(g)); |
---|
| 372 | |
---|
[38cc669] | 373 | g->tw = NULL; |
---|
[7d4fbcd] | 374 | } |
---|
| 375 | |
---|
| 376 | /* resize */ |
---|
| 377 | |
---|
| 378 | void owl_global_set_resize_pending(owl_global *g) { |
---|
| 379 | g->resizepending=1; |
---|
| 380 | } |
---|
| 381 | |
---|
[8742840] | 382 | const char *owl_global_get_homedir(const owl_global *g) { |
---|
[a8938c7] | 383 | if (g->homedir) return(g->homedir); |
---|
| 384 | return("/"); |
---|
[7d4fbcd] | 385 | } |
---|
| 386 | |
---|
[8742840] | 387 | const char *owl_global_get_confdir(const owl_global *g) { |
---|
[b363d83] | 388 | if (g->confdir) return(g->confdir); |
---|
| 389 | return("/"); |
---|
| 390 | } |
---|
| 391 | |
---|
| 392 | /* |
---|
| 393 | * Setting this also sets startupfile to confdir/startup |
---|
| 394 | */ |
---|
[e19eb97] | 395 | void owl_global_set_confdir(owl_global *g, const char *cd) { |
---|
[27f6487] | 396 | owl_free(g->confdir); |
---|
[b363d83] | 397 | g->confdir = owl_strdup(cd); |
---|
[27f6487] | 398 | owl_free(g->startupfile); |
---|
[b363d83] | 399 | g->startupfile = owl_sprintf("%s/startup", cd); |
---|
| 400 | } |
---|
| 401 | |
---|
[8742840] | 402 | const char *owl_global_get_startupfile(const owl_global *g) { |
---|
[b363d83] | 403 | if(g->startupfile) return(g->startupfile); |
---|
| 404 | return("/"); |
---|
| 405 | } |
---|
| 406 | |
---|
[8742840] | 407 | int owl_global_get_direction(const owl_global *g) { |
---|
[7d4fbcd] | 408 | return(g->direction); |
---|
| 409 | } |
---|
| 410 | |
---|
| 411 | void owl_global_set_direction_downwards(owl_global *g) { |
---|
| 412 | g->direction=OWL_DIRECTION_DOWNWARDS; |
---|
| 413 | } |
---|
| 414 | |
---|
| 415 | void owl_global_set_direction_upwards(owl_global *g) { |
---|
| 416 | g->direction=OWL_DIRECTION_UPWARDS; |
---|
| 417 | } |
---|
| 418 | |
---|
| 419 | /* perl stuff */ |
---|
| 420 | |
---|
| 421 | void owl_global_set_perlinterp(owl_global *g, void *p) { |
---|
| 422 | g->perl=p; |
---|
| 423 | } |
---|
| 424 | |
---|
[8742840] | 425 | void *owl_global_get_perlinterp(const owl_global *g) { |
---|
[7d4fbcd] | 426 | return(g->perl); |
---|
| 427 | } |
---|
| 428 | |
---|
[8742840] | 429 | int owl_global_is_config_format(const owl_global *g) { |
---|
[7d4fbcd] | 430 | if (g->config_format) return(1); |
---|
| 431 | return(0); |
---|
| 432 | } |
---|
| 433 | |
---|
| 434 | void owl_global_set_config_format(owl_global *g, int state) { |
---|
| 435 | if (state==1) { |
---|
| 436 | g->config_format=1; |
---|
| 437 | } else { |
---|
| 438 | g->config_format=0; |
---|
| 439 | } |
---|
| 440 | } |
---|
| 441 | |
---|
| 442 | void owl_global_set_have_config(owl_global *g) { |
---|
| 443 | g->haveconfig=1; |
---|
| 444 | } |
---|
| 445 | |
---|
| 446 | void owl_global_set_no_have_config(owl_global *g) { |
---|
| 447 | g->haveconfig=0; |
---|
| 448 | } |
---|
| 449 | |
---|
| 450 | int owl_global_have_config(owl_global *g) { |
---|
| 451 | if (g->haveconfig) return(1); |
---|
| 452 | return(0); |
---|
| 453 | } |
---|
| 454 | |
---|
[285bc9a] | 455 | /* |
---|
| 456 | * Compute the size of the terminal. Try a ioctl, fallback to other stuff on |
---|
| 457 | * fail. |
---|
| 458 | */ |
---|
[d39f68c] | 459 | void owl_global_get_terminal_size(int *lines, int *cols) { |
---|
[285bc9a] | 460 | struct winsize size; |
---|
| 461 | /* get the new size */ |
---|
| 462 | ioctl(STDIN_FILENO, TIOCGWINSZ, &size); |
---|
| 463 | if (size.ws_row) { |
---|
| 464 | *lines = size.ws_row; |
---|
| 465 | } else { |
---|
| 466 | *lines = LINES; |
---|
| 467 | } |
---|
| 468 | |
---|
| 469 | if (size.ws_col) { |
---|
| 470 | *cols = size.ws_col; |
---|
| 471 | } else { |
---|
| 472 | *cols = COLS; |
---|
| 473 | } |
---|
| 474 | } |
---|
| 475 | |
---|
[99ce51c] | 476 | void owl_global_check_resize(owl_global *g) { |
---|
[3e0147f] | 477 | /* resize the screen. If lines or cols is 0 use the terminal size */ |
---|
[7d4fbcd] | 478 | if (!g->resizepending) return; |
---|
[8479494] | 479 | g->resizepending = 0; |
---|
[7d4fbcd] | 480 | |
---|
[99ce51c] | 481 | owl_global_get_terminal_size(&g->lines, &g->cols); |
---|
[7a6e6c7] | 482 | owl_window_resize(owl_window_get_screen(), g->lines, g->cols); |
---|
[7d4fbcd] | 483 | |
---|
[f9f88f3] | 484 | owl_function_debugmsg("New size is %i lines, %i cols.", g->lines, g->cols); |
---|
| 485 | } |
---|
| 486 | |
---|
[7d4fbcd] | 487 | /* debug */ |
---|
| 488 | |
---|
[8742840] | 489 | int owl_global_is_debug_fast(const owl_global *g) { |
---|
[7d4fbcd] | 490 | if (g->debug) return(1); |
---|
| 491 | return(0); |
---|
| 492 | } |
---|
| 493 | |
---|
| 494 | /* starttime */ |
---|
| 495 | |
---|
[8742840] | 496 | time_t owl_global_get_starttime(const owl_global *g) { |
---|
[7d4fbcd] | 497 | return(g->starttime); |
---|
| 498 | } |
---|
| 499 | |
---|
[8742840] | 500 | time_t owl_global_get_runtime(const owl_global *g) { |
---|
[7d4fbcd] | 501 | return(time(NULL)-g->starttime); |
---|
| 502 | } |
---|
| 503 | |
---|
[8742840] | 504 | time_t owl_global_get_lastinputtime(const owl_global *g) { |
---|
[7f792c1] | 505 | return(g->lastinputtime); |
---|
| 506 | } |
---|
| 507 | |
---|
[eebef19] | 508 | void owl_global_set_lastinputtime(owl_global *g, time_t time) { |
---|
| 509 | g->lastinputtime = time; |
---|
[7f792c1] | 510 | } |
---|
| 511 | |
---|
[8742840] | 512 | time_t owl_global_get_idletime(const owl_global *g) { |
---|
[7f792c1] | 513 | return(time(NULL)-g->lastinputtime); |
---|
| 514 | } |
---|
| 515 | |
---|
[8742840] | 516 | const char *owl_global_get_hostname(const owl_global *g) { |
---|
[a8938c7] | 517 | if (g->thishost) return(g->thishost); |
---|
| 518 | return(""); |
---|
[61e79a9] | 519 | } |
---|
| 520 | |
---|
[7d4fbcd] | 521 | /* userclue */ |
---|
| 522 | |
---|
| 523 | void owl_global_set_userclue(owl_global *g, int clue) { |
---|
| 524 | g->userclue=clue; |
---|
| 525 | } |
---|
| 526 | |
---|
| 527 | void owl_global_add_userclue(owl_global *g, int clue) { |
---|
| 528 | g->userclue|=clue; |
---|
| 529 | } |
---|
| 530 | |
---|
[8742840] | 531 | int owl_global_get_userclue(const owl_global *g) { |
---|
[7d4fbcd] | 532 | return(g->userclue); |
---|
| 533 | } |
---|
| 534 | |
---|
[8742840] | 535 | int owl_global_is_userclue(const owl_global *g, int clue) { |
---|
[7d4fbcd] | 536 | if (g->userclue & clue) return(1); |
---|
| 537 | return(0); |
---|
| 538 | } |
---|
| 539 | |
---|
| 540 | /* viewwin */ |
---|
| 541 | |
---|
| 542 | owl_viewwin *owl_global_get_viewwin(owl_global *g) { |
---|
| 543 | return(&(g->vw)); |
---|
| 544 | } |
---|
| 545 | |
---|
| 546 | |
---|
| 547 | /* vert offset */ |
---|
| 548 | |
---|
[8742840] | 549 | int owl_global_get_curmsg_vert_offset(const owl_global *g) { |
---|
[7d4fbcd] | 550 | return(g->curmsg_vert_offset); |
---|
| 551 | } |
---|
| 552 | |
---|
| 553 | void owl_global_set_curmsg_vert_offset(owl_global *g, int i) { |
---|
[5b80b87] | 554 | g->curmsg_vert_offset = i; |
---|
| 555 | g_object_notify(G_OBJECT(g->gn), "curmsg-vert-offset"); |
---|
[7d4fbcd] | 556 | } |
---|
| 557 | |
---|
| 558 | /* startup args */ |
---|
| 559 | |
---|
[e19eb97] | 560 | void owl_global_set_startupargs(owl_global *g, int argc, const char *const *argv) { |
---|
[a8938c7] | 561 | int i, len; |
---|
| 562 | |
---|
| 563 | if (g->startupargs) owl_free(g->startupargs); |
---|
| 564 | |
---|
| 565 | len=0; |
---|
| 566 | for (i=0; i<argc; i++) { |
---|
[591e6aa7] | 567 | len+=strlen(argv[i])+5; |
---|
[a8938c7] | 568 | } |
---|
[34509d5] | 569 | g->startupargs=owl_malloc(len+5); |
---|
[7d4fbcd] | 570 | |
---|
| 571 | strcpy(g->startupargs, ""); |
---|
| 572 | for (i=0; i<argc; i++) { |
---|
[b9cb41b] | 573 | sprintf(g->startupargs + strlen(g->startupargs), "%s ", argv[i]); |
---|
[7d4fbcd] | 574 | } |
---|
| 575 | g->startupargs[strlen(g->startupargs)-1]='\0'; |
---|
| 576 | } |
---|
| 577 | |
---|
[8742840] | 578 | const char *owl_global_get_startupargs(const owl_global *g) { |
---|
[a8938c7] | 579 | if (g->startupargs) return(g->startupargs); |
---|
| 580 | return(""); |
---|
[7d4fbcd] | 581 | } |
---|
| 582 | |
---|
| 583 | /* history */ |
---|
| 584 | |
---|
[10b866d] | 585 | owl_history *owl_global_get_msg_history(owl_global *g) { |
---|
| 586 | return(&(g->msghist)); |
---|
| 587 | } |
---|
| 588 | |
---|
| 589 | owl_history *owl_global_get_cmd_history(owl_global *g) { |
---|
| 590 | return(&(g->cmdhist)); |
---|
[7d4fbcd] | 591 | } |
---|
| 592 | |
---|
| 593 | /* filterlist */ |
---|
[129e609] | 594 | typedef struct _owl_global_filter_ent { /* noproto */ |
---|
| 595 | owl_global *g; |
---|
| 596 | owl_filter *f; |
---|
| 597 | } owl_global_filter_ent; |
---|
[7d4fbcd] | 598 | |
---|
[8742840] | 599 | owl_filter *owl_global_get_filter(const owl_global *g, const char *name) { |
---|
[129e609] | 600 | owl_global_filter_ent *e = owl_dict_find_element(&(g->filters), name); |
---|
| 601 | if (e) return e->f; |
---|
| 602 | return NULL; |
---|
| 603 | } |
---|
[7d4fbcd] | 604 | |
---|
[5294cbf] | 605 | static void owl_global_delete_filter_ent(void *data) |
---|
| 606 | { |
---|
[129e609] | 607 | owl_global_filter_ent *e = data; |
---|
| 608 | e->g->filterlist = g_list_remove(e->g->filterlist, e->f); |
---|
| 609 | owl_filter_delete(e->f); |
---|
| 610 | owl_free(e); |
---|
[7d4fbcd] | 611 | } |
---|
| 612 | |
---|
| 613 | void owl_global_add_filter(owl_global *g, owl_filter *f) { |
---|
[129e609] | 614 | owl_global_filter_ent *e = owl_malloc(sizeof *e); |
---|
| 615 | e->g = g; |
---|
| 616 | e->f = f; |
---|
| 617 | |
---|
| 618 | owl_dict_insert_element(&(g->filters), owl_filter_get_name(f), |
---|
[5294cbf] | 619 | e, owl_global_delete_filter_ent); |
---|
[129e609] | 620 | g->filterlist = g_list_append(g->filterlist, f); |
---|
[7d4fbcd] | 621 | } |
---|
| 622 | |
---|
[e19eb97] | 623 | void owl_global_remove_filter(owl_global *g, const char *name) { |
---|
[129e609] | 624 | owl_global_filter_ent *e = owl_dict_remove_element(&(g->filters), name); |
---|
| 625 | if (e) |
---|
[5294cbf] | 626 | owl_global_delete_filter_ent(e); |
---|
[7d4fbcd] | 627 | } |
---|
| 628 | |
---|
| 629 | /* nextmsgid */ |
---|
| 630 | |
---|
| 631 | int owl_global_get_nextmsgid(owl_global *g) { |
---|
| 632 | return(g->nextmsgid++); |
---|
| 633 | } |
---|
| 634 | |
---|
| 635 | /* current view */ |
---|
| 636 | |
---|
| 637 | owl_view *owl_global_get_current_view(owl_global *g) { |
---|
| 638 | return(&(g->current_view)); |
---|
| 639 | } |
---|
| 640 | |
---|
| 641 | /* has colors */ |
---|
| 642 | |
---|
[8742840] | 643 | int owl_global_get_hascolors(const owl_global *g) { |
---|
[7d4fbcd] | 644 | if (g->hascolors) return(1); |
---|
| 645 | return(0); |
---|
| 646 | } |
---|
| 647 | |
---|
| 648 | /* color pairs */ |
---|
| 649 | |
---|
[8742840] | 650 | int owl_global_get_colorpairs(const owl_global *g) { |
---|
[7d4fbcd] | 651 | return(g->colorpairs); |
---|
| 652 | } |
---|
| 653 | |
---|
[8fa9562] | 654 | owl_colorpair_mgr *owl_global_get_colorpair_mgr(owl_global *g) { |
---|
| 655 | return(&(g->cpmgr)); |
---|
| 656 | } |
---|
| 657 | |
---|
[7d4fbcd] | 658 | /* puntlist */ |
---|
| 659 | |
---|
| 660 | owl_list *owl_global_get_puntlist(owl_global *g) { |
---|
| 661 | return(&(g->puntlist)); |
---|
| 662 | } |
---|
| 663 | |
---|
[c08c70a] | 664 | int owl_global_message_is_puntable(owl_global *g, const owl_message *m) { |
---|
[77bced3] | 665 | const owl_list *pl; |
---|
[7d4fbcd] | 666 | int i, j; |
---|
| 667 | |
---|
| 668 | pl=owl_global_get_puntlist(g); |
---|
| 669 | j=owl_list_get_size(pl); |
---|
| 670 | for (i=0; i<j; i++) { |
---|
| 671 | if (owl_filter_message_match(owl_list_get_element(pl, i), m)) return(1); |
---|
| 672 | } |
---|
| 673 | return(0); |
---|
| 674 | } |
---|
| 675 | |
---|
| 676 | int owl_global_should_followlast(owl_global *g) { |
---|
[9e5c9f3] | 677 | const owl_view *v; |
---|
[7d4fbcd] | 678 | |
---|
| 679 | if (!owl_global_is__followlast(g)) return(0); |
---|
| 680 | |
---|
| 681 | v=owl_global_get_current_view(g); |
---|
| 682 | |
---|
| 683 | if (owl_global_get_curmsg(g)==owl_view_get_size(v)-1) return(1); |
---|
| 684 | return(0); |
---|
| 685 | } |
---|
[1fd0b25] | 686 | |
---|
[8742840] | 687 | int owl_global_is_search_active(const owl_global *g) { |
---|
[41c9a96] | 688 | if (owl_regex_is_set(&g->search_re)) return(1); |
---|
[1fd0b25] | 689 | return(0); |
---|
| 690 | } |
---|
| 691 | |
---|
[89b2daf] | 692 | void owl_global_set_search_re(owl_global *g, const owl_regex *re) { |
---|
[41c9a96] | 693 | if (owl_regex_is_set(&g->search_re)) { |
---|
[5cbc929] | 694 | owl_regex_cleanup(&g->search_re); |
---|
[41c9a96] | 695 | owl_regex_init(&g->search_re); |
---|
| 696 | } |
---|
| 697 | if (re != NULL) |
---|
| 698 | owl_regex_copy(re, &g->search_re); |
---|
[1fd0b25] | 699 | } |
---|
| 700 | |
---|
[8742840] | 701 | const owl_regex *owl_global_get_search_re(const owl_global *g) { |
---|
[41c9a96] | 702 | return &g->search_re; |
---|
[1fd0b25] | 703 | } |
---|
[700c712] | 704 | |
---|
[0e5afa2] | 705 | void owl_global_set_newmsgproc_pid(owl_global *g, pid_t i) { |
---|
[700c712] | 706 | g->newmsgproc_pid=i; |
---|
| 707 | } |
---|
| 708 | |
---|
[0e5afa2] | 709 | pid_t owl_global_get_newmsgproc_pid(const owl_global *g) { |
---|
[700c712] | 710 | return(g->newmsgproc_pid); |
---|
| 711 | } |
---|
| 712 | |
---|
[d09e5a1] | 713 | /* AIM stuff */ |
---|
| 714 | |
---|
[8742840] | 715 | int owl_global_is_aimloggedin(const owl_global *g) |
---|
[6a415e9] | 716 | { |
---|
[d09e5a1] | 717 | if (g->aim_loggedin) return(1); |
---|
| 718 | return(0); |
---|
| 719 | } |
---|
| 720 | |
---|
[8742840] | 721 | const char *owl_global_get_aim_screenname(const owl_global *g) |
---|
[6a415e9] | 722 | { |
---|
[a352335c] | 723 | if (owl_global_is_aimloggedin(g)) { |
---|
| 724 | return (g->aim_screenname); |
---|
| 725 | } |
---|
| 726 | return(""); |
---|
[d09e5a1] | 727 | } |
---|
| 728 | |
---|
[8742840] | 729 | const char *owl_global_get_aim_screenname_for_filters(const owl_global *g) |
---|
[81655f8] | 730 | { |
---|
| 731 | if (owl_global_is_aimloggedin(g)) { |
---|
| 732 | return (g->aim_screenname_for_filters); |
---|
| 733 | } |
---|
| 734 | return(""); |
---|
| 735 | } |
---|
| 736 | |
---|
[e19eb97] | 737 | void owl_global_set_aimloggedin(owl_global *g, const char *screenname) |
---|
[6a415e9] | 738 | { |
---|
[65b2173] | 739 | char *sn_escaped; |
---|
[e19eb97] | 740 | const char *quote; |
---|
[d09e5a1] | 741 | g->aim_loggedin=1; |
---|
| 742 | if (g->aim_screenname) owl_free(g->aim_screenname); |
---|
[81655f8] | 743 | if (g->aim_screenname_for_filters) owl_free(g->aim_screenname_for_filters); |
---|
[d09e5a1] | 744 | g->aim_screenname=owl_strdup(screenname); |
---|
[81655f8] | 745 | sn_escaped = owl_text_quote(screenname, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH); |
---|
| 746 | quote = owl_getquoting(sn_escaped); |
---|
[9f4e3f8] | 747 | g->aim_screenname_for_filters=owl_sprintf("%s%s%s", quote, sn_escaped, quote); |
---|
[81655f8] | 748 | owl_free(sn_escaped); |
---|
[d09e5a1] | 749 | } |
---|
| 750 | |
---|
[6a415e9] | 751 | void owl_global_set_aimnologgedin(owl_global *g) |
---|
| 752 | { |
---|
[d09e5a1] | 753 | g->aim_loggedin=0; |
---|
| 754 | } |
---|
| 755 | |
---|
[8742840] | 756 | int owl_global_is_doaimevents(const owl_global *g) |
---|
[a352335c] | 757 | { |
---|
| 758 | if (g->aim_doprocessing) return(1); |
---|
| 759 | return(0); |
---|
| 760 | } |
---|
| 761 | |
---|
| 762 | void owl_global_set_doaimevents(owl_global *g) |
---|
| 763 | { |
---|
| 764 | g->aim_doprocessing=1; |
---|
| 765 | } |
---|
| 766 | |
---|
| 767 | void owl_global_set_no_doaimevents(owl_global *g) |
---|
| 768 | { |
---|
| 769 | g->aim_doprocessing=0; |
---|
| 770 | } |
---|
| 771 | |
---|
[6a415e9] | 772 | aim_session_t *owl_global_get_aimsess(owl_global *g) |
---|
| 773 | { |
---|
[d09e5a1] | 774 | return(&(g->aimsess)); |
---|
| 775 | } |
---|
| 776 | |
---|
[c15bbfb] | 777 | aim_conn_t *owl_global_get_bosconn(owl_global *g) |
---|
| 778 | { |
---|
| 779 | return(&(g->bosconn)); |
---|
| 780 | } |
---|
| 781 | |
---|
| 782 | void owl_global_set_bossconn(owl_global *g, aim_conn_t *conn) |
---|
[6a415e9] | 783 | { |
---|
[c15bbfb] | 784 | g->bosconn=*conn; |
---|
[d09e5a1] | 785 | } |
---|
| 786 | |
---|
| 787 | /* message queue */ |
---|
| 788 | |
---|
[6a415e9] | 789 | void owl_global_messagequeue_addmsg(owl_global *g, owl_message *m) |
---|
| 790 | { |
---|
[20aced3] | 791 | g_queue_push_tail(g->messagequeue, m); |
---|
[d09e5a1] | 792 | } |
---|
| 793 | |
---|
| 794 | /* pop off the first message and return it. Return NULL if the queue |
---|
| 795 | * is empty. The caller should free the message after using it, if |
---|
| 796 | * necessary. |
---|
| 797 | */ |
---|
[13a3c1db] | 798 | owl_message *owl_global_messagequeue_popmsg(owl_global *g) |
---|
[6a415e9] | 799 | { |
---|
[d09e5a1] | 800 | owl_message *out; |
---|
| 801 | |
---|
[20aced3] | 802 | if (g_queue_is_empty(g->messagequeue)) |
---|
| 803 | return NULL; |
---|
| 804 | out = g_queue_pop_head(g->messagequeue); |
---|
| 805 | return out; |
---|
[d09e5a1] | 806 | } |
---|
| 807 | |
---|
[6a415e9] | 808 | int owl_global_messagequeue_pending(owl_global *g) |
---|
| 809 | { |
---|
[20aced3] | 810 | return !g_queue_is_empty(g->messagequeue); |
---|
[d09e5a1] | 811 | } |
---|
[aa5f725] | 812 | |
---|
[6a415e9] | 813 | owl_buddylist *owl_global_get_buddylist(owl_global *g) |
---|
| 814 | { |
---|
[aa5f725] | 815 | return(&(g->buddylist)); |
---|
| 816 | } |
---|
| 817 | |
---|
[bd3f232] | 818 | /* style */ |
---|
| 819 | |
---|
| 820 | /* Return the style with name 'name'. If it does not exist return |
---|
| 821 | * NULL */ |
---|
[8742840] | 822 | const owl_style *owl_global_get_style_by_name(const owl_global *g, const char *name) |
---|
[bd3f232] | 823 | { |
---|
[f1e629d] | 824 | return owl_dict_find_element(&(g->styledict), name); |
---|
| 825 | } |
---|
| 826 | |
---|
| 827 | /* creates a list and fills it in with keys. duplicates the keys, |
---|
| 828 | * so they will need to be freed by the caller. */ |
---|
[8742840] | 829 | int owl_global_get_style_names(const owl_global *g, owl_list *l) { |
---|
[f1e629d] | 830 | return owl_dict_get_keys(&(g->styledict), l); |
---|
[bd3f232] | 831 | } |
---|
| 832 | |
---|
[cf83b7a] | 833 | void owl_global_add_style(owl_global *g, owl_style *s) |
---|
| 834 | { |
---|
[f1fc47f] | 835 | /* |
---|
| 836 | * If we're redefining the current style, make sure to update |
---|
| 837 | * pointers to it. |
---|
| 838 | */ |
---|
| 839 | if(g->current_view.style |
---|
| 840 | && !strcmp(owl_style_get_name(g->current_view.style), |
---|
| 841 | owl_style_get_name(s))) |
---|
| 842 | g->current_view.style = s; |
---|
| 843 | owl_dict_insert_element(&(g->styledict), owl_style_get_name(s), |
---|
[516c27e] | 844 | s, (void (*)(void *))owl_style_delete); |
---|
[bd3f232] | 845 | } |
---|
[cf83b7a] | 846 | |
---|
[09489b89] | 847 | void owl_global_set_haveaim(owl_global *g) |
---|
| 848 | { |
---|
| 849 | g->haveaim=1; |
---|
| 850 | } |
---|
| 851 | |
---|
[8742840] | 852 | int owl_global_is_haveaim(const owl_global *g) |
---|
[09489b89] | 853 | { |
---|
| 854 | if (g->haveaim) return(1); |
---|
| 855 | return(0); |
---|
| 856 | } |
---|
| 857 | |
---|
[b7bb454] | 858 | void owl_global_set_ignore_aimlogin(owl_global *g) |
---|
| 859 | { |
---|
| 860 | g->ignoreaimlogin = 1; |
---|
| 861 | } |
---|
| 862 | |
---|
| 863 | void owl_global_unset_ignore_aimlogin(owl_global *g) |
---|
| 864 | { |
---|
| 865 | g->ignoreaimlogin = 0; |
---|
| 866 | } |
---|
| 867 | |
---|
[8742840] | 868 | int owl_global_is_ignore_aimlogin(const owl_global *g) |
---|
[b7bb454] | 869 | { |
---|
| 870 | return g->ignoreaimlogin; |
---|
| 871 | } |
---|
| 872 | |
---|
[09489b89] | 873 | void owl_global_set_havezephyr(owl_global *g) |
---|
| 874 | { |
---|
| 875 | g->havezephyr=1; |
---|
| 876 | } |
---|
| 877 | |
---|
[8742840] | 878 | int owl_global_is_havezephyr(const owl_global *g) |
---|
[09489b89] | 879 | { |
---|
| 880 | if (g->havezephyr) return(1); |
---|
| 881 | return(0); |
---|
| 882 | } |
---|
[de03334] | 883 | |
---|
[ec6ff52] | 884 | owl_errqueue *owl_global_get_errqueue(owl_global *g) |
---|
| 885 | { |
---|
| 886 | return(&(g->errqueue)); |
---|
| 887 | } |
---|
[c9e72d1] | 888 | |
---|
| 889 | void owl_global_set_errsignal(owl_global *g, int signum, siginfo_t *siginfo) |
---|
| 890 | { |
---|
| 891 | g->got_err_signal = signum; |
---|
| 892 | if (siginfo) { |
---|
| 893 | g->err_signal_info = *siginfo; |
---|
| 894 | } else { |
---|
[7892963] | 895 | siginfo_t si; |
---|
| 896 | memset(&si, 0, sizeof(si)); |
---|
| 897 | g->err_signal_info = si; |
---|
[c9e72d1] | 898 | } |
---|
| 899 | } |
---|
| 900 | |
---|
| 901 | int owl_global_get_errsignal_and_clear(owl_global *g, siginfo_t *siginfo) |
---|
| 902 | { |
---|
| 903 | int signum; |
---|
| 904 | if (siginfo && g->got_err_signal) { |
---|
| 905 | *siginfo = g->err_signal_info; |
---|
| 906 | } |
---|
| 907 | signum = g->got_err_signal; |
---|
| 908 | g->got_err_signal = 0; |
---|
| 909 | return signum; |
---|
| 910 | } |
---|
| 911 | |
---|
[5a95b69] | 912 | |
---|
| 913 | owl_zbuddylist *owl_global_get_zephyr_buddylist(owl_global *g) |
---|
| 914 | { |
---|
| 915 | return(&(g->zbuddies)); |
---|
| 916 | } |
---|
[8232149] | 917 | |
---|
[f25812b] | 918 | GList **owl_global_get_zaldlist(owl_global *g) |
---|
| 919 | { |
---|
| 920 | return &(g->zaldlist); |
---|
| 921 | } |
---|
| 922 | |
---|
| 923 | int owl_global_get_pseudologin_notify(owl_global *g) |
---|
| 924 | { |
---|
| 925 | return g->pseudologin_notify; |
---|
| 926 | } |
---|
| 927 | |
---|
| 928 | void owl_global_set_pseudologin_notify(owl_global *g, int notify) |
---|
| 929 | { |
---|
| 930 | g->pseudologin_notify = notify; |
---|
| 931 | } |
---|
| 932 | |
---|
[8232149] | 933 | struct termios *owl_global_get_startup_tio(owl_global *g) |
---|
| 934 | { |
---|
| 935 | return(&(g->startup_tio)); |
---|
| 936 | } |
---|
[8e401cae] | 937 | |
---|
[df0138f] | 938 | owl_list *owl_global_get_io_dispatch_list(owl_global *g) |
---|
| 939 | { |
---|
| 940 | return &(g->io_dispatch_list); |
---|
| 941 | } |
---|
| 942 | |
---|
[4f2166b] | 943 | owl_list *owl_global_get_psa_list(owl_global *g) |
---|
| 944 | { |
---|
| 945 | return &(g->psa_list); |
---|
| 946 | } |
---|
| 947 | |
---|
[58d1f8a] | 948 | GList **owl_global_get_timerlist(owl_global *g) |
---|
[b7bb454] | 949 | { |
---|
[58d1f8a] | 950 | return &(g->timerlist); |
---|
[b7bb454] | 951 | } |
---|
[adee9cc] | 952 | |
---|
[8742840] | 953 | int owl_global_is_interrupted(const owl_global *g) { |
---|
[0cb6c26] | 954 | return g->interrupted; |
---|
[adee9cc] | 955 | } |
---|
| 956 | |
---|
| 957 | void owl_global_set_interrupted(owl_global *g) { |
---|
| 958 | g->interrupted = 1; |
---|
| 959 | } |
---|
| 960 | |
---|
| 961 | void owl_global_unset_interrupted(owl_global *g) { |
---|
| 962 | g->interrupted = 0; |
---|
| 963 | } |
---|