Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/main.c @ 1780:e4378fbab5d7
Major API cleanup - bump API to 4
Get rid of old CamelCase names in screen.h
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sun, 14 Mar 2010 12:09:08 +0100 |
parents | 6e856c5858c3 |
children | e73cd9377a4e |
comparison
equal
deleted
inserted
replaced
1779:2911c950dcd1 | 1780:e4378fbab5d7 |
---|---|
77 | 77 |
78 static void mcabber_terminate(const char *msg) | 78 static void mcabber_terminate(const char *msg) |
79 { | 79 { |
80 fifo_deinit(); | 80 fifo_deinit(); |
81 xmpp_disconnect(); | 81 xmpp_disconnect(); |
82 scr_TerminateCurses(); | 82 scr_terminate_curses(); |
83 | 83 |
84 // Restore term settings, if needed. | 84 // Restore term settings, if needed. |
85 if (backup_termios) | 85 if (backup_termios) |
86 tcsetattr(fileno(stdin), TCSAFLUSH, backup_termios); | 86 tcsetattr(fileno(stdin), TCSAFLUSH, backup_termios); |
87 | 87 |
101 // Check the exit status value if 'eventcmd_checkstatus' is set | 101 // Check the exit status value if 'eventcmd_checkstatus' is set |
102 if (settings_opt_get_int("eventcmd_checkstatus")) { | 102 if (settings_opt_get_int("eventcmd_checkstatus")) { |
103 if (pid > 0) { | 103 if (pid > 0) { |
104 // exit status 2 -> beep | 104 // exit status 2 -> beep |
105 if (WIFEXITED(status) && WEXITSTATUS(status) == 2) { | 105 if (WIFEXITED(status) && WEXITSTATUS(status) == 2) { |
106 scr_Beep(); | 106 scr_beep(); |
107 } | 107 } |
108 } | 108 } |
109 } | 109 } |
110 } while (pid > 0); | 110 } while (pid > 0); |
111 signal(SIGCHLD, sig_handler); | 111 signal(SIGCHLD, sig_handler); |
287 keycode kcode; | 287 keycode kcode; |
288 | 288 |
289 if (terminate_ui) { | 289 if (terminate_ui) { |
290 return FALSE; | 290 return FALSE; |
291 } | 291 } |
292 scr_DoUpdate(); | 292 scr_do_update(); |
293 scr_Getch(&kcode); | 293 scr_getch(&kcode); |
294 | 294 |
295 while (kcode.value != ERR) { | 295 while (kcode.value != ERR) { |
296 process_key(kcode); | 296 scr_process_key(kcode); |
297 scr_Getch(&kcode); | 297 scr_getch(&kcode); |
298 } | 298 } |
299 scr_CheckAutoAway(FALSE); | 299 scr_check_auto_away(FALSE); |
300 | 300 |
301 return TRUE; | 301 return TRUE; |
302 } | 302 } |
303 | 303 |
304 static gboolean mcabber_source_dispatch(GSource *source, GSourceFunc callback, | 304 static gboolean mcabber_source_dispatch(GSource *source, GSourceFunc callback, |
365 caps_init(); | 365 caps_init(); |
366 #ifdef MODULES_ENABLE | 366 #ifdef MODULES_ENABLE |
367 modules_init(); | 367 modules_init(); |
368 #endif | 368 #endif |
369 /* Initialize charset */ | 369 /* Initialize charset */ |
370 scr_InitLocaleCharSet(); | 370 scr_init_locale_charset(); |
371 ut_InitDebug(); | 371 ut_init_debug(); |
372 help_init(); | 372 help_init(); |
373 | 373 |
374 /* Parsing config file... */ | 374 /* Parsing config file... */ |
375 ret = cfg_read_file(configFile, TRUE); | 375 ret = cfg_read_file(configFile, TRUE); |
376 /* free() configFile if it has been allocated during options parsing */ | 376 /* free() configFile if it has been allocated during options parsing */ |
402 if (settings_opt_get_int("pgp")) | 402 if (settings_opt_get_int("pgp")) |
403 main_init_pgp(); | 403 main_init_pgp(); |
404 | 404 |
405 /* Initialize N-Curses */ | 405 /* Initialize N-Curses */ |
406 scr_LogPrint(LPRINT_DEBUG, "Initializing N-Curses..."); | 406 scr_LogPrint(LPRINT_DEBUG, "Initializing N-Curses..."); |
407 scr_InitCurses(); | 407 scr_init_curses(); |
408 scr_DrawMainWindow(TRUE); | 408 scr_draw_main_window(TRUE); |
409 | 409 |
410 optval = (settings_opt_get_int("logging") > 0); | 410 optval = (settings_opt_get_int("logging") > 0); |
411 optval2 = (settings_opt_get_int("load_logs") > 0); | 411 optval2 = (settings_opt_get_int("load_logs") > 0); |
412 if (optval || optval2) | 412 if (optval || optval2) |
413 hlog_enable(optval, settings_opt_get("logging_dir"), optval2); | 413 hlog_enable(optval, settings_opt_get("logging_dir"), optval2); |
423 if (optstring) | 423 if (optstring) |
424 hk_ext_cmd_init(optstring); | 424 hk_ext_cmd_init(optstring); |
425 | 425 |
426 optstring = settings_opt_get("roster_display_filter"); | 426 optstring = settings_opt_get("roster_display_filter"); |
427 if (optstring) | 427 if (optstring) |
428 scr_RosterDisplay(optstring); | 428 scr_roster_display(optstring); |
429 // Empty filter isn't allowed... | 429 // Empty filter isn't allowed... |
430 if (!buddylist_get_filter()) | 430 if (!buddylist_get_filter()) |
431 scr_RosterDisplay("*"); | 431 scr_roster_display("*"); |
432 | 432 |
433 chatstates_disabled = settings_opt_get_int("disable_chatstates"); | 433 chatstates_disabled = settings_opt_get_int("disable_chatstates"); |
434 | 434 |
435 /* Initialize FIFO named pipe */ | 435 /* Initialize FIFO named pipe */ |
436 fifo_init(settings_opt_get("fifo_name")); | 436 fifo_init(settings_opt_get("fifo_name")); |
440 | 440 |
441 main_context = g_main_context_default(); | 441 main_context = g_main_context_default(); |
442 | 442 |
443 if (ret < 0) { | 443 if (ret < 0) { |
444 scr_LogPrint(LPRINT_NORMAL, "No configuration file has been found."); | 444 scr_LogPrint(LPRINT_NORMAL, "No configuration file has been found."); |
445 scr_ShowBuddyWindow(); | 445 scr_show_buddy_window(); |
446 } else { | 446 } else { |
447 /* Connection */ | 447 /* Connection */ |
448 xmpp_connect(); | 448 xmpp_connect(); |
449 } | 449 } |
450 | 450 |
462 | 462 |
463 while(!terminate_ui) { | 463 while(!terminate_ui) { |
464 if (g_main_context_iteration(main_context, TRUE) == FALSE) | 464 if (g_main_context_iteration(main_context, TRUE) == FALSE) |
465 keyboard_activity(); | 465 keyboard_activity(); |
466 if (update_roster) | 466 if (update_roster) |
467 scr_DrawRoster(); | 467 scr_draw_roster(); |
468 scr_DoUpdate(); | 468 scr_do_update(); |
469 } | 469 } |
470 | 470 |
471 g_source_destroy(mc_source); | 471 g_source_destroy(mc_source); |
472 g_source_unref(mc_source); | 472 g_source_unref(mc_source); |
473 } | 473 } |
474 | 474 |
475 evs_deinit(); | 475 evs_deinit(); |
476 scr_TerminateCurses(); | 476 scr_terminate_curses(); |
477 #ifdef MODULES_ENABLE | 477 #ifdef MODULES_ENABLE |
478 modules_deinit(); | 478 modules_deinit(); |
479 #endif | 479 #endif |
480 fifo_deinit(); | 480 fifo_deinit(); |
481 #ifdef HAVE_LIBOTR | 481 #ifdef HAVE_LIBOTR |