[evolution-kolab/account-mgmt: 28/29] kolab_util_calendar_create_http_request: Use CamelKolabIMAPXSettings.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab/account-mgmt: 28/29] kolab_util_calendar_create_http_request: Use CamelKolabIMAPXSettings.
- Date: Mon, 2 Jul 2012 04:26:11 +0000 (UTC)
commit 1315a238afb1086e507bc453646ca2344f81a4a0
Author: Matthew Barnes <mbarnes redhat com>
Date: Sun Jul 1 17:44:58 2012 -0400
kolab_util_calendar_create_http_request: Use CamelKolabIMAPXSettings.
Extract the CamelKolabIMAPXSettings from the KolabSettingsHandler,
call camel_kolab_imapx_settings_build_url(), set the protocol based
on CamelNetworkSettings security method, apply the given path, done.
src/calendar/kolab-util-calendar.c | 52 +++++-------------------------------
1 files changed, 7 insertions(+), 45 deletions(-)
---
diff --git a/src/calendar/kolab-util-calendar.c b/src/calendar/kolab-util-calendar.c
index 096c7d9..32de950 100644
--- a/src/calendar/kolab-util-calendar.c
+++ b/src/calendar/kolab-util-calendar.c
@@ -39,11 +39,9 @@ kolab_util_calendar_create_http_request (KolabSettingsHandler *ksettings,
const gchar *path,
GError **error)
{
- CamelURL *uri = NULL;
- const gchar *url = NULL;
- const gchar *user = NULL;
+ CamelURL *url = NULL;
+ CamelKolabIMAPXSettings *settings;
const gchar *passwd = NULL;
- guint tls_variant = KOLAB_TLS_VARIANT_DEFAULT;
KolabUtilHttpJob *job = NULL;
GError *tmp_err = NULL;
@@ -51,46 +49,10 @@ kolab_util_calendar_create_http_request (KolabSettingsHandler *ksettings,
g_assert (path != NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
- url = kolab_settings_handler_get_char_field (ksettings,
- KOLAB_SETTINGS_HANDLER_CHAR_FIELD_KOLAB_URI,
- &tmp_err);
- if (url == NULL) {
- g_propagate_error (error, tmp_err);
- return NULL;
- }
- tls_variant = kolab_settings_handler_get_uint_field (ksettings,
- KOLAB_SETTINGS_HANDLER_UINT_FIELD_TLS_VARIANT,
- &tmp_err);
- if (tmp_err != NULL) {
- g_propagate_error (error, tmp_err);
- return NULL;
- }
- uri = camel_url_new (url, &tmp_err);
- if (tmp_err != NULL) {
- g_propagate_error (error, tmp_err);
- return NULL;
- }
- if (uri == NULL) {
- /* FIXME is this an error condition? */
- return NULL;
- }
- switch (tls_variant) {
- case KOLAB_TLS_VARIANT_NONE:
- camel_url_set_protocol (uri, "http");
- break;
- default:
- camel_url_set_protocol (uri, "https");
- }
- camel_url_set_path (uri, path);
- user = kolab_settings_handler_get_char_field (ksettings,
- KOLAB_SETTINGS_HANDLER_CHAR_FIELD_KOLAB_USER_NAME,
- &tmp_err);
- if (user == NULL) {
- g_propagate_error (error, tmp_err);
- camel_url_free (uri);
- return NULL;
- }
- camel_url_set_user (uri, user);
+ settings = kolab_settings_handler_get_camel_settings (ksettings);
+ url = camel_kolab_imapx_settings_build_url (settings);
+ camel_url_set_path (url, path);
+
passwd = kolab_settings_handler_get_char_field (ksettings,
KOLAB_SETTINGS_HANDLER_CHAR_FIELD_KOLAB_USER_PASSWORD,
&tmp_err);
@@ -101,7 +63,7 @@ kolab_util_calendar_create_http_request (KolabSettingsHandler *ksettings,
}
job = kolab_util_http_job_new ();
- job->url = uri;
+ job->url = url;
job->passwd = g_strdup (passwd); /* no longer carried by CamelURL */
return job;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]