[evolution-groupwise] Add a new provider based on imapx for mails and soap for calendar/address-book



commit 35c9f644541f2551000a8eed348bc7210e426723
Author: Chenthill Palanisamy <pchenthill novell com>
Date:   Tue May 8 14:27:37 2012 +0530

    Add a new provider based on imapx for mails and soap for calendar/address-book

 configure.ac                            |    1 +
 src/camel/Makefile.am                   |    1 +
 src/camel/imapx/camel-gwimap-provider.c |  211 +++++++++++++++++++++++++++++++
 src/camel/imapx/camel-gwimap-settings.c |  145 +++++++++++++++++++++
 src/camel/imapx/camel-gwimap-settings.h |   71 +++++++++++
 src/camel/imapx/camel-gwimap-store.c    |   49 +++++++
 src/camel/imapx/camel-gwimap-store.h    |   66 ++++++++++
 src/plugins/Makefile.am                 |    2 +
 src/plugins/camel-gw-listener.c         |   31 ++++--
 9 files changed, 569 insertions(+), 8 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 926ec9b..e5b0445 100644
--- a/configure.ac
+++ b/configure.ac
@@ -332,6 +332,7 @@ src/plugins/Makefile
 src/calendar/Makefile
 src/addressbook/Makefile
 src/camel/Makefile
+src/camel/imapx/Makefile
 src/server/libegroupwise-]EVO_GW_API_VERSION_MACRO[.pc:src/server/libegroupwise.pc.in
 ])
 AC_OUTPUT
diff --git a/src/camel/Makefile.am b/src/camel/Makefile.am
index e4ce094..a73c51a 100644
--- a/src/camel/Makefile.am
+++ b/src/camel/Makefile.am
@@ -1,3 +1,4 @@
+SUBDIRS = imapx
 camel_provider_LTLIBRARIES = libcamelgroupwise.la
 camel_provider_DATA = libcamelgroupwise.urls
 
diff --git a/src/camel/imapx/camel-gwimap-provider.c b/src/camel/imapx/camel-gwimap-provider.c
new file mode 100644
index 0000000..a3f110c
--- /dev/null
+++ b/src/camel/imapx/camel-gwimap-provider.c
@@ -0,0 +1,211 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* camel-pop3-provider.c: pop3 provider registration code */
+/*
+ * Authors :
+ *   Dan Winship <danw ximian com>
+ *   Michael Zucchi <notzed ximian com>
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU Lesser General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <camel/camel.h>
+#include <glib/gi18n-lib.h>
+
+#include <camel-gwimap-store.h>
+
+static guint gwimap_url_hash (gconstpointer key);
+static gint  gwimap_url_equal (gconstpointer a, gconstpointer b);
+
+CamelProviderConfEntry gwimap_conf_entries[] = {
+	{ CAMEL_PROVIDER_CONF_SECTION_START, "mailcheck", NULL,
+	  N_("Checking for New Mail") },
+	{ CAMEL_PROVIDER_CONF_CHECKBOX, "check-all", NULL,
+	  N_("C_heck for new messages in all folders"), "1" },
+	{ CAMEL_PROVIDER_CONF_CHECKBOX, "check-subscribed", NULL,
+	  N_("Ch_eck for new messages in subscribed folders"), "0" },
+	{ CAMEL_PROVIDER_CONF_CHECKBOX, "use-qresync", NULL,
+	  N_("Use _Quick Resync if the server supports it"), "1" },
+	{ CAMEL_PROVIDER_CONF_CHECKBOX, "use-idle", NULL,
+	  N_("_Listen for server change notifications"), "1" },
+	{ CAMEL_PROVIDER_CONF_SECTION_END },
+#ifndef G_OS_WIN32
+	{ CAMEL_PROVIDER_CONF_SECTION_START, "cmdsection", NULL,
+	  N_("Connection to Server") },
+	{ CAMEL_PROVIDER_CONF_CHECKBOX, "use-shell-command", NULL,
+	  N_("_Use custom command to connect to server"), "0" },
+	{ CAMEL_PROVIDER_CONF_ENTRY, "shell-command", "use-shell-command",
+	  N_("Command:"), "ssh -C -l %u %h exec /usr/sbin/dovecot --exec-mail imap" },
+	{ CAMEL_PROVIDER_CONF_CHECKSPIN, "concurrent-connections", NULL,
+	  N_("Numbe_r of cached connections to use"), "y:1:5:7" },
+	{ CAMEL_PROVIDER_CONF_SECTION_END },
+#endif
+	{ CAMEL_PROVIDER_CONF_SECTION_START, "folders", NULL,
+	  N_("Folders") },
+	{ CAMEL_PROVIDER_CONF_CHECKBOX, "use-subscriptions", NULL,
+	  N_("_Show only subscribed folders"), "1" },
+#if 0
+	{ CAMEL_PROVIDER_CONF_CHECKBOX, "use-namespace", NULL,
+	  N_("O_verride server-supplied folder namespace"), "0" },
+	{ CAMEL_PROVIDER_CONF_ENTRY, "namespace", "use-namespace",
+	  N_("Namespace:") },
+#endif
+	{ CAMEL_PROVIDER_CONF_SECTION_END },
+	{ CAMEL_PROVIDER_CONF_SECTION_START, "general", NULL, N_("Options") },
+	{ CAMEL_PROVIDER_CONF_CHECKBOX, "filter-all", NULL,
+	  N_("Apply _filters to new messages in all folders"), "0" },
+	{ CAMEL_PROVIDER_CONF_CHECKBOX, "filter-inbox", "!filter-all",
+	  N_("_Apply filters to new messages in Inbox on this server"), "1" },
+	{ CAMEL_PROVIDER_CONF_CHECKBOX, "filter-junk", NULL,
+	  N_("Check new messages for _Junk contents"), "0" },
+	{ CAMEL_PROVIDER_CONF_CHECKBOX, "filter-junk-inbox", "filter-junk",
+	  N_("Only check for Junk messages in the IN_BOX folder"), "0" },
+	{ CAMEL_PROVIDER_CONF_CHECKBOX, "stay-synchronized", NULL,
+	  N_("Automatically synchroni_ze remote mail locally"), "0" },
+	{ CAMEL_PROVIDER_CONF_SECTION_END },
+
+	/* extra GroupWise  configuration settings */
+	{CAMEL_PROVIDER_CONF_SECTION_START, "soapport", NULL,
+	  N_("SOAP Settings") },
+
+	{ CAMEL_PROVIDER_CONF_ENTRY, "soap-port", NULL,
+	  N_("Post Office Agent SOAP _Port:"), "7191" },
+
+	{ CAMEL_PROVIDER_CONF_HIDDEN, "auth-domain", NULL,
+	  NULL, "Groupwise" },
+	{ CAMEL_PROVIDER_CONF_SECTION_END },
+
+	{ CAMEL_PROVIDER_CONF_END }
+};
+
+CamelProviderPortEntry gwimap_port_entries[] = {
+	{ 143, N_("Default IMAP port"), FALSE },
+	{ 993, N_("IMAP over SSL"), TRUE },
+	{ 0, NULL, 0 }
+};
+
+static CamelProvider gwimap_provider = {
+	"gwimap",
+
+	N_("GroupWise IMAP"),
+
+	N_("For Accessing Novell GroupWise Server using imap for mails and groupwise protocol for calendar and address-book"),
+
+	"mail",
+
+	CAMEL_PROVIDER_IS_REMOTE | CAMEL_PROVIDER_IS_SOURCE |
+	CAMEL_PROVIDER_IS_STORAGE | CAMEL_PROVIDER_SUPPORTS_SSL|
+	CAMEL_PROVIDER_SUPPORTS_MOBILE_DEVICES |
+	CAMEL_PROVIDER_SUPPORTS_BATCH_FETCH |
+	CAMEL_PROVIDER_SUPPORTS_PURGE_MESSAGE_CACHE,
+
+	CAMEL_URL_NEED_USER | CAMEL_URL_NEED_HOST | CAMEL_URL_ALLOW_AUTH,
+
+	gwimap_conf_entries,
+
+	gwimap_port_entries,
+
+	/* ... */
+};
+
+void camel_gwimap_module_init (void);
+
+CamelServiceAuthType camel_gwimap_password_authtype = {
+	N_("Password"),
+
+	N_("This option will connect to the IMAP server using a "
+	   "plaintext password."),
+
+	"",
+	TRUE
+};
+
+void
+camel_gwimap_module_init (void)
+{
+	gwimap_provider.object_types[CAMEL_PROVIDER_STORE] = camel_gwimap_store_get_type ();
+	gwimap_provider.url_hash = gwimap_url_hash;
+	gwimap_provider.url_equal = gwimap_url_equal;
+	gwimap_provider.authtypes = camel_sasl_authtype_list (FALSE);
+	gwimap_provider.authtypes = g_list_prepend (gwimap_provider.authtypes, &camel_gwimap_password_authtype);
+	gwimap_provider.translation_domain = GETTEXT_PACKAGE;
+
+	/* TEMPORARY */
+	imapx_utils_init ();
+
+	camel_provider_register (&gwimap_provider);
+}
+
+void
+camel_provider_module_init (void)
+{
+	camel_gwimap_module_init ();
+}
+
+static void
+gwimap_add_hash (guint *hash,
+                gchar *s)
+{
+	if (s)
+		*hash ^= g_str_hash(s);
+}
+
+static guint
+gwimap_url_hash (gconstpointer key)
+{
+	const CamelURL *u = (CamelURL *) key;
+	guint hash = 0;
+
+	gwimap_add_hash (&hash, u->user);
+	gwimap_add_hash (&hash, u->host);
+	hash ^= u->port;
+
+	return hash;
+}
+
+static gint
+gwimap_check_equal (gchar *s1,
+                   gchar *s2)
+{
+	if (s1 == NULL) {
+		if (s2 == NULL)
+			return TRUE;
+		else
+			return FALSE;
+	}
+
+	if (s2 == NULL)
+		return FALSE;
+
+	return strcmp (s1, s2) == 0;
+}
+
+static gint
+gwimap_url_equal (gconstpointer a,
+                 gconstpointer b)
+{
+	const CamelURL *u1 = a, *u2 = b;
+
+	return gwimap_check_equal (u1->protocol, u2->protocol)
+		&& gwimap_check_equal (u1->user, u2->user)
+		&& gwimap_check_equal (u1->host, u2->host)
+		&& u1->port == u2->port;
+}
diff --git a/src/camel/imapx/camel-gwimap-settings.c b/src/camel/imapx/camel-gwimap-settings.c
new file mode 100644
index 0000000..d981317
--- /dev/null
+++ b/src/camel/imapx/camel-gwimap-settings.c
@@ -0,0 +1,145 @@
+/*
+ * camel-gwimap-settings.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#include "camel-gwimap-settings.h"
+
+#define CAMEL_GWIMAP_SETTINGS_GET_PRIVATE(obj) \
+	(G_TYPE_INSTANCE_GET_PRIVATE \
+	((obj), CAMEL_TYPE_GWIMAP_SETTINGS, CamelGwImapSettingsPrivate))
+
+struct _CamelGwImapSettingsPrivate {
+	gchar *soap_port;
+};
+
+enum {
+	PROP_0,
+	PROP_SOAP_PORT
+};
+
+G_DEFINE_TYPE_WITH_CODE (
+	CamelGwImapSettings,
+	camel_gwimap_settings,
+	CAMEL_TYPE_OFFLINE_SETTINGS,
+	G_IMPLEMENT_INTERFACE (
+		CAMEL_TYPE_NETWORK_SETTINGS, NULL))
+
+static void
+gwimap_settings_set_property (GObject *object,
+                                 guint property_id,
+                                 const GValue *value,
+                                 GParamSpec *pspec)
+{
+	switch (property_id) {
+		case PROP_SOAP_PORT:
+			camel_gwimap_settings_set_soap_port (
+				CAMEL_GWIMAP_SETTINGS (object),
+				g_value_get_string (value));
+			return;
+
+	}
+
+	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+gwimap_settings_get_property (GObject *object,
+                                 guint property_id,
+                                 GValue *value,
+                                 GParamSpec *pspec)
+{
+	switch (property_id) {
+		case PROP_SOAP_PORT:
+			g_value_set_string (
+				value,
+				camel_gwimap_settings_get_soap_port (
+				CAMEL_GWIMAP_SETTINGS (object)));
+			return;
+	}
+
+	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+gwimap_settings_finalize (GObject *object)
+{
+	CamelGwImapSettingsPrivate *priv;
+
+	priv = CAMEL_GWIMAP_SETTINGS_GET_PRIVATE (object);
+
+	g_free (priv->soap_port);
+
+	/* Chain up to parent's finalize() method. */
+	G_OBJECT_CLASS (camel_gwimap_settings_parent_class)->finalize (object);
+}
+
+static void
+camel_gwimap_settings_class_init (CamelGwImapSettingsClass *class)
+{
+	GObjectClass *object_class;
+
+	g_type_class_add_private (class, sizeof (CamelGwImapSettingsPrivate));
+
+	object_class = G_OBJECT_CLASS (class);
+	object_class->set_property = gwimap_settings_set_property;
+	object_class->get_property = gwimap_settings_get_property;
+	object_class->finalize = gwimap_settings_finalize;
+
+	g_object_class_install_property (
+		object_class,
+		PROP_SOAP_PORT,
+		g_param_spec_string (
+			"soap-port",
+			"SOAP Port",
+			"Post Office Agent SOAP Port",
+			"7191",
+			G_PARAM_READWRITE |
+			G_PARAM_CONSTRUCT |
+			G_PARAM_STATIC_STRINGS));
+}
+
+static void
+camel_gwimap_settings_init (CamelGwImapSettings *settings)
+{
+	settings->priv = CAMEL_GWIMAP_SETTINGS_GET_PRIVATE (settings);
+}
+
+const gchar *
+camel_gwimap_settings_get_soap_port (CamelGwImapSettings *settings)
+{
+	g_return_val_if_fail (CAMEL_IS_GWIMAP_SETTINGS (settings), "7191");
+
+	if (!settings->priv->soap_port)
+		return "7191";
+
+	return settings->priv->soap_port;
+}
+
+void
+camel_gwimap_settings_set_soap_port (CamelGwImapSettings *settings,
+                                        const gchar *soap_port)
+{
+	g_return_if_fail (CAMEL_IS_GWIMAP_SETTINGS (settings));
+
+	g_free (settings->priv->soap_port);
+	if (atoi (soap_port))
+		settings->priv->soap_port = g_strdup (soap_port);
+	else
+		settings->priv->soap_port = NULL;
+
+	g_object_notify (G_OBJECT (settings), "soap-port");
+}
diff --git a/src/camel/imapx/camel-gwimap-settings.h b/src/camel/imapx/camel-gwimap-settings.h
new file mode 100644
index 0000000..0906603
--- /dev/null
+++ b/src/camel/imapx/camel-gwimap-settings.h
@@ -0,0 +1,71 @@
+/*
+ * camel-groupwise-settings.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#ifndef CAMEL_GWIMAP_SETTINGS_H
+#define CAMEL_GWIMAP_SETTINGS_H
+
+#include <camel/camel.h>
+
+/* Standard GObject macros */
+#define CAMEL_TYPE_GWIMAP_SETTINGS \
+	(camel_gwimap_settings_get_type ())
+#define CAMEL_GWIMAP_SETTINGS(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), CAMEL_TYPE_GWIMAP_SETTINGS, CamelGwImapSettings))
+#define CAMEL_GWIMAP_SETTINGS_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), CAMEL_TYPE_GWIMAP_SETTINGS, CamelGwImapSettingsClass))
+#define CAMEL_IS_GWIMAP_SETTINGS(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), CAMEL_TYPE_GWIMAP_SETTINGS))
+#define CAMEL_IS_GWIMAP_SETTINGS_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), CAMEL_TYPE_GWIMAP_SETTINGS))
+#define CAMEL_GWIMAP_SETTINGS_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), CAMEL_TYPE_GWIMAP_SETTINGS, CamelGwImapSettingsClass))
+
+G_BEGIN_DECLS
+
+typedef struct _CamelGwImapSettings CamelGwImapSettings;
+typedef struct _CamelGwImapSettingsClass CamelGwImapSettingsClass;
+typedef struct _CamelGwImapSettingsPrivate CamelGwImapSettingsPrivate;
+
+struct _CamelGwImapSettings {
+	CamelIMAPXSettings parent;
+	CamelGwImapSettingsPrivate *priv;
+};
+
+struct _CamelGwImapSettingsClass {
+	CamelIMAPXSettingsClass parent_class;
+};
+
+GType		camel_gwimap_settings_get_type
+					(void) G_GNUC_CONST;
+
+					
+					
+const gchar *	camel_gwimap_settings_get_soap_port
+					(CamelGwImapSettings *settings);
+void		camel_gwimap_settings_set_soap_port
+					(CamelGwImapSettings *settings,
+					 const gchar *soap_port);
+
+G_END_DECLS
+
+#endif /* CAMEL_GWIMAP_SETTINGS_H */
diff --git a/src/camel/imapx/camel-gwimap-store.c b/src/camel/imapx/camel-gwimap-store.c
new file mode 100644
index 0000000..82a33da
--- /dev/null
+++ b/src/camel/imapx/camel-gwimap-store.c
@@ -0,0 +1,49 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* camel-imap-store.c : class for a imap store */
+/*
+ * Authors: Michael Zucchi <notzed ximian com>
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU Lesser General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "camel-gwimap-store.h"
+#include "camel-gwimap-settings.h"
+
+G_DEFINE_TYPE (
+	CamelGwImapStore,
+	camel_gwimap_store,
+	CAMEL_TYPE_IMAPX_STORE)
+
+
+static void
+camel_gwimap_store_class_init (CamelGwImapStoreClass *class)
+{
+	CamelServiceClass *service_class;
+
+	service_class = CAMEL_SERVICE_CLASS (class);
+	service_class->settings_type = CAMEL_TYPE_GWIMAP_SETTINGS;
+}
+
+static void
+camel_gwimap_store_init (CamelGwImapStore *gstore)
+{
+	
+}
diff --git a/src/camel/imapx/camel-gwimap-store.h b/src/camel/imapx/camel-gwimap-store.h
new file mode 100644
index 0000000..e3253f7
--- /dev/null
+++ b/src/camel/imapx/camel-gwimap-store.h
@@ -0,0 +1,66 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* camel-imap-store.h : class for an imap store */
+
+/*
+ * Authors: Michael Zucchi <notzed ximian com>
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU Lesser General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CAMEL_GWIMAP_STORE_H
+#define CAMEL_GWIMAP_STORE_H
+
+#include <camel/camel.h>
+
+/* Standard GObject macros */
+#define CAMEL_TYPE_GWIMAP_STORE \
+	(camel_gwimap_store_get_type ())
+#define CAMEL_GWIMAP_STORE(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), CAMEL_TYPE_GWIMAP_STORE, CamelGwImapStore))
+#define CAMEL_GWIMAP_STORE_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), CAMEL_TYPE_GWIMAP_STORE, CamelGwImapStoreClass))
+#define CAMEL_IS_GWIMAP_STORE(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), CAMEL_TYPE_GWIMAP_STORE))
+#define CAMEL_IS_GWIMAP_STORE_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), CAMEL_TYPE_GWIMAP_STORE))
+#define CAMEL_GWIMAP_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), CAMEL_TYPE_GWIMAP_STORE, CamelGwImapStoreClass))
+
+G_BEGIN_DECLS
+
+typedef struct _CamelGwImapStore CamelGwImapStore;
+typedef struct _CamelGwImapStoreClass CamelGwImapStoreClass;
+typedef struct _CamelGwImapStorePrivate CamelGwImapStorePrivate;
+
+struct _CamelGwImapStore {
+	CamelIMAPXStore parent;
+};
+
+struct _CamelGwImapStoreClass {
+	CamelIMAPXStoreClass parent_class;
+};
+
+GType		camel_gwimap_store_get_type	(void);
+
+G_END_DECLS
+
+#endif /* CAMEL_GWIMAP_STORE_H */
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index c78e1a6..b612869 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -27,6 +27,7 @@ liborg_gnome_groupwise_features_la_CPPFLAGS =		\
 	$(AM_CPPFLAGS)					\
 	-I$(top_srcdir)					\
 	-I$(top_srcdir)/src/camel			\
+	-I$(top_srcdir)/src/camel/imapx			\
 	-I$(top_srcdir)/src/server			\
 	-I$(top_builddir)/src/plugins			\
 	$(EVOLUTION_PLUGIN_CFLAGS)			\
@@ -40,6 +41,7 @@ liborg_gnome_groupwise_features_la_CPPFLAGS =		\
 	$(CAMEL_GROUPWISE_CFLAGS)			\
 	$(GNOME_PLATFORM_CFLAGS)			\
 	$(E_DATA_SERVER_CFLAGS)				\
+	$(IMAPX_CFLAGS)					\
 	$(DEBUG_CFLAGS)					\
 	$(CAMEL_CFLAGS)					\
 	-DEVOLUTION_UIDIR=\""$(uidir)"\"		\
diff --git a/src/plugins/camel-gw-listener.c b/src/plugins/camel-gw-listener.c
index b1d448e..ea2e1da 100644
--- a/src/plugins/camel-gw-listener.c
+++ b/src/plugins/camel-gw-listener.c
@@ -26,6 +26,7 @@
 
 #include "camel-gw-listener.h"
 #include "camel-groupwise-settings.h"
+#include "camel-gwimap-settings.h"
 #include <string.h>
 #include <glib/gi18n-lib.h>
 #include <camel/camel.h>
@@ -133,12 +134,26 @@ static gboolean
 is_groupwise_account (EAccount *account)
 {
 	if (account->source->url != NULL) {
-		return (strncmp (account->source->url,  GROUPWISE_URI_PREFIX, GROUPWISE_PREFIX_LENGTH ) == 0);
+		return ((strncmp (account->source->url,  GROUPWISE_URI_PREFIX, GROUPWISE_PREFIX_LENGTH ) == 0) ||
+				(strncmp (account->source->url, "gwimap", 6 ) == 0));
 	} else {
 		return FALSE;
 	}
 }
 
+static CamelSettings *
+get_camel_settings_for_url (const gchar *source_url)
+{
+	if (strncmp (source_url, GROUPWISE_URI_PREFIX, GROUPWISE_PREFIX_LENGTH) == 0)
+		return g_object_new (CAMEL_TYPE_GROUPWISE_SETTINGS, NULL);
+	else if (strncmp (source_url, "gwimap", 6) == 0)
+		return g_object_new (CAMEL_TYPE_GWIMAP_SETTINGS, NULL);
+	else
+		g_assert_not_reached ();
+
+	return NULL;
+}
+
 /* looks up for an existing groupwise account info in the groupwise_accounts list based on uid */
 
 static GwAccountInfo *
@@ -201,7 +216,7 @@ add_esource (const gchar *conf_key,
 
 	group_name = info->name;
 
-	settings = g_object_new (CAMEL_TYPE_GROUPWISE_SETTINGS, NULL);
+	settings = get_camel_settings_for_url (info->source_url);
 	camel_settings_load_from_url (settings, url);
 
 	g_object_get (
@@ -409,7 +424,7 @@ modify_esource (const gchar *conf_key,
 
 	found_group = FALSE;
 
-	settings = g_object_new (CAMEL_TYPE_GROUPWISE_SETTINGS, NULL);
+	settings = get_camel_settings_for_url (old_account_info->source_url);
 	camel_settings_load_from_url (settings, new_url);
 
 	g_object_get (
@@ -562,7 +577,7 @@ get_addressbook_names_from_server (gchar *source_url)
 	if (!poa_address || strlen (poa_address) ==0)
 		return NULL;
 
-	settings = g_object_new (CAMEL_TYPE_GROUPWISE_SETTINGS, NULL);
+	settings = get_camel_settings_for_url (source_url);
 	camel_settings_load_from_url (settings, url);
 
 	g_object_get (
@@ -687,7 +702,7 @@ add_addressbook_sources (EAccount *account)
 	if (!poa_address || strlen (poa_address) ==0)
 		return FALSE;
 
-	settings = g_object_new (CAMEL_TYPE_GROUPWISE_SETTINGS, NULL);
+	settings = get_camel_settings_for_url (account->source->url);
 	camel_settings_load_from_url (settings, url);
 
 	g_object_get (
@@ -825,7 +840,7 @@ modify_addressbook_sources (EAccount *account,
 	if (!poa_address || strlen (poa_address) ==0)
 		return;
 
-	settings = g_object_new (CAMEL_TYPE_GROUPWISE_SETTINGS, NULL);
+	settings = get_camel_settings_for_url (account->source->url);
 	camel_settings_load_from_url (settings, url);
 
 	g_object_get (
@@ -1047,7 +1062,7 @@ account_changed (EAccountList *account_listener,
 		old_url = camel_url_new (existing_account_info->source_url, NULL);
 		old_poa_address = old_url->host;
 
-		settings = g_object_new (CAMEL_TYPE_GROUPWISE_SETTINGS, NULL);
+		settings = get_camel_settings_for_url (existing_account_info->source_url);
 		camel_settings_load_from_url (settings, old_url);
 
 		g_object_get (
@@ -1064,7 +1079,7 @@ account_changed (EAccountList *account_listener,
 		if (!new_poa_address || strlen (new_poa_address) ==0)
 			return;
 
-		settings = g_object_new (CAMEL_TYPE_GROUPWISE_SETTINGS, NULL);
+		settings = get_camel_settings_for_url (existing_account_info->source_url);
 		camel_settings_load_from_url (settings, new_url);
 
 		g_object_get (



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