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