diff options
Diffstat (limited to 'mail/mail-config.c')
-rw-r--r-- | mail/mail-config.c | 113 |
1 files changed, 0 insertions, 113 deletions
diff --git a/mail/mail-config.c b/mail/mail-config.c index 31630836b0..1789a17423 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -283,119 +283,6 @@ mail_config_get_sync_timeout (void) return res; } -static EAccount * -mc_get_account_by (const gchar *given_url, const gchar * (get_url_string)(EAccount *account)) -{ - EAccountList *account_list; - EAccount *account = NULL; - EIterator *iter; - CamelURL *url; - CamelProvider *provider; - - g_return_val_if_fail (given_url != NULL, NULL); - g_return_val_if_fail (get_url_string != NULL, NULL); - - url = camel_url_new (given_url, NULL); - g_return_val_if_fail (url != NULL, NULL); - - provider = camel_provider_get (given_url, NULL); - g_return_val_if_fail (provider != NULL && provider->url_equal != NULL, NULL); - - account_list = e_get_account_list (); - iter = e_list_get_iterator ((EList *) account_list); - while (account == NULL && e_iterator_is_valid (iter)) { - CamelURL *account_url; - const gchar *account_url_string; - - account = (EAccount *) e_iterator_get (iter); - - e_iterator_next (iter); - - account_url_string = get_url_string (account); - - if ( !account_url_string || !*account_url_string) { - account = NULL; - continue; - } - - account_url = camel_url_new (account_url_string, NULL); - if (account_url == NULL) { - account = NULL; - continue; - } - - if (!provider->url_equal (url, account_url)) - account = NULL; /* not a match */ - - camel_url_free (account_url); - } - - g_object_unref (iter); - camel_url_free (url); - - return account; -} - -static const gchar * -get_source_url_string (EAccount *account) -{ - if (account && account->source && account->source->url && *account->source->url) - return account->source->url; - return NULL; -} - -static const gchar * -get_transport_url_string (EAccount *account) -{ - if (account && account->transport && account->transport->url && *account->transport->url) - return account->transport->url; - return NULL; -} - -EAccount * -mail_config_get_account_by_source_url (const gchar *source_url) -{ - return mc_get_account_by (source_url, get_source_url_string); -} - -EAccount * -mail_config_get_account_by_transport_url (const gchar *transport_url) -{ - return mc_get_account_by (transport_url, get_transport_url_string); -} - -EAccountService * -mail_config_get_default_transport (void) -{ - EAccountList *account_list; - EAccount *account; - EIterator *iter; - - account_list = e_get_account_list (); - account = e_get_default_account (); - - if (account && account->enabled && account->transport && account->transport->url && account->transport->url[0]) - return account->transport; - - /* return the first account with a transport? */ - iter = e_list_get_iterator ((EList *) account_list); - while (e_iterator_is_valid (iter)) { - account = (EAccount *) e_iterator_get (iter); - - if (account->enabled && account->transport && account->transport->url && account->transport->url[0]) { - g_object_unref (iter); - - return account->transport; - } - - e_iterator_next (iter); - } - - g_object_unref (iter); - - return NULL; -} - static gchar * uri_to_evname (const gchar *uri, const gchar *prefix) { |