aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2012-05-17 20:08:30 +0800
committerMilan Crha <mcrha@redhat.com>2012-05-17 20:09:30 +0800
commit7d337633ecc3a737580748c669e1f61144b80738 (patch)
treebd1b3b184d59ef7ca055b07e7ec79a79b362dc5f /mail
parenta0303ab5d220329fd23407149aaed1bdcdfb8c09 (diff)
downloadgsoc2013-evolution-7d337633ecc3a737580748c669e1f61144b80738.tar.gz
gsoc2013-evolution-7d337633ecc3a737580748c669e1f61144b80738.tar.zst
gsoc2013-evolution-7d337633ecc3a737580748c669e1f61144b80738.zip
Bug #676226 - Changing GOA mail account looses GOA key
Diffstat (limited to 'mail')
-rw-r--r--mail/em-account-editor.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c
index ad32e26df2..3c85daf983 100644
--- a/mail/em-account-editor.c
+++ b/mail/em-account-editor.c
@@ -5556,6 +5556,37 @@ setup_yahoo_calendar (EMAccountEditor *emae,
}
static void
+copy_param (GQuark key_id,
+ gpointer data,
+ gpointer user_data)
+{
+ GData **copy = user_data;
+
+ g_datalist_id_set_data_full (copy, key_id, g_strdup (data), g_free);
+}
+
+static void
+copy_original_url_parameters (CamelURL *copy_to_url,
+ const gchar *copy_from)
+{
+ CamelURL *url;
+
+ g_return_if_fail (copy_to_url != NULL);
+
+ if (!copy_from || !*copy_from)
+ return;
+
+ url = camel_url_new (copy_from, NULL);
+ if (!url)
+ return;
+
+ if (url->params)
+ g_datalist_foreach (&url->params, copy_param, &copy_to_url->params);
+
+ camel_url_free (url);
+}
+
+static void
emae_commit (EConfig *ec,
EMAccountEditor *emae)
{
@@ -5618,6 +5649,11 @@ emae_commit (EConfig *ec,
if (protocol != NULL)
camel_url_set_protocol (url, protocol);
+ /* the CamelSaslXOAUTH stores its data into parameters
+ unknown to settings, thus copy these first and overwrite
+ those known during save */
+ copy_original_url_parameters (url, modified_account->source->url);
+
if (settings != NULL)
camel_settings_save_to_url (settings, url);
@@ -5639,6 +5675,11 @@ emae_commit (EConfig *ec,
if (protocol != NULL)
camel_url_set_protocol (url, protocol);
+ /* the CamelSaslXOAUTH stores its data into parameters
+ unknown to settings, thus copy these first and overwrite
+ those known during save */
+ copy_original_url_parameters (url, modified_account->transport->url);
+
if (settings != NULL)
camel_settings_save_to_url (settings, url);