commit e789c3054683a2bbda2e551ff9a367b5efec6830 from: Oliver Lowe date: Mon Aug 18 04:35:41 2025 UTC Don't try to migrate old preferences Too many prefs commit - b612b470a5d7c3335d6a58af6019b2336ca09a32 commit + e789c3054683a2bbda2e551ff9a367b5efec6830 blob - 135a926f134ca9360a905e00613cc63f7239c70f blob + 8db9a13d44b88deb56ccabab2e881288d936beea --- src/Makefile.am +++ src/Makefile.am @@ -99,7 +99,6 @@ claws_mail_SOURCES = \ prefs_logging.c \ prefs_matcher.c \ prefs_message.c \ - prefs_migration.c \ prefs_other.c \ prefs_proxy.c \ prefs_quote.c \ @@ -203,7 +202,6 @@ claws_mailinclude_HEADERS = \ prefs_logging.h \ prefs_matcher.h \ prefs_message.h \ - prefs_migration.h \ prefs_other.h \ prefs_proxy.h \ prefs_quote.h \ blob - 5a25fff81334f4082ace47d1b5853a79f6ab1f55 blob + ab4b9d1393f70b91666055f24efa7b9b09a3f5d7 --- src/folder.c +++ src/folder.c @@ -56,7 +56,6 @@ #include "msgcache.h" #include "privacy.h" #include "prefs_common.h" -#include "prefs_migration.h" #include "file-utils.h" /* Dependecies to be removed ?! */ @@ -860,15 +859,9 @@ gint folder_read_list(void) xml_free_tree(node); - if (prefs_update_config_version_folderlist(config_version) < 0) { - debug_print("Folderlist configuration file version upgrade failed\n"); - return -2; - } - if (folder_list || folder_unloaded_list) return 0; - else - return -1; + return -1; } void folder_write_list(void) blob - f3c5f5a26f5c10be5db343a9d1ad61ee828dc952 blob + 09a3b9eabc4eefbe21584ecdf0f568b7049bf47a --- src/folder_item_prefs.c +++ src/folder_item_prefs.c @@ -27,10 +27,10 @@ #include "defs.h" #include "folder.h" +#include "matcher.h" #include "utils.h" #include "prefs_gtk.h" #include "folder_item_prefs.h" -#include "prefs_migration.h" FolderItemPrefs tmp_prefs; @@ -148,8 +148,6 @@ void folder_item_prefs_read_config(FolderItem * item) g_free(rcpath); *item->prefs = tmp_prefs; - - prefs_update_config_version_folder_item(item); } void folder_item_prefs_save_config(FolderItem * item) @@ -277,7 +275,7 @@ void folder_item_prefs_free(FolderItemPrefs * prefs) void folder_item_prefs_copy_prefs(FolderItem * src, FolderItem * dest) { - GSList *tmp_prop_list = NULL, *tmp; + GSList *tmp_prop_list = NULL; folder_item_prefs_read_config(src); tmp_prefs.directory = g_strdup(src->prefs->directory); blob - 37219664e01ba4f4ddd2c3fda355fed7840e5b3f blob + 2d8d9b4f3eb1aed9c9423d56be52f7696187e7ad --- src/main.c +++ src/main.c @@ -61,7 +61,6 @@ #include "prefs_ext_prog.h" #include "prefs_fonts.h" #include "prefs_message.h" -#include "prefs_migration.h" #include "prefs_receive.h" #include "prefs_quote.h" #include "prefs_spelling.h" @@ -504,11 +503,6 @@ int main(int argc, char *argv[]) folder_system_init(); prefs_common_read_config(); - if (prefs_update_config_version_common() < 0) { - debug_print("Main configuration file version upgrade failed, exiting\n"); - exit(200); - } - prefs_themes_init(); prefs_fonts_init(); prefs_ext_prog_init(); @@ -567,11 +561,6 @@ int main(int argc, char *argv[]) account_read_oauth2_all(); #endif - if (prefs_update_config_version_accounts() < 0) { - debug_print("Accounts configuration file version upgrade failed, exiting\n"); - exit(201); - } - imap_main_init(prefs_common.skip_ssl_cert_check); imap_main_set_timeout(prefs_common.io_timeout_secs); nntp_main_init(prefs_common.skip_ssl_cert_check); blob - 65b63b3edd69c72f581113d8b78a65f24d170b08 blob + ff3d035de0f7e02ee939a1fbef00ca755c578994 --- src/passwordstore.c +++ src/passwordstore.c @@ -34,7 +34,6 @@ #include "password.h" #include "prefs_common.h" #include "prefs_gtk.h" -#include "prefs_migration.h" #include "file-utils.h" static GSList *_password_store; @@ -562,10 +561,5 @@ int passwd_store_read_config(void) } g_strfreev(lines); - if (prefs_update_config_version_password_store(config_version) < 0) { - debug_print("Password store configuration file version upgrade failed\n"); - return -2; - } - return g_slist_length(_password_store); } blob - e51960e08ef097f4c88bcaae1bec314d4a77593e blob + 64554140d670ebbc70a7303f4673478ed6731f89 --- src/prefs_common.c +++ src/prefs_common.c @@ -41,7 +41,6 @@ #include "prefs_display_header.h" #include "prefs_summary_column.h" #include "prefs_folder_column.h" -#include "prefs_migration.h" #include "mainwindow.h" #include "summaryview.h" #include "folderview.h" blob - 072b05e3ee60c5c37afad1c20d5597dda86b2715 (mode 644) blob + /dev/null --- src/prefs_migration.c +++ /dev/null @@ -1,389 +0,0 @@ -/* - * Claws Mail -- a GTK based, lightweight, and fast e-mail client - * Copyright (C) 2016-2024 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 . - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#include "claws-features.h" -#endif - -#ifdef ENABLE_NLS -#include -#else -#define _(a) (a) -#define N_(a) (a) -#endif - -#include "defs.h" -#include "account.h" -#include "folder_item_prefs.h" -#include "prefs_account.h" -#include "prefs_common.h" -#include "alertpanel.h" - -static gint starting_config_version = 0; -static gboolean version_check_warning_shown = FALSE; - -gboolean _version_check(gint ver) -{ - if (ver > CLAWS_CONFIG_VERSION && !version_check_warning_shown) { - gchar *msg; - gchar *markup; - AlertValue av; - - markup = g_strdup_printf( - "", - 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, ""); - g_free(markup); - av = alertpanel_full(_("Configuration warning"), msg, - NULL, _("_No"), NULL, _("_Yes"), - NULL, NULL, ALERTFOCUS_SECOND, - FALSE, NULL, ALERT_ERROR); - g_free(msg); - - if (av != G_ALERTDEFAULT) - return FALSE; /* abort startup */ - - version_check_warning_shown = TRUE; - - return TRUE; /* hic sunt dracones */ - } - - return TRUE; -} - -static void _update_config_common(gint version) -{ - debug_print("Updating config version %d to %d.\n", version, version + 1); - - switch (version) { - case 1: - - /* The autochk_interval preference is now - * interpreted as seconds instead of minutes */ - prefs_common.autochk_itv *= 60; - - break; - case 4: - if (prefs_common.no_recv_err_panel) - prefs_common.show_recv_err_dialog = FALSE; - else - prefs_common.show_recv_err_dialog = TRUE; - - default: - - /* NOOP */ - - break; - } -} - -static void _update_config_account(PrefsAccount *ac_prefs, gint version) -{ - debug_print("Account '%s': Updating config version from %d to %d.\n", - ac_prefs->account_name, 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. :) */ - 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; - - case 2: - - /* Introducing per-account mail check intervals, and separating - * recv_at_getall from autocheck function. - * - * If recv_at_getall is TRUE, the account's autocheck will be - * enabled, following global autocheck interval. - * - * The account's own autocheck interval will be set to the - * same value as the global interval, but will not be used. - * - * recv_at_getall will remain enabled, but will only be used - * to determine whether or not to include this account for - * manual 'Get all' check. */ - ac_prefs->autochk_itv = prefs_common_get_prefs()->autochk_itv; - ac_prefs->autochk_use_custom = FALSE; - if (ac_prefs->recv_at_getall) { - ac_prefs->autochk_use_default = TRUE; - } else { - ac_prefs->autochk_use_default = FALSE; - } - - break; - - case 3: - /* With the introduction of OAuth2 support, the APOP option - * (use_apop_auth) has been swallowed into a combobox and - * renamed */ - if (ac_prefs->use_apop_auth == 1) { - ac_prefs->use_pop_auth = 1; - ac_prefs->pop_auth_type = 1; - } - break; - default: - - /* NOOP */ - - break; - } - - ac_prefs->config_version = version + 1; -} - -static void _update_config_password_store(gint version) -{ - debug_print("Password store: Updating config version from %d to %d.\n", - version, version + 1); - - switch (version) { - /* nothing here yet */ - - default: - - /* NOOP */ - - break; - } -} - -static void _update_config_folderlist(gint version) -{ - debug_print("Folderlist: Updating config version from %d to %d.\n", - version, version + 1); - - switch (version) { - /* nothing here yet */ - - default: - - /* NOOP */ - - break; - } -} - -static void _update_config_folder_item(FolderItem *item, - gint version) -{ - debug_print("Updating config_version from %d to %d.\n", - version, version + 1); - - switch (version) { - /* nothing here yet */ - - default: - - /* NOOP */ - - break; - } - item->prefs->config_version = version + 1; - folder_item_prefs_save_config(item); -} - -int prefs_update_config_version_common() -{ - gint ver = prefs_common_get_prefs()->config_version; - - /* Store the starting version number for other components' - * migration functions. */ - starting_config_version = ver; - - if (!_version_check(ver)) - return -1; - - 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 0; /* nothing to do */ - } - - while (ver < CLAWS_CONFIG_VERSION) { - _update_config_common(ver++); - prefs_common_get_prefs()->config_version = ver; - } - - debug_print("Config update done.\n"); - return 1; /* update done */ -} - -int prefs_update_config_version_accounts() -{ - GList *cur; - PrefsAccount *ac_prefs; - - for (cur = account_get_list(); cur != NULL; cur = cur->next) { - ac_prefs = (PrefsAccount *)cur->data; - - if (ac_prefs->config_version == -1) { - /* There was no config_version stored in the config, let's - * assume config_version same as what clawsrc started at - * this session, to avoid breaking the configuration by - * "upgrading" it unnecessarily. */ - debug_print("Account '%s': config_version not saved, using one from clawsrc: %d\n", ac_prefs->account_name, starting_config_version); - ac_prefs->config_version = starting_config_version; - } - - gint ver = ac_prefs->config_version; - - debug_print("Account '%s': Starting config update at config_version %d.\n", ac_prefs->account_name, ver); - - if (!_version_check(ver)) - return -1; - - if (ver == CLAWS_CONFIG_VERSION) { - debug_print("Account '%s': No update necessary, already at latest config_version.\n", ac_prefs->account_name); - continue; - } - - while (ver < CLAWS_CONFIG_VERSION) { - _update_config_account(ac_prefs, ver++); - } - } - - debug_print("Accounts config update done.\n"); - return 1; -} - -int prefs_update_config_version_password_store(gint from_version) -{ - gint ver = from_version; - - if (ver == -1) { - /* There was no config_version stored in the config, let's assume - * config_version same as what clawsrc started at this session, - * to avoid breaking the configuration by "upgrading" it unnecessarily. */ - debug_print("Password store: config_version not saved, using one from clawsrc: %d\n", starting_config_version); - ver = starting_config_version; - } - - debug_print("Starting config update at config_version %d.\n", ver); - - if (!_version_check(ver)) - return -1; - - if (ver == CLAWS_CONFIG_VERSION) { - debug_print("No update necessary, already at latest config_version.\n"); - return 0; /* nothing to do */ - } - - while (ver < CLAWS_CONFIG_VERSION) { - _update_config_password_store(ver++); - } - - debug_print("Passwordstore config update done.\n"); - return 1; -} - -int prefs_update_config_version_folderlist(gint from_version) -{ - gint ver = from_version; - - if (ver == -1) { - /* There was no config_version stored in the config, let's assume - * config_version same as what clawsrc started at this session, - * to avoid breaking the configuration by "upgrading" it unnecessarily. */ - debug_print("Folderlist: config_version not saved, using one from clawsrc: %d\n", starting_config_version); - ver = starting_config_version; - } - - debug_print("Starting config_update at config_version %d,\n", ver); - - if (!_version_check(ver)) - return -1; - - if (ver == CLAWS_CONFIG_VERSION) { - debug_print("No update necessary, already at latest config_version.\n"); - return 0; /* nothing to do */ - } - - while (ver < CLAWS_CONFIG_VERSION) { - _update_config_folderlist(ver++); - } - - debug_print("Folderlist config update done.\n"); - return 1; -} - -int prefs_update_config_version_folder_item(FolderItem *item) -{ - gint ver; - gchar *id; - - cm_return_val_if_fail(item != NULL, 0); - - id = folder_item_get_identifier(item); - - if (item->prefs->config_version == -1) { - /* There was no config_version stored in the config, let's assume - * config_version same as what clawsrc started at this session, - * to avoid breaking the configuration by "upgrading" it unnecessarily. */ - debug_print("Folder item '%s': config_version not saved, using one from clawsrc: %d\n", id, starting_config_version); - item->prefs->config_version = starting_config_version; - } - - ver = item->prefs->config_version; - - if (!_version_check(ver)) { - g_free(id); - return -1; - } - - if (ver == CLAWS_CONFIG_VERSION) { - debug_print("Folder item '%s': No update necessary, already at latest config_version %d.\n", id, ver); - g_free(id); - return 0; /* nothing to do */ - } - - debug_print("Folder item '%s': starting config_update at version %d.\n", - id, ver); - g_free(id); - - while (ver < CLAWS_CONFIG_VERSION) { - _update_config_folder_item(item, ver++); - } - - debug_print("Folder item config update done.\n"); - return 0; -} blob - a317921882a01a1e6358fc3b8678fdd557692fdb (mode 644) blob + /dev/null --- src/prefs_migration.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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 . - */ - -#ifndef __PREFS_MIGRATION_H__ -#define __PREFS_MIGRATION_H__ - -int prefs_update_config_version_common(); -int prefs_update_config_version_accounts(); -int prefs_update_config_version_password_store(gint from_version); -int prefs_update_config_version_folderlist(gint from_version); -int prefs_update_config_version_folder_item(FolderItem *item); - -#endif /* __PREFS_MIGRATION_H__ */