about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-10-24 00:59:18 +0100
committerJames Booth <boothj5@gmail.com>2012-10-24 00:59:18 +0100
commitff335f80a9218a0d46d9b5790b452cc09125efa9 (patch)
tree14e0039cb47028b38a04b2c4aa7550b03f9f17cf /src
parentb7ea72453f5ac0b7560b8f0961f7a74998f67b71 (diff)
downloadprofani-tty-ff335f80a9218a0d46d9b5790b452cc09125efa9.tar.gz
Check for later release
Diffstat (limited to 'src')
-rw-r--r--src/windows.c41
1 files changed, 35 insertions, 6 deletions
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)
 {