aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2008-06-19 00:36:52 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-06-19 00:36:52 +0800
commitef395aea81c8fc6b1e2d51c75833e167fdf6510b (patch)
tree6b288cc02c1c7d69434a68d023abd0cd6a8a0d65 /mail
parent1a5163b53919385a751bdcfdbc20d63a9424f3d0 (diff)
downloadgsoc2013-evolution-ef395aea81c8fc6b1e2d51c75833e167fdf6510b.tar
gsoc2013-evolution-ef395aea81c8fc6b1e2d51c75833e167fdf6510b.tar.gz
gsoc2013-evolution-ef395aea81c8fc6b1e2d51c75833e167fdf6510b.tar.bz2
gsoc2013-evolution-ef395aea81c8fc6b1e2d51c75833e167fdf6510b.tar.lz
gsoc2013-evolution-ef395aea81c8fc6b1e2d51c75833e167fdf6510b.tar.xz
gsoc2013-evolution-ef395aea81c8fc6b1e2d51c75833e167fdf6510b.tar.zst
gsoc2013-evolution-ef395aea81c8fc6b1e2d51c75833e167fdf6510b.zip
** Fixes part of bug #532472
2008-06-18 Matthew Barnes <mbarnes@redhat.com> ** Fixes part of bug #532472 * mail/mail-config.c (mail_config_get_account_by_transport_url): Strip the account URL (via CAMEL_URL_HIDE_ALL) before comparing it to the already-stripped 'transport_url', to avoid unnecessary password prompts. svn path=/trunk/; revision=35649
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog9
-rw-r--r--mail/mail-config.c53
2 files changed, 36 insertions, 26 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 1e8ce2d191..bef54c63c9 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,12 @@
+2008-06-18 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Fixes part of bug #532472
+
+ * mail-config.c (mail_config_get_account_by_transport_url):
+ Strip the account URL (via CAMEL_URL_HIDE_ALL) before comparing
+ it to the already-stripped 'transport_url', to avoid unnecessary
+ password prompts.
+
2008-06-16 Milan Crha <mcrha@redhat.com>
** Fix for bug #467892
diff --git a/mail/mail-config.c b/mail/mail-config.c
index ec2e491519..80f7171a80 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -829,48 +829,49 @@ mail_config_get_account_by_source_url (const char *source_url)
EAccount *
mail_config_get_account_by_transport_url (const char *transport_url)
{
- CamelProvider *provider;
- CamelURL *transport;
- EAccount *account;
+ EAccount *account = NULL;
EIterator *iter;
g_return_val_if_fail (transport_url != NULL, NULL);
- provider = camel_provider_get(transport_url, NULL);
- if (!provider)
- return NULL;
-
- transport = camel_url_new (transport_url, NULL);
- if (!transport)
- return NULL;
-
iter = e_list_get_iterator ((EList *) config->accounts);
while (e_iterator_is_valid (iter)) {
+ CamelURL *url;
+ gchar *string;
+
account = (EAccount *) e_iterator_get (iter);
- if (account->transport && account->transport->url && account->transport->url[0]) {
- CamelURL *url;
+ e_iterator_next (iter);
- url = camel_url_new (account->transport->url, NULL);
- if (url && provider->url_equal (url, transport)) {
- camel_url_free (url);
- camel_url_free (transport);
- g_object_unref (iter);
+ if (account->transport == NULL)
+ continue;
- return account;
- }
+ else if (account->transport->url == NULL)
+ continue;
- if (url)
- camel_url_free (url);
- }
+ else if (*account->transport->url == '\0')
+ continue;
- e_iterator_next (iter);
+ url = camel_url_new (account->transport->url, NULL);
+ if (url == NULL)
+ continue;
+
+ /* Simplify the account URL for comparison. */
+ string = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
+ if (string == NULL || strcmp (string, transport_url) != 0)
+ account = NULL; /* not a match */
+
+ camel_url_free (url);
+ g_free (string);
+
+ if (account != NULL) {
+ g_object_unref (iter);
+ return account;
+ }
}
g_object_unref (iter);
- camel_url_free (transport);
-
return NULL;
}