1
1
mirror of https://github.com/profanity-im/profanity.git synced 2025-02-02 15:08:15 -05:00

Check for later release

This commit is contained in:
James Booth 2012-10-24 00:59:18 +01:00
parent b7ea72453f
commit ff335f80a9
2 changed files with 36 additions and 7 deletions

View File

@ -3,7 +3,7 @@
AC_PREREQ([2.65]) AC_PREREQ([2.65])
AC_INIT([profanity], [0.1.9], [boothj5web@gmail.com]) AC_INIT([profanity], [0.1.9], [boothj5web@gmail.com])
AC_DEFINE([PACKAGE_STATUS], ["release"], [Status of this build]) AC_DEFINE([PACKAGE_STATUS], ["development"], [Status of this build])
AC_CONFIG_SRCDIR([src/main.c]) AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_HEADERS([src/config.h]) AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_AUX_DIR([build-aux])

View File

@ -87,6 +87,7 @@ static void _win_resize_all(void);
static gint _win_get_unread(void); static gint _win_get_unread(void);
static void _win_show_history(WINDOW *win, int win_index, static void _win_show_history(WINDOW *win, int win_index,
const char * const contact); const char * const contact);
static gboolean _new_release(char *found_version);
#ifdef HAVE_LIBNOTIFY #ifdef HAVE_LIBNOTIFY
static void _win_notify(const char * const message, int timeout, static void _win_notify(const char * const message, int timeout,
@ -821,7 +822,7 @@ cons_about(void)
} else { } else {
_win_show_time(_cons_win); _win_show_time(_cons_win);
if (strcmp(PACKAGE_STATUS, "dev") == 0) { if (strcmp(PACKAGE_STATUS, "development") == 0) {
wprintw(_cons_win, "Welcome to Profanity, version %sdev\n", PACKAGE_VERSION); wprintw(_cons_win, "Welcome to Profanity, version %sdev\n", PACKAGE_VERSION);
} else { } else {
wprintw(_cons_win, "Welcome to Profanity, version %s\n", PACKAGE_VERSION); wprintw(_cons_win, "Welcome to Profanity, version %s\n", PACKAGE_VERSION);
@ -853,6 +854,7 @@ cons_about(void)
gboolean relase_valid = g_regex_match_simple("^\\d+\\.\\d+\\.\\d+$", latest_release, 0, 0); gboolean relase_valid = g_regex_match_simple("^\\d+\\.\\d+\\.\\d+$", latest_release, 0, 0);
if (relase_valid) { if (relase_valid) {
if (_new_release(latest_release)) {
_win_show_time(_cons_win); _win_show_time(_cons_win);
wprintw(_cons_win, "RELEASE: %s", latest_release); wprintw(_cons_win, "RELEASE: %s", latest_release);
free(latest_release); free(latest_release);
@ -861,12 +863,39 @@ cons_about(void)
} }
} }
} }
}
prefresh(_cons_win, 0, 0, 1, 0, rows-3, cols-1); prefresh(_cons_win, 0, 0, 1, 0, rows-3, cols-1);
dirty = TRUE; dirty = TRUE;
} }
static gboolean
_new_release(char *found_version)
{
int curr_maj, curr_min, curr_patch, found_maj, found_min, found_patch;
int parse_curr = sscanf(PACKAGE_VERSION, "%d.%d.%d", &curr_maj, &curr_min,
&curr_patch);
int parse_found = sscanf(found_version, "%d.%d.%d", &found_maj, &found_min,
&found_patch);
if (parse_found == 3 && parse_curr == 3) {
if (found_maj > curr_maj) {
return TRUE;
} else if (found_maj == curr_maj && found_min > curr_min) {
return TRUE;
} else if (found_maj == curr_maj && found_min == curr_min
&& found_patch > curr_patch) {
return TRUE;
} else {
return FALSE;
}
} else {
return FALSE;
}
}
static void static void
_cons_splash_logo(void) _cons_splash_logo(void)
{ {