[Commits] [SCM] claws branch, master, updated. 3.13.2-207-g9e4a326

mones at claws-mail.org mones at claws-mail.org
Wed Jul 27 16:49:13 CEST 2016


The branch, master has been updated
       via  9e4a3265d7e0e60ba7b1c43c7a4a8ce9c0cab99b (commit)
      from  4d766fb1d2b569504465ae089a69e14fb002768d (commit)

Summary of changes:
 src/common/defs.h     |    6 +++---
 src/main.c            |    8 +++++++-
 src/prefs_migration.c |   46 +++++++++++++++++++++++++++++++++++++++++++---
 src/prefs_migration.h |    3 +--
 4 files changed, 54 insertions(+), 9 deletions(-)


- Log -----------------------------------------------------------------
commit 9e4a3265d7e0e60ba7b1c43c7a4a8ce9c0cab99b
Author: Ricardo Mones <ricardo at mones.org>
Date:   Wed Jul 27 16:46:22 2016 +0200

    Handle configuration versions from the future

diff --git a/src/common/defs.h b/src/common/defs.h
index c19a26e..c10ac65 100644
--- a/src/common/defs.h
+++ b/src/common/defs.h
@@ -1,6 +1,6 @@
 /*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2013 Hiroyuki Yamamoto and the Claws Mail team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2016 Hiroyuki Yamamoto and the Claws Mail team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,7 +14,6 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * 
  */
 
 #ifndef __DEFS_H__
@@ -91,6 +90,7 @@
 #define USERS_ML_URI		"http://lists.claws-mail.org/cgi-bin/mailman/listinfo/users"
 #define GPL_URI			"http://www.gnu.org/licenses/gpl.html"
 #define DONATE_URI		"http://www.claws-mail.org/sponsors.php"
+#define CONFIG_VERSIONS_URI	"http://www.claws-mail.org/cvc.php"
 #define RELEASE_NOTES_FILE	"RELEASE_NOTES"
 #define THEMEINFO_FILE		".claws_themeinfo"
 #define FOLDER_LIST		"folderlist.xml"
diff --git a/src/main.c b/src/main.c
index 987bc68..11ce45e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1458,7 +1458,13 @@ int main(int argc, char *argv[])
 		g_slist_free(plug_list);
 	}
 
-	prefs_update_config_version();
+	if (prefs_update_config_version() < 0) {
+		exit_claws(mainwin);
+#ifdef G_OS_WIN32
+		win32_close_log();
+#endif
+		exit(0);
+	}
 
 	if (never_ran) {
 		prefs_common_write_config();
diff --git a/src/prefs_migration.c b/src/prefs_migration.c
index 0ee859c..cf8a103 100644
--- a/src/prefs_migration.c
+++ b/src/prefs_migration.c
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2016 the Claws Mail team
+ * Copyright (C) 2016 the Claws Mail team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -21,9 +21,18 @@
 #include "claws-features.h"
 #endif
 
+#ifdef ENABLE_NLS
+#include <glib/gi18n.h>
+#else
+#define _(a) (a)
+#define N_(a) (a)
+#endif
+
+#include "defs.h"
 #include "account.h"
 #include "prefs_account.h"
 #include "prefs_common.h"
+#include "alertpanel.h"
 
 static void _update_config(gint version)
 {
@@ -70,14 +79,44 @@ static void _update_config(gint version)
 	}
 }
 
-void prefs_update_config_version()
+int prefs_update_config_version()
 {
 	gint ver = prefs_common_get_prefs()->config_version;
 
+	if (ver > CLAWS_CONFIG_VERSION) {
+		gchar *msg;
+		gchar *markup;
+		AlertValue av;
+
+		markup = g_strdup_printf(
+			"<a href=\"%s\"><span underline=\"none\">",
+			CONFIG_VERSIONS_URI);
+		msg = g_strdup_printf(
+			_("Your Claws Mail configuration is from a newer "
+			  "version than the version which you are currently "
+			  "using.\n\n"
+			  "This is not recommended.\n\n"
+			  "For further information see the %sClaws Mail "
+			  "website%s.\n\n"
+			  "Do you want to exit now?"),
+			  markup, "</span></a>");
+		g_free(markup);
+		av = alertpanel_full(_("Configuration warning"), msg,
+					GTK_STOCK_NO, GTK_STOCK_YES, NULL,
+					FALSE, NULL,
+					ALERT_ERROR, G_ALERTALTERNATE);
+		g_free(msg);
+
+		if (av != G_ALERTDEFAULT)
+			return -1; /* abort startup */
+
+		return 0; /* hic sunt dracones */
+	}
+
 	debug_print("Starting config update at config_version %d.\n", ver);
 	if (ver == CLAWS_CONFIG_VERSION) {
 		debug_print("No update necessary, already at latest config_version.\n");
-		return;
+		return 0; /* nothing to do */
 	}
 
 	while (ver < CLAWS_CONFIG_VERSION) {
@@ -86,4 +125,5 @@ void prefs_update_config_version()
 	}
 
 	debug_print("Config update done.\n");
+	return 1; /* update done */
 }
diff --git a/src/prefs_migration.h b/src/prefs_migration.h
index 226f1df..e984096 100644
--- a/src/prefs_migration.h
+++ b/src/prefs_migration.h
@@ -14,12 +14,11 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #ifndef __PREFS_MIGRATION_H__
 #define __PREFS_MIGRATION_H__
 
-void prefs_update_config_version();
+int prefs_update_config_version();
 
 #endif /* __PREFS_MIGRATION_H__ */

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list