[Commits] [SCM] claws branch, master, updated. 3.13.2-181-g358e811
ticho at claws-mail.org
ticho at claws-mail.org
Fri Jul 15 17:00:42 CEST 2016
The branch, master has been updated
via 358e811283ebfd8c377dd2ef94876f4e52e67606 (commit)
via 3b5b4f75ddf190346e4e8a1ee4521f32cafd0a37 (commit)
from 74b625c53e38ed53a585fe43df23f12d50d447a6 (commit)
Summary of changes:
src/Makefile.am | 2 +
src/inc.c | 1 -
src/main.c | 3 +
src/prefs_account.c | 6 --
src/prefs_account.h | 2 -
src/prefs_common.c | 3 +
src/prefs_common.h | 4 +
src/prefs_migration.c | 82 ++++++++++++++++++++
.../pgpmime/pgpmime.h => prefs_migration.h} | 13 ++--
src/send_message.c | 2 +-
10 files changed, 101 insertions(+), 17 deletions(-)
create mode 100644 src/prefs_migration.c
copy src/{plugins/pgpmime/pgpmime.h => prefs_migration.h} (80%)
- Log -----------------------------------------------------------------
commit 358e811283ebfd8c377dd2ef94876f4e52e67606
Author: Andrej Kacian <ticho at claws-mail.org>
Date: Fri Jul 15 11:56:22 2016 +0200
Remove obsolete A_APOP and A_RPOP account protocols.
CLAWS_CONFIG_VERSION bumped to 1.
diff --git a/src/inc.c b/src/inc.c
index 6344d22..745aedc 100644
--- a/src/inc.c
+++ b/src/inc.c
@@ -257,7 +257,6 @@ static gint inc_account_mail_real(MainWindow *mainwin, PrefsAccount *account)
folderview_check_new(FOLDER(account->folder));
return 0;
case A_POP3:
- case A_APOP:
session = inc_session_new(account);
if (!session) return 0;
diff --git a/src/prefs_account.c b/src/prefs_account.c
index 5a4deec..fe83306 100644
--- a/src/prefs_account.c
+++ b/src/prefs_account.c
@@ -3557,12 +3557,6 @@ void prefs_account_read_config(PrefsAccount *ac_prefs, const gchar *label)
if (id < 0) g_warning("wrong account id: %d", id);
ac_prefs->account_id = id;
- if (ac_prefs->protocol == A_APOP) {
- debug_print("converting protocol A_APOP to new prefs.\n");
- ac_prefs->protocol = A_POP3;
- ac_prefs->use_apop_auth = TRUE;
- }
-
if (privacy_prefs != NULL) {
strv = g_strsplit(privacy_prefs, ",", 0);
for (cur = strv; *cur != NULL; cur++) {
diff --git a/src/prefs_account.h b/src/prefs_account.h
index b34c425..4e4217d 100644
--- a/src/prefs_account.h
+++ b/src/prefs_account.h
@@ -28,8 +28,6 @@ typedef struct _PrefsAccount PrefsAccount;
typedef enum {
A_POP3,
- A_APOP, /* deprecated */
- A_RPOP, /* deprecated */
A_IMAP4,
A_NNTP,
A_LOCAL,
diff --git a/src/prefs_common.h b/src/prefs_common.h
index ddb455f..e38fda0 100644
--- a/src/prefs_common.h
+++ b/src/prefs_common.h
@@ -36,7 +36,7 @@
#include "prefs_msg_colors.h"
#include "prefs_summary_open.h"
-#define CLAWS_CONFIG_VERSION 0
+#define CLAWS_CONFIG_VERSION 1
typedef struct _PrefsCommon PrefsCommon;
diff --git a/src/prefs_migration.c b/src/prefs_migration.c
index 01e3d44..dbd039a 100644
--- a/src/prefs_migration.c
+++ b/src/prefs_migration.c
@@ -22,12 +22,42 @@
#include "claws-features.h"
#endif
+#include "account.h"
+#include "prefs_account.h"
#include "prefs_common.h"
static void _update_config(gint version)
{
+ GList *cur;
+ PrefsAccount *ac_prefs;
+
+ debug_print("Updating config version %d to %d.\n", version, version + 1);
+
switch (version) {
case 0:
+
+ /* Removing A_APOP and A_RPOP from RecvProtocol enum,
+ * protocol numbers above A_POP3 need to be adjusted.
+ *
+ * In config_version=0:
+ * A_POP3 is 0,
+ * A_APOP is 1,
+ * A_RPOP is 2,
+ * A_IMAP and the rest are from 3 up.
+ * We can't use the macros, since they may change in the
+ * future. Numbers do not change. :) */
+ for (cur = account_get_list(); cur != NULL; cur = cur->next) {
+ ac_prefs = (PrefsAccount *)cur->data;
+ if (ac_prefs->protocol == 1) {
+ ac_prefs->protocol = 0;
+ } else if (ac_prefs->protocol > 2) {
+ /* A_IMAP and above gets bumped down by 2. */
+ ac_prefs->protocol -= 2;
+ }
+ }
+
+ break;
+
default:
break;
}
diff --git a/src/send_message.c b/src/send_message.c
index 75bdd20..7e99c7e 100644
--- a/src/send_message.c
+++ b/src/send_message.c
@@ -350,7 +350,7 @@ gint send_message_smtp_full(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp, g
_("Connecting"));
if (ac_prefs->pop_before_smtp
- && (ac_prefs->protocol == A_APOP || ac_prefs->protocol == A_POP3)
+ && (ac_prefs->protocol == A_POP3)
&& (time(NULL) - ac_prefs->last_pop_login_time) > (60 * ac_prefs->pop_before_smtp_timeout)) {
g_snprintf(buf, sizeof(buf), _("Doing POP before SMTP..."));
log_message(LOG_PROTOCOL, "%s\n", buf);
commit 3b5b4f75ddf190346e4e8a1ee4521f32cafd0a37
Author: Andrej Kacian <ticho at claws-mail.org>
Date: Thu Jul 14 11:55:54 2016 +0200
Added config versioning.
This allows us to change meaning of existing preferences,
without losing or mangling user data. Controlled by a common
pref "config_version", which is checked on startup after
reading all configuration. If this version is lower than
what is defined in CLAWS_CONFIG_VERSION, an upgrade is done
incrementally, from one version to the next and to the next,
so that all affected preferences are adjusted.
diff --git a/src/Makefile.am b/src/Makefile.am
index 3cb8fd5..b840f34 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -196,6 +196,7 @@ claws_mail_SOURCES = \
prefs_logging.c \
prefs_matcher.c \
prefs_message.c \
+ prefs_migration.c \
prefs_msg_colors.c \
prefs_other.c \
prefs_quote.c \
@@ -314,6 +315,7 @@ claws_mailinclude_HEADERS = \
prefs_logging.h \
prefs_matcher.h \
prefs_message.h \
+ prefs_migration.h \
prefs_msg_colors.h \
prefs_other.h \
prefs_quote.h \
diff --git a/src/main.c b/src/main.c
index 19f96f3..388a66f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -79,6 +79,7 @@
#include "prefs_fonts.h"
#include "prefs_image_viewer.h"
#include "prefs_message.h"
+#include "prefs_migration.h"
#include "prefs_receive.h"
#include "prefs_msg_colors.h"
#include "prefs_quote.h"
@@ -1457,6 +1458,8 @@ int main(int argc, char *argv[])
g_slist_free(plug_list);
}
+ prefs_update_config_version();
+
if (never_ran) {
prefs_common_write_config();
plugin_load_standard_plugins ();
diff --git a/src/prefs_common.c b/src/prefs_common.c
index f4acf34..8518f80 100644
--- a/src/prefs_common.c
+++ b/src/prefs_common.c
@@ -141,6 +141,9 @@ static PrefParam param_os_specific[] = {
*/
static PrefParam param[] = {
+ {"config_version", "0",
+ &prefs_common.config_version, P_INT, NULL, NULL, NULL},
+
/* Receive */
{"use_ext_inc", "FALSE", &prefs_common.use_extinc, P_BOOL,
NULL, NULL, NULL},
diff --git a/src/prefs_common.h b/src/prefs_common.h
index e1c2df9..ddb455f 100644
--- a/src/prefs_common.h
+++ b/src/prefs_common.h
@@ -36,6 +36,8 @@
#include "prefs_msg_colors.h"
#include "prefs_summary_open.h"
+#define CLAWS_CONFIG_VERSION 0
+
typedef struct _PrefsCommon PrefsCommon;
typedef enum {
@@ -113,6 +115,8 @@ typedef enum
struct _PrefsCommon
{
+ gint config_version;
+
/* Receive */
gboolean use_extinc;
gchar *extinc_cmd;
diff --git a/src/prefs_migration.c b/src/prefs_migration.c
new file mode 100644
index 0000000..01e3d44
--- /dev/null
+++ b/src/prefs_migration.c
@@ -0,0 +1,52 @@
+/*
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-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
+ * 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 "prefs_common.h"
+
+static void _update_config(gint version)
+{
+ switch (version) {
+ case 0:
+ default:
+ break;
+ }
+}
+
+void prefs_update_config_version()
+{
+ gint ver = prefs_common_get_prefs()->config_version;
+
+ 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;
+ }
+
+ while (ver < CLAWS_CONFIG_VERSION) {
+ _update_config(ver++);
+ prefs_common_get_prefs()->config_version = ver;
+ }
+
+ debug_print("Config update done.\n");
+}
diff --git a/src/prefs_migration.h b/src/prefs_migration.h
new file mode 100644
index 0000000..226f1df
--- /dev/null
+++ b/src/prefs_migration.h
@@ -0,0 +1,25 @@
+/*
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * 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
+ * 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 __PREFS_MIGRATION_H__
+#define __PREFS_MIGRATION_H__
+
+void prefs_update_config_version();
+
+#endif /* __PREFS_MIGRATION_H__ */
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list