void cons_check_version(gboolean not_available_msg) { char *latest_release = release_get_latest(); if (latest_release != NULL) { gboolean relase_valid = g_regex_match_simple("^\\d+\\.\\d+\\.\\d+$", latest_release, 0, 0); if (relase_valid) { if (release_is_new(latest_release)) { win_print_time(console, '-'); wprintw(console->win, "A new version of Profanity is available: %s", latest_release); win_print_time(console, '-'); wprintw(console->win, "Check <http://www.profanity.im> for details.\n"); free(latest_release); win_print_time(console, '-'); wprintw(console->win, "\n"); } else { if (not_available_msg) { cons_show("No new version available."); cons_show(""); } } ui_console_dirty(); cons_alert(); } } }
/* * Use CURL to get the latest release of the software. * All release information will be stored globally variable. * Use release_dispose() when the release information are no longer needed. */ static gpointer version_check(gpointer data) { bool status = true; ver_check_done = false; if (phone_home_init()) { release = release_get_latest(); phone_home_terminate(); } else { status = false; } ver_check_done = true; return (gpointer)status; }