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