Write passwordstore into file more often, not just at exit.
authorAndrej Kacian <ticho@claws-mail.org>
Sat, 19 Mar 2016 19:50:04 +0000 (20:50 +0100)
committerAndrej Kacian <ticho@claws-mail.org>
Sat, 19 Mar 2016 19:50:04 +0000 (20:50 +0100)
src/plugins/gdata/cm_gdata_contacts.c
src/plugins/gdata/gdata_plugin.c
src/plugins/spam_report/spam_report_prefs.c
src/prefs_account.c

index fb7526396f35e22f7abcc422f99b5729e2c655b5..46c3385b701eddfc92e647c08c8c79c1d150ea4e 100644 (file)
@@ -644,6 +644,7 @@ void cm_gdata_contacts_done(void)
            memset(pass, 0, strlen(pass));
            g_free(pass);
                }
            memset(pass, 0, strlen(pass));
            g_free(pass);
                }
+               passwd_store_write_config();
 #endif
 
     g_object_unref(G_OBJECT(authorizer));
 #endif
 
     g_object_unref(G_OBJECT(authorizer));
index 99303a19c764ebf83cf5d20e3eeb3ac42ecfd1da..3e3e70c2e9f155fdd67b9f964783048c66357c00 100644 (file)
@@ -127,6 +127,7 @@ gint plugin_init(gchar **error)
        if(cm_gdata_config.oauth2_refresh_token != NULL) {
                passwd_store_set(PWS_PLUGIN, "GData", GDATA_TOKEN_PWD_STRING,
                                cm_gdata_config.oauth2_refresh_token, FALSE);
        if(cm_gdata_config.oauth2_refresh_token != NULL) {
                passwd_store_set(PWS_PLUGIN, "GData", GDATA_TOKEN_PWD_STRING,
                                cm_gdata_config.oauth2_refresh_token, FALSE);
+               passwd_store_write_config();
        }
 
   cm_gdata_prefs_init();
        }
 
   cm_gdata_prefs_init();
index 617794a9c6094adf78d8279c1e7e9fa4e6459955..b8b17b995e265c204414e1fea422a0c7626cdab8 100644 (file)
@@ -77,6 +77,7 @@ void spamreport_prefs_init(void)
        static gchar *path[3];
        gchar *rcpath;
        guint i;
        static gchar *path[3];
        gchar *rcpath;
        guint i;
+       gboolean passwords_migrated = FALSE;
 
        path[0] = _("Plugins");
        path[1] = _("SpamReport");
 
        path[0] = _("Plugins");
        path[1] = _("SpamReport");
@@ -93,8 +94,11 @@ void spamreport_prefs_init(void)
                                strlen(spamreport_prefs.pass[i]) > 0) {
                        spamreport_passwd_set(spam_interfaces[i].name,
                                        spamreport_prefs.pass[i]);
                                strlen(spamreport_prefs.pass[i]) > 0) {
                        spamreport_passwd_set(spam_interfaces[i].name,
                                        spamreport_prefs.pass[i]);
+                       passwords_migrated = TRUE;
                }
        }
                }
        }
+       if (passwords_migrated)
+               passwd_store_write_config();
 
         spamreport_prefs_page.page.path = path;
         spamreport_prefs_page.page.create_widget = create_spamreport_prefs_page;
 
         spamreport_prefs_page.page.path = path;
         spamreport_prefs_page.page.create_widget = create_spamreport_prefs_page;
@@ -243,4 +247,6 @@ static void save_spamreport_prefs(PrefsPage *page)
                prefs_file_close_revert(pref_file);
        } else
                prefs_file_close(pref_file);
                prefs_file_close_revert(pref_file);
        } else
                prefs_file_close(pref_file);
+
+       passwd_store_write_config();
 }
 }
index 1d9b4122183c39a56d9c44b50aa98a160165ae1a..f31db873f3b9fcccc8dfdcf56449e135517ae059 100644 (file)
@@ -3693,6 +3693,8 @@ void prefs_account_write_config_all(GList *account_list)
 
        if (prefs_file_close(pfile) < 0)
                g_warning("failed to write configuration to file");
 
        if (prefs_file_close(pfile) < 0)
                g_warning("failed to write configuration to file");
+
+       passwd_store_write_config();
 }
 #undef WRITE_PARAM
 
 }
 #undef WRITE_PARAM