diff options
Diffstat (limited to 'mail/mail-config.c')
-rw-r--r-- | mail/mail-config.c | 75 |
1 files changed, 49 insertions, 26 deletions
diff --git a/mail/mail-config.c b/mail/mail-config.c index 4ae2b0f885..8993e3b915 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -249,6 +249,22 @@ gconf_style_changed (GConfClient *client, guint cnxn_id, } static void +gconf_outlook_filenames_changed (GConfClient *client, guint cnxn_id, + GConfEntry *entry, gpointer user_data) +{ + extern int camel_header_param_encode_filenames_in_rfc_2047; + + g_return_if_fail (client != NULL); + + /* pass option to the camel */ + if (gconf_client_get_bool (client, "/apps/evolution/mail/composer/outlook_filenames", NULL)) { + camel_header_param_encode_filenames_in_rfc_2047 = 1; + } else { + camel_header_param_encode_filenames_in_rfc_2047 = 0; + } +} + +static void gconf_jh_check_changed (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) { @@ -370,6 +386,12 @@ mail_config_init (void) gconf_client_notify_add ( config->gconf, key, func, NULL, NULL, NULL); + key = "/apps/evolution/mail/composer/outlook_filenames"; + func = (GConfClientNotifyFunc) gconf_outlook_filenames_changed; + gconf_outlook_filenames_changed (config->gconf, 0, NULL, NULL); + gconf_client_notify_add ( + config->gconf, key, func, NULL, NULL, NULL); + /* Display Configuration */ gconf_client_add_dir ( @@ -782,48 +804,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); + + if (account->source == NULL) + continue; - 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); + else if (account->source->url == NULL) + continue; - return account; - } + else if (*account->source->url == '\0') + continue; - if (url) - camel_url_free (url); - } + url = camel_url_new (account->source->url, NULL); + if (url == NULL) + continue; - e_iterator_next (iter); + /* 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; } |