[evolution-ews/wip/mcrha/soup3] Fix account auto-discover
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews/wip/mcrha/soup3] Fix account auto-discover
- Date: Tue, 31 May 2022 14:01:46 +0000 (UTC)
commit c691fbc1d4f54895c719743bb6d8159007a30dd0
Author: Milan Crha <mcrha redhat com>
Date: Tue May 31 16:00:52 2022 +0200
Fix account auto-discover
src/EWS/common/e-ews-connection.c | 10 ++++++----
src/EWS/common/e-soap-request.c | 2 +-
src/EWS/evolution/e-mail-config-ews-autodiscover.c | 12 +++---------
3 files changed, 10 insertions(+), 14 deletions(-)
---
diff --git a/src/EWS/common/e-ews-connection.c b/src/EWS/common/e-ews-connection.c
index fbc5d28c..ea6f9e1d 100644
--- a/src/EWS/common/e-ews-connection.c
+++ b/src/EWS/common/e-ews-connection.c
@@ -2694,7 +2694,7 @@ ews_autodiscover_response_ready_cb (GObject *source_object,
g_clear_error (&local_error);
}
- if (!g_atomic_int_dec_and_test (&ad->n_pending))
+ if (g_atomic_int_dec_and_test (&ad->n_pending))
g_main_loop_quit (ad->main_loop);
g_object_unref (ard->message);
@@ -2781,7 +2781,7 @@ autodiscover_srv_record_resolved_cb (GObject *source,
success = FALSE;
}
- if (!success && !g_atomic_int_dec_and_test (&ad->n_pending))
+ if (g_atomic_int_dec_and_test (&ad->n_pending))
g_main_loop_quit (ad->main_loop);
g_free (new_uri);
@@ -2834,7 +2834,7 @@ e_ews_autodiscover_prepare_requests_and_send_sync (AutodiscoverData *ad,
}
/* pair decrement for the increment at the beginning of the function */
- if (!g_atomic_int_dec_and_test (&ad->n_pending))
+ if (g_atomic_int_dec_and_test (&ad->n_pending))
g_main_loop_quit (ad->main_loop);
g_slist_free_full (requests, g_object_unref);
@@ -2931,10 +2931,12 @@ e_ews_autodiscover_ws_url_sync (ESource *source,
ad.session = e_ews_connection_create_soup_session (tmp_cnc);
g_object_set (ad.session, "timeout", 20, NULL);
e_ews_connection_set_password (tmp_cnc, password);
+ e_soup_session_set_credentials (E_SOUP_SESSION (ad.session), tmp_cnc->priv->credentials);
host_url = camel_ews_settings_get_hosturl (settings);
- if (e_ews_autodiscover_prepare_requests_and_send_sync (&ad, email_address, host_url, cancellable))
+ if (e_ews_autodiscover_prepare_requests_and_send_sync (&ad, email_address, host_url, cancellable) &&
+ g_atomic_int_get (&ad.n_pending) > 0)
g_main_loop_run (ad.main_loop);
g_main_context_pop_thread_default (main_context);
diff --git a/src/EWS/common/e-soap-request.c b/src/EWS/common/e-soap-request.c
index b4b744da..b6cf7f17 100644
--- a/src/EWS/common/e-soap-request.c
+++ b/src/EWS/common/e-soap-request.c
@@ -928,7 +928,7 @@ e_soap_request_set_custom_body (ESoapRequest *req,
req->priv->custom_body_data_len = 0;
if (content_type) {
- req->priv->custom_body_content_type = g_strdup (req->priv->custom_body_content_type);
+ req->priv->custom_body_content_type = g_strdup (content_type);
if (*content_type) {
req->priv->custom_body_data = g_memdup2 (body, body_len);
diff --git a/src/EWS/evolution/e-mail-config-ews-autodiscover.c
b/src/EWS/evolution/e-mail-config-ews-autodiscover.c
index 78c38843..9a78b0af 100644
--- a/src/EWS/evolution/e-mail-config-ews-autodiscover.c
+++ b/src/EWS/evolution/e-mail-config-ews-autodiscover.c
@@ -249,17 +249,11 @@ mail_config_ews_autodiscover_run (EMailConfigEwsAutodiscover *autodiscover)
backend = e_mail_config_ews_autodiscover_get_backend (autodiscover);
page = e_mail_config_service_backend_get_page (backend);
- source = e_mail_config_service_backend_get_source (backend);
+ source = e_mail_config_service_backend_get_collection (backend);
settings = e_mail_config_service_backend_get_settings (backend);
- if (!e_source_has_extension (source, E_SOURCE_EXTENSION_AUTHENTICATION)) {
- ESource *collection;
-
- collection = e_mail_config_service_backend_get_collection (backend);
- if (collection && e_source_has_extension (collection, E_SOURCE_EXTENSION_AUTHENTICATION)) {
- source = collection;
- }
- }
+ if (!source)
+ source = e_mail_config_service_backend_get_source (backend);
activity = e_mail_config_activity_page_new_activity (E_MAIL_CONFIG_ACTIVITY_PAGE (page));
cancellable = e_activity_get_cancellable (activity);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]