diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-10-22 01:26:07 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-10-25 00:03:54 +0800 |
commit | 56ebfe2f3f1bbcd05c2ac78821edd06c986b40e6 (patch) | |
tree | 9d042f76db5acba2aaaed47b41c581a06a204883 | |
parent | 8c67e84f9bf1803108f7a004513e37c6ef22d41f (diff) | |
download | gsoc2013-evolution-56ebfe2f3f1bbcd05c2ac78821edd06c986b40e6.tar gsoc2013-evolution-56ebfe2f3f1bbcd05c2ac78821edd06c986b40e6.tar.gz gsoc2013-evolution-56ebfe2f3f1bbcd05c2ac78821edd06c986b40e6.tar.bz2 gsoc2013-evolution-56ebfe2f3f1bbcd05c2ac78821edd06c986b40e6.tar.lz gsoc2013-evolution-56ebfe2f3f1bbcd05c2ac78821edd06c986b40e6.tar.xz gsoc2013-evolution-56ebfe2f3f1bbcd05c2ac78821edd06c986b40e6.tar.zst gsoc2013-evolution-56ebfe2f3f1bbcd05c2ac78821edd06c986b40e6.zip |
Adapt to CamelNetworkSettings changes.
-rw-r--r-- | mail/e-mail-local.c | 23 | ||||
-rw-r--r-- | mail/e-mail-migrate.c | 78 | ||||
-rw-r--r-- | mail/e-mail-session.c | 72 | ||||
-rw-r--r-- | mail/e-mail-store.c | 90 | ||||
-rw-r--r-- | mail/em-account-editor.c | 12 | ||||
-rw-r--r-- | mail/em-composer-utils.c | 4 | ||||
-rw-r--r-- | mail/em-folder-tree-model.c | 10 | ||||
-rw-r--r-- | mail/mail-ops.c | 13 | ||||
-rw-r--r-- | mail/mail-tools.c | 20 | ||||
-rw-r--r-- | mail/mail-vfolder.c | 9 | ||||
-rw-r--r-- | modules/online-accounts/camel-sasl-xoauth.c | 15 | ||||
-rw-r--r-- | plugins/itip-formatter/itip-formatter.c | 3 |
12 files changed, 218 insertions, 131 deletions
diff --git a/mail/e-mail-local.c b/mail/e-mail-local.c index 1f33c08ab8..28d174e303 100644 --- a/mail/e-mail-local.c +++ b/mail/e-mail-local.c @@ -53,9 +53,9 @@ void e_mail_local_init (EMailSession *session, const gchar *data_dir) { + CamelSettings *settings; CamelService *service; - CamelURL *url; - gchar *temp; + gchar *path; gint ii; GError *error = NULL; @@ -67,19 +67,19 @@ e_mail_local_init (EMailSession *session, mail_local_initialized = TRUE; - url = camel_url_new ("maildir:", NULL); - temp = g_build_filename (data_dir, "local", NULL); - camel_url_set_path (url, temp); - g_free (temp); - - temp = camel_url_to_string (url, 0); service = camel_session_add_service ( - CAMEL_SESSION (session), "local", temp, + CAMEL_SESSION (session), + "local", "maildir", CAMEL_PROVIDER_STORE, &error); - g_free (temp); camel_service_set_display_name (service, _("On This Computer")); + settings = camel_service_get_settings (service); + + path = g_build_filename (data_dir, "local", NULL); + g_object_set (settings, "path", path, NULL); + g_free (path); + /* Shouldn't need to worry about other mail applications * altering files in our local mail store. */ g_object_set (service, "need-summary-check", FALSE, NULL); @@ -114,8 +114,6 @@ e_mail_local_init (EMailSession *session, } } - camel_url_free (url); - local_store = g_object_ref (service); return; @@ -126,7 +124,6 @@ fail: error->message); g_error_free (error); - camel_url_free (url); } CamelFolder * diff --git a/mail/e-mail-migrate.c b/mail/e-mail-migrate.c index 10afa58e04..b11e3c4ae1 100644 --- a/mail/e-mail-migrate.c +++ b/mail/e-mail-migrate.c @@ -288,7 +288,7 @@ cp (const gchar *src, total += nwritten; if (show_progress) - em_migrate_set_progress (((double) total) / ((double) st.st_size)); + em_migrate_set_progress (((gdouble) total) / ((gdouble) st.st_size)); } while (total < st.st_size); if (fsync (writefd) == -1) @@ -610,7 +610,7 @@ migrate_folders (CamelStore *store, info = g_slice_new0 (MigrateStateInfo); info->label_name = g_strdup_printf ( "%s/%s", acc, fi->full_name); - info->progress = (double) (*nth_folder) / total_folders; + info->progress = (gdouble) (*nth_folder) / total_folders; g_idle_add_full ( G_PRIORITY_LOW, (GSourceFunc) @@ -655,23 +655,23 @@ static CamelStore * setup_local_store (EShellBackend *shell_backend, EMMigrateSession *session) { - CamelURL *url; + CamelSettings *settings; + CamelService *service; const gchar *data_dir; - gchar *tmp; - CamelStore *store; + gchar *path; - url = camel_url_new("mbox:", NULL); - data_dir = e_shell_backend_get_data_dir (shell_backend); - tmp = g_build_filename (data_dir, "local", NULL); - camel_url_set_path (url, tmp); - g_free (tmp); - tmp = camel_url_to_string (url, 0); - store = (CamelStore *) camel_session_add_service ( - CAMEL_SESSION (session), "local", tmp, + service = camel_session_add_service ( + CAMEL_SESSION (session), "local", "mbox", CAMEL_PROVIDER_STORE, NULL); - g_free (tmp); - return store; + settings = camel_service_get_settings (service); + data_dir = e_shell_backend_get_data_dir (shell_backend); + + path = g_build_filename (data_dir, "local", NULL); + g_object_set (settings, "path", path, NULL); + g_free (path); + + return CAMEL_STORE (service); } #ifndef G_OS_WIN32 @@ -704,9 +704,10 @@ migrate_to_db (EShellBackend *shell_backend) EIterator *iter; gint i = 0, len; CamelStore *store = NULL; + CamelSettings *settings; CamelFolderInfo *info; - CamelURL *url; const gchar *data_dir; + const gchar *path; if (!(accounts = e_get_account_list ())) return; @@ -728,9 +729,11 @@ migrate_to_db (EShellBackend *shell_backend) "folders has been moved to SQLite since Evolution 2.24.\n\nPlease be " "patient while Evolution migrates your folders...")); - em_migrate_set_progress ( (double) i / (len + 1)); + em_migrate_set_progress ((gdouble) i / (len + 1)); store = setup_local_store (shell_backend, session); - url = camel_service_get_camel_url (CAMEL_SERVICE (store)); + + settings = camel_service_get_settings (CAMEL_SERVICE (store)); + path = camel_local_settings_get_path (CAMEL_LOCAL_SETTINGS (settings)); info = camel_store_get_folder_info_sync ( store, NULL, @@ -741,7 +744,7 @@ migrate_to_db (EShellBackend *shell_backend) if (info) { struct migrate_folders_to_db_structure migrate_dbs; - if (g_str_has_suffix (url->path, ".evolution/mail/local")) + if (path != NULL && g_str_has_suffix (path, ".evolution/mail/local")) migrate_dbs.is_local_store = TRUE; else migrate_dbs.is_local_store = FALSE; @@ -757,14 +760,14 @@ migrate_to_db (EShellBackend *shell_backend) g_main_context_iteration (NULL, TRUE); } i++; - em_migrate_set_progress ( (double) i / (len + 1)); + em_migrate_set_progress ((gdouble) i / (len + 1)); while (e_iterator_is_valid (iter)) { EAccount *account = (EAccount *) e_iterator_get (iter); EAccountService *service; service = account->source; - em_migrate_set_progress ( (double) i / (len + 1)); + em_migrate_set_progress ((gdouble) i / (len + 1)); if (account->enabled && service->url != NULL && service->url[0] && strncmp (service->url, "mbox:", 5) != 0) { @@ -944,36 +947,31 @@ migrate_mbox_to_maildir (EShellBackend *shell_backend, { CamelService *mbox_service, *maildir_service; CamelStore *mbox_store, *maildir_store; - CamelURL *url; + CamelSettings *settings; const gchar *data_dir; - gchar *temp; + gchar *path; struct MigrateStore ms; data_dir = e_shell_backend_get_data_dir (shell_backend); - url = camel_url_new ("mbox:", NULL); - temp = g_build_filename (data_dir, "local_mbox", NULL); - camel_url_set_path (url, temp); - g_free (temp); - temp = camel_url_to_string (url, 0); mbox_service = camel_session_add_service ( - CAMEL_SESSION (session), "local_mbox", temp, + CAMEL_SESSION (session), "local_mbox", "mbox", CAMEL_PROVIDER_STORE, NULL); - g_free (temp); - camel_url_free (url); - url = camel_url_new ("maildir:", NULL); - temp = g_build_filename (data_dir, "local", NULL); - g_mkdir (temp, 0700); - camel_url_set_path (url, temp); - g_free (temp); + settings = camel_service_get_settings (mbox_service); + path = g_build_filename (data_dir, "local_mbox", NULL); + g_object_set (settings, "path", path, NULL); + g_free (path); - temp = camel_url_to_string (url, 0); maildir_service = camel_session_add_service ( - CAMEL_SESSION (session), "local", temp, + CAMEL_SESSION (session), "local", "maildir", CAMEL_PROVIDER_STORE, NULL); - g_free (temp); - camel_url_free (url); + + settings = camel_service_get_settings (maildir_service); + path = g_build_filename (data_dir, "local", NULL); + g_object_set (settings, "path", path, NULL); + g_mkdir (path, 0700); + g_free (path); mbox_store = CAMEL_STORE (mbox_service); maildir_store = CAMEL_STORE (maildir_service); diff --git a/mail/e-mail-session.c b/mail/e-mail-session.c index c14bdd56d8..39ccbbba80 100644 --- a/mail/e-mail-session.c +++ b/mail/e-mail-session.c @@ -459,11 +459,13 @@ mail_session_make_key (CamelService *service, { gchar *key; - if (service != NULL) - key = camel_url_to_string ( - camel_service_get_camel_url (service), - CAMEL_URL_HIDE_PARAMS); - else + if (service != NULL) { + CamelURL *url; + + url = camel_service_new_camel_url (service); + key = camel_url_to_string (url, CAMEL_URL_HIDE_ALL); + camel_url_free (url); + } else key = g_strdup (item); return key; @@ -720,7 +722,7 @@ mail_session_constructed (GObject *object) static CamelService * mail_session_add_service (CamelSession *session, const gchar *uid, - const gchar *url_string, + const gchar *protocol, CamelProviderType type, GError **error) { @@ -728,18 +730,51 @@ mail_session_add_service (CamelSession *session, /* Chain up to parents add_service() method. */ service = CAMEL_SESSION_CLASS (e_mail_session_parent_class)-> - add_service (session, uid, url_string, type, error); + add_service (session, uid, protocol, type, error); /* Initialize the CamelSettings object from CamelURL parameters. * This is temporary; soon we'll read settings from key files. */ if (CAMEL_IS_SERVICE (service)) { - CamelSettings *settings; - CamelURL *url; + EAccount *account; + CamelURL *url = NULL; - settings = camel_service_get_settings (service); - url = camel_service_get_camel_url (service); - camel_settings_load_from_url (settings, url); + account = e_get_account_by_uid (uid); + if (account != NULL) { + const gchar *url_string = NULL; + + switch (type) { + case CAMEL_PROVIDER_STORE: + url_string = account->source->url; + break; + case CAMEL_PROVIDER_TRANSPORT: + url_string = account->transport->url; + break; + default: + break; + } + + if (url_string != NULL) { + url = camel_url_new (url_string, error); + if (url == NULL) { + g_object_unref (service); + service = NULL; + } + } + } + + if (url != NULL) { + CamelSettings *settings; + + settings = camel_service_get_settings (service); + camel_settings_load_from_url (settings, url); + camel_url_free (url); + + /* Migrate files for this service from its old + * URL-based directory to a UID-based directory + * if necessary. */ + camel_service_migrate_files (service); + } } return service; @@ -1106,7 +1141,7 @@ mail_session_authenticate_sync (CamelSession *session, CamelServiceAuthType *authtype = NULL; CamelAuthenticationResult result; CamelProvider *provider; - CamelURL *url; + CamelSettings *settings; const gchar *password; guint32 password_flags; GError *local_error = NULL; @@ -1114,8 +1149,8 @@ mail_session_authenticate_sync (CamelSession *session, /* Do not chain up. Camel's default method is only an example for * subclasses to follow. Instead we mimic most of its logic here. */ - url = camel_service_get_camel_url (service); provider = camel_service_get_provider (service); + settings = camel_service_get_settings (service); /* APOP is one case where a non-SASL mechanism name is passed, so * don't bail if the CamelServiceAuthType struct comes back NULL. */ @@ -1174,11 +1209,18 @@ retry: password = camel_service_get_password (service); if (password == NULL) { + CamelNetworkSettings *network_settings; + const gchar *host; + const gchar *user; gchar *prompt; gchar *new_passwd; + network_settings = CAMEL_NETWORK_SETTINGS (settings); + host = camel_network_settings_get_host (network_settings); + user = camel_network_settings_get_user (network_settings); + prompt = camel_session_build_password_prompt ( - provider->name, url->user, url->host); + provider->name, user, host); new_passwd = camel_session_get_password ( session, service, prompt, "password", diff --git a/mail/e-mail-store.c b/mail/e-mail-store.c index 4785eb5177..07dcab8c5e 100644 --- a/mail/e-mail-store.c +++ b/mail/e-mail-store.c @@ -311,7 +311,9 @@ e_mail_store_add_by_account (EMailBackend *backend, CamelService *service = NULL; CamelProvider *provider; CamelURL *url; - gboolean skip = FALSE, transport_only; + gboolean transport_only; + gboolean service_is_local_delivery; + gboolean service_belongs_in_tree_model; GError *error = NULL; g_return_val_if_fail (E_IS_MAIL_BACKEND (backend), NULL); @@ -320,46 +322,84 @@ e_mail_store_add_by_account (EMailBackend *backend, session = e_mail_backend_get_session (backend); /* check whether it's transport-only accounts */ - transport_only = !account->source || !account->source->url || !*account->source->url; + transport_only = + (account->source == NULL) || + (account->source->url == NULL) || + (*account->source->url == '\0'); if (transport_only) goto handle_transport; /* Load the service, but don't connect. Check its provider, * and if this belongs in the folder tree model, add it. */ - provider = camel_provider_get (account->source->url, &error); + url = camel_url_new (account->source->url, NULL); + if (url != NULL) { + service_is_local_delivery = + em_utils_is_local_delivery_mbox_file (url); + provider = camel_provider_get (url->protocol, NULL); + camel_url_free (url); + } else { + service_is_local_delivery = FALSE; + provider = NULL; + } + if (provider == NULL) { - /* In case we do not have a provider here, we handle - * the special case of having multiple mail identities - * eg. a dummy account having just SMTP server defined */ + /* In case we do not have a provider here, we handle + * the special case of having multiple mail identities + * eg. a dummy account having just SMTP server defined */ goto handle_transport; } service = camel_session_add_service ( CAMEL_SESSION (session), - account->uid, account->source->url, + account->uid, provider->protocol, CAMEL_PROVIDER_STORE, &error); + if (!CAMEL_IS_STORE (service)) + goto fail; + camel_service_set_display_name (service, account->name); + service_belongs_in_tree_model = + (provider->flags & CAMEL_PROVIDER_IS_STORAGE) && + !service_is_local_delivery; + + if (service_belongs_in_tree_model && store_table != NULL) + e_mail_store_add (backend, CAMEL_STORE (service)); + handle_transport: + /* While we're at it, add the account's transport (if it has one) + * to the CamelSession. The transport's UID is a kludge for now. + * We take the EAccount's UID and tack on "-transport". */ + if (account->transport) { - /* While we're at it, add the account's transport to the - * CamelSession. The transport's UID is a kludge for now. - * We take the EAccount's UID and tack on "-transport". */ - gchar *transport_uid; GError *transport_error = NULL; - transport_uid = g_strconcat ( - account->uid, "-transport", NULL); + url = camel_url_new ( + account->transport->url, + &transport_error); + + if (url != NULL) { + provider = camel_provider_get ( + url->protocol, &transport_error); + camel_url_free (url); + } else + provider = NULL; - camel_session_add_service ( - CAMEL_SESSION (session), - transport_uid, account->transport->url, - CAMEL_PROVIDER_TRANSPORT, &transport_error); + if (provider != NULL) { + gchar *transport_uid; - g_free (transport_uid); + transport_uid = g_strconcat ( + account->uid, "-transport", NULL); + + camel_session_add_service ( + CAMEL_SESSION (session), + transport_uid, provider->protocol, + CAMEL_PROVIDER_TRANSPORT, &transport_error); + + g_free (transport_uid); + } if (transport_error) { g_warning ( @@ -372,20 +412,6 @@ handle_transport: if (transport_only) return NULL; - if (!CAMEL_IS_STORE (service)) - goto fail; - - /* Do not add local-delivery files, - * but make them ready for later use. */ - url = camel_url_new (account->source->url, NULL); - if (url != NULL) { - skip = em_utils_is_local_delivery_mbox_file (url); - camel_url_free (url); - } - - if (!skip && (provider->flags & CAMEL_PROVIDER_IS_STORAGE) != 0 && store_table != NULL) - e_mail_store_add (backend, CAMEL_STORE (service)); - return CAMEL_STORE (service); fail: diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c index b8510b8600..3236975978 100644 --- a/mail/em-account-editor.c +++ b/mail/em-account-editor.c @@ -2098,18 +2098,18 @@ emae_check_authtype (GtkWidget *w, url_string = (gchar *) e_account_get_string ( account, emae_service_info[service->type].account_uri_key); url = camel_url_new (url_string, NULL); - if (service->settings) - camel_settings_save_to_url (service->settings, url); - url_string = camel_url_to_string (url, 0); - camel_url_free (url); /* to test on actual data, not on previously used */ camel_service = camel_session_add_service ( CAMEL_SESSION (session), uid, - url_string, service->type, &error); + url->protocol, service->type, &error); - g_free (uid); + camel_url_free (url); g_free (url_string); + g_free (uid); + + if (camel_service != NULL && service->settings != NULL) + camel_service_set_settings (camel_service, service->settings); if (editor != NULL) parent = gtk_widget_get_toplevel (editor); diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index 837cc31f62..b09d3cd4e2 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -2214,12 +2214,14 @@ reply_get_composer (EShell *shell, parent_store = camel_folder_get_parent_store (folder); service = CAMEL_SERVICE (parent_store); - url = camel_service_get_camel_url (service); + url = camel_service_new_camel_url (service); store_url = camel_url_to_string ( url, CAMEL_URL_HIDE_ALL); if (store_url[strlen (store_url) - 1] == '/') store_url[strlen (store_url) - 1] = '\0'; + + camel_url_free (url); } post = camel_address_encode ((CamelAddress *) postto); diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c index 1e7840710f..0d305799fb 100644 --- a/mail/em-folder-tree-model.c +++ b/mail/em-folder-tree-model.c @@ -1218,7 +1218,6 @@ em_folder_tree_model_add_store (EMFolderTreeModel *model, service = CAMEL_SERVICE (store); provider = camel_service_get_provider (service); - service_url = camel_service_get_camel_url (service); display_name = camel_service_get_display_name (service); account_uid = camel_service_get_uid (service); @@ -1230,15 +1229,18 @@ em_folder_tree_model_add_store (EMFolderTreeModel *model, if ((provider->flags & CAMEL_PROVIDER_IS_STORAGE) == 0) return; - if (em_utils_is_local_delivery_mbox_file (service_url)) + service_url = camel_service_new_camel_url (service); + if (em_utils_is_local_delivery_mbox_file (service_url)) { + camel_url_free (service_url); return; + } + uri = camel_url_to_string (service_url, CAMEL_URL_HIDE_ALL); + camel_url_free (service_url); si = em_folder_tree_model_lookup_store_info (model, store); if (si != NULL) em_folder_tree_model_remove_store (model, store); - uri = camel_url_to_string (service_url, CAMEL_URL_HIDE_ALL); - mail_backend = em_folder_tree_model_get_backend (model); /* Add the store to the tree. */ diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 57885172a9..8bdb329f36 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -214,8 +214,8 @@ fetch_mail_exec (struct _fetch_mail_msg *m, struct _filter_mail_msg *fm = (struct _filter_mail_msg *) m; CamelFolder *folder = NULL; CamelURL *url; + gboolean is_local_delivery; const gchar *uid; - gboolean is_local_delivery = FALSE; gint i; fm->destination = e_mail_local_get_folder ( @@ -224,8 +224,9 @@ fetch_mail_exec (struct _fetch_mail_msg *m, goto fail; g_object_ref (fm->destination); - url = camel_service_get_camel_url (CAMEL_SERVICE (m->store)); + url = camel_service_new_camel_url (CAMEL_SERVICE (m->store)); is_local_delivery = em_utils_is_local_delivery_mbox_file (url); + if (is_local_delivery) { gchar *path; gchar *url_string; @@ -256,6 +257,8 @@ fetch_mail_exec (struct _fetch_mail_msg *m, fm->session, uid, cancellable, error); } + camel_url_free (url); + if (folder != NULL) { /* This handles 'keep on server' stuff, if we have any new * uid's to copy across, we need to copy them to a new array @@ -554,9 +557,10 @@ mail_send_message (struct _send_queue_msg *m, gchar *url_string; gchar *escaped; - url = camel_service_get_camel_url (CAMEL_SERVICE (transport)); + url = camel_service_new_camel_url (CAMEL_SERVICE (transport)); url_string = camel_url_to_string (url, CAMEL_URL_HIDE_ALL); escaped = escape_percent_sign (url_string); + camel_url_free (url); /* Let the dialog know the right account it is using. */ report_status (m, CAMEL_FILTER_STATUS_ACTION, 0, escaped); @@ -1199,8 +1203,9 @@ sync_store_desc (struct _sync_store_msg *m) CamelURL *url; gchar *uri, *res; - url = camel_service_get_camel_url (CAMEL_SERVICE (m->store)); + url = camel_service_new_camel_url (CAMEL_SERVICE (m->store)); uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL); + camel_url_free (url); res = g_strdup_printf (m->expunge ?_("Expunging and storing account '%s'") diff --git a/mail/mail-tools.c b/mail/mail-tools.c index 9ef758f06f..30ac175a18 100644 --- a/mail/mail-tools.c +++ b/mail/mail-tools.c @@ -89,16 +89,23 @@ mail_tool_do_movemail (CamelStore *store, GError **error) { #ifndef G_OS_WIN32 + CamelService *service; + CamelProvider *provider; + CamelSettings *settings; + const gchar *src_path; gchar *dest_path; struct stat sb; - CamelURL *url; gboolean success; g_return_val_if_fail (CAMEL_IS_STORE (store), NULL); - url = camel_service_get_camel_url (CAMEL_SERVICE (store)); + service = CAMEL_SERVICE (store); + provider = camel_service_get_provider (service); + settings = camel_service_get_settings (service); - if (strcmp (url->protocol, "mbox") != 0) { + g_return_val_if_fail (provider != NULL, NULL); + + if (g_strcmp0 (provider->protocol, "mbox") != 0) { /* This is really only an internal error anyway */ g_set_error ( error, CAMEL_SERVICE_ERROR, @@ -108,13 +115,16 @@ mail_tool_do_movemail (CamelStore *store, return NULL; } + src_path = camel_local_settings_get_path ( + CAMEL_LOCAL_SETTINGS (settings)); + /* Set up our destination. */ dest_path = mail_tool_get_local_movemail_path (store, error); if (dest_path == NULL) return NULL; - /* Movemail from source (source_url) to dest_path */ - success = camel_movemail (url->path, dest_path, error) != -1; + /* Movemail from source to dest_path */ + success = camel_movemail (src_path, dest_path, error) != -1; if (g_stat (dest_path, &sb) < 0 || sb.st_size == 0) { g_unlink (dest_path); /* Clean up the movemail.foo file. */ diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index c1e451d04c..66438f57ed 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -1089,9 +1089,8 @@ vfolder_load_storage (EMailBackend *backend) CamelService *service; const gchar *key; - const gchar *data_dir; const gchar *config_dir; - gchar *user, *storeuri; + gchar *user; EFilterRule *rule; MailFolderCache *folder_cache; EMailSession *session; @@ -1112,15 +1111,13 @@ vfolder_load_storage (EMailBackend *backend) G_UNLOCK (vfolder_hash); - data_dir = mail_session_get_data_dir (); config_dir = mail_session_get_config_dir (); session = e_mail_backend_get_session (backend); /* first, create the vfolder store, and set it up */ - storeuri = g_strdup_printf("vfolder:%s/vfolder", data_dir); service = camel_session_add_service ( CAMEL_SESSION (session), "vfolder", - storeuri, CAMEL_PROVIDER_STORE, NULL); + "vfolder", CAMEL_PROVIDER_STORE, NULL); if (service != NULL) { camel_service_set_display_name (service, _("Search Folders")); em_utils_connect_service_sync (service, NULL, NULL); @@ -1174,8 +1171,6 @@ vfolder_load_storage (EMailBackend *backend) } } - g_free (storeuri); - /* reenable the feature if required */ client = gconf_client_get_default (); key = "/apps/evolution/mail/display/enable_vfolders"; diff --git a/modules/online-accounts/camel-sasl-xoauth.c b/modules/online-accounts/camel-sasl-xoauth.c index 14ecb29bc4..e2ba57287a 100644 --- a/modules/online-accounts/camel-sasl-xoauth.c +++ b/modules/online-accounts/camel-sasl-xoauth.c @@ -352,21 +352,30 @@ sasl_xoauth_challenge_sync (CamelSasl *sasl, GoaAccount *goa_account; GByteArray *parameters = NULL; CamelService *service; + EAccount *account; CamelURL *url; const gchar *account_id; + const gchar *uid; gchar *xoauth_param = NULL; gboolean success; service = camel_sasl_get_service (sasl); - url = camel_service_get_camel_url (service); - account_id = camel_url_get_param (url, GOA_KEY); - g_return_val_if_fail (account_id != NULL, NULL); + uid = camel_service_get_uid (service); + account = e_get_account_by_uid (uid); + g_return_val_if_fail (account != NULL, NULL); goa_client = goa_client_new_sync (cancellable, error); if (goa_client == NULL) return NULL; + url = camel_url_new (account->store->url, error); + if (url == NULL) + return NULL; + + account_id = camel_url_get_param (url, GOA_KEY); goa_object = sasl_xoauth_get_account_by_id (goa_client, account_id); + camel_url_free (url); + if (goa_object == NULL) { g_set_error_literal ( error, CAMEL_SERVICE_ERROR, diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c index 5c733b7d49..72535a3a99 100644 --- a/plugins/itip-formatter/itip-formatter.c +++ b/plugins/itip-formatter/itip-formatter.c @@ -1036,8 +1036,9 @@ find_server (struct _itip_puri *pitip, parent_store = camel_folder_get_parent_store (pitip->folder); - url = camel_service_get_camel_url (CAMEL_SERVICE (parent_store)); + url = camel_service_new_camel_url (CAMEL_SERVICE (parent_store)); uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL); + camel_url_free (url); itip_view_set_buttons_sensitive (ITIP_VIEW (pitip->view), FALSE); |