[evolution-kolab/account-mgmt] Simplify kolab_mail_imap_client_configure_store_settings().
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab/account-mgmt] Simplify kolab_mail_imap_client_configure_store_settings().
- Date: Mon, 2 Jul 2012 13:13:06 +0000 (UTC)
commit 7e4f4cf9d4cd6390df1ac08d491e5f74d2c5182d
Author: Matthew Barnes <mbarnes redhat com>
Date: Mon Jul 2 09:11:50 2012 -0400
Simplify kolab_mail_imap_client_configure_store_settings().
KolabSettingsHandler carries an authoritative CamelKolabIMAPXSettings,
so just plug the CamelKolabIMAPXSettings into the CamelStore. Done.
src/libekolab/kolab-mail-imap-client.c | 76 +++----------------------------
1 files changed, 8 insertions(+), 68 deletions(-)
---
diff --git a/src/libekolab/kolab-mail-imap-client.c b/src/libekolab/kolab-mail-imap-client.c
index 79adc81..12e9b09 100644
--- a/src/libekolab/kolab-mail-imap-client.c
+++ b/src/libekolab/kolab-mail-imap-client.c
@@ -709,78 +709,23 @@ kolab_mail_imap_client_configure (KolabMailImapClient *self,
return TRUE;
}
-static gboolean
-kolab_mail_imap_client_configure_store_settings (KolabMailImapClient *self,
- GError **err)
+static void
+kolab_mail_imap_client_configure_store_settings (KolabMailImapClient *self)
{
KolabMailImapClientPrivate *priv = NULL;
CamelService *service = NULL;
- CamelSettings *camel_settings = NULL;
- CamelNetworkSecurityMethod security_method = CAMEL_NETWORK_SECURITY_METHOD_STARTTLS_ON_STANDARD_PORT;
- guint16 port = 0;
- KolabTLSVariantID tlsvariant = KOLAB_TLS_VARIANT_NONE;
- GError *tmp_err = NULL;
+ CamelKolabIMAPXSettings *settings;
g_assert (KOLAB_IS_MAIL_IMAP_CLIENT (self));
- g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
priv = KOLAB_MAIL_IMAP_CLIENT_PRIVATE (self);
- /* create new settings object for service */
service = CAMEL_SERVICE (priv->store);
- camel_service_set_settings (service, NULL);
- camel_settings = camel_service_get_settings (service);
+ settings = kolab_settings_handler_get_camel_settings (priv->ksettings);
- /* get the details not (or no longer) covered by
- * CamelURL. Should be done for all details this
- * way, instead of using the (deprecated) CamelURL
- * for this
- */
-
- /* security and port settings */
- tlsvariant = kolab_settings_handler_get_uint_field (priv->ksettings,
- KOLAB_SETTINGS_HANDLER_UINT_FIELD_TLS_VARIANT,
- &tmp_err);
- if (tmp_err != NULL) {
- g_propagate_error (err, tmp_err);
- return FALSE;
- }
-
- switch (tlsvariant) {
- case KOLAB_TLS_VARIANT_NONE:
- security_method = CAMEL_NETWORK_SECURITY_METHOD_NONE;
- port = (guint16)kolab_settings_handler_get_int_field (priv->ksettings,
- KOLAB_SETTINGS_HANDLER_INT_FIELD_KOLAB_SERVER_IMAP_PORT,
- &tmp_err);
- break;
- case KOLAB_TLS_VARIANT_SSL:
- security_method = CAMEL_NETWORK_SECURITY_METHOD_SSL_ON_ALTERNATE_PORT;
- port = (guint16)kolab_settings_handler_get_int_field (priv->ksettings,
- KOLAB_SETTINGS_HANDLER_INT_FIELD_KOLAB_SERVER_IMAPS_PORT,
- &tmp_err);
- break;
- case KOLAB_TLS_VARIANT_STARTTLS:
- default:
- security_method = CAMEL_NETWORK_SECURITY_METHOD_STARTTLS_ON_STANDARD_PORT;
- port = (guint16)kolab_settings_handler_get_int_field (priv->ksettings,
- KOLAB_SETTINGS_HANDLER_INT_FIELD_KOLAB_SERVER_IMAP_PORT,
- &tmp_err);
- }
- if (tmp_err != NULL) {
- g_propagate_error (err, tmp_err);
- return FALSE;
- }
-
- /* set details */
- camel_network_settings_set_security_method (CAMEL_NETWORK_SETTINGS (camel_settings),
- security_method);
- camel_network_settings_set_port (CAMEL_NETWORK_SETTINGS (camel_settings),
- port);
-
- /* re-set the settings for our service (store) */
- camel_service_set_settings (service, camel_settings);
-
- return TRUE;
+ /* The CamelKolabIMAPXSettings held by CamelSettingsHandler
+ * is authoritative, so just plug it into the CamelService. */
+ camel_service_set_settings (service, CAMEL_SETTINGS (settings));
}
gboolean
@@ -855,12 +800,7 @@ kolab_mail_imap_client_bringup (KolabMailImapClient *self,
}
/* configure the service with settings from KolabSettingsHandler */
- ok = kolab_mail_imap_client_configure_store_settings (self,
- &tmp_err);
- if (! ok) {
- g_propagate_error (err, tmp_err);
- return FALSE;
- }
+ kolab_mail_imap_client_configure_store_settings (self);
/* set offline state */
ok = camel_offline_store_set_online_sync (CAMEL_OFFLINE_STORE (priv->store),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]