aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2008-11-07 14:34:14 +0800
committerBharath Acharya <abharath@src.gnome.org>2008-11-07 14:34:14 +0800
commitd88fc2bcc8a70c9edc7216f6de185bfec0ab6253 (patch)
tree40193b8ad9e7439e3bfb6be4d5a2bade28af71b3
parentd30ea147a736aad6d2731d07125e95cb122b5fda (diff)
downloadgsoc2013-evolution-d88fc2bcc8a70c9edc7216f6de185bfec0ab6253.tar
gsoc2013-evolution-d88fc2bcc8a70c9edc7216f6de185bfec0ab6253.tar.gz
gsoc2013-evolution-d88fc2bcc8a70c9edc7216f6de185bfec0ab6253.tar.bz2
gsoc2013-evolution-d88fc2bcc8a70c9edc7216f6de185bfec0ab6253.tar.lz
gsoc2013-evolution-d88fc2bcc8a70c9edc7216f6de185bfec0ab6253.tar.xz
gsoc2013-evolution-d88fc2bcc8a70c9edc7216f6de185bfec0ab6253.tar.zst
gsoc2013-evolution-d88fc2bcc8a70c9edc7216f6de185bfec0ab6253.zip
Committing on behalf of Matthew Barnes <mbarnes@redhat.com>
2008-11-07 Matthew Barnes <mbarnes@redhat.com> ** Fix for bug #552583 * mail-config.c: (mail_config_get_account_by_source_url): Instead of preserving the authmech attribute in the two URLs being compared, strip the attributes out of both URLs and just do a simple string comparison. We're just trying to match a URL to an account here. The authentication method shouldn't be relevant. svn path=/branches/gnome-2-24/; revision=36759
-rw-r--r--mail/ChangeLog10
-rw-r--r--mail/mail-config.c53
2 files changed, 37 insertions, 26 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 6bb5fe4118..ed487d75c9 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,13 @@
+2008-11-07 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Fix for bug #552583
+
+ * mail-config.c: (mail_config_get_account_by_source_url):
+ Instead of preserving the authmech attribute in the two URLs
+ being compared, strip the attributes out of both URLs and just do
+ a simple string comparison. We're just trying to match a URL to
+ an account here. The authentication method shouldn't be relevant.
+
2008-11-07 Bharath Acharya <abharath@novell.com>
** Fix for BNC bug #437226
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 9c2bff8a61..4629d7a310 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -781,48 +781,49 @@ mail_config_get_account_by_uid (const char *uid)
EAccount *
mail_config_get_account_by_source_url (const char *source_url)
{
- CamelProvider *provider;
- EAccount *account;
- CamelURL *source;
+ EAccount *account = NULL;
EIterator *iter;
g_return_val_if_fail (source_url != NULL, NULL);
- provider = camel_provider_get(source_url, NULL);
- if (!provider)
- return NULL;
-
- source = camel_url_new (source_url, NULL);
- if (!source)
- 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->source && account->source->url && account->source->url[0]) {
- CamelURL *url;
+ e_iterator_next (iter);
- url = camel_url_new (account->source->url, NULL);
- if (url && provider->url_equal (url, source)) {
- camel_url_free (url);
- camel_url_free (source);
- g_object_unref (iter);
+ if (account->source == NULL)
+ continue;
- return account;
- }
+ else if (account->source->url == NULL)
+ continue;
- if (url)
- camel_url_free (url);
- }
+ else if (*account->source->url == '\0')
+ continue;
- e_iterator_next (iter);
+ url = camel_url_new (account->source->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, source_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 (source);
-
return NULL;
}