Remove obsolete A_APOP and A_RPOP account protocols.
authorAndrej Kacian <ticho@claws-mail.org>
Fri, 15 Jul 2016 09:56:22 +0000 (11:56 +0200)
committerAndrej Kacian <ticho@claws-mail.org>
Fri, 15 Jul 2016 15:00:26 +0000 (17:00 +0200)
CLAWS_CONFIG_VERSION bumped to 1.

src/inc.c
src/prefs_account.c
src/prefs_account.h
src/prefs_common.h
src/prefs_migration.c
src/send_message.c

index 6344d22..745aedc 100644 (file)
--- 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;
                
index 5a4deec..fe83306 100644 (file)
@@ -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++) {
index b34c425..4e4217d 100644 (file)
@@ -28,8 +28,6 @@ typedef struct _PrefsAccount  PrefsAccount;
 
 typedef enum {
        A_POP3,
-       A_APOP, /* deprecated */
-       A_RPOP, /* deprecated */
        A_IMAP4,
        A_NNTP,
        A_LOCAL,
index ddb455f..e38fda0 100644 (file)
@@ -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;
 
index 01e3d44..dbd039a 100644 (file)
 #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;
        }
index 75bdd20..7e99c7e 100644 (file)
@@ -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);