[evolution-groupwise] Bug #661543 - Evolution GroupWise connector always sets SOAP port to 0



commit 61870e9843c5d694c29d1547cd7fad498234046c
Author: Vibha Yadav <yvibha novell com>
Date:   Fri Oct 14 11:00:41 2011 +0530

    Bug #661543 - Evolution GroupWise connector always sets SOAP port to 0
    
    Porting CamelGroupwiseSettings:soap-port from unsigned int to string
    type for proper property binding.

 src/camel/camel-groupwise-settings.c |   23 ++++++++++++-----------
 src/camel/camel-groupwise-settings.h |    4 ++--
 src/camel/camel-groupwise-store.c    |    8 ++++----
 src/plugins/camel-gw-listener.c      |   26 +++++++++++++-------------
 src/plugins/proxy-login.c            |    8 ++++----
 src/plugins/proxy.c                  |    4 ++--
 src/plugins/send-options.c           |    4 ++--
 src/plugins/share-folder-common.c    |    4 ++--
 8 files changed, 41 insertions(+), 40 deletions(-)
---
diff --git a/src/camel/camel-groupwise-settings.c b/src/camel/camel-groupwise-settings.c
index d4f2426..0bb8f7f 100644
--- a/src/camel/camel-groupwise-settings.c
+++ b/src/camel/camel-groupwise-settings.c
@@ -26,7 +26,7 @@ struct _CamelGroupwiseSettingsPrivate {
 	gboolean check_all;
 	gboolean filter_junk;
 	gboolean filter_junk_inbox;
-	guint16 soap_port;
+	gchar *soap_port;
 };
 
 enum {
@@ -79,7 +79,7 @@ groupwise_settings_set_property (GObject *object,
 		case PROP_SOAP_PORT:
 			camel_groupwise_settings_set_soap_port (
 				CAMEL_GROUPWISE_SETTINGS (object),
-				g_value_get_uint (value));
+				g_value_get_string (value));
 			return;
 	}
 
@@ -122,7 +122,7 @@ groupwise_settings_get_property (GObject *object,
 			return;
 
 		case PROP_SOAP_PORT:
-			g_value_set_uint (
+			g_value_set_string (
 				value,
 				camel_groupwise_settings_get_soap_port (
 				CAMEL_GROUPWISE_SETTINGS (object)));
@@ -188,13 +188,11 @@ camel_groupwise_settings_class_init (CamelGroupwiseSettingsClass *class)
 	g_object_class_install_property (
 		object_class,
 		PROP_SOAP_PORT,
-		g_param_spec_uint (
+		g_param_spec_string (
 			"soap-port",
 			"SOAP Port",
 			"Post Office Agent SOAP Port",
-			0,
-			G_MAXUINT16,
-			7191,
+			"7191",
 			G_PARAM_READWRITE |
 			G_PARAM_CONSTRUCT |
 			G_PARAM_STATIC_STRINGS));
@@ -263,21 +261,24 @@ camel_groupwise_settings_set_filter_junk_inbox (CamelGroupwiseSettings *settings
 	g_object_notify (G_OBJECT (settings), "filter-junk-inbox");
 }
 
-guint16
+const gchar *
 camel_groupwise_settings_get_soap_port (CamelGroupwiseSettings *settings)
 {
-	g_return_val_if_fail (CAMEL_IS_GROUPWISE_SETTINGS (settings), 0);
+	g_return_val_if_fail (CAMEL_IS_GROUPWISE_SETTINGS (settings), "7191");
 
 	return settings->priv->soap_port;
 }
 
 void
 camel_groupwise_settings_set_soap_port (CamelGroupwiseSettings *settings,
-                                        guint16 soap_port)
+					const gchar* soap_port)
 {
 	g_return_if_fail (CAMEL_IS_GROUPWISE_SETTINGS (settings));
 
-	settings->priv->soap_port = soap_port;
+	if(atoi(soap_port))
+		settings->priv->soap_port = g_strdup(soap_port);
+	else
+		settings->priv->soap_port = g_strdup("7191");
 
 	g_object_notify (G_OBJECT (settings), "soap-port");
 }
diff --git a/src/camel/camel-groupwise-settings.h b/src/camel/camel-groupwise-settings.h
index f329fa9..c0d6339 100644
--- a/src/camel/camel-groupwise-settings.h
+++ b/src/camel/camel-groupwise-settings.h
@@ -72,11 +72,11 @@ gboolean	camel_groupwise_settings_get_filter_junk_inbox
 void		camel_groupwise_settings_set_filter_junk_inbox
 					(CamelGroupwiseSettings *settings,
 					 gboolean filter_junk_inbox);
-guint16		camel_groupwise_settings_get_soap_port
+const gchar*	camel_groupwise_settings_get_soap_port
 					(CamelGroupwiseSettings *settings);
 void		camel_groupwise_settings_set_soap_port
 					(CamelGroupwiseSettings *settings,
-					 guint16 soap_port);
+					 const gchar *soap_port);
 
 G_END_DECLS
 
diff --git a/src/camel/camel-groupwise-store.c b/src/camel/camel-groupwise-store.c
index cdc72a6..405607a 100644
--- a/src/camel/camel-groupwise-store.c
+++ b/src/camel/camel-groupwise-store.c
@@ -114,7 +114,7 @@ groupwise_auth_loop (CamelService *service,
 	const gchar *scheme;
 	const gchar *password;
 	EGwConnectionErrors errors = {E_GW_CONNECTION_STATUS_INVALID_OBJECT, NULL};
-	guint16 soap_port;
+	const gchar *soap_port;
 
 	url = camel_service_get_camel_url (service);
 	settings = camel_service_get_settings (service);
@@ -131,7 +131,7 @@ groupwise_auth_loop (CamelService *service,
 		scheme = "https";
 
 	uri = g_strdup_printf (
-		"%s://%s:%u/soap", scheme, priv->server_name, soap_port);
+		"%s://%s:%s/soap", scheme, priv->server_name, soap_port);
 
 	camel_service_set_password (service, NULL);
 	password = camel_service_get_password (service);
@@ -211,14 +211,14 @@ check_for_connection (CamelService *service,
 	ai = camel_getaddrinfo(priv->server_name, "groupwise", &hints, cancellable, &local_error);
 	if (ai == NULL && g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
 		gchar *port_string;
-		guint16 soap_port;
+		const gchar *soap_port;
 
 		g_clear_error (&local_error);
 
 		soap_port = camel_groupwise_settings_get_soap_port (
 			CAMEL_GROUPWISE_SETTINGS (settings));
 
-		port_string = g_strdup_printf ("%u", soap_port);
+		port_string = g_strdup(soap_port);
 		ai = camel_getaddrinfo (
 			priv->server_name, port_string, &hints,
 			cancellable, &local_error);
diff --git a/src/plugins/camel-gw-listener.c b/src/plugins/camel-gw-listener.c
index 39b18da..2397df8 100644
--- a/src/plugins/camel-gw-listener.c
+++ b/src/plugins/camel-gw-listener.c
@@ -191,7 +191,7 @@ add_esource (const gchar *conf_key,
 	const gchar *use_ssl;
 	const gchar *poa_address;
 	const gchar *group_name;
-	guint16 soap_port;
+	gchar *soap_port;
 	gboolean stay_synchronized;
 	gchar *port_string;
 
@@ -237,7 +237,7 @@ add_esource (const gchar *conf_key,
 	if (!can_create)
 		e_source_group_set_property (group, "create_source", "no");
 
-	port_string = g_strdup_printf ("%u", soap_port);
+	port_string = g_strdup(soap_port);
 
 	relative_uri = g_strdup_printf ("%s %s/", url->user, poa_address);
 	source = e_source_new (source_name, relative_uri);
@@ -392,7 +392,7 @@ modify_esource (const gchar *conf_key,
 	const gchar *new_poa_address;
 	const gchar *new_group_name = a->name;
 	const gchar *use_ssl;
-	guint16 soap_port;
+	gchar *soap_port;
 	gboolean stay_synchronized;
 	gchar *port_string;
 
@@ -435,7 +435,7 @@ modify_esource (const gchar *conf_key,
 			g_return_if_reached ();
 	}
 
-	port_string = g_strdup_printf ("%u", soap_port);
+	port_string = g_strdup(soap_port);
 
 	for (; groups != NULL &&  !found_group; groups = g_slist_next (groups)) {
 		ESourceGroup *group = E_SOURCE_GROUP (groups->data);
@@ -552,7 +552,7 @@ get_addressbook_names_from_server (gchar *source_url)
 	guint32 flags = E_PASSWORDS_REMEMBER_FOREVER | E_PASSWORDS_SECRET;
 	CamelNetworkSecurityMethod security_method;
 	const gchar *scheme;
-	guint16 soap_port;
+	gchar *soap_port;
 
 	url = camel_url_new (source_url, NULL);
 	if (url == NULL) {
@@ -580,7 +580,7 @@ get_addressbook_names_from_server (gchar *source_url)
 
 	key = g_strdup_printf ("groupwise://%s %s/", url->user, poa_address);
 
-	uri = g_strdup_printf ("%s://%s:%u/soap", scheme, poa_address, soap_port);
+	uri = g_strdup_printf ("%s://%s:%s/soap", scheme, poa_address, soap_port);
 
 	cnc = NULL;
 
@@ -676,7 +676,7 @@ add_addressbook_sources (EAccount *account)
 	CamelNetworkSecurityMethod security_method;
 	gboolean stay_synchronized;
 	gchar *port_string;
-	guint16 soap_port;
+	gchar *soap_port;
 
 	url = camel_url_new (account->source->url, NULL);
 	if (url == NULL) {
@@ -722,7 +722,7 @@ add_addressbook_sources (EAccount *account)
 	if (!temp_list)
 		return FALSE;
 
-	port_string = g_strdup_printf ("%u", soap_port);
+	port_string = g_strdup(soap_port);
 
 	for (; temp_list != NULL; temp_list = g_list_next (temp_list)) {
 		const gchar *book_name =  e_gw_container_get_name (E_GW_CONTAINER (temp_list->data));
@@ -804,7 +804,7 @@ modify_addressbook_sources (EAccount *account,
 	const gchar *poa_address;
 	CamelNetworkSecurityMethod security_method;
 	gchar *port_string;
-	guint16 soap_port;
+	gchar *soap_port;
 
 	url = camel_url_new (existing_account_info->source_url, NULL);
 	if (url == NULL) {
@@ -850,7 +850,7 @@ modify_addressbook_sources (EAccount *account,
 			g_return_if_reached ();
 	}
 
-	port_string = g_strdup_printf ("%u", soap_port);
+	port_string = g_strdup(soap_port);
 
 	new_base_uri = g_strdup_printf ("groupwise://%s %s", url->user, poa_address);
 
@@ -1034,8 +1034,8 @@ account_changed (EAccountList *account_listener,
 		CamelSettings *settings;
 		CamelNetworkSecurityMethod old_security_method;
 		CamelNetworkSecurityMethod new_security_method;
-		guint16 old_soap_port;
-		guint16 new_soap_port;
+		gchar *old_soap_port;
+		gchar *new_soap_port;
 
 		if (!account->enabled) {
 			account_removed (account_listener, account);
@@ -1075,7 +1075,7 @@ account_changed (EAccountList *account_listener,
 		g_object_unref (settings);
 
 		if ((old_poa_address && strcmp (old_poa_address, new_poa_address))
-		   || old_soap_port != new_soap_port
+		   || strcmp(old_soap_port, new_soap_port)
 		   || strcmp (old_url->user, new_url->user)
 		   || old_security_method != new_security_method) {
 
diff --git a/src/plugins/proxy-login.c b/src/plugins/proxy-login.c
index 100334d..8b868b2 100644
--- a/src/plugins/proxy-login.c
+++ b/src/plugins/proxy-login.c
@@ -188,7 +188,7 @@ proxy_get_password (EAccount *account,
 	CamelNetworkSecurityMethod security_method;
 	const gchar *poa_address;
 	const gchar *scheme;
-	guint16 soap_port;
+	gchar *soap_port;
 
 	url = camel_url_new (account->source->url, NULL);
 	if (url == NULL)
@@ -216,7 +216,7 @@ proxy_get_password (EAccount *account,
 
 	key = g_strdup_printf ("groupwise://%s %s/", url->user, poa_address);
 
-	uri = g_strdup_printf ("%s://%s:%u/soap", scheme, poa_address, soap_port);
+	uri = g_strdup_printf ("%s://%s:%s/soap", scheme, poa_address, soap_port);
 
 	failed_auth = "";
 
@@ -244,7 +244,7 @@ proxy_login_get_cnc (EAccount *account,
 	const gchar *failed_auth;
 	gchar *uri = NULL, *key = NULL, *prompt = NULL, *password = NULL;
 	const gchar *scheme;
-	guint16 soap_port;
+	gchar *soap_port;
 	gboolean remember;
 
 	url = camel_url_new (account->source->url, NULL);
@@ -270,7 +270,7 @@ proxy_login_get_cnc (EAccount *account,
 		scheme = "https";
 
 	key = g_strdup_printf ("groupwise://%s %s/", url->user, url->host);
-	uri = g_strdup_printf ("%s://%s:%u/soap", scheme, url->host, soap_port);
+	uri = g_strdup_printf ("%s://%s:%s/soap", scheme, url->host, soap_port);
 
 	failed_auth = "";
 	cnc = NULL;
diff --git a/src/plugins/proxy.c b/src/plugins/proxy.c
index 33c3f06..d067891 100644
--- a/src/plugins/proxy.c
+++ b/src/plugins/proxy.c
@@ -475,7 +475,7 @@ proxy_get_cnc (EAccount *account,
 	const gchar *poa_address;
 	const gchar *scheme;
 	gboolean remember;
-	guint16 soap_port;
+	gchar *soap_port;
 
 	url = camel_url_new (account->source->url, NULL);
 	if (url == NULL)
@@ -502,7 +502,7 @@ proxy_get_cnc (EAccount *account,
 
 	key =  g_strdup_printf ("groupwise://%s %s/", url->user, poa_address);
 
-	uri = g_strdup_printf ("%s://%s:%u/soap", scheme, poa_address, soap_port);
+	uri = g_strdup_printf ("%s://%s:%s/soap", scheme, poa_address, soap_port);
 
 	failed_auth = "";
 	cnc = NULL;
diff --git a/src/plugins/send-options.c b/src/plugins/send-options.c
index fdb263f..719b50d 100644
--- a/src/plugins/send-options.c
+++ b/src/plugins/send-options.c
@@ -62,7 +62,7 @@ get_cnc (GtkWindow *parent_window)
 	const gchar *poa_address;
 	const gchar *scheme;
 	gboolean remember;
-	guint16 soap_port;
+	gchar *soap_port;
 
 	url = camel_url_new (account->source->url, NULL);
 	if (url == NULL)
@@ -89,7 +89,7 @@ get_cnc (GtkWindow *parent_window)
 
 	key =  g_strdup_printf ("groupwise://%s %s/", url->user, poa_address);
 
-	uri = g_strdup_printf ("%s://%s:%u/soap", scheme, poa_address, soap_port);
+	uri = g_strdup_printf ("%s://%s:%s/soap", scheme, poa_address, soap_port);
 
 	failed_auth = "";
 	cnc = NULL;
diff --git a/src/plugins/share-folder-common.c b/src/plugins/share-folder-common.c
index 256ae24..8095dab 100644
--- a/src/plugins/share-folder-common.c
+++ b/src/plugins/share-folder-common.c
@@ -443,7 +443,7 @@ get_cnc (CamelStore *store)
 	CamelNetworkSecurityMethod security_method;
 	const gchar *scheme;
 	const gchar *password;
-	guint16 soap_port;
+	gchar *soap_port;
 
 	if (!store)
 		return  NULL;
@@ -467,7 +467,7 @@ get_cnc (CamelStore *store)
 		scheme = "https";
 
 	uri = g_strdup_printf (
-		"%s://%s:%u/soap", scheme, server_name, soap_port);
+		"%s://%s:%s/soap", scheme, server_name, soap_port);
 
 	return e_gw_connection_new (uri, user, password);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]