about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--src/windows.c41
2 files changed, 36 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac
index c0590d44..41d59087 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@
 
 AC_PREREQ([2.65])
 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_HEADERS([src/config.h])
 AC_CONFIG_AUX_DIR([build-aux])
diff --git a/src/windows.c b/src/windows.c
index 97d85192..ff11bb7f 100644
--- a/src/windows.c
+++ b/src/windows.c
@@ -87,6 +87,7 @@ static void _win_resize_all(void);
 static gint _win_get_unread(void);
 static void _win_show_history(WINDOW *win, int win_index,
     const char * const contact);
+static gboolean _new_release(char *found_version);
 
 #ifdef HAVE_LIBNOTIFY
 static void _win_notify(const char * const message, int timeout,
@@ -821,7 +822,7 @@ cons_about(void)
     } else {
         _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);
         } else {
             wprintw(_cons_win, "Welcome to Profanity, version %s\n", PACKAGE_VERSION);
@@ -853,11 +854,13 @@ cons_about(void)
             gboolean relase_valid = g_regex_match_simple("^\\d+\\.\\d+\\.\\d+$", latest_release, 0, 0);
 
             if (relase_valid) {
-                _win_show_time(_cons_win);
-                wprintw(_cons_win, "RELEASE: %s", latest_release);
-                free(latest_release);
-                _win_show_time(_cons_win);
-                wprintw(_cons_win, "\n");
+                if (_new_release(latest_release)) {
+                    _win_show_time(_cons_win);
+                    wprintw(_cons_win, "RELEASE: %s", latest_release);
+                    free(latest_release);
+                    _win_show_time(_cons_win);
+                    wprintw(_cons_win, "\n");
+                }
             }
         }
     }
@@ -867,6 +870,32 @@ cons_about(void)
     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
 _cons_splash_logo(void)
 {