aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-config.c
diff options
context:
space:
mode:
Diffstat (limited to 'mail/mail-config.c')
-rw-r--r--mail/mail-config.c35
1 files changed, 28 insertions, 7 deletions
diff --git a/mail/mail-config.c b/mail/mail-config.c
index fbdded27c6..512a760034 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -1422,22 +1422,43 @@ const MailConfigAccount *
mail_config_get_account_by_source_url (const char *source_url)
{
const MailConfigAccount *account;
+ CamelProvider *provider;
+ CamelURL *source;
GSList *l;
-
+
g_return_val_if_fail (source_url != NULL, NULL);
-
+
+ provider = camel_session_get_provider (session, source_url, NULL);
+ if (!provider)
+ return NULL;
+
+ source = camel_url_new (source_url, NULL);
+ if (!source)
+ return NULL;
+
l = config->accounts;
while (l) {
account = l->data;
- if (account
- && account->source
- && account->source->url
- && e_url_equal (account->source->url, source_url))
- return account;
+
+ if (account && account->source && account->source->url) {
+ CamelURL *url;
+
+ url = camel_url_new (account->source->url, NULL);
+ if (url && provider->url_equal (url, source)) {
+ camel_url_free (url);
+ camel_url_free (source);
+ return account;
+ }
+
+ if (url)
+ camel_url_free (url);
+ }
l = l->next;
}
+ camel_url_free (source);
+
return NULL;
}