[Commits] [SCM] claws branch, master, updated. 3.9.2-83-g76c91d8

claws at claws-mail.org claws at claws-mail.org
Tue Aug 27 13:32:17 CEST 2013


The branch master of project "claws" (Claws Mail) has been updated
  discards  e4137d42b94406995549368fc4e92eef917c8137 (commit)
  discards  6d912604e61010cef1fb0fe701760371c8d1cfb2 (commit)
       via  76c91d8cceb7bdcdf8ede508fc1e1b349dcf930a (commit)
       via  f275669014aa3fc6fc5252996841ed425544e442 (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (e4137d42b94406995549368fc4e92eef917c8137)
            \
             N -- N -- N (76c91d8cceb7bdcdf8ede508fc1e1b349dcf930a)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.


- Log -----------------------------------------------------------------
commit 76c91d8cceb7bdcdf8ede508fc1e1b349dcf930a
Author: Paul <paul at claws-mail.org>
Date:   Tue Aug 27 09:45:42 2013 +0100

    fix bug 2979, 'claws fails to load (empty) folderlist.xml and shows account wizard'

diff --git a/po/POTFILES.in b/po/POTFILES.in
index 2599a27..9d7a8a3 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -36,6 +36,7 @@ src/expldifdlg.c
 src/export.c
 src/exporthtml.c
 src/exportldif.c
+src/file_checker.c
 src/folder.c
 src/foldersel.c
 src/folderview.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 1a173ee..08bc2b3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -54,6 +54,7 @@ old_abook_source = \
 	expldifdlg.c \
 	exporthtml.c \
 	exportldif.c \
+	file_checker.c \
 	importldif.c \
 	importmutt.c \
 	importpine.c \
@@ -102,6 +103,7 @@ abook_headers = \
 	expldifdlg.h \
 	exporthtml.h \
 	exportldif.h \
+	file_checker.h \
 	importldif.h \
 	importmutt.h \
 	importpine.h \
diff --git a/src/file_checker.c b/src/file_checker.c
new file mode 100644
index 0000000..5205070
--- /dev/null
+++ b/src/file_checker.c
@@ -0,0 +1,112 @@
+/*
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 2013 Paul Mangan <paul at claws-mail.org> 
+ * 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
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * 
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#include "claws-features.h"
+#endif
+
+#include "defs.h"
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <gdk/gdkkeysyms.h>
+#include <gtk/gtk.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "utils.h"
+#include "alertpanel.h"
+#include "folder.h"
+
+static gboolean verify_folderlist_xml();
+
+gboolean check_file_integrity() {
+	if (verify_folderlist_xml() != TRUE)
+		return FALSE;
+
+	return TRUE;
+}
+
+static gboolean verify_folderlist_xml() {
+	GNode *node;
+	static gchar *filename = NULL;
+	static gchar *bak = NULL;
+	time_t date;
+	struct tm *ts;
+	gchar buf[BUFFSIZE];
+
+	filename = folder_get_list_path();
+	bak = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
+ 			  FOLDER_LIST, ".bak", NULL);
+	
+ 	if (is_file_exist(bak)) {
+		date = get_file_mtime(bak);
+		ts = localtime(&date);
+		strftime(buf, sizeof(buf), "%a %d-%b-%Y %H:%M %Z", ts);
+	}
+	
+	if (!is_file_exist(filename) && is_file_exist(bak)) {
+		AlertValue aval;
+		gchar *msg;
+
+		msg = g_strdup_printf
+			(_("The file %s is missing! "
+			   "Do you want to use the backup file from %s?"), FOLDER_LIST,buf);
+		aval = alertpanel(_("Warning"), msg, GTK_STOCK_NO, GTK_STOCK_YES, NULL);
+		g_free(msg);
+		if (aval != G_ALERTALTERNATE)
+			return FALSE;
+		else {
+			if (copy_file(bak,filename,FALSE) < 0) {
+				alertpanel_warning(_("Could not copy %s to %s"),bak,filename);
+				return FALSE;
+			}
+			g_free(bak);
+			return TRUE;
+		}
+
+	}
+ 	node = xml_parse_file(filename);
+  	if (!node && is_file_exist(bak)) {
+		AlertValue aval;
+		gchar *msg;
+
+		msg = g_strdup_printf
+			(_("The file %s is empty or corrupted! "
+			   "Do you want to use the backup file from %s?"), FOLDER_LIST,buf);
+		aval = alertpanel(_("Warning"), msg, GTK_STOCK_NO, GTK_STOCK_YES, NULL);
+		g_free(msg);
+		if (aval != G_ALERTALTERNATE)
+			return FALSE;
+		else {
+			if (copy_file(bak,filename,FALSE) < 0) {
+				alertpanel_warning(_("Could not copy %s to %s"),bak,filename);
+				return FALSE;
+			}
+			g_free(bak);	
+		}
+  	}
+
+	return TRUE;	
+}
diff --git a/src/file_checker.h b/src/file_checker.h
new file mode 100644
index 0000000..e08ffe1
--- /dev/null
+++ b/src/file_checker.h
@@ -0,0 +1,31 @@
+/*
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 2013 Paul Mangan <paul at claws-mail.org> 
+ * 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
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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 __FILE_CHECKER_H__
+#define __FILE_CHECKER_H__
+
+#include <glib.h>
+#include <gdk/gdk.h>
+#include <gtk/gtk.h>
+
+gboolean check_file_integrity();
+
+#endif
+ 
diff --git a/src/folder.c b/src/folder.c
index 39ba0e4..1b4ec03 100644
--- a/src/folder.c
+++ b/src/folder.c
@@ -88,7 +88,6 @@ void folder_init		(Folder		*folder,
 static gchar *folder_item_get_cache_file	(FolderItem	*item);
 static gchar *folder_item_get_mark_file	(FolderItem	*item);
 static gchar *folder_item_get_tags_file	(FolderItem	*item);
-static gchar *folder_get_list_path	(void);
 static GNode *folder_get_xml_node	(Folder 	*folder);
 static Folder *folder_get_from_xml	(GNode 		*node);
 static void folder_update_op_count_rec	(GNode		*node);
@@ -4122,7 +4121,7 @@ static Folder *folder_get_from_xml(GNode *node)
 	return folder;
 }
 
-static gchar *folder_get_list_path(void)
+gchar *folder_get_list_path(void)
 {
 	static gchar *filename = NULL;
 
diff --git a/src/folder.h b/src/folder.h
index d87eb0c..44f69bb 100644
--- a/src/folder.h
+++ b/src/folder.h
@@ -998,4 +998,5 @@ gint folder_item_search_msgs_local	(Folder			*folder,
 					 SearchProgressNotify	progress_cb,
 					 gpointer		progress_data);
 
+gchar *folder_get_list_path	(void);
 #endif /* __FOLDER_H__ */
diff --git a/src/main.c b/src/main.c
index f7a2eaa..c7d3eac 100644
--- a/src/main.c
+++ b/src/main.c
@@ -49,6 +49,7 @@
 #include <sys/file.h>
 #endif
 
+#include "file_checker.h"
 #include "wizard.h"
 #ifdef HAVE_STARTUP_NOTIFICATION
 # define SN_API_NOT_YET_FROZEN
@@ -1277,6 +1278,9 @@ int main(int argc, char *argv[])
 
 	mainwin = main_window_create();
 
+	if (!check_file_integrity())
+		exit(1);
+
 #ifdef HAVE_NETWORKMANAGER_SUPPORT
 	networkmanager_state_change_cb(nm_proxy,NULL,mainwin);
 #endif

commit f275669014aa3fc6fc5252996841ed425544e442
Author: Paul <paul at claws-mail.org>
Date:   Wed Aug 21 07:55:37 2013 +0100

    no need to do ifdef HAVE_CONFIG_H twice

diff --git a/src/wizard.c b/src/wizard.c
index 70a071d..fb677a8 100644
--- a/src/wizard.c
+++ b/src/wizard.c
@@ -35,11 +35,6 @@
 #include <string.h>
 #include <ctype.h>
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#include "claws-features.h"
-#endif
-
 #include "utils.h"
 #include "gtk/menu.h"
 #include "plugin.h"

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

Summary of changes:


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list