static void _init(char *log_level) { setlocale(LC_ALL, ""); // ignore SIGPIPE signal(SIGPIPE, SIG_IGN); signal(SIGINT, SIG_IGN); signal(SIGTSTP, SIG_IGN); signal(SIGWINCH, ui_sigwinch_handler); if (pthread_mutex_init(&lock, NULL) != 0) { log_error("Mutex init failed"); exit(1); } pthread_mutex_lock(&lock); files_create_directories(); log_level_t prof_log_level = log_level_from_string(log_level); prefs_load(); log_init(prof_log_level); log_stderr_init(PROF_LEVEL_ERROR); if (strcmp(PACKAGE_STATUS, "development") == 0) { #ifdef HAVE_GIT_VERSION log_info("Starting Profanity (%sdev.%s.%s)...", PACKAGE_VERSION, PROF_GIT_BRANCH, PROF_GIT_REVISION); #else log_info("Starting Profanity (%sdev)...", PACKAGE_VERSION); #endif } else { log_info("Starting Profanity (%s)...", PACKAGE_VERSION); } chat_log_init(); groupchat_log_init(); accounts_load(); char *theme = prefs_get_string(PREF_THEME); theme_init(theme); prefs_free_string(theme); ui_init(); session_init(); cmd_init(); log_info("Initialising contact list"); muc_init(); tlscerts_init(); scripts_init(); #ifdef HAVE_LIBOTR otr_init(); #endif #ifdef HAVE_LIBGPGME p_gpg_init(); #endif #ifdef HAVE_OMEMO omemo_init(); #endif atexit(_shutdown); plugins_init(); #ifdef HAVE_GTK tray_init(); #endif inp_nonblocking(TRUE); ui_resize(); }
BOOL egl_init() { if( theme_init() == FALSE ) return FALSE; egl_sys_font = egl_create_default_font(); if( egl_sys_font == NULL ) return FALSE; return TRUE; }
static void _init(char *log_level) { setlocale(LC_ALL, ""); // ignore SIGPIPE signal(SIGPIPE, SIG_IGN); signal(SIGINT, SIG_IGN); signal(SIGTSTP, SIG_IGN); signal(SIGWINCH, ui_sigwinch_handler); _create_directories(); log_level_t prof_log_level = log_level_from_string(log_level); prefs_load(); log_init(prof_log_level); log_stderr_init(PROF_LEVEL_ERROR); if (strcmp(PROF_PACKAGE_STATUS, "development") == 0) { #ifdef PROF_HAVE_GIT_VERSION log_info("Starting Profanity (%sdev.%s.%s)...", PROF_PACKAGE_VERSION, PROF_GIT_BRANCH, PROF_GIT_REVISION); #else log_info("Starting Profanity (%sdev)...", PROF_PACKAGE_VERSION); #endif } else { log_info("Starting Profanity (%s)...", PROF_PACKAGE_VERSION); } chat_log_init(); groupchat_log_init(); accounts_load(); char *theme = prefs_get_string(PREF_THEME); theme_init(theme); prefs_free_string(theme); ui_init(); jabber_init(); cmd_init(); log_info("Initialising contact list"); muc_init(); tlscerts_init(); scripts_init(); #ifdef PROF_HAVE_LIBOTR otr_init(); #endif #ifdef PROF_HAVE_LIBGPGME p_gpg_init(); #endif atexit(_shutdown); plugins_init(); #ifdef PROF_HAVE_GTK if (gtk_ready) { log_debug("Building GTK icon"); create_tray(); } #endif inp_nonblocking(TRUE); }
int main(int argc, char **argv) { char *paths[] = { NULL, NULL }; int i; pthread_t u_tid; cmdname = argv[0]; for (i = 1; i < argc && *argv[i] == '-'; i++) { if (streq(argv[i], "-h")) { usage(); } } paths[0] = (argc > i) ? argv[i] : "."; paths[1] = (argc > (i + 1)) ? argv[i + 1] : paths[0]; atexit(atexit_handler); if (!setlocale(LC_CTYPE, "")) die("couldn't set locale\n"); config_init(); program_init(); read_config_files(); /* setup windows */ for (i = 0; i < 2; i++) { data.win[i] = dwindow_create(); dwindow_set_sort(data.win[i], config()->sort); dwindow_read(data.win[i], paths[i]); } data.wsel = data.win[0]; /* setup ui */ ui_init(); theme_init(); /* set default state */ states_push(list_state()); /* start update thread */ pthread_mutex_init(&data.mutex, NULL); if (pthread_create(&u_tid, NULL, update_loop, &data) != 0) die("pthread_create: %s\n", strerror(errno)); main_loop(); ui_close(); return 0; }
static void _init(const int disable_tls, char *log_level) { setlocale(LC_ALL, ""); // ignore SIGPIPE signal(SIGPIPE, SIG_IGN); signal(SIGINT, SIG_IGN); signal(SIGTSTP, SIG_IGN); _create_directories(); log_level_t prof_log_level = log_level_from_string(log_level); prefs_load(); log_init(prof_log_level); if (strcmp(PACKAGE_STATUS, "development") == 0) { #ifdef HAVE_GIT_VERSION log_info("Starting Profanity (%sdev.%s.%s)...", PACKAGE_VERSION, PROF_GIT_BRANCH, PROF_GIT_REVISION); #else log_info("Starting Profanity (%sdev)...", PACKAGE_VERSION); #endif } else { log_info("Starting Profanity (%s)...", PACKAGE_VERSION); } chat_log_init(); groupchat_log_init(); accounts_load(); char *theme = prefs_get_string(PREF_THEME); theme_init(theme); prefs_free_string(theme); ui_init(); jabber_init(disable_tls); cmd_init(); log_info("Initialising contact list"); roster_init(); muc_init(); #ifdef HAVE_LIBOTR otr_init(); #endif atexit(_shutdown); ui_input_nonblocking(TRUE); }