Bug 649365 - Creation of new repository evolution-groupwise
authorVibha Yadav <yvibha@novell.com>
Thu, 5 May 2011 07:16:09 +0000 (12:46 +0530)
committerVibha Yadav <yvibha@novell.com>
Thu, 5 May 2011 07:16:09 +0000 (12:46 +0530)
Removing groupwise plugin code from evolution.
Please find the evolution-groupwise repository
http://git.gnome.org/browse/evolution-groupwise

65 files changed:
Makefile.am
addressbook/backends/Makefile.am
addressbook/backends/groupwise/Makefile.am [deleted file]
addressbook/backends/groupwise/create-account.c [deleted file]
addressbook/backends/groupwise/e-book-backend-groupwise-factory.c [deleted file]
addressbook/backends/groupwise/e-book-backend-groupwise.c [deleted file]
addressbook/backends/groupwise/e-book-backend-groupwise.h [deleted file]
calendar/backends/Makefile.am
calendar/backends/groupwise/Makefile.am [deleted file]
calendar/backends/groupwise/TODO [deleted file]
calendar/backends/groupwise/e-cal-backend-groupwise-factory.c [deleted file]
calendar/backends/groupwise/e-cal-backend-groupwise-factory.h [deleted file]
calendar/backends/groupwise/e-cal-backend-groupwise-utils.c [deleted file]
calendar/backends/groupwise/e-cal-backend-groupwise-utils.h [deleted file]
calendar/backends/groupwise/e-cal-backend-groupwise.c [deleted file]
calendar/backends/groupwise/e-cal-backend-groupwise.h [deleted file]
camel/providers/Makefile.am
camel/providers/groupwise/Makefile.am [deleted file]
camel/providers/groupwise/camel-groupwise-folder.c [deleted file]
camel/providers/groupwise/camel-groupwise-folder.h [deleted file]
camel/providers/groupwise/camel-groupwise-journal.c [deleted file]
camel/providers/groupwise/camel-groupwise-journal.h [deleted file]
camel/providers/groupwise/camel-groupwise-private.h [deleted file]
camel/providers/groupwise/camel-groupwise-provider.c [deleted file]
camel/providers/groupwise/camel-groupwise-store-summary.c [deleted file]
camel/providers/groupwise/camel-groupwise-store-summary.h [deleted file]
camel/providers/groupwise/camel-groupwise-store.c [deleted file]
camel/providers/groupwise/camel-groupwise-store.h [deleted file]
camel/providers/groupwise/camel-groupwise-summary.c [deleted file]
camel/providers/groupwise/camel-groupwise-summary.h [deleted file]
camel/providers/groupwise/camel-groupwise-transport.c [deleted file]
camel/providers/groupwise/camel-groupwise-transport.h [deleted file]
camel/providers/groupwise/camel-groupwise-utils.c [deleted file]
camel/providers/groupwise/camel-groupwise-utils.h [deleted file]
camel/providers/groupwise/libcamelgroupwise.urls [deleted file]
configure.ac
servers/Makefile.am [deleted file]
servers/groupwise/Makefile.am [deleted file]
servers/groupwise/create-account.c [deleted file]
servers/groupwise/doc/GW_SABdeltas.txt [deleted file]
servers/groupwise/doc/gw-soap-enums.xsd [deleted file]
servers/groupwise/doc/gw-soap-methods.xsd [deleted file]
servers/groupwise/doc/gw-soap-types.xsd [deleted file]
servers/groupwise/e-gw-connection.c [deleted file]
servers/groupwise/e-gw-connection.h [deleted file]
servers/groupwise/e-gw-container.c [deleted file]
servers/groupwise/e-gw-container.h [deleted file]
servers/groupwise/e-gw-filter.c [deleted file]
servers/groupwise/e-gw-filter.h [deleted file]
servers/groupwise/e-gw-item.c [deleted file]
servers/groupwise/e-gw-item.h [deleted file]
servers/groupwise/e-gw-message.c [deleted file]
servers/groupwise/e-gw-message.h [deleted file]
servers/groupwise/e-gw-proxy.c [deleted file]
servers/groupwise/e-gw-proxy.h [deleted file]
servers/groupwise/e-gw-recur-utils.c [deleted file]
servers/groupwise/e-gw-recur-utils.h [deleted file]
servers/groupwise/e-gw-sendoptions.c [deleted file]
servers/groupwise/e-gw-sendoptions.h [deleted file]
servers/groupwise/libegroupwise.pc.in [deleted file]
servers/groupwise/soap-test.c [deleted file]
servers/groupwise/soup-soap-message.c [deleted file]
servers/groupwise/soup-soap-message.h [deleted file]
servers/groupwise/soup-soap-response.c [deleted file]
servers/groupwise/soup-soap-response.h [deleted file]

index eaaf5ec..9a4b309 100644 (file)
@@ -6,8 +6,8 @@ if ENABLE_CALENDAR
 CALENDAR_DIR = calendar
 endif
 
-SUBDIRS = libedataserver libebackend servers camel addressbook $(CALENDAR_DIR) libedataserverui tests docs art po
-DIST_SUBDIRS = libedataserver libebackend servers camel addressbook calendar libedataserverui tests docs art po
+SUBDIRS = libedataserver libebackend camel addressbook $(CALENDAR_DIR) libedataserverui tests docs art po
+DIST_SUBDIRS = libedataserver libebackend camel addressbook calendar libedataserverui tests docs art po
 
 %-$(API_VERSION).pc: %.pc
         cp $< $@
index b172d1c..d566392 100644 (file)
@@ -4,6 +4,6 @@ else
 LDAP_SUBDIR =
 endif
 
-SUBDIRS = file vcf $(LDAP_SUBDIR) google groupwise webdav
+SUBDIRS = file vcf $(LDAP_SUBDIR) google webdav
 
 -include $(top_srcdir)/git.mk
diff --git a/addressbook/backends/groupwise/Makefile.am b/addressbook/backends/groupwise/Makefile.am
deleted file mode 100644 (file)
index 3e64da5..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-ebook_backend_LTLIBRARIES = libebookbackendgroupwise.la
-
-libebookbackendgroupwise_la_CPPFLAGS = \
-       $(AM_CPPFLAGS)                                  \
-       -DG_LOG_DOMAIN=\"libebookbackend\"              \
-       -I$(top_srcdir)                                 \
-       -I$(top_builddir)                               \
-       -I$(top_srcdir)/addressbook                     \
-       -I$(top_builddir)/addressbook                   \
-       -I$(top_srcdir)/servers/groupwise               \
-       $(DB_CFLAGS)                                    \
-       $(EVOLUTION_ADDRESSBOOK_CFLAGS)                 \
-       $(SOUP_CFLAGS)  
-
-libebookbackendgroupwise_la_SOURCES =                  \
-       e-book-backend-groupwise.c                      \
-       e-book-backend-groupwise.h                      \
-       e-book-backend-groupwise-factory.c
-
-libebookbackendgroupwise_la_LIBADD =                                   \
-       $(top_builddir)/servers/groupwise/libegroupwise-1.2.la          \
-       $(top_builddir)/addressbook/libebook/libebook-1.2.la            \
-       $(top_builddir)/addressbook/libedata-book/libedata-book-1.2.la  \
-       $(top_builddir)/libedataserver/libedataserver-1.2.la            \
-       $(top_builddir)/libebackend/libebackend-1.2.la          \
-       $(DB_LIBS)                                                      \
-       $(EVOLUTION_ADDRESSBOOK_LIBS)                                   \
-       $(SOUP_LIBS)
-
-libebookbackendgroupwise_la_LDFLAGS =          \
-       -module -avoid-version $(NO_UNDEFINED)
-
-noinst_PROGRAMS = create-account
-
-create_account_CPPFLAGS = \
-       $(AM_CPPFLAGS)          \
-       -I$(top_srcdir)                                 \
-       -I$(top_builddir)                               \
-       -I$(top_srcdir)/addressbook                     \
-       -I$(top_builddir)/addressbook                   \
-       -I$(top_srcdir)/servers/groupwise               \
-       $(EVOLUTION_ADDRESSBOOK_CFLAGS)
-
-create_account_SOURCES = create-account.c
-
-create_account_LDADD =  $(top_builddir)/addressbook/libedata-book/libedata-book-1.2.la      \
-        $(top_builddir)/libedataserver/libedataserver-1.2.la              \
-        $(top_builddir)/servers/groupwise/libegroupwise-1.2.la \
-        $(E_DATA_SERVER_LIBS)
-
-
--include $(top_srcdir)/git.mk
diff --git a/addressbook/backends/groupwise/create-account.c b/addressbook/backends/groupwise/create-account.c
deleted file mode 100644 (file)
index a6433ab..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-
-#include <config.h>
-#include <gconf/gconf-client.h>
-#include <glib.h>
-#include "libedataserver/e-source-list.h"
-
-static GConfClient *conf_client;
-static GMainLoop *main_loop;
-static gchar *arg_hostname, *arg_username, *arg_password;
-
-static void
-add_account (const gchar *conf_key, const gchar *hostname, const gchar *username, const gchar *password)
-{
-       ESourceList *source_list;
-       ESourceGroup *group;
-       ESource *source;
-       gchar *group_name;
-
-       source_list = e_source_list_new_for_gconf (conf_client, conf_key);
-
-       group_name = g_strdup_printf ("%s@%s:7181/soap", username, hostname);
-       group = e_source_group_new ("Groupwise", "groupwise://");
-       e_source_list_add_group (source_list, group, -1);
-
-       if (password && *password) {
-               g_free (group_name);
-               group_name = g_strdup_printf ("%s:%s@%s/soap/", username, password, hostname);
-       }
-       source = e_source_new ("Frequent Contacts", group_name);
-       e_source_set_property (source, "auth", "ldap/simple-binddn");
-       e_source_set_property(source, "binddn", "user1");
-       e_source_group_add_source (group, source, -1);
-/*
-       source = e_source_new ("Test User1", group_name);
-       e_source_set_property (source, "auth", "ldap/simple-binddn");
-       e_source_set_property(source, "binddn", "user1");
-       e_source_group_add_source (group, source, -1);
-       source = e_source_new ("mybook1", group_name);
-       e_source_set_property (source, "auth", "ldap/simple-binddn");
-       e_source_set_property(source, "binddn", "user1");
-       e_source_group_add_source (group, source, -1);*/
-       e_source_list_sync (source_list, NULL);
-
-       g_free (group_name);
-       g_object_unref (source);
-       g_object_unref (group);
-       g_object_unref (source_list);
-}
-
-static gboolean
-idle_cb (gpointer data)
-{
-       add_account ("/apps/evolution/addressbook/sources", arg_hostname, arg_username, arg_password);
-/*     add_account ("/apps/evolution/tasks/sources", arg_hostname, arg_username, arg_password); */
-
-       g_main_loop_quit (main_loop);
-
-       return FALSE;
-}
-
-gint
-main (gint argc, gchar *argv[])
-{
-       g_type_init ();
-
-       if (argc != 3 && argc != 4) {
-               g_print ("Usage: %s hostname username [password]\n", argv[0]);
-               return -1;
-       }
-
-       arg_hostname = argv[1];
-       arg_username = argv[2];
-       if (argc == 4)
-               arg_password = argv[3];
-       else
-               arg_password = NULL;
-
-       conf_client = gconf_client_get_default ();
-
-       main_loop = g_main_loop_new (NULL, TRUE);
-       g_idle_add ((GSourceFunc) idle_cb, NULL);
-       g_main_loop_run (main_loop);
-
-       /* terminate */
-       g_object_unref (conf_client);
-       g_main_loop_unref (main_loop);
-
-       return 0;
-}
diff --git a/addressbook/backends/groupwise/e-book-backend-groupwise-factory.c b/addressbook/backends/groupwise/e-book-backend-groupwise-factory.c
deleted file mode 100644 (file)
index 67fe7b0..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* e-book-backend-groupwise-factory.c - Groupwise contact backend factory.
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * Authors: Chris Toshok <toshok@ximian.com>
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "libebackend/e-data-server-module.h"
-#include "libedata-book/e-book-backend-factory.h"
-#include "e-book-backend-groupwise.h"
-
-E_BOOK_BACKEND_FACTORY_SIMPLE (groupwise, Groupwise, e_book_backend_groupwise_new)
-
-static GType  groupwise_type;
-
-void
-eds_module_initialize (GTypeModule *module)
-{
-       groupwise_type = _groupwise_factory_get_type (module);
-}
-
-void
-eds_module_shutdown   (void)
-{
-}
-
-void
-eds_module_list_types (const GType **types, gint *num_types)
-{
-       *types = & groupwise_type;
-       *num_types = 1;
-}
-
diff --git a/addressbook/backends/groupwise/e-book-backend-groupwise.c b/addressbook/backends/groupwise/e-book-backend-groupwise.c
deleted file mode 100644 (file)
index 3fc997e..0000000
+++ /dev/null
@@ -1,3923 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* e-book-backend-groupwise.c - Groupwise contact backend.
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * Authors: Sivaiah Nallagatla <snallagatla@novell.com>
- */
-
-#include <config.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <time.h>
-#include <unistd.h>
-#include <errno.h>
-#include "db.h"
-
-#include <glib.h>
-#include <glib/gstdio.h>
-#include <glib/gi18n-lib.h>
-
-#include "libebackend/e-db3-utils.h"
-
-#include "libedataserver/e-sexp.h"
-#include "libedataserver/e-data-server-util.h"
-#include "libedataserver/e-flag.h"
-#include "libedataserver/e-url.h"
-#include "libebook/e-contact.h"
-#include "libebook/e-destination.h"
-#include "libedata-book/e-book-backend-sexp.h"
-#include "libedata-book/e-data-book.h"
-#include "libedata-book/e-data-book-view.h"
-#include "libedata-book/e-book-backend-db-cache.h"
-#include "libedata-book/e-book-backend-summary.h"
-#include "e-book-backend-groupwise.h"
-
-#include "e-gw-connection.h"
-#include "e-gw-item.h"
-#include "e-gw-filter.h"
-
-#define EDB_ERROR(_code) e_data_book_create_error (E_DATA_BOOK_STATUS_ ## _code, NULL)
-#define EDB_ERROR_EX(_code,_msg) e_data_book_create_error (E_DATA_BOOK_STATUS_ ## _code, _msg)
-#define EDB_ERROR_FAILED_STATUS(_code, _status) e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_ ## _code, "Failed with status 0x%x", _status)
-
-G_DEFINE_TYPE (EBookBackendGroupwise, e_book_backend_groupwise, E_TYPE_BOOK_BACKEND)
-
-typedef struct {
-        GCond *cond;
-        GMutex *mutex;
-        gboolean exit;
-} SyncUpdate;
-
-struct _EBookBackendGroupwisePrivate {
-       EGwConnection *cnc;
-       gchar *uri;
-       gchar *container_id;
-       gchar *book_name;
-       gchar *original_uri;
-       gchar *summary_file_name;
-       gboolean only_if_exists;
-       GHashTable *categories_by_id;
-       GHashTable *categories_by_name;
-       gboolean is_writable;
-       gboolean is_cache_ready;
-       gboolean is_summary_ready;
-       gboolean marked_for_offline;
-       gchar *use_ssl;
-       gint mode;
-       EBookBackendSummary *summary;
-       GMutex *update_cache_mutex;
-       GMutex *update_mutex;
-       DB     *file_db;
-       DB_ENV *env;
-
-       guint cache_timeout;
-       GThread *dthread;
-        SyncUpdate *dlock;
-};
-
-static GStaticMutex global_env_lock = G_STATIC_MUTEX_INIT;
-static struct {
-       gint ref_count;
-       DB_ENV *env;
-} global_env;
-
-#define CACHE_REFRESH_INTERVAL 600000
-#define ELEMENT_TYPE_SIMPLE 0x01
-#define ELEMENT_TYPE_COMPLEX 0x02 /* fields which require explicit functions to set values into EContact and EGwItem */
-#define SUMMARY_FLUSH_TIMEOUT 5000
-
-static gboolean enable_debug = FALSE;
-
-static void populate_emails (EContact *contact, gpointer data);
-static void set_emails_in_gw_item (EGwItem *item, gpointer data);
-static void set_emails_changes (EGwItem *new_item, EGwItem *old_item);
-static void populate_full_name (EContact *contact, gpointer data);
-static void set_full_name_in_gw_item (EGwItem *item, gpointer data);
-static void set_full_name_changes (EGwItem *new_item, EGwItem *old_item);
-static void populate_contact_members (EContact *contact, gpointer data);
-static void set_categories_changes (EGwItem *new_item, EGwItem *old_item);
-static void populate_birth_date (EContact *contact, gpointer data);
-static void set_birth_date_in_gw_item (EGwItem *item, gpointer data);
-static void set_birth_date_changes  (EGwItem *new_item, EGwItem *old_item);
-static void populate_address (EContact *contact, gpointer data);
-static void set_address_in_gw_item (EGwItem *item, gpointer data);
-static void set_address_changes (EGwItem *new_item, EGwItem *old_item);
-static void populate_ims (EContact *contact, gpointer data);
-static void set_ims_in_gw_item (EGwItem *item, gpointer data);
-static void set_im_changes (EGwItem *new_item, EGwItem *old_item);
-static void fill_contact_from_gw_item (EContact *contact, EGwItem *item, GHashTable *categories_by_ids);
-
-static const struct field_element_mapping {
-       EContactField field_id;
-       gint element_type;
-       const gchar *element_name;
-       void (*populate_contact_func)(EContact *contact,    gpointer data);
-       void (*set_value_in_gw_item) (EGwItem *item, gpointer data);
-       void (*set_changes) (EGwItem *new_item, EGwItem *old_item);
-
-} mappings[] = {
-
-       { E_CONTACT_UID, ELEMENT_TYPE_SIMPLE, "id"},
-       { E_CONTACT_FILE_AS, ELEMENT_TYPE_SIMPLE, "name" },
-       { E_CONTACT_FULL_NAME, ELEMENT_TYPE_COMPLEX, "full_name", populate_full_name, set_full_name_in_gw_item, set_full_name_changes},
-       { E_CONTACT_BIRTH_DATE, ELEMENT_TYPE_COMPLEX, "birthday", populate_birth_date, set_birth_date_in_gw_item, set_birth_date_changes },
-       { E_CONTACT_HOMEPAGE_URL, ELEMENT_TYPE_SIMPLE, "website"},
-       { E_CONTACT_NOTE, ELEMENT_TYPE_SIMPLE, "comment"},
-       { E_CONTACT_PHONE_PRIMARY, ELEMENT_TYPE_SIMPLE , "default_phone"},
-       { E_CONTACT_PHONE_BUSINESS, ELEMENT_TYPE_SIMPLE, "phone_Office"},
-       { E_CONTACT_PHONE_HOME, ELEMENT_TYPE_SIMPLE, "phone_Home"},
-       { E_CONTACT_PHONE_MOBILE, ELEMENT_TYPE_SIMPLE, "phone_Mobile"},
-       { E_CONTACT_PHONE_BUSINESS_FAX, ELEMENT_TYPE_SIMPLE, "phone_Fax" },
-       { E_CONTACT_PHONE_PAGER, ELEMENT_TYPE_SIMPLE, "phone_Pager"},
-       { E_CONTACT_ORG, ELEMENT_TYPE_SIMPLE, "organization"},
-       { E_CONTACT_ORG_UNIT, ELEMENT_TYPE_SIMPLE, "department"},
-       { E_CONTACT_TITLE, ELEMENT_TYPE_SIMPLE, "title"},
-       { E_CONTACT_EMAIL, ELEMENT_TYPE_COMPLEX, "members", populate_contact_members, NULL, NULL},
-       { E_CONTACT_ADDRESS_HOME, ELEMENT_TYPE_COMPLEX, "Home", populate_address, set_address_in_gw_item, set_address_changes },
-       { E_CONTACT_IM_AIM, ELEMENT_TYPE_COMPLEX, "ims", populate_ims, set_ims_in_gw_item, set_im_changes },
-       { E_CONTACT_CATEGORIES, ELEMENT_TYPE_COMPLEX, "categories", NULL, NULL, set_categories_changes},
-       { E_CONTACT_EMAIL_1, ELEMENT_TYPE_COMPLEX, "email", populate_emails, set_emails_in_gw_item, set_emails_changes },
-       { E_CONTACT_REV, ELEMENT_TYPE_SIMPLE, "modified_time"},
-       { E_CONTACT_BOOK_URI, ELEMENT_TYPE_SIMPLE, "book_uri"}
-};
-
-static void
-free_attr_list (GList *attr_list)
-{
-       GList *l;
-
-       for (l = attr_list; l; l = g_list_next (l)) {
-               EVCardAttribute *attr = l->data;
-               e_vcard_attribute_free (attr);
-       }
-
-       g_list_free (attr_list);
-}
-
-static void
-populate_ims (EContact *contact, gpointer data)
-{
-       GList *im_list;
-       GList *aim_list = NULL;
-       GList *icq_list = NULL;
-       GList *yahoo_list = NULL;
-       GList *gadugadu_list = NULL;
-       GList *msn_list = NULL;
-       GList *skype_list = NULL;
-       GList *jabber_list = NULL;
-       GList *groupwise_list = NULL;
-       IMAddress *address;
-       EGwItem *item;
-
-       item = E_GW_ITEM (data);
-       im_list = e_gw_item_get_im_list (item);
-
-       for (; im_list != NULL; im_list = g_list_next (im_list)) {
-               EVCardAttribute *attr;
-               GList **im_attr_list = NULL;
-               gint im_field_id = -1;
-
-               address = (IMAddress *) (im_list->data);
-               if (address->service == NULL) {
-                       continue;
-               }
-
-               if (g_str_equal (address->service, "icq")) {
-                       im_field_id = E_CONTACT_IM_ICQ;
-                       im_attr_list = &icq_list;
-               }
-               else if (g_str_equal (address->service, "aim")) {
-                       im_field_id = E_CONTACT_IM_AIM;
-                       im_attr_list = &aim_list;
-               }
-               else if (g_str_equal (address->service, "msn")) {
-                       im_field_id = E_CONTACT_IM_MSN;
-                       im_attr_list = &msn_list;
-               }
-               else if (g_str_equal (address->service, "skype")) {
-                       im_field_id = E_CONTACT_IM_SKYPE;
-                       im_attr_list = &skype_list;
-               }
-               else if (g_str_equal (address->service, "yahoo")) {
-                       im_field_id = E_CONTACT_IM_YAHOO;
-                       im_attr_list = &yahoo_list;
-               }
-               else if (g_str_equal (address->service, "gadu-gadu")) {
-                       im_field_id = E_CONTACT_IM_GADUGADU;
-                       im_attr_list = &gadugadu_list;
-               }
-               else if (g_str_equal (address->service, "jabber")) {
-                       im_field_id = E_CONTACT_IM_JABBER;
-                       im_attr_list = &jabber_list;
-               }
-
-               else if (g_str_equal (address->service, "nov")) {
-                       im_field_id = E_CONTACT_IM_GROUPWISE;
-                       im_attr_list = &groupwise_list;
-               }
-               if (im_field_id == -1)
-                       continue;
-
-               attr = e_vcard_attribute_new ("", e_contact_vcard_attribute(im_field_id));
-               e_vcard_attribute_add_param_with_value (attr, e_vcard_attribute_param_new (EVC_TYPE), "WORK");
-               e_vcard_attribute_add_value (attr, address->address);
-               *im_attr_list = g_list_append (*im_attr_list, attr);
-       }
-
-       e_contact_set_attributes (contact, E_CONTACT_IM_AIM, aim_list);
-       e_contact_set_attributes (contact, E_CONTACT_IM_JABBER, jabber_list);
-       e_contact_set_attributes (contact, E_CONTACT_IM_ICQ, icq_list);
-       e_contact_set_attributes (contact, E_CONTACT_IM_YAHOO, yahoo_list);
-       e_contact_set_attributes (contact, E_CONTACT_IM_GADUGADU, gadugadu_list);
-       e_contact_set_attributes (contact, E_CONTACT_IM_MSN, msn_list);
-       e_contact_set_attributes (contact, E_CONTACT_IM_SKYPE, skype_list);
-       e_contact_set_attributes (contact, E_CONTACT_IM_GROUPWISE, groupwise_list);
-
-       free_attr_list (aim_list);
-       free_attr_list (jabber_list);
-       free_attr_list (icq_list);
-       free_attr_list (yahoo_list);
-       free_attr_list (gadugadu_list);
-       free_attr_list (msn_list);
-       free_attr_list (skype_list);
-       free_attr_list (groupwise_list);
-}
-
-static void
-append_ims_to_list (GList **im_list, EContact *contact, const gchar *service_name, EContactField field_id)
-{
-       GList *list;
-       IMAddress *address;
-       list = e_contact_get (contact, field_id);
-       for (; list != NULL; list =  g_list_next (list)) {
-               address = g_new0 (IMAddress , 1);
-               address->service = g_strdup (service_name);
-               address->address = list->data;
-               *im_list = g_list_append (*im_list, address);
-       }
-       g_list_free (list);
-
-}
-
-static void
-set_ims_in_gw_item (EGwItem *item, gpointer data)
-{
-       EContact *contact;
-       GList *im_list = NULL;
-
-       contact = E_CONTACT (data);
-
-       append_ims_to_list (&im_list, contact, "aim", E_CONTACT_IM_AIM);
-       append_ims_to_list (&im_list, contact, "yahoo", E_CONTACT_IM_YAHOO);
-       append_ims_to_list (&im_list, contact, "gadu-gadu", E_CONTACT_IM_GADUGADU);
-       append_ims_to_list (&im_list, contact, "icq", E_CONTACT_IM_ICQ);
-       append_ims_to_list (&im_list, contact, "msn", E_CONTACT_IM_MSN);
-       append_ims_to_list (&im_list, contact, "skype", E_CONTACT_IM_SKYPE);
-       append_ims_to_list (&im_list, contact, "jabber", E_CONTACT_IM_JABBER);
-       append_ims_to_list (&im_list, contact, "nov", E_CONTACT_IM_GROUPWISE);
-       if (im_list)
-               e_gw_item_set_im_list (item, im_list);
-}
-
-static void
-set_im_changes (EGwItem *new_item, EGwItem *old_item)
-{
-       GList *old_ims;
-       GList *new_ims;
-       GList *added_ims = NULL;
-       GList *old_ims_copy;
-       GList *temp;
-       gboolean ims_matched;
-       IMAddress *im1, *im2;
-
-       old_ims = e_gw_item_get_im_list (old_item);
-       new_ims = e_gw_item_get_im_list (new_item);
-
-       if (old_ims && new_ims) {
-
-               old_ims_copy = g_list_copy (old_ims);
-               for (; new_ims != NULL; new_ims = g_list_next (new_ims)) {
-
-                       im1 = new_ims->data;
-                       temp = old_ims;
-                       ims_matched = FALSE;
-                       for (; temp != NULL; temp = g_list_next (temp)) {
-                               im2 = temp->data;
-                               if (g_str_equal (im1->service, im2->service) && g_str_equal (im1->address, im2->address)) {
-                                       ims_matched = TRUE;
-                                       old_ims_copy = g_list_remove (old_ims_copy, im2);
-                                       break;
-                               }
-
-                       }
-                       if (!ims_matched)
-                               added_ims = g_list_append (added_ims, im1);
-               }
-
-               e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_ADD, "ims", added_ims);
-               e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_DELETE, "ims", old_ims_copy);
-
-       } else if (!new_ims && old_ims) {
-               e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_DELETE, "ims", g_list_copy (old_ims));
-       } else if (new_ims && !old_ims) {
-               e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_ADD, "ims", g_list_copy (new_ims));
-       }
-
-}
-
-static void
-copy_postal_address_to_contact_address ( EContactAddress *contact_addr, PostalAddress *address)
-{
-       contact_addr->address_format = NULL;
-       contact_addr->po = NULL;
-       contact_addr->street = g_strdup (address->street_address);
-       contact_addr->ext = g_strdup (address->location);
-       contact_addr->locality = g_strdup (address->city);
-       contact_addr->region = g_strdup (address->state);
-       contact_addr->code = g_strdup (address->postal_code);
-       contact_addr->country = g_strdup (address->country);
-}
-
-static void
-copy_contact_address_to_postal_address (PostalAddress *address, EContactAddress *contact_addr)
-{
-       /* ugh, contact addr has null terminated strings instead of NULLs*/
-       address->street_address = (contact_addr->street && *contact_addr->street) ? g_strdup (contact_addr->street): NULL;
-       address->location = (contact_addr->ext && *contact_addr->ext) ? g_strdup (contact_addr->ext) : NULL;
-       address->city = (contact_addr->locality && *contact_addr->locality) ? g_strdup (contact_addr->locality) : NULL;
-       address->state = (contact_addr->region && *contact_addr->region) ?  g_strdup (contact_addr->region) : NULL;
-       address->postal_code = (contact_addr->code && *contact_addr->code ) ? g_strdup (contact_addr->code) : NULL;
-       address->country = (contact_addr->country && *(contact_addr->country)) ? g_strdup (contact_addr->country) : NULL;
-}
-
-static void
-populate_address (EContact *contact, gpointer data)
-{
-       PostalAddress *address;
-       EGwItem *item;
-       EContactAddress *contact_addr;
-
-       item = E_GW_ITEM (data);
-
-       address = e_gw_item_get_address (item, "Home");
-       contact_addr = NULL;
-
-       if (address) {
-               contact_addr = g_new0 (EContactAddress, 1);
-               copy_postal_address_to_contact_address (contact_addr, address);
-               e_contact_set (contact, E_CONTACT_ADDRESS_HOME, contact_addr);
-               e_contact_address_free (contact_addr);
-       }
-
-       address = e_gw_item_get_address (item, "Office");
-       if (address) {
-               contact_addr = g_new0 (EContactAddress, 1);
-               copy_postal_address_to_contact_address (contact_addr, address);
-               e_contact_set (contact, E_CONTACT_ADDRESS_WORK, contact_addr);
-               e_contact_address_free (contact_addr);
-       }
-}
-
-static void
-set_address_in_gw_item (EGwItem *item, gpointer data)
-{
-       EContact *contact;
-       EContactAddress *contact_address;
-       PostalAddress *address;
-
-       contact = E_CONTACT (data);
-
-       contact_address = e_contact_get (contact, E_CONTACT_ADDRESS_HOME);
-       if (contact_address) {
-               address = g_new0 (PostalAddress, 1);
-               copy_contact_address_to_postal_address (address, contact_address);
-               e_gw_item_set_address (item, "Home", address);
-               e_contact_address_free (contact_address);
-       }
-
-       contact_address = e_contact_get (contact, E_CONTACT_ADDRESS_WORK);
-       if (contact_address) {
-               address = g_new0 (PostalAddress, 1);
-               copy_contact_address_to_postal_address (address, contact_address);
-               e_gw_item_set_address (item, "Office", address);
-               e_contact_address_free (contact_address);
-       }
-}
-
-static PostalAddress *
-copy_postal_address (PostalAddress *address)
-{
-       PostalAddress *address_copy;
-
-       address_copy = g_new0 (PostalAddress, 1);
-
-       address_copy->street_address = g_strdup (address->street_address);
-       address_copy->location = g_strdup (address->location);
-       address_copy->city = g_strdup (address->city);
-       address_copy->state = g_strdup (address->state);
-       address_copy->postal_code = g_strdup (address->postal_code);
-       address_copy->country = g_strdup (address->country);
-       return address_copy;
-}
-
-static void
-set_postal_address_change (EGwItem *new_item, EGwItem *old_item, const gchar *address_type)
-{
-       PostalAddress *old_postal_address;
-       PostalAddress *new_postal_address;
-       PostalAddress *update_postal_address, *delete_postal_address;
-       gchar *s1, *s2;
-       update_postal_address = g_new0 (PostalAddress, 1);
-       delete_postal_address = g_new0 (PostalAddress, 1);
-
-       new_postal_address = e_gw_item_get_address (new_item,  address_type);
-       old_postal_address = e_gw_item_get_address (old_item, address_type);
-       if (new_postal_address && old_postal_address) {
-               s1 = new_postal_address->street_address;
-               s2 = old_postal_address->street_address;
-               if (!s1 && s2)
-                       delete_postal_address->street_address = g_strdup (s2);
-               else if (s1)
-                       update_postal_address->street_address = g_strdup (s1);
-
-               s1 =  new_postal_address->location;
-               s2 = old_postal_address->location;
-               if (!s1 && s2)
-                       delete_postal_address->location = g_strdup (s2);
-               else if (s1)
-                       update_postal_address->location = g_strdup (s1);
-
-               s1 = new_postal_address->city;
-               s2 = old_postal_address->city;
-               if (!s1 && s2)
-                       delete_postal_address->city = g_strdup (s2);
-               else if (s1)
-                       update_postal_address->city = g_strdup (s1);
-
-               s1 =  new_postal_address->state;
-               s2 = old_postal_address->state;
-               if (!s1 && s2)
-                       delete_postal_address->state = g_strdup (s2);
-               else if (s1)
-                       update_postal_address->state = g_strdup (s1);
-               s1 =  new_postal_address->postal_code;
-               s2 = old_postal_address->postal_code;
-               if (!s1 && s2)
-                       delete_postal_address->postal_code = g_strdup (s2);
-               else if (s1)
-                       update_postal_address->postal_code = g_strdup (s1);
-
-               s1 =  new_postal_address->country;
-               s2 =  old_postal_address->country;
-               if (!s1 && s2)
-                       delete_postal_address->country = g_strdup (s2);
-               else if (s1)
-                       update_postal_address->country = g_strdup (s1);
-
-               e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_UPDATE, address_type, update_postal_address);
-               e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_DELETE, address_type, delete_postal_address);
-
-       } else if (!new_postal_address && old_postal_address) {
-               e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_DELETE, address_type, copy_postal_address (old_postal_address));
-       } else if (new_postal_address && !old_postal_address) {
-               e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_ADD, address_type, copy_postal_address (new_postal_address));
-       }
-}
-
-static void
-set_address_changes (EGwItem *new_item , EGwItem *old_item)
-{
-       set_postal_address_change (new_item, old_item, "Home");
-       set_postal_address_change (new_item, old_item, "Office");
-}
-
-static void
-populate_birth_date (EContact *contact, gpointer data)
-{
-       EGwItem *item;
-       gchar *value;
-       EContactDate *date;
-
-       item = E_GW_ITEM (data);
-       value = e_gw_item_get_field_value (item, "birthday");
-       if (value) {
-               date =  e_contact_date_from_string (value);
-               e_contact_set (contact, E_CONTACT_BIRTH_DATE, date);
-               e_contact_date_free (date);
-       }
-}
-
-static void
-set_birth_date_in_gw_item (EGwItem *item, gpointer data)
-{
-       EContact *contact;
-       EContactDate *date;
-       gchar *date_string;
-       contact = E_CONTACT (data);
-       date = e_contact_get (contact, E_CONTACT_BIRTH_DATE);
-       if (date) {
-               date_string = e_contact_date_to_string (date);
-               e_gw_item_set_field_value (item, "birthday", date_string);
-               e_contact_date_free (date);
-               g_free (date_string);
-       }
-
-}
-
-static void
-set_birth_date_changes (EGwItem *new_item, EGwItem *old_item)
-{
-       gchar *new_birthday;
-       gchar *old_birthday;
-
-       new_birthday = e_gw_item_get_field_value (new_item, "birthday");
-       old_birthday = e_gw_item_get_field_value (old_item, "birthday");
-
-       if (new_birthday && old_birthday) {
-               if (!g_str_equal (new_birthday, old_birthday))
-                       e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_UPDATE, "birthday", new_birthday);
-       }
-       else if (!new_birthday && old_birthday) {
-               e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_DELETE, "birthday", old_birthday);
-       }
-       else if (new_birthday && !old_birthday) {
-               e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_ADD, "birthday", new_birthday);
-       }
-}
-
-static const gint email_fields[3] = {
-       E_CONTACT_EMAIL_1,
-       E_CONTACT_EMAIL_2,
-       E_CONTACT_EMAIL_3
-
-};
-
-static void
-populate_emails (EContact *contact, gpointer data)
-{
-       GList *email_list;
-       EGwItem *item;
-       gint i;
-
-       item = E_GW_ITEM (data);
-       email_list = e_gw_item_get_email_list (item);
-
-       for (i =0; i < 3 && email_list; i++, email_list = g_list_next (email_list)) {
-               if (email_list->data)
-                       e_contact_set (contact, email_fields[i], email_list->data);
-       }
-}
-
-static void
-set_emails_in_gw_item (EGwItem *item, gpointer data)
-{
-       GList *email_list;
-       EContact *contact;
-       gchar *email;
-       gint i;
-
-       contact = E_CONTACT (data);
-       email_list = NULL;
-       for (i =0; i < 3; i++) {
-               email = e_contact_get (contact, email_fields[i]);
-               if (email)
-                       email_list = g_list_append (email_list, g_strdup (email));
-       }
-       e_gw_item_set_email_list (item, email_list);
-}
-
-static void
-compare_string_lists ( GList *old_list, GList *new_list, GList **additions, GList **deletions)
-{
-       GList *temp, *old_list_copy;
-       gboolean strings_matched;
-       gchar *string1, *string2;
-
-       if (old_list && new_list) {
-               old_list_copy = g_list_copy (old_list);
-               for (; new_list != NULL; new_list = g_list_next (new_list)) {
-
-                       string1 = new_list->data;
-                       temp = old_list;
-                       strings_matched = FALSE;
-                       for (; temp != NULL; temp = g_list_next (temp)) {
-                               string2 = temp->data;
-                               if ( g_str_equal (string1, string2)) {
-                                       strings_matched = TRUE;
-                                       old_list_copy = g_list_remove (old_list_copy, string2);
-                                       break;
-                               }
-                       }
-                       if (!strings_matched)
-                               *additions = g_list_append (*additions, string1);
-               }
-               *deletions = old_list_copy;
-       }
-       else if (!new_list && old_list)
-               *deletions = g_list_copy (old_list);
-       else if (new_list && !old_list)
-               *additions = g_list_copy (new_list);
-}
-
-static void
-set_emails_changes (EGwItem *new_item, EGwItem *old_item)
-{
-       GList *old_email_list;
-       GList *new_email_list;
-       GList  *added_emails = NULL, *deleted_emails = NULL;
-
-       old_email_list = e_gw_item_get_email_list (old_item);
-       new_email_list = e_gw_item_get_email_list (new_item);
-       compare_string_lists (old_email_list, new_email_list, &added_emails, &deleted_emails);
-       if (added_emails)
-               e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_ADD, "email", added_emails);
-       if (deleted_emails)
-               e_gw_item_set_change (new_item,  E_GW_ITEM_CHANGE_TYPE_DELETE, "email", deleted_emails);
-}
-
-static void
-populate_full_name (EContact *contact, gpointer data)
-{
-       EGwItem *item;
-       FullName  *full_name;
-       gchar *full_name_string;
-
-       item = E_GW_ITEM (data);
-       full_name = e_gw_item_get_full_name (item);
-       if (full_name) {
-               full_name_string = g_strconcat ( (full_name->first_name == NULL) ? "\0" :    full_name->first_name, " ",
-                           (full_name->middle_name == NULL) ? "\0" : full_name->middle_name, " ",
-                           full_name->last_name == NULL ? "\0" : full_name->last_name, " ",
-                           (full_name->name_suffix == NULL ) ? "\0" : full_name->name_suffix, NULL);
-               full_name_string = g_strstrip (full_name_string);
-               if (!g_str_equal (full_name_string, "\0"))
-                       e_contact_set (contact, E_CONTACT_FULL_NAME, full_name_string);
-               g_free (full_name_string);
-       }
-}
-
-static void
-set_full_name_in_gw_item (EGwItem *item, gpointer data)
-{
-       EContact *contact;
-       gchar   *name;
-       EContactName *contact_name;
-       FullName *full_name;
-
-       contact = E_CONTACT (data);
-
-       name = e_contact_get (contact, E_CONTACT_FULL_NAME);
-
-       if (name) {
-               contact_name = e_contact_name_from_string (name);
-               full_name = g_new0 (FullName, 1);
-               if (contact_name && full_name) {
-                       full_name->name_prefix =  g_strdup (contact_name->prefixes);
-                       full_name->first_name =  g_strdup (contact_name->given);
-                       full_name->middle_name =  g_strdup (contact_name->additional);
-                       full_name->last_name =  g_strdup (contact_name->family);
-                       full_name->name_suffix = g_strdup (contact_name->suffixes);
-                       e_contact_name_free (contact_name);
-               }
-               e_gw_item_set_full_name (item, full_name);
-       }
-}
-
-static FullName *
-copy_full_name (FullName *full_name)
-{
-       FullName *full_name_copy = g_new0 (FullName, 1);
-       full_name_copy->name_prefix = g_strdup (full_name->name_prefix);
-       full_name_copy->first_name =  g_strdup (full_name->first_name);
-       full_name_copy->middle_name = g_strdup (full_name->middle_name);
-       full_name_copy->last_name = g_strdup (full_name->last_name);
-       full_name_copy->name_suffix = g_strdup (full_name->name_suffix);
-       return full_name_copy;
-}
-
-static void
-set_full_name_changes (EGwItem *new_item, EGwItem *old_item)
-{
-       FullName *old_full_name;
-       FullName *new_full_name;
-       FullName  *update_full_name, *delete_full_name;
-       gchar *s1, *s2;
-       update_full_name = g_new0 (FullName, 1);
-       delete_full_name = g_new0 (FullName, 1);
-
-       old_full_name = e_gw_item_get_full_name (old_item);
-       new_full_name = e_gw_item_get_full_name (new_item);
-
-       if (old_full_name && new_full_name) {
-               s1 = new_full_name->name_prefix;
-               s2 = old_full_name->name_prefix;
-               if (!s1 && s2)
-                       delete_full_name->name_prefix = g_strdup (s2);
-               else if (s1)
-                       update_full_name->name_prefix = g_strdup (s1);
-               s1 = new_full_name->first_name;
-               s2  = old_full_name->first_name;
-               if (!s1 && s2)
-                       delete_full_name->first_name = g_strdup (s2);
-               else if (s1)
-                       update_full_name->first_name = g_strdup (s1);
-               s1 = new_full_name->middle_name;
-               s2  = old_full_name->middle_name;
-               if (!s1 && s2)
-                       delete_full_name->middle_name = g_strdup (s2);
-               else if (s1)
-                       update_full_name->middle_name = g_strdup (s1);
-
-               s1 = new_full_name->last_name;
-               s2 = old_full_name->last_name;
-               if (!s1 && s2)
-                       delete_full_name->last_name = g_strdup (s2);
-               else if (s1)
-                       update_full_name->last_name = g_strdup (s1);
-               s1 = new_full_name->name_suffix;
-               s2  = old_full_name->name_suffix;
-               if (!s1 && s2)
-                       delete_full_name->name_suffix = g_strdup (s2);
-               else if (s1)
-                       update_full_name->name_suffix = g_strdup (s1);
-               e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_UPDATE,"full_name",  update_full_name);
-               e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_DELETE,"full_name",  delete_full_name);
-
-       } else if (!new_full_name && old_full_name) {
-               e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_DELETE, "full_name", copy_full_name(old_full_name));
-       } else if (new_full_name && !old_full_name) {
-               e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_ADD, "full_name", copy_full_name(new_full_name));
-       }
-}
-
-static void
-populate_contact_members (EContact *contact, gpointer data)
-{
-       EGwItem *item;
-       GList *member_list;
-
-       item = E_GW_ITEM (data);
-       member_list = e_gw_item_get_member_list (item);
-
-       for (; member_list != NULL; member_list = g_list_next (member_list)) {
-               EVCardAttribute *attr;
-               EGroupMember *member;
-               member = (EGroupMember *) member_list->data;
-
-               attr = e_vcard_attribute_new (NULL, EVC_EMAIL);
-               e_vcard_attribute_add_param_with_value (attr,
-                                                       e_vcard_attribute_param_new (EVC_X_DEST_CONTACT_UID),
-                                                       member->id);
-               if (member->name) {
-                       gint len = strlen (member->name);
-                       gchar *value;
-
-                       if (member->name [0] == '\"' && member->name [len - 1] == '\"')
-                               value = g_strdup_printf ("%s <%s>", member->name, member->email);
-                       else
-                               value = g_strdup_printf ("\"%s\" <%s>", member->name, member->email);
-
-                       e_vcard_attribute_add_value (attr, value);
-                       g_free (value);
-               } else {
-                       e_vcard_attribute_add_value (attr, member->email);
-               }
-
-               e_vcard_add_attribute (E_VCARD (contact), attr);
-       }
-}
-
-static void
-set_members_in_gw_item (EGwItem  *item, EContact *contact, EBookBackendGroupwise *egwb)
-{
-       GList  *members, *temp, *dtemp, *items, *p, *emails_without_ids, *dest_without_ids;
-       GList *group_members;
-       gchar *email;
-       EGwFilter *filter;
-       gint status;
-       gchar *id;
-       EGwItem *temp_item;
-       gint count = 0;
-       gint element_type;
-       gint i;
-       gchar *value;
-       EGroupMember *member;
-
-       members = e_contact_get_attributes (contact, E_CONTACT_EMAIL);
-       temp = members;
-       filter = e_gw_filter_new ();
-       group_members = NULL;
-       emails_without_ids = NULL;
-       dest_without_ids = NULL;
-
-       for (;temp != NULL; temp = g_list_next (temp)) {
-               EVCardAttribute *attr = temp->data;
-               EDestination *dest;
-               id = email = NULL;
-
-               dest = e_destination_new ();
-
-               for (p = e_vcard_attribute_get_params (attr); p; p = p->next) {
-                       EVCardAttributeParam *param = p->data;
-                       const gchar *param_name = e_vcard_attribute_param_get_name (param);
-
-                       if (!g_ascii_strcasecmp (param_name,
-                                                EVC_X_DEST_CONTACT_UID)) {
-                               GList *v = e_vcard_attribute_param_get_values (param);
-                               id = v ? v->data : NULL;
-                               if (id) {
-                                       EGwItem *gw_item = NULL;
-                                       e_gw_connection_get_item (egwb->priv->cnc, egwb->priv->container_id,id, "name email", &gw_item);
-                                       if (!gw_item) {
-                                               /* The item corresponding to this id is not found. This happens in case of
-                                                * importing, in imported file the stored id is corresponding to the address
-                                                * book from which the contact list was exported.
-                                                */
-                                               id = NULL;
-                                       }
-                                       else
-                                               g_object_unref (gw_item);
-                               }
-                       } else if (!g_ascii_strcasecmp (param_name,
-                                                       EVC_X_DEST_EMAIL)) {
-                               GList *v = e_vcard_attribute_param_get_values (param);
-                               email = v ? v->data : NULL;
-                       }
-               }
-
-               if (!id && !email)
-                       email = e_vcard_attribute_get_value (attr);
-               if (id) {
-                       member = g_new0 (EGroupMember , 1);
-                       member->id = g_strdup (id);
-                       group_members = g_list_append (group_members, member);
-               } else if (email) {
-                       e_destination_set_raw (dest, email);
-                       e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_EQUAL, "emailList/@primary", email);
-                       emails_without_ids = g_list_append (emails_without_ids, g_strdup (email));
-                       dest_without_ids = g_list_append (dest_without_ids, dest);
-
-                       count++;
-               }
-       }
-       e_gw_filter_group_conditions (filter, E_GW_FILTER_OP_OR, count);
-       items = NULL;
-
-       if (count)
-               status = e_gw_connection_get_items (egwb->priv->cnc, egwb->priv->container_id, "name email default members", filter, &items);
-
-       for (; items != NULL; items = g_list_next (items )) {
-               GList *emails;
-               GList *ptr;
-
-               temp_item = E_GW_ITEM (items->data);
-               emails = e_gw_item_get_email_list (temp_item);
-               if (emails_without_ids && (ptr = g_list_find_custom (emails_without_ids, emails->data, (GCompareFunc)strcasecmp ))) {
-                       gint pos = g_list_position (emails_without_ids, ptr);
-                       emails_without_ids = g_list_remove_link (emails_without_ids, ptr);
-                       g_list_free (ptr);
-
-                       ptr = g_list_nth (dest_without_ids, pos);
-                       dest_without_ids = g_list_remove_link (dest_without_ids, ptr);
-                       g_object_unref (ptr->data);
-                       g_list_free (ptr);
-
-                       id = g_strdup (e_gw_item_get_id (temp_item));
-                       member = g_new0 (EGroupMember , 1);
-                       member->id = id;
-                       group_members = g_list_append (group_members, member);
-               }
-               g_object_unref (temp_item);
-       }
-
-       /* In groupwise there is no way to put arbitrary members into a group. There's no
-        * mechanism for a group to contain members that are not already present in a system
-        * or personal addressbook as a contact, and so they cant be saved and will be lost.
-        * In order to save them we first need to create groupwise based contacts for these
-        * arbitrary contacts and then add them as members to the group.
-        */
-
-       temp = emails_without_ids;
-       dtemp = dest_without_ids;
-       for (; temp != NULL && dtemp != NULL; temp = g_list_next (temp), dtemp = g_list_next (dtemp)) {
-               EContact *new_contact = e_contact_new ();
-               EGwItem *new_item = e_gw_item_new_empty ();
-               FullName *full_name;
-               EDestination *tdest = (EDestination *)dtemp->data;
-
-               e_contact_set (new_contact,E_CONTACT_FULL_NAME, e_contact_name_from_string (strdup (e_destination_get_email (tdest))));
-               e_contact_set (new_contact, E_CONTACT_EMAIL_1, strdup (e_destination_get_email (tdest)));
-               e_contact_set (new_contact, E_CONTACT_IS_LIST, GINT_TO_POINTER (FALSE));
-               e_gw_item_set_item_type (new_item, E_GW_ITEM_TYPE_CONTACT);
-               e_gw_item_set_container_id (new_item, g_strdup (egwb->priv->container_id));
-               full_name = g_new0 (FullName, 1);
-               full_name->name_prefix = NULL;
-               full_name->first_name = g_strdup (e_destination_get_name (tdest));
-               full_name->middle_name = NULL;
-               full_name->last_name = NULL;
-               full_name->name_suffix = NULL;
-               e_gw_item_set_full_name (new_item, full_name);
-
-               for (i=0; i < G_N_ELEMENTS (mappings); i++) {
-                       element_type = mappings[i].element_type;
-                       if (element_type == ELEMENT_TYPE_SIMPLE) {
-                               value = e_contact_get (new_contact, mappings[i].field_id);
-                               if (value != NULL) {
-                                       e_gw_item_set_field_value (new_item, mappings[i].element_name, value);
-                                       g_free (value);
-                               }
-                       }
-                       else if (element_type == ELEMENT_TYPE_COMPLEX) {
-                               if (mappings[i].field_id == E_CONTACT_CATEGORIES) {
-                                       continue;
-                               }
-                               else if (mappings[i].field_id == E_CONTACT_EMAIL) {
-                                       if (e_contact_get (contact, E_CONTACT_IS_LIST))
-                                               continue;
-                               }
-                               else if (mappings[i].field_id == E_CONTACT_FULL_NAME) {
-                                       continue;
-                               }
-                               else {
-                                       mappings[i].set_value_in_gw_item (new_item, new_contact);
-                               }
-                       }
-
-               }
-               id = NULL;
-               status = e_gw_connection_create_item (egwb->priv->cnc, new_item, &id);
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       status = e_gw_connection_create_item (egwb->priv->cnc, new_item, &id);
-
-               if (status == E_GW_CONNECTION_STATUS_OK && id) {
-                       e_contact_set (new_contact, E_CONTACT_UID, id);
-                       e_book_backend_db_cache_add_contact (egwb->priv->file_db, new_contact);
-                       e_book_backend_summary_add_contact (egwb->priv->summary, new_contact);
-                       member = g_new0 (EGroupMember, 1);
-                       member->id = g_strdup (id);
-                       group_members = g_list_append (group_members, member);
-                       g_free (id);
-               }
-               g_object_unref (new_item);
-               g_object_unref (new_contact);
-       }
-
-       g_list_foreach (members, (GFunc) e_vcard_attribute_free, NULL);
-       g_list_free (members);
-       g_list_foreach (emails_without_ids, (GFunc) g_free, NULL);
-       g_list_free (emails_without_ids);
-       g_list_foreach (dest_without_ids, (GFunc) g_object_unref, NULL);
-       g_list_free (dest_without_ids);
-
-       g_list_free (items);
-       e_gw_item_set_member_list (item, group_members);
-}
-
-static void
-set_member_changes (EGwItem *new_item, EGwItem *old_item, EBookBackendGroupwise *egwb)
-{
-       GList *old_members, *new_members;
-       GList *old_ids,  *new_ids,  *additions, *deletions;
-
-       old_ids = new_ids = additions = deletions = NULL;
-       old_members = e_gw_item_get_member_list (old_item);
-       new_members = e_gw_item_get_member_list (new_item);
-
-       for (;old_members != NULL; old_members = g_list_next (old_members)) {
-               EGroupMember *member;
-               member = (EGroupMember *)old_members->data;
-               old_ids = g_list_append (old_ids, member->id);
-       }
-       for (;new_members != NULL; new_members = g_list_next (new_members)) {
-               EGroupMember *member;
-               member = (EGroupMember *)new_members->data;
-               new_ids = g_list_append (new_ids, member->id);
-       }
-
-       compare_string_lists (old_ids, new_ids, &additions, &deletions);
-       if (additions)
-               e_gw_connection_add_members (egwb->priv->cnc, e_gw_item_get_id (old_item), additions);
-       if (deletions)
-               e_gw_connection_remove_members (egwb->priv->cnc, e_gw_item_get_id (old_item), deletions);
-
-       g_list_free (new_ids);
-       g_list_free (old_ids);
-       g_list_free (additions);
-       g_list_free (deletions);
-}
-
-static void
-set_organization_changes_in_gw_item (EGwItem *new_item, EGwItem *old_item)
-{
-       gchar *old_value;
-       gchar *new_value;
-       gchar *old_org_id;
-       gchar *new_org_id;
-
-       old_value = e_gw_item_get_field_value (old_item, "organization");
-       new_value = e_gw_item_get_field_value (new_item, "organization");
-       old_org_id = e_gw_item_get_field_value (old_item, "organization_id");
-       new_org_id = e_gw_item_get_field_value (new_item, "organization_id");
-       if (new_value && old_value) {
-               if (!g_str_equal (new_value, old_value)) {
-                       e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_UPDATE, "organization", new_value);
-                       e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_UPDATE, "organization_id", new_org_id);
-               }
-       } else if (!new_value  && old_value) {
-               e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_DELETE,"organization", old_value);
-               e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_DELETE, "organization_id", old_org_id);
-       } else if (new_value && !old_value) {
-               e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_ADD, "organization", new_value);
-               e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_ADD, "organization_id", new_org_id);
-       }
-}
-
-static void
-set_categories_in_gw_item (EGwItem *item, EContact *contact, EBookBackendGroupwise *egwb)
-{
-       GHashTable *categories_by_name;
-       GList *category_names,  *category_ids;
-       gchar *id;
-       gint status;
-
-       categories_by_name = egwb->priv->categories_by_name;
-       category_names = e_contact_get (contact, E_CONTACT_CATEGORY_LIST);
-       category_ids = NULL;
-       id = NULL;
-       for (; category_names != NULL; category_names = g_list_next (category_names)) {
-               if (!category_names->data || strlen (category_names->data) == 0 )
-                       continue;
-               id = g_hash_table_lookup (categories_by_name, category_names->data);
-               if (id)
-                       category_ids = g_list_append (category_ids, g_strdup (id));
-               else {
-                       EGwItem *category_item;
-
-                       category_item = e_gw_item_new_empty ();
-                       e_gw_item_set_item_type (category_item,  E_GW_ITEM_TYPE_CATEGORY);
-                       e_gw_item_set_category_name (category_item, category_names->data);
-                       status = e_gw_connection_create_item (egwb->priv->cnc, category_item, &id);
-                       if (status == E_GW_CONNECTION_STATUS_OK && id != NULL) {
-                               gchar **components = g_strsplit (id, "@", -1);
-                               gchar *temp_id = components[0];
-
-                               g_hash_table_insert (categories_by_name, g_strdup (category_names->data), g_strdup (temp_id));
-                               g_hash_table_insert (egwb->priv->categories_by_id, g_strdup (temp_id), g_strdup (category_names->data));
-                               category_ids = g_list_append (category_ids, g_strdup (temp_id));
-                               g_free (id);
-                               g_strfreev (components);
-                       }
-                       g_object_unref (category_item);
-               }
-       }
-       e_gw_item_set_categories (item, category_ids);
-}
-
-static void
-set_categories_changes (EGwItem *new_item, EGwItem *old_item)
-{
-       GList *old_category_list;
-       GList *new_category_list;
-       GList *temp, *old_categories_copy, *added_categories = NULL;
-       gboolean categories_matched;
-       gchar *category1, *category2;
-
-       old_category_list = e_gw_item_get_categories (old_item);
-       new_category_list = e_gw_item_get_categories (new_item);
-
-       if (old_category_list && new_category_list) {
-               old_categories_copy = g_list_copy (old_category_list);
-
-               for (; new_category_list != NULL; new_category_list = g_list_next (new_category_list)) {
-                       category1  = new_category_list->data;
-                       temp = old_category_list;
-                       categories_matched  = FALSE;
-
-                       for (; temp != NULL; temp = g_list_next (temp)) {
-                               category2 = temp->data;
-                               if ( g_str_equal (category1, category2)) {
-                                       categories_matched = TRUE;
-                                       old_categories_copy = g_list_remove (old_categories_copy, category2);
-                                       break;
-                               }
-                       }
-                       if (!categories_matched)
-                               added_categories = g_list_append (added_categories, category1);
-               }
-
-               e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_ADD, "categories", added_categories);
-               e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_DELETE, "categories", old_categories_copy);
-       } else if (!new_category_list && old_category_list) {
-               e_gw_item_set_change (new_item,  E_GW_ITEM_CHANGE_TYPE_DELETE, "categories", old_category_list);
-       } else if (new_category_list && !old_category_list) {
-               e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_ADD, "categories", new_category_list);
-       }
-}
-
-static void
-fill_contact_from_gw_item (EContact *contact, EGwItem *item, GHashTable *categories_by_ids)
-{
-       gchar * value;
-       gint element_type;
-       gint i;
-       gboolean is_contact_list;
-       gboolean is_organization;
-
-       is_organization = e_gw_item_get_item_type (item) == E_GW_ITEM_TYPE_ORGANISATION ? TRUE: FALSE;
-       is_contact_list = e_gw_item_get_item_type (item) == E_GW_ITEM_TYPE_GROUP ? TRUE: FALSE;
-
-       e_contact_set (contact, E_CONTACT_IS_LIST, GINT_TO_POINTER (is_contact_list));
-       if (is_contact_list)
-               e_contact_set (contact, E_CONTACT_LIST_SHOW_ADDRESSES, GINT_TO_POINTER (TRUE));
-
-       for ( i = 0; i < G_N_ELEMENTS (mappings); i++) {
-               element_type = mappings[i].element_type;
-
-               if (element_type == ELEMENT_TYPE_SIMPLE) {
-                       if (mappings[i].field_id != E_CONTACT_BOOK_URI) {
-                               if (!is_organization) {
-                                       value = e_gw_item_get_field_value (item, mappings[i].element_name);
-                                       if (value != NULL)
-                                               e_contact_set (contact, mappings[i].field_id, value);
-                               }
-                       }
-               } else if (element_type == ELEMENT_TYPE_COMPLEX) {
-                       if (mappings[i].field_id == E_CONTACT_CATEGORIES) {
-                               GList *category_ids, *category_names;
-                               gchar *name;
-
-                               category_names = NULL;
-                               category_ids = e_gw_item_get_categories (item);
-                               for (; category_ids; category_ids = g_list_next (category_ids)) {
-                                       name = g_hash_table_lookup (categories_by_ids, category_ids->data);
-                                       if (name)
-                                               category_names = g_list_append (category_names, name);
-                               }
-                               if (category_names) {
-                                       e_contact_set (contact, E_CONTACT_CATEGORY_LIST, category_names);
-                                       g_list_free (category_names);
-                               }
-                       }
-                       else
-                               mappings[i].populate_contact_func (contact, item);
-               }
-       }
-}
-
-static void
-e_book_backend_groupwise_create_contact (EBookBackend *backend,
-                                        EDataBook *book,
-                                        guint32 opid,
-                                        const gchar *vcard )
-{
-       EContact *contact;
-       EBookBackendGroupwise *egwb;
-       gchar *id;
-       gint status;
-       EGwItem *item;
-       gint element_type;
-       gchar * value;
-       gint i;
-
-       if (enable_debug)
-               printf("\ne_book_backend_groupwise_create_contact...\n");
-
-       egwb = E_BOOK_BACKEND_GROUPWISE (backend);
-
-       switch (egwb->priv->mode) {
-
-       case E_DATA_BOOK_MODE_LOCAL :
-               e_data_book_respond_create (book, opid, EDB_ERROR (REPOSITORY_OFFLINE), NULL);
-               return;
-
-       case  E_DATA_BOOK_MODE_REMOTE :
-
-               if (egwb->priv->cnc == NULL) {
-                       e_data_book_respond_create (book, opid, EDB_ERROR (AUTHENTICATION_REQUIRED), NULL);
-                       return;
-               }
-               if (!egwb->priv->is_writable) {
-                       e_data_book_respond_create (book, opid, EDB_ERROR (PERMISSION_DENIED), NULL);
-                       return;
-               }
-               contact = e_contact_new_from_vcard (vcard);
-               item = e_gw_item_new_empty ();
-               e_gw_item_set_item_type (item, e_contact_get (contact, E_CONTACT_IS_LIST) ? E_GW_ITEM_TYPE_GROUP :E_GW_ITEM_TYPE_CONTACT);
-               e_gw_item_set_container_id (item, g_strdup (egwb->priv->container_id));
-
-               for (i = 0; i < G_N_ELEMENTS (mappings); i++) {
-                       element_type = mappings[i].element_type;
-                       if (element_type == ELEMENT_TYPE_SIMPLE)  {
-                               value =  e_contact_get (contact, mappings[i].field_id);
-                               if (value != NULL)
-                                       e_gw_item_set_field_value (item, mappings[i].element_name, value);
-                       } else if (element_type == ELEMENT_TYPE_COMPLEX) {
-                               if (mappings[i].field_id == E_CONTACT_CATEGORIES) {
-                                       set_categories_in_gw_item (item, contact, egwb);
-                               }
-                               else if (mappings[i].field_id == E_CONTACT_EMAIL) {
-                                       if (e_contact_get (contact, E_CONTACT_IS_LIST))
-                                               set_members_in_gw_item (item, contact, egwb);
-                               }
-                               else {
-                                       mappings[i].set_value_in_gw_item (item, contact);
-                               }
-                       }
-               }
-               id = NULL;
-               status = e_gw_connection_create_item (egwb->priv->cnc, item, &id);
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       status = e_gw_connection_create_item (egwb->priv->cnc, item, &id);
-
-               /* Make sure server has returned  an id for the created contact */
-               if (status == E_GW_CONNECTION_STATUS_OK && id) {
-                       e_contact_set (contact, E_CONTACT_UID, id);
-                       g_free (id);
-                       e_book_backend_db_cache_add_contact (egwb->priv->file_db, contact);
-                       egwb->priv->file_db->sync (egwb->priv->file_db, 0);
-                       e_book_backend_summary_add_contact (egwb->priv->summary, contact);
-                       e_data_book_respond_create (book, opid, EDB_ERROR (SUCCESS), contact);
-
-               }
-               else {
-                       e_data_book_respond_create (book, opid, EDB_ERROR_FAILED_STATUS (OTHER_ERROR, status), NULL);
-               }
-               g_object_unref (item);
-               return;
-       default:
-               break;
-       }
-}
-
-static void
-e_book_backend_groupwise_remove_contacts (EBookBackend *backend,
-                                         EDataBook    *book,
-                                         guint32 opid,
-                                         GList *id_list)
-{
-       gchar *id;
-       EBookBackendGroupwise *ebgw;
-       GList *deleted_ids = NULL;
-
-       if (enable_debug)
-               printf ("\ne_book_backend_groupwise_remove_contacts...\n");
-
-       ebgw = E_BOOK_BACKEND_GROUPWISE (backend);
-
-       switch (ebgw->priv->mode) {
-
-       case E_DATA_BOOK_MODE_LOCAL :
-               e_data_book_respond_remove_contacts (book, opid, EDB_ERROR (REPOSITORY_OFFLINE), NULL);
-               return;
-
-       case E_DATA_BOOK_MODE_REMOTE :
-               if (ebgw->priv->cnc == NULL) {
-                       e_data_book_respond_remove_contacts (book, opid, EDB_ERROR (AUTHENTICATION_REQUIRED), NULL);
-                       return;
-               }
-
-               if (!ebgw->priv->is_writable) {
-                       e_data_book_respond_remove_contacts (book, opid, EDB_ERROR (PERMISSION_DENIED), NULL);
-                       return;
-               }
-
-               for (; id_list != NULL; id_list = g_list_next (id_list)) {
-                       id = (gchar *) id_list->data;
-                       e_gw_connection_remove_item (ebgw->priv->cnc, ebgw->priv->container_id, id);
-                       deleted_ids =  g_list_append (deleted_ids, id);
-                       e_book_backend_db_cache_remove_contact (ebgw->priv->file_db, id);
-                       e_book_backend_summary_remove_contact (ebgw->priv->summary, id);
-               }
-               ebgw->priv->file_db->sync (ebgw->priv->file_db, 0);
-               e_data_book_respond_remove_contacts (book, opid, EDB_ERROR (SUCCESS),  deleted_ids);
-               return;
-       default :
-               break;
-       }
-}
-
-static void
-set_changes_in_gw_item (EGwItem *new_item, EGwItem *old_item)
-{
-       gchar * new_value;
-       gchar *old_value;
-       gint element_type;
-       gint i;
-
-       g_return_if_fail (E_IS_GW_ITEM (new_item));
-       g_return_if_fail (E_IS_GW_ITEM (old_item));
-
-       for ( i = 0; i < G_N_ELEMENTS (mappings); i++) {
-               element_type = mappings[i].element_type;
-               if (element_type == ELEMENT_TYPE_SIMPLE) {
-                       if (mappings[i].field_id == E_CONTACT_ORG) {
-                               set_organization_changes_in_gw_item (new_item, old_item);
-                               continue;
-                       }
-
-                       new_value = e_gw_item_get_field_value (new_item, mappings[i].element_name);
-                       old_value = e_gw_item_get_field_value (old_item, mappings[i].element_name);
-                       if (new_value && old_value) {
-                               if (!g_str_equal (new_value, old_value))
-                                       e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_UPDATE, mappings[i].element_name, new_value);
-                       } else if (!new_value  && old_value) {
-                               e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_DELETE, mappings[i].element_name, old_value);
-                       } else if (new_value && !old_value) {
-                               e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_ADD, mappings[i].element_name, new_value);
-                       }
-
-               } else if (element_type == ELEMENT_TYPE_COMPLEX) {
-                       if (mappings[i].field_id != E_CONTACT_EMAIL)
-                               mappings[i].set_changes (new_item, old_item);
-               }
-       }
-}
-
-static void
-e_book_backend_groupwise_modify_contact (EBookBackend *backend,
-                                        EDataBook    *book,
-                                        guint32       opid,
-                                        const gchar   *vcard)
-{
-       EContact *contact;
-       EBookBackendGroupwise *egwb;
-       gchar *id;
-       gint status;
-       EGwItem *new_item;
-       EGwItem *old_item;
-       gint element_type;
-       gchar * value;
-       gint i;
-
-       if (enable_debug)
-               printf ("\ne_book_backend_groupwise_modify_contact...\n");
-       egwb = E_BOOK_BACKEND_GROUPWISE (backend);
-
-       switch (egwb->priv->mode) {
-
-       case E_DATA_BOOK_MODE_LOCAL :
-               e_data_book_respond_modify (book, opid, EDB_ERROR (REPOSITORY_OFFLINE), NULL);
-               return;
-       case E_DATA_BOOK_MODE_REMOTE :
-
-               if (egwb->priv->cnc == NULL) {
-                       e_data_book_respond_modify (book, opid, EDB_ERROR (AUTHENTICATION_REQUIRED), NULL);
-                       return;
-               }
-               if (!egwb->priv->is_writable) {
-                       e_data_book_respond_modify (book, opid, EDB_ERROR (PERMISSION_DENIED), NULL);
-                       return;
-               }
-               contact = e_contact_new_from_vcard (vcard);
-               new_item = e_gw_item_new_empty ();
-
-               for (i = 0; i < G_N_ELEMENTS (mappings); i++) {
-                       element_type = mappings[i].element_type;
-                       if (element_type == ELEMENT_TYPE_SIMPLE)  {
-                               value =  e_contact_get (contact, mappings[i].field_id);
-                               if (value &&  *value)
-                                       e_gw_item_set_field_value (new_item, mappings[i].element_name, value);
-                       } else if (element_type == ELEMENT_TYPE_COMPLEX) {
-                               if (mappings[i].field_id == E_CONTACT_CATEGORIES)
-                                       set_categories_in_gw_item (new_item, contact, egwb);
-                               else if (mappings[i].field_id == E_CONTACT_EMAIL) {
-                                       if (e_contact_get (contact, E_CONTACT_IS_LIST))
-                                               set_members_in_gw_item (new_item, contact, egwb);
-                               }
-                               else
-                                       mappings[i].set_value_in_gw_item (new_item, contact);
-                       }
-               }
-
-               id = e_contact_get (contact, E_CONTACT_UID);
-               old_item = NULL;
-               status = e_gw_connection_get_item (egwb->priv->cnc, egwb->priv->container_id, id, NULL,  &old_item);
-
-               if (old_item == NULL) {
-                       e_data_book_respond_modify (book, opid, EDB_ERROR (CONTACT_NOT_FOUND), NULL);
-                       return;
-               }
-
-               if (status != E_GW_CONNECTION_STATUS_OK) {
-                       e_data_book_respond_modify (book, opid, EDB_ERROR_FAILED_STATUS (OTHER_ERROR, status), NULL);
-                       return;
-               }
-
-               if (e_contact_get (contact, E_CONTACT_IS_LIST))
-                       set_member_changes (new_item, old_item, egwb);
-
-               set_changes_in_gw_item (new_item, old_item);
-
-               e_gw_item_set_item_type (new_item, e_gw_item_get_item_type (old_item));
-               status = e_gw_connection_modify_item (egwb->priv->cnc, id, new_item);
-               if (status == E_GW_CONNECTION_STATUS_OK) {
-                       e_data_book_respond_modify (book, opid, EDB_ERROR (SUCCESS), contact);
-                       e_book_backend_db_cache_remove_contact (egwb->priv->file_db, id);
-                       e_book_backend_summary_remove_contact (egwb->priv->summary, id);
-                       e_book_backend_db_cache_add_contact (egwb->priv->file_db, contact);
-                       egwb->priv->file_db->sync (egwb->priv->file_db, 0);
-                       e_book_backend_summary_add_contact (egwb->priv->summary, contact);
-               }
-               else
-                       e_data_book_respond_modify (book, opid, EDB_ERROR_FAILED_STATUS (OTHER_ERROR, status), NULL);
-               g_object_unref (new_item);
-               g_object_ref (old_item);
-               g_object_unref (contact);
-               return;
-       default :
-               break;
-       }
-}
-
-static void
-e_book_backend_groupwise_get_contact (EBookBackend *backend,
-                                     EDataBook    *book,
-                                     guint32       opid,
-                                     const gchar   *id)
-{
-       EBookBackendGroupwise *gwb;
-       gint status;
-       EGwItem *item;
-       EContact *contact;
-       gchar *vcard;
-
-       if (enable_debug)
-               printf ("\ne_book_backend_groupwise_get_contact...\n");
-
-       gwb =  E_BOOK_BACKEND_GROUPWISE (backend);
-
-       switch (gwb->priv->mode) {
-
-       case E_DATA_BOOK_MODE_LOCAL :
-               contact = e_book_backend_db_cache_get_contact (gwb->priv->file_db, id);
-               vcard =  e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
-               if (contact) {
-                       e_data_book_respond_get_contact (book, opid, EDB_ERROR (SUCCESS), vcard);
-                       g_free (vcard);
-                       g_object_unref (contact);
-               }
-               else {
-                       e_data_book_respond_get_contact (book, opid, EDB_ERROR (CONTACT_NOT_FOUND), "");
-               }
-               return;
-
-       case E_DATA_BOOK_MODE_REMOTE :
-               if (gwb->priv->cnc == NULL) {
-                       e_data_book_respond_get_contact (book, opid, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, "Not connected"), NULL);
-                       return;
-               }
-               status = e_gw_connection_get_item (gwb->priv->cnc, gwb->priv->container_id, id,
-                                                  "name email default members", &item);
-               if (status == E_GW_CONNECTION_STATUS_OK) {
-                       if (item) {
-                               contact = e_contact_new ();
-                               fill_contact_from_gw_item (contact, item, gwb->priv->categories_by_id);
-                               e_contact_set (contact, E_CONTACT_BOOK_URI, gwb->priv->original_uri);
-                               vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
-                               e_data_book_respond_get_contact (book, opid, EDB_ERROR (SUCCESS), vcard);
-                               g_free (vcard);
-                               g_object_unref (contact);
-                               g_object_unref (item);
-                               return;
-                       }
-               }
-               e_data_book_respond_get_contact (book, opid, EDB_ERROR (CONTACT_NOT_FOUND), "");
-               return;
-       default :
-               break;
-       }
-}
-
-typedef struct {
-       EGwFilter *filter;
-       gboolean is_filter_valid;
-       gboolean is_personal_book;
-       gint auto_completion;
-       gchar *search_string;
-} EBookBackendGroupwiseSExpData;
-
-static ESExpResult *
-func_and (ESExp *f, gint argc, ESExpResult **argv, gpointer data)
-{
-       ESExpResult *r;
-       EGwFilter *filter;
-       EBookBackendGroupwiseSExpData *sexp_data;
-
-       sexp_data = (EBookBackendGroupwiseSExpData *) data;
-       filter = E_GW_FILTER (sexp_data->filter);
-       if (argc > 0)
-               e_gw_filter_group_conditions (filter, E_GW_FILTER_OP_AND, argc);
-       r = e_sexp_result_new (f, ESEXP_RES_BOOL);
-       r->value.boolean = FALSE;
-
-       return r;
-}
-
-static ESExpResult *
-func_or (ESExp *f, gint argc, ESExpResult **argv, gpointer data)
-{
-       ESExpResult *r;
-       EGwFilter *filter;
-       EBookBackendGroupwiseSExpData *sexp_data;
-
-       sexp_data = (EBookBackendGroupwiseSExpData *) data;
-       filter = E_GW_FILTER (sexp_data->filter);
-       if (argc > 0)
-                e_gw_filter_group_conditions (filter, E_GW_FILTER_OP_OR, argc);
-       r = e_sexp_result_new (f, ESEXP_RES_BOOL);
-       r->value.boolean = FALSE;
-
-       return r;
-}
-
-static ESExpResult *
-func_not (ESExp *f, gint argc, ESExpResult **argv, gpointer data)
-{
-       ESExpResult *r;
-       EBookBackendGroupwiseSExpData *sexp_data;
-
-       sexp_data = (EBookBackendGroupwiseSExpData *) data;
-       sexp_data->is_filter_valid = FALSE;
-       r = e_sexp_result_new (f, ESEXP_RES_BOOL);
-       r->value.boolean = FALSE;
-
-       return r;
-}
-
-static ESExpResult *
-func_contains (struct _ESExp *f, gint argc, struct _ESExpResult **argv, gpointer data)
-{
-       ESExpResult *r;
-       EGwFilter *filter;
-       EBookBackendGroupwiseSExpData *sexp_data;
-
-       sexp_data = (EBookBackendGroupwiseSExpData *) data;
-       filter = E_GW_FILTER (sexp_data->filter);
-
-       if (argc == 2
-           && argv[0]->type == ESEXP_RES_STRING
-           && argv[1]->type == ESEXP_RES_STRING) {
-               gchar *propname = argv[0]->value.string;
-               gchar *str = argv[1]->value.string;
-               const gchar *gw_field_name;
-
-               if (g_str_equal (propname, "x-evolution-any-field")) {
-                       if (!sexp_data->is_personal_book && str && strlen (str) == 0) {
-                               /* ignore the NULL query */
-                               sexp_data->is_filter_valid = FALSE;
-                               r = e_sexp_result_new (f, ESEXP_RES_BOOL);
-                               r->value.boolean = FALSE;
-                               return r;
-                       }
-               }
-               gw_field_name = NULL;
-               if (g_str_equal (propname, "full_name"))
-                       gw_field_name = "fullName";
-               else if (g_str_equal (propname, "email"))
-                       gw_field_name = "emailList/email";
-               else if (g_str_equal (propname, "file_as") || g_str_equal (propname, "nickname"))
-                        gw_field_name = "name";
-
-               if (gw_field_name) {
-                       if (g_str_equal (gw_field_name, "fullName")) {
-                               e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_CONTAINS, "fullName/firstName", str);
-                               e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_CONTAINS, "fullName/lastName", str);
-                               if (sexp_data->is_personal_book) {
-                                       e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_CONTAINS, "fullName/displayName", str);
-                                       e_gw_filter_group_conditions (filter, E_GW_FILTER_OP_OR, 3);
-                               }
-                               else {
-                                       e_gw_filter_group_conditions (filter, E_GW_FILTER_OP_OR, 2);
-                               }
-                       }
-                       else {
-                               e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_CONTAINS, gw_field_name, str);
-                       }
-               }
-               else {
-                    sexp_data->is_filter_valid = FALSE;
-               }
-       }
-
-       r = e_sexp_result_new (f, ESEXP_RES_BOOL);
-       r->value.boolean = FALSE;
-
-       return r;
-}
-
-static ESExpResult *
-func_is (struct _ESExp *f, gint argc, struct _ESExpResult **argv, gpointer data)
-{
-       ESExpResult *r;
-       EGwFilter *filter;
-       EBookBackendGroupwiseSExpData *sexp_data;
-
-       sexp_data = (EBookBackendGroupwiseSExpData *) data;
-       filter = E_GW_FILTER (sexp_data->filter);
-
-       if (argc == 2
-           && argv[0]->type == ESEXP_RES_STRING
-           && argv[1]->type == ESEXP_RES_STRING) {
-               gchar *propname = argv[0]->value.string;
-               gchar *str = argv[1]->value.string;
-               const gchar *gw_field_name;
-
-               gw_field_name = NULL;
-               if (g_str_equal (propname, "full_name"))
-                       gw_field_name = "fullName";
-               else if (g_str_equal (propname, "email"))
-                       gw_field_name = "emailList/email";
-               else if (g_str_equal (propname, "file_as") || g_str_equal (propname, "nickname"))
-                       gw_field_name = "name";
-
-               if (gw_field_name) {
-                       if (g_str_equal (gw_field_name, "fullName")) {
-                               e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_EQUAL, "fullName/firstName", str);
-                               e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_EQUAL, "fullName/lastName", str);
-                               if (sexp_data->is_personal_book) {
-                                       e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_EQUAL, "fullName/displayName", str);
-                                       e_gw_filter_group_conditions (filter, E_GW_FILTER_OP_OR, 3);
-                               }
-                               else {
-                                       e_gw_filter_group_conditions (filter, E_GW_FILTER_OP_OR, 2);
-                               }
-                       }
-                       else {
-                               e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_EQUAL, gw_field_name, str);
-                       }
-               }
-               else {
-                    sexp_data->is_filter_valid = FALSE;
-               }
-       }
-
-       r = e_sexp_result_new (f, ESEXP_RES_BOOL);
-       r->value.boolean = FALSE;
-
-       return r;
-}
-
-#define BEGINS_WITH_NAME (1 << 0)
-#define BEGINS_WITH_EMAIL (1 << 1)
-#define BEGINS_WITH_FILE_AS (1 << 2)
-#define BEGINS_WITH_NICK_NAME (1 << 3)
-#define AUTO_COMPLETION_QUERY 15
-
-static ESExpResult *
-func_beginswith (struct _ESExp *f, gint argc, struct _ESExpResult **argv, gpointer data)
-{
-       ESExpResult *r;
-       EGwFilter *filter;
-       EBookBackendGroupwiseSExpData *sexp_data;
-
-       sexp_data = (EBookBackendGroupwiseSExpData *) data;
-       filter = E_GW_FILTER (sexp_data->filter);
-
-       if (argc == 2
-           && argv[0]->type == ESEXP_RES_STRING
-           && argv[1]->type == ESEXP_RES_STRING) {
-               gchar *propname = argv[0]->value.string;
-               gchar *str = argv[1]->value.string;
-               const gchar *gw_field_name;
-
-               if (!sexp_data->is_personal_book && str && strlen (str) == 0) {
-                       /* ignore the NULL query */
-                       sexp_data->is_filter_valid = FALSE;
-                       r = e_sexp_result_new (f, ESEXP_RES_BOOL);
-                       r->value.boolean = FALSE;
-                       return r;
-               }
-
-               gw_field_name = NULL;
-               if (g_str_equal (propname, "full_name")) {
-                       gw_field_name = "fullName";
-                       sexp_data->auto_completion |= BEGINS_WITH_NAME;
-                       sexp_data->search_string = g_strdup (str);
-               }
-               else if (g_str_equal (propname, "email")) {
-                       gw_field_name = "emailList/email";
-                       sexp_data->auto_completion |= BEGINS_WITH_EMAIL;
-               }
-               else if (g_str_equal (propname, "file_as")) {
-                        gw_field_name = "name";
-                        sexp_data->auto_completion |= BEGINS_WITH_FILE_AS;
-               } else if (g_str_equal (propname, "nickname")) {
-                        gw_field_name = "name";
-                        sexp_data->auto_completion |= BEGINS_WITH_NICK_NAME;
-               }
-
-               if (gw_field_name) {
-
-                       if (g_str_equal (gw_field_name, "fullName")) {
-                               e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_BEGINS, "fullName/firstName", str);
-                               e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_BEGINS, "fullName/lastName", str);
-                               if (sexp_data->is_personal_book) {
-                                       e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_BEGINS, "fullName/displayName", str);
-                                       e_gw_filter_group_conditions (filter, E_GW_FILTER_OP_OR, 3);
-                               }
-                               else {
-                                       e_gw_filter_group_conditions (filter, E_GW_FILTER_OP_OR, 2);
-                               }
-                       }
-                       else {
-                               e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_BEGINS, gw_field_name, str);
-                       }
-               }
-               else {
-                       sexp_data->is_filter_valid = FALSE;
-               }
-       }
-
-       r = e_sexp_result_new (f, ESEXP_RES_BOOL);
-       r->value.boolean = FALSE;
-
-       return r;
-}
-
-static ESExpResult *
-func_endswith (struct _ESExp *f, gint argc, struct _ESExpResult **argv, gpointer data)
-{
-       EBookBackendGroupwiseSExpData *sexp_data;
-       ESExpResult *r;
-
-       sexp_data = (EBookBackendGroupwiseSExpData *) data;
-       sexp_data->is_filter_valid = FALSE;
-
-       r = e_sexp_result_new (f, ESEXP_RES_BOOL);
-
-       r->value.boolean = FALSE;
-
-       return r;
-}
-
-static ESExpResult *
-func_exists (struct _ESExp *f, gint argc, struct _ESExpResult **argv, gpointer data)
-{
-       ESExpResult *r;
-       EGwFilter *filter;
-       EBookBackendGroupwiseSExpData *sexp_data;
-
-       sexp_data = (EBookBackendGroupwiseSExpData *) data;
-       filter = E_GW_FILTER (sexp_data->filter);
-
-       if (argc == 1
-           && argv[0]->type == ESEXP_RES_STRING) {
-               gchar *propname = argv[0]->value.string;
-               const gchar *str = "";
-               const gchar *gw_field_name;
-
-               gw_field_name = NULL;
-               if (g_str_equal (propname, "full_name"))
-                       gw_field_name = "fullName";
-               else if (g_str_equal (propname, "email"))
-                       gw_field_name = "emailList/email";
-               else if (g_str_equal (propname, "file_as") || g_str_equal (propname, "nickname"))
-                        gw_field_name = "name";
-
-               /* FIXME the whole function looks useless. Why does one need str argument to the filter here ?*/
-               if (gw_field_name) {
-
-                       if (g_str_equal (gw_field_name, "fullName")) {
-                               e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_EXISTS, "fullName/firstName", str);
-                               e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_EXISTS, "fullName/lastName", str);
-                               if (sexp_data->is_personal_book) {
-                                       e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_EXISTS, "fullName/displayName", str);
-                                       e_gw_filter_group_conditions (filter, E_GW_FILTER_OP_OR, 3);
-                               }
-                               else {
-                                       e_gw_filter_group_conditions (filter, E_GW_FILTER_OP_OR, 2);
-                               }
-                       }
-                       else {
-                               e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_EXISTS, gw_field_name, str);
-                       }
-               }
-               else {
-                       sexp_data->is_filter_valid = FALSE;
-               }
-       }
-
-       r = e_sexp_result_new (f, ESEXP_RES_BOOL);
-       r->value.boolean = FALSE;
-
-       return r;
-}
-
-/* 'builtin' functions */
-static const struct {
-       const gchar *name;
-       ESExpFunc *func;
-       gint type;              /* set to 1 if a function can perform shortcut evaluation, or
-                                  doesn't execute everything, 0 otherwise */
-} symbols[] = {
-       { "and", func_and, 0 },
-       { "or", func_or, 0 },
-       { "not", func_not, 0 },
-       { "contains", func_contains, 0 },
-       { "is", func_is, 0 },
-       { "beginswith", func_beginswith, 0 },
-       { "endswith", func_endswith, 0 },
-       { "exists", func_exists, 0 },
-};
-
-static EGwFilter*
-e_book_backend_groupwise_build_gw_filter (EBookBackendGroupwise *ebgw, const gchar *query, gpointer is_auto_completion, gchar ** search_string)
-{
-       ESExp *sexp;
-       ESExpResult *r;
-       EBookBackendGroupwiseSExpData *sexp_data;
-       EGwFilter *filter;
-       gint i;
-
-       sexp = e_sexp_new ();
-       filter = e_gw_filter_new ();
-
-       sexp_data = g_new0 (EBookBackendGroupwiseSExpData, 1);
-       sexp_data->filter = filter;
-       sexp_data->is_filter_valid = TRUE;
-       sexp_data->is_personal_book = e_book_backend_is_writable ( E_BOOK_BACKEND (ebgw));
-       sexp_data->auto_completion = 0;
-       sexp_data->search_string = NULL;
-
-       for (i = 0; i < G_N_ELEMENTS (symbols); i++) {
-               if (symbols[i].type == 1) {
-                       e_sexp_add_ifunction (sexp, 0, symbols[i].name,
-                                            (ESExpIFunc *)symbols[i].func, sexp_data);
-               } else {
-                       e_sexp_add_function (sexp, 0, symbols[i].name,
-                                           symbols[i].func, sexp_data);
-               }
-       }
-
-       e_sexp_input_text (sexp, query, strlen (query));
-       e_sexp_parse (sexp);
-       r = e_sexp_eval (sexp);
-       e_sexp_result_free (sexp, r);
-       e_sexp_unref (sexp);
-
-       if (sexp_data->is_filter_valid) {
-               if (sexp_data->auto_completion == AUTO_COMPLETION_QUERY)
-                       *(gboolean *)is_auto_completion = TRUE;
-               if (search_string)
-                       *search_string = sexp_data->search_string;
-               g_free (sexp_data);
-               return filter;
-       }
-       else {
-               g_object_unref (filter);
-               g_free (sexp_data);
-               return NULL;
-       }
-}
-
-static void
-e_book_backend_groupwise_get_contact_list (EBookBackend *backend,
-                                          EDataBook    *book,
-                                          guint32       opid,
-                                          const gchar   *query )
-{
-       GList *vcard_list;
-       gint status;
-       GList *gw_items, *contacts = NULL, *temp;
-       EContact *contact;
-       EBookBackendGroupwise *egwb;
-       gboolean match_needed;
-       EBookBackendSExp *card_sexp = NULL;
-       EGwFilter *filter = NULL;
-       GPtrArray *ids;
-       gboolean is_auto_completion;
-
-       egwb = E_BOOK_BACKEND_GROUPWISE (backend);
-       vcard_list = NULL;
-       gw_items = NULL;
-
-       if (enable_debug)
-               printf ("\ne_book_backend_groupwise_get_contact_list...\n");
-
-       switch (egwb->priv->mode) {
-
-       case E_DATA_BOOK_MODE_LOCAL :
-
-               if (!egwb->priv->file_db) {
-                       e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (REPOSITORY_OFFLINE), NULL);
-                       return;
-               }
-
-               if (egwb->priv->is_summary_ready &&
-                   e_book_backend_summary_is_summary_query (egwb->priv->summary, query)) {
-                       gint i;
-                       ids = e_book_backend_summary_search (egwb->priv->summary, query);
-                       if (!ids)
-                               return;
-
-                       for (i = 0; i < ids->len; i++) {
-                               gchar *uid = g_ptr_array_index (ids, i);
-
-                               EContact *contact =
-                                       e_book_backend_db_cache_get_contact (egwb->priv->file_db, uid);
-                               contacts = g_list_append (contacts, contact);
-                       }
-                       g_ptr_array_free (ids, TRUE);
-               }
-               else
-                       contacts = e_book_backend_db_cache_get_contacts (egwb->priv->file_db, query);
-
-               temp = contacts;
-               for (; contacts != NULL; contacts = g_list_next (contacts)) {
-                       vcard_list = g_list_append (vcard_list,
-                                                   e_vcard_to_string (E_VCARD (contacts->data),
-                                                   EVC_FORMAT_VCARD_30));
-                       g_object_unref (contacts->data);
-               }
-               e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (SUCCESS), vcard_list);
-               if (temp)
-                       g_list_free (temp);
-               return;
-
-       case E_DATA_BOOK_MODE_REMOTE:
-
-               if (egwb->priv->cnc == NULL) {
-                       e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (AUTHENTICATION_REQUIRED), NULL);
-                       return;
-               }
-
-               match_needed = TRUE;
-               card_sexp = e_book_backend_sexp_new (query);
-               if (!card_sexp) {
-                       e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (INVALID_QUERY), vcard_list);
-               }
-
-               status = E_GW_CONNECTION_STATUS_OK;
-               if (egwb->priv->is_cache_ready ) {
-                       if (egwb->priv->is_summary_ready &&
-                           e_book_backend_summary_is_summary_query (egwb->priv->summary, query)) {
-                               ids = e_book_backend_summary_search (egwb->priv->summary, query);
-
-                               if (!egwb->priv->is_writable) {
-                                       gint i;
-                                       for (i = 0; i < ids->len; i++) {
-                                               gchar *uid = g_ptr_array_index (ids, i);
-                                               contact = e_book_backend_db_cache_get_contact (egwb->priv->file_db, uid);
-                                               vcard_list = g_list_append (vcard_list,
-                                                           e_vcard_to_string (E_VCARD (contact),
-                                                           EVC_FORMAT_VCARD_30));
-                                               g_object_unref (contact);
-                                       }
-                                       g_ptr_array_free (ids, TRUE);
-                                       ids = NULL;
-                               }
-                       }
-                       else {
-                               ids = e_book_backend_db_cache_search (egwb->priv->file_db, query);
-                       }
-
-                       if (ids && ids->len > 0) {
-                               status = e_gw_connection_get_items_from_ids (egwb->priv->cnc,
-                                                                       egwb->priv->container_id,
-                                                                       "name email default members",
-                                                                       ids, &gw_items);
-                               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                               status = e_gw_connection_get_items_from_ids (egwb->priv->cnc,
-                                                                       egwb->priv->container_id,
-                                                                       "name email default members",
-                                                                       ids, &gw_items);
-                       }
-                       if (ids)
-                               g_ptr_array_free (ids, TRUE);
-                       match_needed = FALSE;
-               } else {
-                       if (strcmp (query, "(contains \"x-evolution-any-field\" \"\")") != 0)
-                               filter = e_book_backend_groupwise_build_gw_filter (egwb,
-                                                                                  query,
-                                                                                  &is_auto_completion,
-                                                                                  NULL);
-                       if (filter)
-                               match_needed = FALSE;
-                       status = e_gw_connection_get_items (egwb->priv->cnc,
-                                                           egwb->priv->container_id,
-                                                           "name email default members",
-                                                           filter, &gw_items);
-                       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                               status = e_gw_connection_get_items (egwb->priv->cnc,
-                                                                   egwb->priv->container_id,
-                                                                   "name email default members",
-                                                                   filter, &gw_items);
-               }
-
-               if (status != E_GW_CONNECTION_STATUS_OK) {
-                       e_data_book_respond_get_contact_list (book, opid, EDB_ERROR_FAILED_STATUS (OTHER_ERROR, status), NULL);
-                       return;
-               }
-               for (; gw_items != NULL; gw_items = g_list_next (gw_items)) {
-                       contact = e_contact_new ();
-                       fill_contact_from_gw_item (contact, E_GW_ITEM (gw_items->data), egwb->priv->categories_by_id);
-                       e_contact_set (contact, E_CONTACT_BOOK_URI, egwb->priv->original_uri);
-                       if (match_needed &&  e_book_backend_sexp_match_contact (card_sexp, contact))
-                               vcard_list = g_list_append (vcard_list,
-                                                           e_vcard_to_string (E_VCARD (contact),
-                                                           EVC_FORMAT_VCARD_30));
-                       else
-                               vcard_list = g_list_append (vcard_list,
-                                                           e_vcard_to_string (E_VCARD (contact),
-                                                           EVC_FORMAT_VCARD_30));
-                       g_object_unref (contact);
-                       g_object_unref (gw_items->data);
-               }
-               if (gw_items)
-                       g_list_free (gw_items);
-               e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (SUCCESS), vcard_list);
-               if (filter)
-                       g_object_unref (filter);
-               return;
-       default :
-               break;
-
-       }
-}
-
-typedef struct {
-       EBookBackendGroupwise *bg;
-       GThread *thread;
-       EFlag *running;
-} GroupwiseBackendSearchClosure;
-
-static void
-closure_destroy (GroupwiseBackendSearchClosure *closure)
-{
-       e_flag_free (closure->running);
-       g_free (closure);
-}
-
-static GroupwiseBackendSearchClosure*
-init_closure (EDataBookView *book_view, EBookBackendGroupwise *bg)
-{
-       GroupwiseBackendSearchClosure *closure = g_new (GroupwiseBackendSearchClosure, 1);
-
-       closure->bg = bg;
-       closure->thread = NULL;
-       closure->running = e_flag_new ();
-
-       g_object_set_data_full (G_OBJECT (book_view), "EBookBackendGroupwise.BookView::closure",
-                               closure, (GDestroyNotify)closure_destroy);
-
-       return closure;
-}
-
-static GroupwiseBackendSearchClosure*
-get_closure (EDataBookView *book_view)
-{
-       return g_object_get_data (G_OBJECT (book_view), "EBookBackendGroupwise.BookView::closure");
-}
-
-static void
-get_contacts_from_cache (EBookBackendGroupwise *ebgw,
-                        const gchar *query,
-                        GPtrArray *ids,
-                        EDataBookView *book_view,
-                        GroupwiseBackendSearchClosure *closure)
-{
-       gint i;
-
-       if (enable_debug)
-               printf ("\nread contacts from cache for the ids found in summary\n");
-       for (i = 0; i < ids->len; i++) {
-               gchar *uid;
-               EContact *contact;
-
-               if (!e_flag_is_set (closure->running))
-                       break;
-
-               uid = g_ptr_array_index (ids, i);
-               contact = e_book_backend_db_cache_get_contact (ebgw->priv->file_db, uid);
-               if (contact) {
-                       e_data_book_view_notify_update (book_view, contact);
-                       g_object_unref (contact);
-               }
-       }
-       if (e_flag_is_set (closure->running))
-               e_data_book_view_notify_complete (book_view, NULL /* Success */);
-}
-
-static gpointer
-book_view_thread (gpointer data)
-{
-       gint status, count = 0;
-       GList *gw_items, *temp_list, *contacts;
-       EContact *contact;
-       EBookBackendGroupwise *gwb;
-       const gchar *query = NULL;
-       EGwFilter *filter = NULL;
-       GPtrArray *ids = NULL;
-       EDataBookView *book_view = data;
-       GroupwiseBackendSearchClosure *closure = get_closure (book_view);
-       const gchar *view = NULL;
-       gboolean is_auto_completion = FALSE;
-       gchar *search_string = NULL;
-       GTimeVal start, end;
-       gulong diff;
-
-       gwb  = closure->bg;
-       gw_items = NULL;
-
-       if (enable_debug)
-               printf ("start book view for %s \n", gwb->priv->book_name);
-       e_data_book_view_ref (book_view);
-       e_flag_set (closure->running);
-
-       query = e_data_book_view_get_card_query (book_view);
-       if (enable_debug)
-               printf ("get view for query %s \n", query);
-       switch (gwb->priv->mode) {
-
-       case E_DATA_BOOK_MODE_LOCAL :
-               if (!gwb->priv->file_db) {
-                       e_data_book_view_notify_complete (book_view, NULL /* Success */);
-                       return NULL;
-               }
-
-               if (gwb->priv->is_summary_ready &&
-                   e_book_backend_summary_is_summary_query (gwb->priv->summary, query)) {
-                       if (enable_debug)
-                               printf ("reading the uids from summary \n");
-                       ids = e_book_backend_summary_search (gwb->priv->summary, query);
-                       if (ids && ids->len > 0) {
-                               get_contacts_from_cache (gwb, query, ids, book_view, closure);
-                       }
-                       if (ids)
-                               g_ptr_array_free (ids, TRUE);
-                       e_data_book_view_unref (book_view);
-                       return NULL;
-               }
-
-               /* fall back to cache */
-               if (enable_debug)
-                       printf ("summary not found, reading the uids from cache\n");
-               contacts = e_book_backend_db_cache_get_contacts (gwb->priv->file_db, query);
-               temp_list = contacts;
-               for (; contacts != NULL; contacts = g_list_next (contacts)) {
-                       if (!e_flag_is_set (closure->running)) {
-                               for (;contacts != NULL; contacts = g_list_next (contacts))
-                                       g_object_unref (contacts->data);
-                               break;
-                       }
-                       e_data_book_view_notify_update (book_view, E_CONTACT (contacts->data));
-                       g_object_unref (contacts->data);
-               }
-               if (e_flag_is_set (closure->running))
-                       e_data_book_view_notify_complete (book_view, NULL /* Success */);
-               if (temp_list)
-                       g_list_free (temp_list);
-               e_data_book_view_unref (book_view);
-               return NULL;
-
-       case E_DATA_BOOK_MODE_REMOTE :
-
-               if (gwb->priv->cnc == NULL) {
-                       GError *edb_err = EDB_ERROR (AUTHENTICATION_REQUIRED);
-
-                       e_data_book_view_notify_complete (book_view, edb_err);
-                       e_data_book_view_unref (book_view);
-                       g_error_free (edb_err);
-                       return NULL;
-               }
-
-               if (enable_debug)
-                       g_get_current_time (&start);
-
-               filter = e_book_backend_groupwise_build_gw_filter (gwb, query, &is_auto_completion, &search_string);
-               view = "name email default members";
-               if (is_auto_completion && !g_getenv ("AUTOCOMPLETE_EXPAND_CL"))
-                       view = "name email";
-
-               if (search_string) {
-                       if (filter)
-                               g_object_unref (filter);
-
-                       /* groupwise server supports only name, rebuild the filter */
-                       filter = e_gw_filter_new ();
-                       e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_BEGINS,
-                                                         "fullName/lastName", search_string);
-                       e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_BEGINS,
-                                                         "fullName/firstName", search_string);
-                       e_gw_filter_group_conditions (filter, E_GW_FILTER_OP_OR, 2);
-                       g_free (search_string);
-               }
-
-               if (!gwb->priv->is_writable && !filter && (g_getenv ("GW_HIDE_SYSBOOK") || (!gwb->priv->is_cache_ready))) {
-
-                               e_data_book_view_notify_complete (book_view, NULL /* Success */);
-                               e_data_book_view_unref (book_view);
-                               if (filter)
-                                       g_object_unref (filter);
-                               return NULL;
-               }
-               else
-                       status =  E_GW_CONNECTION_STATUS_OK;
-
-               /* Check if the data is found on summary */
-               if (gwb->priv->is_summary_ready &&
-                   e_book_backend_summary_is_summary_query (gwb->priv->summary, query)) {
-                       if (enable_debug)
-                               printf("reading the uids from summary file\n");
-                       ids = e_book_backend_summary_search (gwb->priv->summary, query);
-               }
-
-               /*
-                * Search for contact in cache, if not found, read from server
-                */
-
-               if (ids && ids->len > 0) {
-                       if (enable_debug)
-                               printf ("number of matches found in summary %d\n", ids->len);
-                       /* read from summary */
-                       if (gwb->priv->is_cache_ready && !gwb->priv->is_writable) {
-                               /* read from cache, only for system address book, as we refresh
-                                * only system address book, periodically.
-                                */
-                               if (enable_debug)
-                                       printf ("reading contacts from cache for the uids in summary \n");
-                               if (!is_auto_completion)
-                                       e_data_book_view_notify_status_message (book_view,
-                                                                               _("Searching..."));
-                               get_contacts_from_cache (gwb, query, ids, book_view, closure);
-                               g_ptr_array_free (ids, TRUE);
-                               e_data_book_view_unref (book_view);
-                               if (enable_debug) {
-                                       g_get_current_time (&end);
-                                       diff = end.tv_sec * 1000 + end.tv_usec/1000;
-                                       diff -= start.tv_sec * 1000 + start.tv_usec/1000;
-                                       printf("reading contacts from cache took %ld.%03ld seconds\n",
-                                               diff/1000,diff%1000);
-                               }
-                               if (filter)
-                                       g_object_unref (filter);
-                               return NULL;
-                       }
-                       else {
-                               /* read from server for the ids */
-                               /* either autocompletion or search query and cache not ready */
-                               if (enable_debug)
-                                       printf ("reading contacts from server for the uids in summary \n");
-                               if (!is_auto_completion)
-                                       e_data_book_view_notify_status_message (book_view,
-                                                                               _("Searching..."));
-                               status = e_gw_connection_get_items_from_ids (gwb->priv->cnc,
-                                                                            gwb->priv->container_id,
-                                                                            view, ids, &gw_items);
-                               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                                       status = e_gw_connection_get_items_from_ids (gwb->priv->cnc,
-                                                                                    gwb->priv->container_id,
-                                                                                    view, ids, &gw_items);
-                               if (enable_debug && status == E_GW_CONNECTION_STATUS_OK)
-                                       printf ("read contacts from server \n");
-                       }
-               }
-               else {
-                       if (gwb->priv->is_cache_ready) {
-                               contacts = e_book_backend_db_cache_get_contacts (gwb->priv->file_db, query);
-                               temp_list = contacts;
-                               for (; contacts != NULL; contacts = g_list_next (contacts)) {
-                                       if (!e_flag_is_set (closure->running)) {
-                                               for (;contacts != NULL; contacts = g_list_next (contacts))
-                                                       g_object_unref (contacts->data);
-                                               break;
-                                       }
-                                       e_data_book_view_notify_update (book_view, E_CONTACT (contacts->data));
-                                       g_object_unref (contacts->data);
-                               }
-                               if (e_flag_is_set (closure->running))
-                                       e_data_book_view_notify_complete (book_view, NULL /* Success */);
-                               if (temp_list)
-                                       g_list_free (temp_list);
-                               e_data_book_view_unref (book_view);
-
-                               if (filter)
-                                       g_object_unref (filter);
-
-                               if (ids)
-                                       g_ptr_array_free (ids, TRUE);
-
-                               return NULL;
-                       }
-
-                       /* no summary information found, read from server */
-                       if (enable_debug)
-                               printf ("summary not found, reading the contacts from server\n");
-                       if (!is_auto_completion) {
-                               if (filter)
-                                       e_data_book_view_notify_status_message (book_view, _("Searching..."));
-                               else
-                                       e_data_book_view_notify_status_message (book_view, _("Loading..."));
-                       }
-                       status = e_gw_connection_get_items (gwb->priv->cnc,
-                                                           gwb->priv->container_id,
-                                                           view, filter, &gw_items);
-                       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                               status = e_gw_connection_get_items (gwb->priv->cnc,
-                                                                   gwb->priv->container_id,
-                                                                   view, filter, &gw_items);
-               }
-
-               if (ids)
-                       g_ptr_array_free (ids, TRUE);
-
-               if (status != E_GW_CONNECTION_STATUS_OK) {
-                       GError *edb_err = EDB_ERROR_FAILED_STATUS (OTHER_ERROR, status);
-                       e_data_book_view_notify_complete (book_view, edb_err);
-                       e_data_book_view_unref (book_view);
-                       g_error_free (edb_err);
-                       if (filter)
-                               g_object_unref (filter);
-                       return NULL;
-               }
-
-               temp_list = gw_items;
-               for (; gw_items != NULL; gw_items = g_list_next (gw_items)) {
-
-                       if (!e_flag_is_set (closure->running)) {
-                               for (;gw_items != NULL; gw_items = g_list_next (gw_items))
-                                       g_object_unref (gw_items->data);
-                               break;
-                       }
-
-                       count++;
-                       contact = e_contact_new ();
-                       fill_contact_from_gw_item (contact,
-                                                  E_GW_ITEM (gw_items->data),
-                                                  gwb->priv->categories_by_id);
-                       e_contact_set (contact, E_CONTACT_BOOK_URI, gwb->priv->original_uri);
-                       if (e_contact_get_const (contact, E_CONTACT_UID))
-                               e_data_book_view_notify_update (book_view, contact);
-                       else
-                               g_critical ("Id missing for item %s\n", (gchar *)e_contact_get_const (contact, E_CONTACT_FILE_AS));
-                       g_object_unref (contact);
-                       g_object_unref (gw_items->data);
-               }
-               if (temp_list)
-                       g_list_free (temp_list);
-               if (e_flag_is_set (closure->running))
-                       e_data_book_view_notify_complete (book_view, NULL /* Success */);
-               if (filter)
-                       g_object_unref (filter);
-               e_data_book_view_unref (book_view);
-
-               if (enable_debug) {
-                       g_get_current_time (&end);
-                       diff = end.tv_sec * 1000 + end.tv_usec/1000;
-                       diff -= start.tv_sec * 1000 + start.tv_usec/1000;
-                       printf("reading %d contacts from server took %ld.%03ld seconds\n",
-                               count, diff/1000,diff%1000);
-               }
-
-               return NULL;
-       default :
-               break;
-       }
-       e_data_book_view_unref (book_view);
-       return NULL;
-}
-
-static void
-e_book_backend_groupwise_start_book_view (EBookBackend  *backend,
-                                    EDataBookView *book_view)
-{
-       GroupwiseBackendSearchClosure *closure = init_closure (book_view, E_BOOK_BACKEND_GROUPWISE (backend));
-
-       if (enable_debug)
-               printf ("\ne_book_backend_groupwise_start_book_view...\n");
-       closure->thread = g_thread_create (book_view_thread, book_view, FALSE, NULL);
-       e_flag_wait (closure->running);
-
-       /* at this point we know the book view thread is actually running */
-}
-
-static void
-e_book_backend_groupwise_stop_book_view (EBookBackend  *backend,
-                                        EDataBookView *book_view)
-{
-       GroupwiseBackendSearchClosure *closure = get_closure (book_view);
-
-       if (enable_debug)
-               printf ("\ne_book_backend_groupwise_stop_book_view...\n");
-       e_flag_clear (closure->running);
-}
-
-static void
-e_book_backend_groupwise_get_changes (EBookBackend *backend,
-                                     EDataBook    *book,
-                                     guint32       opid,
-                                     const gchar *change_id  )
-{
-       if (enable_debug)
-               printf ("\ne_book_backend_groupwise_get_changes...\n");
-
-       /* FIXME : provide implmentation */
-
-}
-
-static void
-book_view_notify_status (EDataBookView *view, const gchar *status)
-{
-       if (!view)
-               return;
-       e_data_book_view_notify_status_message (view, status);
-}
-
-static EDataBookView *
-find_book_view (EBookBackendGroupwise *ebgw)
-{
-       EList *views = e_book_backend_get_book_views (E_BOOK_BACKEND (ebgw));
-       EIterator *iter;
-       EDataBookView *rv = NULL;
-
-       if (!views)
-               return NULL;
-
-       iter = e_list_get_iterator (views);
-
-       if (!iter) {
-               g_object_unref (views);
-               return NULL;
-       }
-
-       if (e_iterator_is_valid (iter)) {
-               /* just always use the first book view */
-               EDataBookView *v = (EDataBookView*)e_iterator_get (iter);
-               if (v)
-                       rv = v;
-       }
-
-       g_object_unref (iter);
-       g_object_unref (views);
-
-       return rv;
-}
-
-static void
-get_sequence_from_cache (DB *db,
-               gdouble *cache_first_sequence,
-               gdouble *cache_last_sequence,
-               gdouble *cache_last_po_rebuild_time)
-{
-       DBT uid_dbt, vcard_dbt;
-       gint db_error;
-
-       string_to_dbt ("firstSequence", &uid_dbt);
-       memset (&vcard_dbt, 0, sizeof (vcard_dbt));
-       vcard_dbt.flags = DB_DBT_MALLOC;
-
-       db_error = db->get (db, NULL, &uid_dbt, &vcard_dbt, 0);
-       if (db_error != 0) {
-               g_warning ("db->get failed with %d", db_error);
-       }
-       else {
-               *cache_first_sequence = strtod (g_strdup (vcard_dbt.data), NULL);
-               g_free (vcard_dbt.data);
-       }
-
-       string_to_dbt ("lastSequence", &uid_dbt);
-       memset (&vcard_dbt, 0, sizeof (vcard_dbt));
-       vcard_dbt.flags = DB_DBT_MALLOC;
-
-       db_error = db->get (db, NULL, &uid_dbt, &vcard_dbt, 0);
-       if (db_error != 0) {
-               g_warning ("db->get failed with %d", db_error);
-       }
-       else {
-               *cache_last_sequence = strtod (g_strdup (vcard_dbt.data), NULL);
-               g_free (vcard_dbt.data);
-       }
-
-       string_to_dbt ("lastTimePORebuild", &uid_dbt);
-       memset (&vcard_dbt, 0, sizeof (vcard_dbt));
-       vcard_dbt.flags = DB_DBT_MALLOC;
-
-       db_error = db->get (db, NULL, &uid_dbt, &vcard_dbt, 0);
-       if (db_error != 0) {
-               g_warning ("db->get failed with %d", db_error);
-       }
-       else {
-               *cache_last_po_rebuild_time = strtod (g_strdup (vcard_dbt.data), NULL);
-               g_free (vcard_dbt.data);
-       }
-
-       if (enable_debug) {
-               printf("Read sequences from cache\n");
-               printf("firstSequence:%lf, lastSequence:%lf, lastPoRebuildTime:%lf\n", *cache_first_sequence, *cache_last_sequence, *cache_last_po_rebuild_time);
-       }
-
-}
-static void
-add_sequence_to_cache (DB *db,
-                      gdouble first_sequence,
-                      gdouble last_sequence,
-                      gdouble last_po_rebuild_time)
-{
-               gchar *tmp;
-               DBT   uid_dbt, vcard_dbt;
-               gint db_error;
-
-               if (enable_debug) {
-                       printf("Adding sequences to cache\n");
-                       printf("firstSequence:%lf, lastSequence:%lf, lastPoRebuildTime:%lf\n", first_sequence, last_sequence, last_po_rebuild_time);
-               }
-
-               string_to_dbt ("firstSequence",&uid_dbt );
-               tmp = g_strdup_printf("%lf", first_sequence);
-               string_to_dbt (tmp, &vcard_dbt);
-
-               db_error = db->put (db, NULL, &uid_dbt, &vcard_dbt, 0);
-
-               g_free (tmp);
-
-               if (db_error != 0) {
-                       g_warning ("db->put failed with %d", db_error);
-               }
-
-               string_to_dbt ("lastSequence",&uid_dbt );
-               tmp = g_strdup_printf("%lf", last_sequence);
-               string_to_dbt (tmp, &vcard_dbt);
-
-               db_error = db->put (db, NULL, &uid_dbt, &vcard_dbt, 0);
-
-               g_free (tmp);
-
-               if (db_error != 0) {
-                       g_warning ("db->put failed with %d", db_error);
-               }
-
-               string_to_dbt ("lastTimePORebuild",&uid_dbt );
-               tmp = g_strdup_printf("%lf", last_po_rebuild_time);
-               string_to_dbt (tmp, &vcard_dbt);
-
-               db_error = db->put (db, NULL, &uid_dbt, &vcard_dbt, 0);
-
-               g_free (tmp);
-
-               if (db_error != 0) {
-                       g_warning ("db->put failed with %d", db_error);
-               }
-}
-
-#define CURSOR_ITEM_LIMIT 100
-/*
-static gpointer
-build_cache (EBookBackendGroupwise *ebgw)
-{
-       gint status, contact_num = 0;
-       GList *gw_items = NULL;
-       EContact *contact;
-       EDataBookView *book_view;
-       EBookBackendGroupwisePrivate *priv = ebgw->priv;
-       gchar *status_msg;
-
-       status = e_gw_connection_get_items (ebgw->priv->cnc, ebgw->priv->container_id, "name email default members", NULL, &gw_items);
-       if (status != E_GW_CONNECTION_STATUS_OK)
-               return NULL;
-
-       for (; gw_items != NULL; gw_items = g_list_next (gw_items)) {
-               contact_num++;
-               contact = e_contact_new ();
-               fill_contact_from_gw_item (contact, E_GW_ITEM (gw_items->data), ebgw->priv->categories_by_id);
-               e_book_backend_cache_add_contact (ebgw->priv->cache, contact);
-               if (book_view) {
-                       status_msg = g_strdup_printf (_("Downloading contacts (%d)... "),
-                                                        contact_num);
-                       book_view_notify_status (book_view, status_msg);
-                       g_free (status_msg);
-               }
-               g_object_unref (contact);
-               g_object_unref (gw_items->data);
-
-       }
-
-       e_book_backend_cache_set_populated (priv->cache);
-       priv->is_cache_ready=TRUE;
-
-       g_list_free (gw_items);
-
-       return NULL;
-}*/
-
-/*FIXME using cursors for address book seems to be crashing server
-till it gets fixed we will use get items. cursor implementation is below */
-
-static gpointer
-build_cache (EBookBackendGroupwise *ebgw)
-{
-       gint status;
-       GList *gw_items = NULL, *l;
-       EContact *contact;
-       gint cursor, contact_num = 0;
-       gboolean done = FALSE;
-       EBookBackendGroupwisePrivate *priv = ebgw->priv;
-       const gchar *position = E_GW_CURSOR_POSITION_START;
-       EDataBookView *book_view;
-       GroupwiseBackendSearchClosure *closure;
-       gchar *status_msg;
-       GTimeVal start, end;
-       GTimeVal tstart, tend;
-       gulong diff;
-
-       if (!ebgw)
-               return NULL;
-
-       if (enable_debug) {
-               g_get_current_time (&start);
-               printf("Building the cache for %s \n", ebgw->priv->book_name);
-       }
-
-       status = e_gw_connection_create_cursor (priv->cnc, priv->container_id,
-                                               "default members", NULL, &cursor);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               if (enable_debug)
-                       printf("No connection with the server \n");
-               return NULL;
-       }
-
-       book_view = find_book_view (ebgw);
-       if (book_view) {
-               closure = get_closure (book_view);
-               e_data_book_view_ref (book_view);
-               if (closure)
-                       e_flag_set (closure->running);
-       }
-
-       while (!done) {
-
-               if (enable_debug)
-                       g_get_current_time (&tstart);
-               status = e_gw_connection_read_cursor (priv->cnc, priv->container_id,
-                                                     cursor, TRUE, CURSOR_ITEM_LIMIT,
-                                                     position, &gw_items);
-               if (enable_debug) {
-                       g_get_current_time (&tend);
-                       diff = tend.tv_sec * 1000 + tend.tv_usec/1000;
-                       diff -= tstart.tv_sec * 1000 + tstart.tv_usec/1000;
-                       printf("e_gw_connection_read_cursor took %ld.%03ld seconds for %d contacts\n", diff / 1000, diff % 1000, CURSOR_ITEM_LIMIT);
-               }
-
-               if (status != E_GW_CONNECTION_STATUS_OK)
-                        break;
-
-               for (l = gw_items; l != NULL; l = g_list_next (l)) {
-                       contact_num++;
-
-                       contact = e_contact_new ();
-                       fill_contact_from_gw_item (contact, E_GW_ITEM (l->data),
-                                                  ebgw->priv->categories_by_id);
-                       e_contact_set (contact, E_CONTACT_BOOK_URI, priv->original_uri);
-                       e_book_backend_db_cache_add_contact (ebgw->priv->file_db, contact);
-                       e_book_backend_summary_add_contact (ebgw->priv->summary, contact);
-
-                       /* Since we get contacts incrementally, 100 at a time, we can not
-                        * calculate the percentage of cache update.
-                        * Also we should be using "percent" in notify_progress() instead of
-                        * forming the message like this.
-                        */
-                       if (book_view) {
-                               status_msg = g_strdup_printf (_("Downloading contacts (%d)... "),
-                                                                contact_num);
-                               book_view_notify_status (book_view, status_msg);
-                               e_data_book_view_notify_update (book_view, contact);
-
-                               g_free (status_msg);
-                       }
-
-                       g_object_unref (contact);
-                       g_object_unref (l->data);
-
-               }
-               if (!gw_items) {
-                       e_book_backend_db_cache_set_populated (ebgw->priv->file_db);
-                       done = TRUE;
-                       priv->is_cache_ready=TRUE;
-                       priv->is_summary_ready = TRUE;
-               }
-
-               g_list_free (gw_items);
-               gw_items = NULL;
-               position = E_GW_CURSOR_POSITION_CURRENT;
-       }
-
-       ebgw->priv->file_db->sync (ebgw->priv->file_db, 0);
-
-       if (book_view) {
-               e_data_book_view_notify_complete (book_view, NULL /* Success */);
-               e_data_book_view_unref (book_view);
-       }
-
-       e_gw_connection_destroy_cursor (priv->cnc, priv->container_id, cursor);
-
-       if (enable_debug) {
-               g_get_current_time (&end);
-               diff = end.tv_sec * 1000 + end.tv_usec/1000;
-               diff -= start.tv_sec * 1000 + start.tv_usec/1000;
-               printf("completed building cache for %s in %ld.%03ld seconds for %d contacts\n",
-                       priv->book_name, diff / 1000, diff % 1000, contact_num);
-       }
-       return NULL;
-}
-
-static void
-build_summary (EBookBackendGroupwise *ebgw)
-{
-       gchar *query_string;
-       GList *contacts, *temp_list = NULL;
-       GTimeVal start, end;
-       gulong diff;
-
-       if (enable_debug) {
-               g_get_current_time (&start);
-               printf ("summary file not found or not up-to-date, building summary for %s\n",
-                       ebgw->priv->book_name);
-       }
-
-       /* build summary from cache */
-       query_string = g_strdup_printf ("(or (beginswith \"file_as\" \"\") "
-                                       "    (beginswith \"full_name\" \"\") "
-                                       "    (beginswith \"email\" \"\") "
-                                       "    (beginswith \"nickname\" \"\"))");
-       contacts = e_book_backend_db_cache_get_contacts (ebgw->priv->file_db, query_string);
-       g_free (query_string);
-       temp_list = contacts;
-       for (; contacts != NULL; contacts = g_list_next (contacts)) {
-               e_book_backend_summary_add_contact (ebgw->priv->summary, contacts->data);
-               g_object_unref (contacts->data);
-       }
-       if (temp_list)
-               g_list_free (temp_list);
-       ebgw->priv->is_summary_ready = TRUE;
-
-       if (enable_debug) {
-               g_get_current_time (&end);
-               diff = end.tv_sec * 1000 + end.tv_usec/1000;
-               diff -= start.tv_sec * 1000 + start.tv_usec/1000;
-               printf("building summary for %s took %ld.%03ld seconds \n",
-                       ebgw->priv->book_name, diff / 1000, diff % 1000);
-       }
-}
-
-static gboolean
-update_cache (EBookBackendGroupwise *ebgw)
-{
-       gint status, contact_num = 0;
-       GList *gw_items = NULL;
-       EContact *contact;
-       EGwFilter *filter;
-       time_t mod_time;
-       gchar cache_time_string[100], *status_msg;
-       const struct tm *tm;
-       struct stat buf;
-       gchar *cache_file_name;
-       EDataBookView *book_view;
-       GroupwiseBackendSearchClosure *closure;
-       GTimeVal start, end;
-       gulong diff;
-
-       if (!ebgw)
-               return FALSE;
-
-       g_mutex_lock (ebgw->priv->update_cache_mutex);
-
-       if (enable_debug) {
-               g_get_current_time (&start);
-               printf("updating cache for %s\n", ebgw->priv->book_name);
-       }
-
-       book_view = find_book_view (ebgw);
-       if (book_view) {
-               closure = get_closure (book_view);
-               e_data_book_view_ref (book_view);
-               if (closure)
-                       e_flag_set (closure->running);
-       }
-
-       cache_file_name = e_book_backend_db_cache_get_filename (ebgw->priv->file_db);
-       g_stat (cache_file_name, &buf);
-       g_free (cache_file_name);
-       mod_time = buf.st_mtime;
-       tm = gmtime (&mod_time);
-       strftime (cache_time_string, 100, "%Y-%m-%dT%H:%M:%SZ", tm);
-
-       filter = e_gw_filter_new ();
-       e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_GREATERTHAN,
-                                         "modified", cache_time_string);
-       status = e_gw_connection_get_items (ebgw->priv->cnc, ebgw->priv->container_id,
-                                           "name email default members", filter, &gw_items);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               if (book_view)
-                       e_data_book_view_unref (book_view);
-               if (enable_debug)
-                       printf("No connection with the server \n");
-               g_mutex_unlock (ebgw->priv->update_cache_mutex);
-               return FALSE;
-       }
-
-       for (; gw_items != NULL; gw_items = g_list_next (gw_items)) {
-               const gchar *id;
-
-               contact = e_contact_new ();
-               fill_contact_from_gw_item (contact, E_GW_ITEM (gw_items->data),
-                                          ebgw->priv->categories_by_id);
-
-               e_contact_set (contact, E_CONTACT_BOOK_URI, ebgw->priv->original_uri);
-               id =  e_contact_get_const (contact, E_CONTACT_UID);
-
-               contact_num++;
-               if (book_view) {
-                       status_msg = g_strdup_printf (_("Updating contacts cache (%d)... "),
-                                                        contact_num);
-                       book_view_notify_status (book_view, status_msg);
-                       g_free (status_msg);
-               }
-
-               if (e_book_backend_db_cache_check_contact (ebgw->priv->file_db, id)) {
-                       e_book_backend_db_cache_add_contact (ebgw->priv->file_db, contact);
-                       e_book_backend_summary_remove_contact (ebgw->priv->summary, id);
-                       e_book_backend_summary_add_contact (ebgw->priv->summary, contact);
-               } else {
-                       e_book_backend_db_cache_add_contact (ebgw->priv->file_db, contact);
-                       e_book_backend_summary_add_contact (ebgw->priv->summary, contact);
-               }
-
-               g_object_unref (contact);
-               g_object_unref (gw_items->data);
-       }
-       ebgw->priv->is_cache_ready = TRUE;
-       ebgw->priv->is_summary_ready = TRUE;
-
-       ebgw->priv->file_db->sync (ebgw->priv->file_db, 0);
-
-       if (book_view) {
-               e_data_book_view_notify_complete (book_view, NULL /* Success */);
-               e_data_book_view_unref (book_view);
-       }
-       g_object_unref (filter);
-       g_list_free (gw_items);
-
-       if (enable_debug) {
-               g_get_current_time (&end);
-               diff = end.tv_sec * 1000 + end.tv_usec/1000;
-               diff -= start.tv_sec * 1000 + start.tv_usec/1000;
-               printf("updating the cache for %s complated in %ld.%03ld seconds for %d contacts\n",
-                       ebgw->priv->book_name, diff / 1000, diff % 1000, contact_num);
-       }
-       g_mutex_unlock (ebgw->priv->update_cache_mutex);
-       return FALSE;
-}
-
-static gboolean
-update_address_book_deltas (EBookBackendGroupwise *ebgw)
-{
-       gint status, contact_num = 0;
-       gdouble server_first_sequence = -1, server_last_sequence = -1, server_last_po_rebuild_time = -1;
-       gdouble cache_first_sequence = -1, cache_last_sequence = -1, cache_last_po_rebuild_time = -1;
-       gchar *count, *sequence, *status_msg;
-       gboolean sync_required = FALSE;
-       GList *add_list = NULL, *delete_list = NULL;
-       EContact *contact;
-       EDataBookView *book_view;
-       GroupwiseBackendSearchClosure *closure;
-       EGwItem *item;
-       EBookBackendGroupwisePrivate *priv;
-
-       GTimeVal start, end;
-       gulong diff;
-       gchar *cache_file_name;
-       struct stat buf;
-
-       if (!ebgw)
-               return FALSE;
-
-       priv = ebgw->priv;
-
-       g_mutex_lock (priv->update_mutex);
-
-       if (enable_debug)
-               printf("\nupdating GroupWise system address book cache \n");
-
-       /* builds or updates the cache for system address book */
-       status = e_gw_connection_get_items_delta_info (priv->cnc,
-                                                      ebgw->priv->container_id,
-                                                      &server_first_sequence,
-                                                      &server_last_sequence,
-                                                      &server_last_po_rebuild_time);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               if (enable_debug)
-                       printf("No connection with the server \n");
-               g_mutex_unlock (priv->update_mutex);
-               return FALSE;
-       }
-
-       /* Check whether the sequence has been reset or not */
-       if (server_first_sequence <= 0 || server_last_sequence <= 0) {
-               /* build the cache */
-               if (enable_debug)
-                       printf ("sequence is reset, rebuilding cache...\n");
-               build_cache (ebgw);
-               add_sequence_to_cache (priv->file_db, server_first_sequence,
-                                      server_last_sequence, server_last_po_rebuild_time);
-               ebgw->priv->file_db->sync (ebgw->priv->file_db, 0);
-               g_mutex_unlock (priv->update_mutex);
-               return TRUE;
-       }
-
-       /* Read the last sequence and last poa rebuild time from cache */
-       get_sequence_from_cache (priv->file_db, &cache_first_sequence, &cache_last_sequence, &cache_last_po_rebuild_time);
-
-       /* check whether the all the sequences are available and also whether the PO is rebuilt */
-       if (server_first_sequence > cache_last_sequence || cache_last_sequence == -1 ||
-           server_last_po_rebuild_time != cache_last_po_rebuild_time) {
-               /* build the cache again and update the cache with the sequence information */
-               if (enable_debug)
-                       printf ("either the sequences missing or PO is rebuilt...rebuilding the cache\n");
-               build_cache (ebgw);
-               add_sequence_to_cache (priv->file_db, server_first_sequence,
-                                      server_last_sequence, server_last_po_rebuild_time);
-               ebgw->priv->file_db->sync (ebgw->priv->file_db, 0);
-               g_mutex_unlock (priv->update_mutex);
-               return TRUE;
-       }
-
-       if (enable_debug)
-               g_get_current_time (&start);
-
-       book_view = find_book_view (ebgw);
-       if (book_view) {
-               closure = get_closure (book_view);
-               e_data_book_view_ref (book_view);
-               if (closure)
-                       e_flag_set (closure->running);
-       }
-
-       /* update the cache */
-       sequence = g_strdup_printf ("%lf", cache_last_sequence +1);
-       count = g_strdup_printf ("%d", CURSOR_ITEM_LIMIT);
-
-       /* load summary file */
-       cache_file_name = e_book_backend_db_cache_get_filename (ebgw->priv->file_db);
-       g_stat (cache_file_name, &buf);
-       g_free (cache_file_name);
-
-       if (cache_last_sequence != server_last_sequence) {
-
-                       if (enable_debug) {
-                               printf("cache_last_sequence:%lf, server_last_sequence:%lf\n", cache_last_sequence, server_last_sequence);
-                               printf("Calling get_items_delta\n");
-                       }
-                       e_gw_connection_get_items_delta (priv->cnc,
-                                                        ebgw->priv->container_id,
-                                                        "name email sync", count,
-                                                        sequence,
-                                                        &add_list, &delete_list);
-
-                       if (add_list == NULL && delete_list == NULL) {
-                               if (enable_debug)
-                                       printf("sequence differs but no changes found !!!\n");
-                               add_sequence_to_cache (priv->file_db, server_first_sequence,
-                                      server_last_sequence, server_last_po_rebuild_time);
-                               g_mutex_unlock (priv->update_mutex);
-                               g_free (sequence);
-                               g_free (count);
-                               return TRUE;
-                       }
-                       sync_required = TRUE;
-                       if (enable_debug) {
-                               printf("add_list size:%d\n", g_list_length(add_list));
-                               printf("delete_list size:%d\n", g_list_length(delete_list));
-                       }
-
-                       for (; delete_list != NULL; delete_list = g_list_next (delete_list)) {
-                               const gchar *id;
-
-                               /* deleted from the server */
-                               contact = e_contact_new ();
-                               fill_contact_from_gw_item (contact,
-                                                          E_GW_ITEM (delete_list->data),
-                                                          ebgw->priv->categories_by_id);
-                               if (enable_debug)
-                                       printf("contact email:%s, contact name:%s\n", (gchar *) e_contact_get(contact, E_CONTACT_EMAIL_1), (gchar *) e_contact_get(contact, E_CONTACT_GIVEN_NAME));
-                               e_contact_set (contact,
-                                              E_CONTACT_BOOK_URI,
-                                              priv->original_uri);
-                               id =  e_contact_get_const (contact, E_CONTACT_UID);
-
-                               if (e_book_backend_db_cache_check_contact (ebgw->priv->file_db, id)) {
-                                       contact_num++;
-
-                                       if (book_view) {
-                                               status_msg = g_strdup_printf (_("Updating contacts cache (%d)... "),
-                                                                                contact_num);
-                                               book_view_notify_status (book_view, status_msg);
-                                               g_free (status_msg);
-                                       }
-                                       e_book_backend_db_cache_remove_contact (ebgw->priv->file_db, id);
-                                       e_book_backend_summary_remove_contact (ebgw->priv->summary, id);
-                               }
-                               g_object_unref (contact);
-                               g_object_unref (delete_list->data);
-                       }
-
-                       for (; add_list != NULL; add_list = g_list_next (add_list)) {
-                               const gchar *id;
-
-                               /* newly added to server */
-                               contact = e_contact_new ();
-                               fill_contact_from_gw_item (contact,
-                                                          E_GW_ITEM (add_list->data),
-                                                          ebgw->priv->categories_by_id);
-
-                               /* When a distribution list is modified the server sends me a delete and add response.
-                               But it doesnt send me the members, so i have to explicitly request the server for the members                                of the distribution list */
-
-                               if (e_contact_get (contact, E_CONTACT_IS_LIST)) {
-                                       if (enable_debug)
-                                               printf ("Contact List modified fetching the members of the contact list\n");
-
-                                       item = NULL;
-                                       status = e_gw_connection_get_item (ebgw->priv->cnc, ebgw->priv->container_id, e_contact_get (contact, E_CONTACT_UID), "name email default members", &item);
-                                       if (status == E_GW_CONNECTION_STATUS_OK && item) {
-                                               g_object_unref (contact);
-                                               contact = e_contact_new ();
-                                               fill_contact_from_gw_item (contact, item, ebgw->priv->categories_by_id);
-                                               g_object_unref (item);
-                                       }
-                               }
-
-                               if (enable_debug)
-                                       printf("contact email:%s, contact name:%s\n", (gchar *)e_contact_get(contact, E_CONTACT_EMAIL_1),(gchar *) e_contact_get(contact, E_CONTACT_GIVEN_NAME));
-                               e_contact_set (contact,
-                                              E_CONTACT_BOOK_URI,
-                                              priv->original_uri);
-                               id =  e_contact_get_const (contact, E_CONTACT_UID);
-
-                               contact_num++;
-                               if (book_view) {
-                                       status_msg = g_strdup_printf (_("Updating contacts cache (%d)... "),
-                                                                        contact_num);
-                                       book_view_notify_status (book_view, status_msg);
-                                       g_free (status_msg);
-                               }
-                               if (e_book_backend_db_cache_check_contact (ebgw->priv->file_db, id)) {
-                                       if (enable_debug)
-                                               printf("contact already there\n");
-                                       e_book_backend_summary_remove_contact (ebgw->priv->summary, id);
-                                       e_book_backend_db_cache_add_contact (ebgw->priv->file_db, contact);
-                                       e_book_backend_summary_add_contact (ebgw->priv->summary, contact);
-                               } else {
-                                       if (enable_debug)
-                                               printf("contact not there\n");
-                                       e_book_backend_db_cache_add_contact (ebgw->priv->file_db, contact);
-                                       e_book_backend_summary_add_contact (ebgw->priv->summary, contact);
-                               }
-
-                               g_object_unref (contact);
-                               g_object_unref (add_list->data);
-                       }
-                       cache_last_sequence += contact_num;
-
-               /* cache is updated, now adding the sequence information to the cache */
-
-               add_sequence_to_cache (priv->file_db, server_first_sequence,
-                                      server_last_sequence, server_last_po_rebuild_time);
-
-               g_list_free (add_list);
-               g_list_free (delete_list);
-       }
-
-       g_free (sequence);
-       g_free (count);
-       ebgw->priv->is_cache_ready = TRUE;
-       ebgw->priv->is_summary_ready = TRUE;
-
-       if (sync_required)
-               ebgw->priv->file_db->sync (ebgw->priv->file_db, 0);
-
-       if (book_view) {
-               e_data_book_view_notify_complete (book_view, NULL /* Success */);
-               e_data_book_view_unref (book_view);
-       }
-
-       if (enable_debug) {
-               g_get_current_time (&end);
-               diff = end.tv_sec * 1000 + end.tv_usec/1000;
-               diff -= start.tv_sec * 1000 + start.tv_usec/1000;
-               printf("updating GroupWise system address book cache took %ld.%03ld seconds for %d changes\n",
-                       diff / 1000, diff % 1000, contact_num);
-       }
-       g_mutex_unlock (priv->update_mutex);
-
-       return TRUE;
-}
-
-static gpointer
-address_book_deltas_thread (gpointer data)
-{
-       EBookBackendGroupwise *ebgw = data;
-       EBookBackendGroupwisePrivate *priv = ebgw->priv;
-       GTimeVal timeout;
-
-       timeout.tv_sec = 0;
-       timeout.tv_usec = 0;
-
-       while (TRUE)    {
-               gboolean succeeded = update_address_book_deltas (ebgw);
-
-               g_mutex_lock (priv->dlock->mutex);
-
-               if (!succeeded || priv->dlock->exit)
-                       break;
-
-               g_get_current_time (&timeout);
-               g_time_val_add (&timeout, CACHE_REFRESH_INTERVAL * 1000);
-               g_cond_timed_wait (priv->dlock->cond, priv->dlock->mutex, &timeout);
-
-               if (priv->dlock->exit)
-                       break;
-
-               g_mutex_unlock (priv->dlock->mutex);
-       }
-
-       g_mutex_unlock (priv->dlock->mutex);
-       priv->dthread = NULL;
-       return NULL;
-}
-
-static gboolean
-fetch_address_book_deltas (EBookBackendGroupwise *ebgw)
-{
-       EBookBackendGroupwisePrivate *priv = ebgw->priv;
-       GError *error = NULL;
-
-        /* If the thread is already running just return back */
-       if (priv->dthread)
-               return FALSE;
-
-       priv->dlock->exit = FALSE;
-       priv->dthread = g_thread_create ((GThreadFunc) address_book_deltas_thread, ebgw, TRUE, &error);
-       if (!priv->dthread) {
-                g_warning (G_STRLOC ": %s", error->message);
-               g_error_free (error);
-       }
-
-       return TRUE;
-}
-
-static gboolean
-update_address_book_cache (gpointer data)
-{
-       EBookBackendGroupwise *ebgw = data;
-
-       fetch_address_book_deltas (ebgw);
-
-       ebgw->priv->cache_timeout = 0;
-       return FALSE;
-}
-
-static void
-e_book_backend_groupwise_authenticate_user (EBookBackend *backend,
-                                           EDataBook    *book,
-                                           guint32       opid,
-                                           const gchar *user,
-                                           const gchar *passwd,
-                                           const gchar *auth_method)
-{
-       EBookBackendGroupwise *ebgw;
-       EBookBackendGroupwisePrivate *priv;
-       EGwConnectionErrors error;
-       gchar *id, *tmpfile;
-       gint status;
-       gchar *http_uri;
-       gboolean is_writable;
-       const gchar *cache_refresh_interval_set;
-       gint cache_refresh_interval = CACHE_REFRESH_INTERVAL;
-
-       ebgw = E_BOOK_BACKEND_GROUPWISE (backend);
-       priv = ebgw->priv;
-
-       if (enable_debug) {
-               printf ("authenticate user ............\n");
-               if (priv->book_name)
-                       printf("book_name:%s\n", priv->book_name);
-       }
-
-       switch (ebgw->priv->mode) {
-       case E_DATA_BOOK_MODE_LOCAL:
-               /* load summary file for offline use */
-               g_mkdir_with_parents (g_path_get_dirname (priv->summary_file_name), 0700);
-               priv->summary = e_book_backend_summary_new (priv->summary_file_name,
-                                                   SUMMARY_FLUSH_TIMEOUT);
-               e_book_backend_summary_load (priv->summary);
-
-               e_book_backend_notify_writable (backend, FALSE);
-               e_book_backend_notify_connection_status (backend, FALSE);
-               e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (SUCCESS));
-               return;
-
-       case E_DATA_BOOK_MODE_REMOTE:
-
-               if (priv->cnc) { /*we have already authenticated to server */
-                       printf("already authenticated\n");
-                       e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (SUCCESS));
-                       return;
-               }
-
-               priv->cnc = e_gw_connection_new_with_error_handler (priv->uri, user, passwd, &error);
-               if (!E_IS_GW_CONNECTION(priv->cnc) && priv->use_ssl && g_str_equal (priv->use_ssl, "when-possible")) {
-                       http_uri = g_strconcat ("http://", priv->uri + 8, NULL);
-                       priv->cnc = e_gw_connection_new (http_uri, user, passwd);
-                       g_free (http_uri);
-               }
-
-               if (!E_IS_GW_CONNECTION (priv->cnc)) {
-
-                       if (error.status == E_GW_CONNECTION_STATUS_INVALID_PASSWORD)
-                               e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (AUTHENTICATION_FAILED));
-                       else
-                               e_data_book_respond_authenticate_user (book, opid, EDB_ERROR_FAILED_STATUS (OTHER_ERROR, error.status));
-                       return;
-               }
-
-               id = NULL;
-               is_writable = FALSE;
-               status = e_gw_connection_get_address_book_id (priv->cnc,  priv->book_name, &id, &is_writable);
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       status = e_gw_connection_get_address_book_id (priv->cnc,  priv->book_name, &id, &is_writable);
-               if (status == E_GW_CONNECTION_STATUS_OK) {
-                       if ((id == NULL) && !priv->only_if_exists) {
-                               status = e_gw_connection_create_book (priv->cnc, priv->book_name,  &id);
-                               is_writable = TRUE;
-                               if (status != E_GW_CONNECTION_STATUS_OK ) {
-                                       e_data_book_respond_authenticate_user (book, opid, EDB_ERROR_FAILED_STATUS (OTHER_ERROR, status));
-                                       return;
-                               }
-                       }
-               }
-               if (id != NULL) {
-                       priv->container_id = g_strdup (id);
-                       g_free (id);
-                       e_book_backend_set_is_writable (backend, is_writable);
-                       e_book_backend_notify_writable (backend, is_writable);
-                       e_book_backend_notify_connection_status (backend, TRUE);
-                       priv->is_writable = is_writable;
-                       e_gw_connection_get_categories (priv->cnc, &priv->categories_by_id, &priv->categories_by_name);
-                       if (!e_gw_connection_get_version (priv->cnc))
-                               e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (INVALID_SERVER_VERSION));
-                       else
-                               e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (SUCCESS));
-               } else {
-                       e_book_backend_set_is_loaded (backend, FALSE);
-                       e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (NO_SUCH_BOOK));
-               }
-
-               /* initialize summary file */
-               tmpfile = g_path_get_dirname (priv->summary_file_name);
-               g_mkdir_with_parents (tmpfile, 0700);
-               g_free (tmpfile);
-               priv->summary = e_book_backend_summary_new (priv->summary_file_name,
-                                                           SUMMARY_FLUSH_TIMEOUT);
-
-               if (!ebgw->priv->file_db) {
-                               e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (OTHER_ERROR));
-                               return;
-               }
-               if (e_book_backend_db_cache_is_populated (ebgw->priv->file_db)) {
-                       if (enable_debug)
-                               printf("cache is populated\n");
-
-                       if (!e_book_backend_summary_load (priv->summary))
-                               build_summary (ebgw);
-
-                       ebgw->priv->is_cache_ready = TRUE;
-                       ebgw->priv->is_summary_ready = TRUE;
-
-                       if (priv->is_writable) {
-                               if (enable_debug) {
-                                       printf("is writable\n");
-                                       printf("creating update_cache thread\n");
-                               }
-                               g_thread_create ((GThreadFunc) update_cache, ebgw, FALSE, NULL);
-                       }
-                       else if (priv->marked_for_offline) {
-                               GThread *t;
-                               if (enable_debug)
-                                       printf("marked for offline\n");
-                               if (enable_debug)
-                                       printf("creating update_address_book_deltas thread\n");
-
-                               t = g_thread_create ((GThreadFunc) update_address_book_deltas, ebgw, TRUE, NULL);
-
-                               /* spawn a thread to update the system address book cache
-                                * at given intervals
-                                */
-                               cache_refresh_interval_set = g_getenv ("BOOK_CACHE_REFRESH_INTERVAL");
-                               if (cache_refresh_interval_set) {
-                                       cache_refresh_interval = g_ascii_strtod (cache_refresh_interval_set,
-                                                                               NULL); /* use this */
-                                       cache_refresh_interval *= (60*1000);
-                               }
-
-                               /* set the cache refresh time */
-                               g_thread_join (t);
-                               if (enable_debug)
-                                       printf ("creating cache refresh thread for GW system book \n");
-                               priv->cache_timeout = g_timeout_add (cache_refresh_interval,
-                                                                    (GSourceFunc) update_address_book_cache,
-                                                                    (gpointer)ebgw);
-                       }
-               }
-               else if (priv->is_writable) {  /* for personal books we always cache */
-                       /* Personal address book and frequent contacts */
-                       if (enable_debug) {
-                               printf("else if is _writable");
-                               printf("build_cahe thread");
-                       }
-                       g_thread_create ((GThreadFunc) build_cache, ebgw, FALSE, NULL);
-               }
-               else if (priv->marked_for_offline) {
-                       GThread *t;
-                       if (enable_debug)
-                               printf("else if marked_for_offline\n");
-                       /* System address book */
-                       /* cache is not populated and book is not writable and marked for offline usage */
-                       if (enable_debug)
-                               printf("creating update_address_book_deltas thread\n");
-                       t = g_thread_create ((GThreadFunc) update_address_book_deltas, ebgw, TRUE, NULL);
-                       g_thread_join (t);
-                       /* set the cache refresh time */
-                       if (enable_debug)
-                               printf ("creating cache refresh thread for GW system book \n");
-                       priv->cache_timeout = g_timeout_add (cache_refresh_interval,
-                                                            (GSourceFunc) update_address_book_cache,
-                                                            (gpointer)ebgw);
-               }
-               return;
-       default :
-               break;
-       }
-}
-
-static void
-e_book_backend_groupwise_get_required_fields (EBookBackend *backend,
-                                              EDataBook    *book,
-                                              guint32       opid)
-{
-       GList *fields = NULL;
-
-       if (enable_debug)
-               printf ("\ne_book_backend_groupwise_get_required_fields...\n");
-
-       fields = g_list_append (fields, (gchar *)e_contact_field_name (E_CONTACT_FILE_AS));
-       e_data_book_respond_get_supported_fields (book, opid,
-                                                 EDB_ERROR (SUCCESS),
-                                                 fields);
-       g_list_free (fields);
-
-}
-
-static void
-e_book_backend_groupwise_get_supported_fields (EBookBackend *backend,
-                                              EDataBook    *book,
-                                              guint32       opid)
-{
-       GList *fields = NULL;
-       gint i;
-
-       if (enable_debug)
-               printf ("\ne_book_backend_groupwise_get_supported_fields...\n");
-
-       for (i = 0; i < G_N_ELEMENTS (mappings); i++)
-               fields = g_list_append (fields, g_strdup (e_contact_field_name (mappings[i].field_id)));
-       fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_EMAIL_2)));
-       fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_EMAIL_3)));
-       fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_ICQ)));
-       fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_YAHOO)));
-       fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_GADUGADU)));
-       fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_MSN)));
-       fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_SKYPE)));
-       fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_JABBER)));
-       fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_GROUPWISE)));
-       fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_ADDRESS_WORK)));
-       e_data_book_respond_get_supported_fields (book, opid,
-                                                 EDB_ERROR (SUCCESS),
-                                                 fields);
-       g_list_free (fields);
-}
-
-static void
-e_book_backend_groupwise_cancel_operation (EBookBackend *backend, EDataBook *book, GError **perror)
-{
-       if (enable_debug)
-               printf ("\ne_book_backend_groupwise_cancel_operation...\n");
-       g_propagate_error (perror, EDB_ERROR (COULD_NOT_CANCEL));
-}
-
-static void
-#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3
-file_errcall (const DB_ENV *env, const gchar *buf1, const gchar *buf2)
-#else
-file_errcall (const gchar *buf1, gchar *buf2)
-#endif
-{
-       g_warning ("libdb error: %s", buf2);
-}
-
-static void
-e_book_backend_groupwise_load_source (EBookBackend           *backend,
-                                     ESource                *source,
-                                     gboolean                only_if_exists,
-                                     GError                **perror)
-{
-       EBookBackendGroupwise *ebgw;
-       EBookBackendGroupwisePrivate *priv;
-       gchar *dirname, *filename, *tmp;
-       gchar *book_name;
-       gchar *uri;
-       gchar **tokens;
-       const gchar *cache_dir;
-       const gchar *port;
-       gint db_error;
-       DB *db;
-       DB_ENV *env;
-       EUri *parsed_uri;
-       const gchar *use_ssl;
-       const gchar *offline;
-
-       cache_dir = e_book_backend_get_cache_dir (backend);
-
-       if (enable_debug)
-               printf("\ne_book_backend_groupwise_load_source.. \n");
-       ebgw = E_BOOK_BACKEND_GROUPWISE (backend);
-       priv = ebgw->priv;
-       g_object_ref (source);
-
-       offline = e_source_get_property (source, "offline_sync");
-       if (offline  && g_str_equal (offline, "1"))
-               priv->marked_for_offline = TRUE;
-
-       uri =  e_source_get_uri (source);
-       priv->original_uri = g_strdup (uri);
-       if (uri == NULL) {
-               g_propagate_error (perror, EDB_ERROR_EX (OTHER_ERROR, "No URI given"));
-               return;
-       }
-
-       tokens = g_strsplit (uri, ";", 2);
-       g_free (uri);
-       if (tokens[0])
-               uri = g_strdup (tokens[0]);
-       book_name = g_strdup (tokens[1]);
-       if (book_name == NULL) {
-               g_propagate_error (perror, EDB_ERROR_EX (OTHER_ERROR, "No book name recognized for a URI"));
-               return;
-       }
-       g_strfreev (tokens);
-       parsed_uri = e_uri_new (uri);
-       port = e_source_get_property (source, "port");
-       if (port == NULL)
-               port = "7191";
-       use_ssl = e_source_get_property (source, "use_ssl");
-       if (use_ssl && !g_str_equal (use_ssl, "never"))
-               priv->uri = g_strconcat ("https://", parsed_uri->host,":", port, "/soap", NULL );
-       else
-               priv->uri = g_strconcat ("http://", parsed_uri->host,":", port, "/soap", NULL );
-
-       priv->book_name = book_name;
-
-       g_free (priv->summary_file_name);
-       tmp = g_build_filename (cache_dir, priv->book_name, NULL);
-       priv->summary_file_name = g_strconcat (tmp, ".summary", NULL);
-       g_free (tmp);
-
-       dirname = g_build_filename (cache_dir, priv->book_name, NULL);
-       filename = g_build_filename (dirname, "cache.db", NULL);
-
-       db_error = e_db3_utils_maybe_recover (filename);
-       if (db_error !=0) {
-               g_warning ("db recovery failed with %d", db_error);
-               g_free (dirname);
-               g_free (filename);
-               g_propagate_error (perror, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, "DB recovery failed with code 0x%x", db_error));
-               return;
-       }
-
-       g_static_mutex_lock (&global_env_lock);
-       if (global_env.ref_count > 0) {
-               env = global_env.env;
-               global_env.ref_count++;
-       }
-       else {
-               db_error = db_env_create (&env, 0);
-               if (db_error != 0) {
-                       g_warning ("db_env_create failed with %d", db_error);
-                       g_static_mutex_unlock (&global_env_lock);
-                       g_free (dirname);
-                       g_free (filename);
-                       g_propagate_error (perror, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, "db_env_create failed with code 0x%x", db_error));
-                       return;
-               }
-
-               db_error = env->open (env, NULL, DB_CREATE | DB_INIT_MPOOL | DB_PRIVATE | DB_THREAD, 0);
-               if (db_error != 0) {
-                       env->close (env, 0);
-                       g_warning ("db_env_open failed with %d", db_error);
-                       g_static_mutex_unlock (&global_env_lock);
-                       g_free (dirname);
-                       g_free (filename);
-                       g_propagate_error (perror, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, "db_env_open failed with code 0x%x", db_error));
-                       return;
-               }
-
-               env->set_errcall (env, file_errcall);
-
-               global_env.env = env;
-               global_env.ref_count = 1;
-       }
-       g_static_mutex_unlock (&global_env_lock);
-
-       ebgw->priv->env = env;
-
-       db_error = db_create (&db, env, 0);
-       if (db_error != 0) {
-               g_warning ("db_create failed with %d", db_error);
-               g_free (dirname);
-               g_free (filename);
-               g_propagate_error (perror, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, "db_create failed with code 0x%x", db_error));
-               return;
-       }
-
-       db_error = db->open (db, NULL, filename, NULL, DB_HASH, DB_THREAD, 0666);
-
-       if (db_error == DB_OLD_VERSION) {
-               db_error = e_db3_utils_upgrade_format (filename);
-
-               if (db_error != 0) {
-                       g_warning ("db format upgrade failed with %d", db_error);
-                       g_free (filename);
-                       g_free (dirname);
-                       g_propagate_error (perror, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, "db format upgrade failed with code 0x%x", db_error));
-                       return;
-               }
-
-               db_error = db->open (db, NULL, filename, NULL, DB_HASH, DB_THREAD, 0666);
-       }
-
-       ebgw->priv->file_db = db;
-
-       if (db_error != 0) {
-               gint rv;
-
-               /* the databade didn't exist, so we create the
-                  directory then the .db */
-               rv = g_mkdir_with_parents (dirname, 0700);
-               if (rv == -1 && errno != EEXIST) {
-                       if (errno == EACCES || errno == EPERM)
-                               g_propagate_error (perror, EDB_ERROR (PERMISSION_DENIED));
-                       else
-                               g_propagate_error (perror, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, "Failed to make directory %s: %s", dirname, g_strerror (errno)));
-                       g_free (dirname);
-                       g_free (filename);
-                       return;
-               }
-
-               db_error = db->open (db, NULL, filename, NULL, DB_HASH, DB_CREATE | DB_THREAD, 0666);
-               if (db_error != 0) {
-                       g_warning ("db->open (...DB_CREATE...) failed with %d", db_error);
-               }
-
-       }
-
-       ebgw->priv->file_db = db;
-
-       if (db_error != 0 || ebgw->priv->file_db == NULL) {
-               ebgw->priv->file_db = NULL;
-               g_free (filename);
-               g_free (dirname);
-               g_propagate_error (perror, EDB_ERROR (OTHER_ERROR));
-               return;
-       }
-
-       if (priv->mode ==  E_DATA_BOOK_MODE_LOCAL &&  !priv->marked_for_offline ) {
-               g_propagate_error (perror, EDB_ERROR (OFFLINE_UNAVAILABLE));
-               return;
-       }
-
-       priv->use_ssl = g_strdup (use_ssl);
-       priv->only_if_exists = only_if_exists;
-
-       e_book_backend_set_is_loaded (E_BOOK_BACKEND (backend), TRUE);
-       e_book_backend_set_is_writable (E_BOOK_BACKEND (backend), FALSE);
-       if (priv->mode == E_DATA_BOOK_MODE_LOCAL) {
-               e_book_backend_notify_writable (backend, FALSE);
-               e_book_backend_notify_connection_status (backend, FALSE);
-       }
-       else {
-               e_book_backend_notify_connection_status (backend, TRUE);
-       }
-
-       if (priv->mode == E_DATA_BOOK_MODE_LOCAL)
-               if (!g_file_test (filename, G_FILE_TEST_IS_REGULAR)) {
-                       g_free (uri);
-                       e_uri_free (parsed_uri);
-                       g_propagate_error (perror, EDB_ERROR (OFFLINE_UNAVAILABLE));
-                       return;
-               }
-
-       e_book_backend_db_cache_set_filename (ebgw->priv->file_db, filename);
-       if (priv->marked_for_offline)
-               ebgw->priv->is_cache_ready = TRUE;
-       g_free (filename);
-       g_free (dirname);
-       g_free (uri);
-       e_uri_free (parsed_uri);
-
-       /*if (enable_debug) {
-               printf ("summary file name = %s\ncache file name = %s \n",
-                        priv->summary_file_name, e_file_cache_get_filename (E_FILE_CACHE (priv->cache)));
-       }*/
-}
-
-static void
-e_book_backend_groupwise_remove (EBookBackend *backend,
-                                EDataBook        *book,
-                                guint32           opid)
-{
-       EBookBackendGroupwise *ebgw;
-       gint status;
-
-       if (enable_debug)
-               printf ("\ne_book_backend_groupwise_remove...\n");
-       ebgw = E_BOOK_BACKEND_GROUPWISE (backend);
-       if (ebgw->priv->cnc == NULL) {
-               e_data_book_respond_remove (book,  opid,  EDB_ERROR (AUTHENTICATION_REQUIRED));
-               return;
-       }
-       if (!ebgw->priv->is_writable) {
-               e_data_book_respond_remove (book,  opid,  EDB_ERROR (PERMISSION_DENIED));
-               return;
-       }
-       status = e_gw_connection_remove_item (ebgw->priv->cnc, NULL, ebgw->priv->container_id);
-       if (status == E_GW_CONNECTION_STATUS_OK)
-               e_data_book_respond_remove (book,  opid, EDB_ERROR (SUCCESS));
-       else
-               e_data_book_respond_remove (book,  opid, EDB_ERROR_FAILED_STATUS (OTHER_ERROR, status));
-       g_unlink (e_book_backend_db_cache_get_filename (ebgw->priv->file_db));
-}
-
-static gchar *
-e_book_backend_groupwise_get_static_capabilities (EBookBackend *backend)
-{
-       if (enable_debug)
-               printf ("\ne_book_backend_groupwise_get_static_capabilities...\n");
-
-       /* do-initialy-query is enabled for system address book also, so that we get the
-        * book_view, which is needed for displaying cache update progress.
-        * and null query is handled for system address book.
-        */
-       return g_strdup ("net,bulk-removes,do-initial-query,contact-lists");
-}
-
-static void
-e_book_backend_groupwise_get_supported_auth_methods (EBookBackend *backend, EDataBook *book, guint32 opid)
-{
-       GList *auth_methods = NULL;
-       gchar *auth_method;
-
-       if (enable_debug)
-               printf ("\ne_book_backend_groupwise_get_supported_auth_methods...\n");
-       auth_method =  g_strdup_printf ("plain/password");
-       auth_methods = g_list_append (auth_methods, auth_method);
-       e_data_book_respond_get_supported_auth_methods (book,
-                                                       opid,
-                                                       EDB_ERROR (SUCCESS),
-                                                       auth_methods);
-       g_free (auth_method);
-       g_list_free (auth_methods);
-}
-
-static void
-e_book_backend_groupwise_set_mode (EBookBackend *backend,
-                                   EDataBookMode mode)
-{
-       EBookBackendGroupwise *bg;
-
-       if (enable_debug)
-               printf ("\ne_book_backend_groupwise_set_mode...\n");
-       bg = E_BOOK_BACKEND_GROUPWISE (backend);
-       bg->priv->mode = mode;
-       if (e_book_backend_is_loaded (backend)) {
-               if (mode == E_DATA_BOOK_MODE_LOCAL) {
-                       e_book_backend_notify_writable (backend, FALSE);
-                       e_book_backend_notify_connection_status (backend, FALSE);
-                       if (bg->priv->cnc) {
-                               g_object_unref (bg->priv->cnc);
-                               bg->priv->cnc=NULL;
-                       }
-               }
-               else if (mode == E_DATA_BOOK_MODE_REMOTE) {
-                       if (bg->priv->is_writable)
-                               e_book_backend_notify_writable (backend, TRUE);
-                       else
-                               e_book_backend_notify_writable (backend, FALSE);
-                       e_book_backend_notify_connection_status (backend, TRUE);
-                       e_book_backend_notify_auth_required (backend);
-               }
-       }
-}
-
-/**
- * e_book_backend_groupwise_new:
- */
-EBookBackend *
-e_book_backend_groupwise_new (void)
-{
-       EBookBackendGroupwise *backend;
-
-       if (enable_debug)
-               printf ("\ne_book_backend_groupwise_new...\n");
-
-       backend = g_object_new (E_TYPE_BOOK_BACKEND_GROUPWISE, NULL);
-
-       return E_BOOK_BACKEND (backend);
-}
-
-static void
-e_book_backend_groupwise_dispose (GObject *object)
-{
-       EBookBackendGroupwise *bgw;
-
-       EBookBackendGroupwisePrivate *priv;
-
-       bgw = E_BOOK_BACKEND_GROUPWISE (object);
-       priv = bgw->priv;
-
-       if (enable_debug)
-               printf ("\ne_book_backend_groupwise_dispose...\n");
-
-       /* Clean up */
-
-       if (priv->cache_timeout) {
-               g_source_remove (priv->cache_timeout);
-               priv->cache_timeout = 0;
-       }
-
-       if (priv->dlock) {
-               g_mutex_lock (priv->dlock->mutex);
-               priv->dlock->exit = TRUE;
-               g_mutex_unlock (priv->dlock->mutex);
-
-               g_cond_signal (priv->dlock->cond);
-
-               if (priv->dthread)
-                       g_thread_join (priv->dthread);
-
-               g_mutex_free (priv->dlock->mutex);
-               g_cond_free (priv->dlock->cond);
-               g_free (priv->dlock);
-               priv->dthread = NULL;
-       }
-
-       if (bgw->priv) {
-               if (bgw->priv->file_db)
-                       bgw->priv->file_db->close (bgw->priv->file_db, 0);
-
-               g_static_mutex_lock (&global_env_lock);
-               global_env.ref_count--;
-               if (global_env.ref_count == 0) {
-                       global_env.env->close (global_env.env, 0);
-                       global_env.env = NULL;
-               }
-               g_static_mutex_unlock (&global_env_lock);
-               if (bgw->priv->uri) {
-                       g_free (bgw->priv->uri);
-                       bgw->priv->uri = NULL;
-               }
-
-               if (bgw->priv->original_uri) {
-                       g_free (bgw->priv->original_uri);
-                       bgw->priv->original_uri = NULL;
-               }
-
-               if (bgw->priv->cnc) {
-                       g_object_unref (bgw->priv->cnc);
-                       bgw->priv->cnc = NULL;
-               }
-               if (bgw->priv->container_id) {
-                       g_free (bgw->priv->container_id);
-                       bgw->priv->container_id = NULL;
-               }
-               if (bgw->priv->book_name) {
-                       g_free (bgw->priv->book_name);
-                       bgw->priv->book_name = NULL;
-               }
-               if (bgw->priv->summary_file_name) {
-                       g_free (bgw->priv->summary_file_name);
-                       bgw->priv->summary_file_name = NULL;
-               }
-               if (bgw->priv->summary) {
-                       e_book_backend_summary_save (bgw->priv->summary);
-                       g_object_unref (bgw->priv->summary);
-                       bgw->priv->summary = NULL;
-               }
-               if (bgw->priv->use_ssl) {
-                       g_free (bgw->priv->use_ssl);
-               }
-               if (bgw->priv->cache_timeout) {
-                       g_source_remove (bgw->priv->cache_timeout);
-                       bgw->priv->cache_timeout = 0;
-               }
-               if (bgw->priv->update_mutex)
-                       g_mutex_free (bgw->priv->update_mutex);
-               if (bgw->priv->update_cache_mutex)
-                       g_mutex_free (bgw->priv->update_cache_mutex);
-
-               g_free (bgw->priv);
-               bgw->priv = NULL;
-       }
-
-       G_OBJECT_CLASS (e_book_backend_groupwise_parent_class)->dispose (object);
-}
-
-static void
-e_book_backend_groupwise_class_init (EBookBackendGroupwiseClass *klass)
-{
-
-       GObjectClass  *object_class = G_OBJECT_CLASS (klass);
-       EBookBackendClass *parent_class;
-
-       parent_class = E_BOOK_BACKEND_CLASS (klass);
-
-       /* Set the virtual methods. */
-       parent_class->load_source             = e_book_backend_groupwise_load_source;
-       parent_class->get_static_capabilities = e_book_backend_groupwise_get_static_capabilities;
-
-       parent_class->create_contact          = e_book_backend_groupwise_create_contact;
-       parent_class->remove_contacts         = e_book_backend_groupwise_remove_contacts;
-       parent_class->modify_contact          = e_book_backend_groupwise_modify_contact;
-       parent_class->get_contact             = e_book_backend_groupwise_get_contact;
-       parent_class->get_contact_list        = e_book_backend_groupwise_get_contact_list;
-       parent_class->start_book_view         = e_book_backend_groupwise_start_book_view;
-       parent_class->stop_book_view          = e_book_backend_groupwise_stop_book_view;
-       parent_class->get_changes             = e_book_backend_groupwise_get_changes;
-       parent_class->authenticate_user       = e_book_backend_groupwise_authenticate_user;
-       parent_class->get_required_fields     = e_book_backend_groupwise_get_required_fields;
-       parent_class->get_supported_fields    = e_book_backend_groupwise_get_supported_fields;
-       parent_class->get_supported_auth_methods = e_book_backend_groupwise_get_supported_auth_methods;
-       parent_class->cancel_operation        = e_book_backend_groupwise_cancel_operation;
-       parent_class->remove                  = e_book_backend_groupwise_remove;
-       parent_class->set_mode                = e_book_backend_groupwise_set_mode;
-       object_class->dispose                 = e_book_backend_groupwise_dispose;
-}
-
-static void
-e_book_backend_groupwise_init (EBookBackendGroupwise *backend)
-{
-       EBookBackendGroupwisePrivate *priv;
-
-       priv= g_new0 (EBookBackendGroupwisePrivate, 1);
-       priv->is_writable = TRUE;
-       priv->is_cache_ready = FALSE;
-       priv->is_summary_ready = FALSE;
-       priv->marked_for_offline = FALSE;
-       priv->use_ssl = NULL;
-       priv->cnc = NULL;
-       priv->original_uri = NULL;
-       priv->cache_timeout = 0;
-       priv->update_mutex = g_mutex_new ();
-       priv->update_cache_mutex = g_mutex_new ();
-       backend->priv = priv;
-
-       if (!priv->dlock) {
-               priv->dlock = g_new0 (SyncUpdate, 1);
-               priv->dlock->mutex = g_mutex_new ();
-               priv->dlock->cond = g_cond_new ();
-       }
-
-       if (g_getenv ("GROUPWISE_DEBUG")) {
-               if (atoi (g_getenv ("GROUPWISE_DEBUG")) == 2)
-                       enable_debug = TRUE;
-               else
-                       enable_debug = FALSE;
-       }
-}
diff --git a/addressbook/backends/groupwise/e-book-backend-groupwise.h b/addressbook/backends/groupwise/e-book-backend-groupwise.h
deleted file mode 100644 (file)
index 080d6a4..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* e-book-backend-groupwise.h - Groupwise contact backend.
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * Authors: Sivaiah Nallagatla <snallagatla@novell.com>
- */
-
-#ifndef __E_BOOK_BACKEND_GROUPWISE_H__
-#define __E_BOOK_BACKEND_GROUPWISE_H__
-
-#include <libedata-book/e-book-backend-sync.h>
-#include "db.h"
-
-#define E_TYPE_BOOK_BACKEND_GROUPWISE        (e_book_backend_groupwise_get_type ())
-#define E_BOOK_BACKEND_GROUPWISE(o)          (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_BOOK_BACKEND_GROUPWISE, EBookBackendGroupwise))
-#define E_BOOK_BACKEND_GROUPWISE_CLASS(k)    (G_TYPE_CHECK_CLASS_CAST((k), E_TYPE_BOOK_BACKEND_GROUPWISE, EBookBackendGroupwiseClass))
-#define E_IS_BOOK_BACKEND_GROUPWISE(o)       (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_BOOK_BACKEND_GROUPWISE))
-#define E_IS_BOOK_BACKEND_GROUPWISE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_BOOK_BACKEND_GROUPWISE))
-#define E_BOOK_BACKEND_GROUPWISE_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_BOOK_BACKEND_GROUPWISE, EBookBackenGroupwiseClass))
-typedef struct _EBookBackendGroupwisePrivate EBookBackendGroupwisePrivate;
-
-typedef struct {
-       EBookBackend         parent_object;
-       EBookBackendGroupwisePrivate *priv;
-} EBookBackendGroupwise;
-
-typedef struct {
-       EBookBackendClass parent_class;
-} EBookBackendGroupwiseClass;
-
-EBookBackend *e_book_backend_groupwise_new      (void);
-GType       e_book_backend_groupwise_get_type (void);
-
-#endif /* __E_BOOK_BACKEND_GROUPWISE_H__ */
-
index 84fd82a..b282566 100644 (file)
@@ -4,6 +4,6 @@ else
 WEATHER_SUBDIR =
 endif
 
-SUBDIRS = file groupwise http contacts $(WEATHER_SUBDIR) caldav
+SUBDIRS = file http contacts $(WEATHER_SUBDIR) caldav
 
 -include $(top_srcdir)/git.mk
diff --git a/calendar/backends/groupwise/Makefile.am b/calendar/backends/groupwise/Makefile.am
deleted file mode 100644 (file)
index f03da4c..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-ecal_backend_LTLIBRARIES = libecalbackendgroupwise.la
-
-libecalbackendgroupwise_la_CPPFLAGS = \
-       $(AM_CPPFLAGS)                                  \
-       -DG_LOG_DOMAIN=\"libecalbackendgroupwise\"      \
-       -I$(top_srcdir)                                 \
-       -I$(top_builddir)                               \
-       -I$(top_srcdir)/calendar                        \
-       -I$(top_builddir)/calendar                      \
-       -I$(top_srcdir)/servers/groupwise               \
-       -I$(top_builddir)/servers/groupwise             \
-       $(EVOLUTION_CALENDAR_CFLAGS)                    \
-       $(SOUP_CFLAGS)                                  \
-       $(DEBUG_CFLAGS)
-
-libecalbackendgroupwise_la_SOURCES =           \
-       e-cal-backend-groupwise-factory.c       \
-       e-cal-backend-groupwise-factory.h       \
-       e-cal-backend-groupwise.c               \
-       e-cal-backend-groupwise.h               \
-       e-cal-backend-groupwise-utils.c         \
-       e-cal-backend-groupwise-utils.h
-
-libecalbackendgroupwise_la_LIBADD =                                    \
-       $(top_builddir)/calendar/libecal/libecal-1.2.la                 \
-       $(top_builddir)/calendar/libedata-cal/libedata-cal-1.2.la       \
-       $(top_builddir)/servers/groupwise/libegroupwise-1.2.la          \
-       $(top_builddir)/libedataserver/libedataserver-1.2.la            \
-       $(top_builddir)/libebackend/libebackend-1.2.la                  \
-       $(EVOLUTION_CALENDAR_LIBS)                                      \
-       $(SOUP_LIBS)
-
-libecalbackendgroupwise_la_LDFLAGS =           \
-       -module -avoid-version $(NO_UNDEFINED)
-
--include $(top_srcdir)/git.mk
diff --git a/calendar/backends/groupwise/TODO b/calendar/backends/groupwise/TODO
deleted file mode 100644 (file)
index 15726f8..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-Things to do and people working on it
--------------------------------------
-
-Step 1 - Infrastructure
-
- 1.1 DONE - Create SOAP management API in libsoup, in soup-soap-message.[ch]
-     to manage messages, and soup-soap-response.[ch] to manage responses
-     from the server.
-
- 1.2 DONE - Implement interface to Groupwise server, in
-     e-d-s/calendar/backends/groupwise/e-gw-connection.[ch], to manage
-     the connections to the server, and e-gw-message.[ch] for utility
-     functions to easily create SOAP messages to be sent to the server.
-
- 1.3 DONE - Implement login/logout to server, e_gw_connection_login and
-     e_gw_connection_logout, being called from e_cal_backend_groupwise_open
-
- 1.4  Map error codes returned in the "status" SOAP type to our
-      EGwConnectionStatus. This is in e-gw-connection.c#parse_response_status.
-      We need the list of status codes returned by the server from the GW team.
-
- 1.5 DONE - Write script/program to easily add an account until we have the configuration
-     GUI
-
-Step 2 - Basic functionality
-
- 2.1 DONE - Make the ECalBackendGroupwise class use ECalBackendCache, so that after
-     first connecting to a server we can keep the calendar in the cache
-
- 2.2 DONE - Implement retrieval of objects, that will be saved to the cache. This is
-     probably best done by listening to modifications on the server, and updating
-     the cache whenever a change is made on the server. On the first connection,
-     we should probably retrieve all objects, or at least their UIDs.
-     This involves implementing the following methods on the backend:
-          - Implement e_cal_backend_groupwise_get_default_object, which
-           should return an empty object with the minimal required fields
-           (if any) the server might need.
-         - Implement e_cal_backend_groupwise_get_object, which must
-           retrieve the specified object from the cache, or from the server
-           if it's still not in the cache.
-         - Implement e_cal_backend_groupwise_get_timezone, which must
-           return a VTIMEZONE object representing the required timezone.
-           The server should have a list of available timezones, if not,
-           we can use libical's built-in timezones.
-
- 2.3 DONE - Retrieve information about connection : when loging to the server, we get, in
-     the loginResponse response, some information about the user being connected.
-     From that we can retrieve some information needed to implement the following
-     backend methods:
-          - Implement e_cal_backend_groupwise_is_read_only, which tells the
-           caller whether the given calendar is read only or not. If read only,
-           the GUI will disable all modifications-related options.
-         - Implement e_cal_backend_groupwise_get_cal_address, which returns
-           the associated email address with this calendar. This is the email
-           address of the user that opened the calendar.
-         - Implement e_cal_backend_groupwise_get_ldap_attribute
-         - Implement e_cal_backend_groupwise_get_alarm_email_address, which
-           returns the email address to use when sending alarms.
-         - Implement e_cal_backend_groupwise_get_static_capabilities, which
-           returns a list of the capabilities of the backend. Those capabilities
-           are listed in e-cal-backend.h
-
- 2.4 Implement modification of objects on the server. This involves adding,
-     removing and updating objects (either tasks, events or timezones) and
-     implementing the following methods on the backend:
-           - Implement e_cal_backend_groupwise_add_timezone, which adds
-            a VTIMEZONE to the calendar/tasks folder.
-          - Implement e_cal_backend_groupwise_set_default_timezone, which
-            sets the default timezone to use when no timezone is given. This
-            should probably also change the default timezone on the server, not
-            only locally.
-          - Implement e_cal_backend_groupwise_discard_alarm, which is used
-            to let the backend do whatever it needs to do in order to discard
-            an alarm. We probably need to do nothing here, apart from updating
-            the object on the server with the alarm removed (already removed by
-            the GUI).
-          - Implement e_cal_backend_groupwise_create_object, which is used
-            by clients to add new objects to the calendar/tasks folder.
-          - Implement e_cal_backend_groupwise_modify_object, used to modify
-            an already existing object on the server. If the object does not
-            exist, it must return an error, and not try to add the object.
-          - Implement e_cal_backend_groupwise_remove_object, which removes
-            an object from the server.
-          - Implement e_cal_backend_groupwise_receive_objects, used for iMIP/iTIP.
-            It should act more or less like modify/create_object. If it's an
-            external invitation, the event should be added to the calendar. If
-            it's a reply to an existing meeting, the related event should be
-            updated.
-          - Implement e_cal_backend_groupwise_send_objects, which lets the
-            server send a meeting invitation in whatever means it's got.
-     When sending modifications to the server, only deltas (the fields that have
-     been modified) are sent, so we should compare the objects with the cache
-     and get the deltas out of that. When a successful update is made to the
-     server, the cache must be updated.
-
- 2.5 DONE - Implement queries to the server. This involves implementing the following
-     backend methods:
-            - Implement e_cal_backend_groupwise_get_object_list, which returns
-             a list of objects that match a given regular expression.
-           - Implement e_cal_backend_groupwise_start_query, which makes the
-             backend start a query asynchronously.
-           - Implement e_cal_backend_groupwise_get_changes, which returns
-             a list of changes done to the calendar since a given date. For
-             this, we should probably use the same method the file backend
-             uses.
-     The question remaining here is what to do with the queries. Since we are
-     keeping a cache, I guess we should make all queries against the cache, instead
-     of contacting the server for each query, or making a cache of queries, like we
-     had in Evolution 1.4.
-
- 2.6 Free/Busy. This is the implementation of the e_cal_backend_groupwise_get_free_busy
-     method on the backend.
-
- 2.7 DONE - Addition/removal of calendars. The backend should be able to create new calendars
-     when the _open method is called with 'only_if_exists' set to FALSE. In that case,
-     it should create the new calendar, and add the new source to the calendar sources
-     tree. Make sure the new-calendar dialog should call that method (e_cal_open) to tell the
-     backend to create the calendar.
-     Also, the e_cal_backend_groupwise_remove method should be implemented to allow the
-     removal of those calendars.
-
- 2.8 Implement configuration of GW accounts.
-
-Step 3 - Extra
-
- 3.1 DONE - Offline/Online mode:
-            - Implement e_cal_backend_groupwise_get_mode, which returns the current
-             online/offline mode of the backend.
-           - Implement e_cal_backend_groupwise_set_mode, used by clients to
-             change the online/offline status of the backend. When going offline,
-             the backend should synchronize its local copy, and when going back
-             online, synchronize back all changes made to the local cache. To
-             determine the set of changes, we can use a similar method to the one
-             used for the get_changes method.
-
- 3.2 Folder properties. Each calendar/tasks folder should be configurable from the
-     UI. The source selector widget will display a 'Properties' menu item in the
-     popup menu which will show up a dialog that allows the user to change the folder
-     properties (name, permissions, whatever). We need to decide on how this is done,
-     since the GUI should not know anything about Groupwise.
-
diff --git a/calendar/backends/groupwise/e-cal-backend-groupwise-factory.c b/calendar/backends/groupwise/e-cal-backend-groupwise-factory.c
deleted file mode 100644 (file)
index 49711a9..0000000
+++ /dev/null
@@ -1,203 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- *
- * Author:
- *   Chris Toshok (toshok@ximian.com)
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include "e-cal-backend-groupwise-factory.h"
-#include "e-cal-backend-groupwise.h"
-
-typedef struct {
-       ECalBackendFactory            parent_object;
-} ECalBackendGroupwiseFactory;
-
-typedef struct {
-       ECalBackendFactoryClass parent_class;
-} ECalBackendGroupwiseFactoryClass;
-
-static void
-e_cal_backend_groupwise_factory_instance_init (ECalBackendGroupwiseFactory *factory)
-{
-}
-
-static const gchar *
-_get_protocol (ECalBackendFactory *factory)
-{
-       return "groupwise";
-}
-
-static ECalBackend*
-_todos_new_backend (ECalBackendFactory *factory, ESource *source)
-{
-       return g_object_new (e_cal_backend_groupwise_get_type (),
-                            "source", source,
-                            "kind", ICAL_VTODO_COMPONENT,
-                            NULL);
-}
-
-static icalcomponent_kind
-_todos_get_kind (ECalBackendFactory *factory)
-{
-       return ICAL_VTODO_COMPONENT;
-}
-
-static ECalBackend*
-_journal_new_backend (ECalBackendFactory *factory, ESource *source)
-{
-       return g_object_new (e_cal_backend_groupwise_get_type (),
-                            "source", source,
-                            "kind", ICAL_VJOURNAL_COMPONENT,
-                            NULL);
-}
-
-static icalcomponent_kind
-_journal_get_kind (ECalBackendFactory *factory)
-{
-       return ICAL_VJOURNAL_COMPONENT;
-}
-
-static ECalBackend*
-_events_new_backend (ECalBackendFactory *factory, ESource *source)
-{
-       return g_object_new (e_cal_backend_groupwise_get_type (),
-                            "source", source,
-                            "kind", ICAL_VEVENT_COMPONENT,
-                            NULL);
-}
-
-static icalcomponent_kind
-_events_get_kind (ECalBackendFactory *factory)
-{
-       return ICAL_VEVENT_COMPONENT;
-}
-
-static void
-todos_backend_factory_class_init (ECalBackendGroupwiseFactoryClass *klass)
-{
-       E_CAL_BACKEND_FACTORY_CLASS (klass)->get_protocol = _get_protocol;
-       E_CAL_BACKEND_FACTORY_CLASS (klass)->get_kind     = _todos_get_kind;
-       E_CAL_BACKEND_FACTORY_CLASS (klass)->new_backend  = _todos_new_backend;
-}
-
-static void
-events_backend_factory_class_init (ECalBackendGroupwiseFactoryClass *klass)
-{
-       E_CAL_BACKEND_FACTORY_CLASS (klass)->get_protocol = _get_protocol;
-       E_CAL_BACKEND_FACTORY_CLASS (klass)->get_kind     = _events_get_kind;
-       E_CAL_BACKEND_FACTORY_CLASS (klass)->new_backend  = _events_new_backend;
-}
-
-static void
-journal_backend_factory_class_init (ECalBackendGroupwiseFactoryClass *klass)
-{
-       E_CAL_BACKEND_FACTORY_CLASS (klass)->get_protocol = _get_protocol;
-       E_CAL_BACKEND_FACTORY_CLASS (klass)->get_kind     = _journal_get_kind;
-       E_CAL_BACKEND_FACTORY_CLASS (klass)->new_backend  = _journal_new_backend;
-}
-
-static GType
-events_backend_factory_get_type (GTypeModule *module)
-{
-       GType type;
-
-       GTypeInfo info = {
-               sizeof (ECalBackendGroupwiseFactoryClass),
-               NULL, /* base_class_init */
-               NULL, /* base_class_finalize */
-               (GClassInitFunc)  events_backend_factory_class_init,
-               NULL, /* class_finalize */
-               NULL, /* class_data */
-               sizeof (ECalBackend),
-               0,    /* n_preallocs */
-               (GInstanceInitFunc) e_cal_backend_groupwise_factory_instance_init
-       };
-
-       type = g_type_module_register_type (module,
-                                           E_TYPE_CAL_BACKEND_FACTORY,
-                                           "ECalBackendGroupwiseEventsFactory",
-                                           &info, 0);
-
-       return type;
-}
-
-static GType
-todos_backend_factory_get_type (GTypeModule *module)
-{
-       GType type;
-
-       GTypeInfo info = {
-               sizeof (ECalBackendGroupwiseFactoryClass),
-               NULL, /* base_class_init */
-               NULL, /* base_class_finalize */
-               (GClassInitFunc)  todos_backend_factory_class_init,
-               NULL, /* class_finalize */
-               NULL, /* class_data */
-               sizeof (ECalBackend),
-               0,    /* n_preallocs */
-               (GInstanceInitFunc) e_cal_backend_groupwise_factory_instance_init
-       };
-
-       type = g_type_module_register_type (module,
-                                           E_TYPE_CAL_BACKEND_FACTORY,
-                                           "ECalBackendGroupwiseTodosFactory",
-                                           &info, 0);
-
-       return type;
-}
-
-static GType
-journal_backend_factory_get_type (GTypeModule *module)
-{
-       GType type;
-
-       GTypeInfo info = {
-               sizeof (ECalBackendGroupwiseFactoryClass),
-               NULL, /* base_class_init */
-               NULL, /* base_class_finalize */
-               (GClassInitFunc)  journal_backend_factory_class_init,
-               NULL, /* class_finalize */
-               NULL, /* class_data */
-               sizeof (ECalBackend),
-               0,    /* n_preallocs */
-               (GInstanceInitFunc) e_cal_backend_groupwise_factory_instance_init
-       };
-
-       type = g_type_module_register_type (module,
-                                           E_TYPE_CAL_BACKEND_FACTORY,
-                                           "ECalBackendGroupwiseJournalFactory",
-                                           &info, 0);
-
-       return type;
-}
-\f
-
-static GType groupwise_types[3];
-
-void
-eds_module_initialize (GTypeModule *module)
-{
-       groupwise_types[0] = todos_backend_factory_get_type (module);
-       groupwise_types[1] = events_backend_factory_get_type (module);
-       groupwise_types[2] = journal_backend_factory_get_type (module);
-}
-
-void
-eds_module_shutdown   (void)
-{
-}
-
-void
-eds_module_list_types (const GType **types, gint *num_types)
-{
-       *types = groupwise_types;
-       *num_types = 3;
-}
diff --git a/calendar/backends/groupwise/e-cal-backend-groupwise-factory.h b/calendar/backends/groupwise/e-cal-backend-groupwise-factory.h
deleted file mode 100644 (file)
index 831ee8a..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-cal-backend-groupwise-factory.h
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * Author: Chris Toshok <toshok@ximian.com>
- */
-
-#ifndef _E_CAL_BACKEND_GROUPWISE_FACTORY_H_
-#define _E_CAL_BACKEND_GROUPWISE_FACTORY_H_
-
-#include <glib-object.h>
-#include "libedata-cal/e-cal-backend-factory.h"
-
-G_BEGIN_DECLS
-
-void                 eds_module_initialize (GTypeModule *module);
-void                 eds_module_shutdown   (void);
-void                 eds_module_list_types (const GType **types, gint *num_types);
-
-G_END_DECLS
-
-#endif /* _E_CAL_BACKEND_GROUPWISE_FACTORY_H_ */
diff --git a/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c b/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c
deleted file mode 100644 (file)
index 23984bd..0000000
+++ /dev/null
@@ -1,2282 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors :
- *  JP Rosevear <jpr@ximian.com>
- *  Rodrigo Moya <rodrigo@ximian.com>
- *  Harish Krishnaswamy <kharish@novell.com>
- *  Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- */
-
-#include <config.h>
-
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <glib/gstdio.h>
-#include <gio/gio.h>
-
-#include <e-gw-connection.h>
-#include <e-gw-message.h>
-#include <libecal/e-cal-recur.h>
-#include <libecal/e-cal-time-util.h>
-#include <libsoup/soup-misc.h>
-#include "e-cal-backend-groupwise-utils.h"
-#include "libedataserver/e-source-list.h"
-
-static gboolean
-get_recur_instance (ECalComponent *comp, time_t instance_start, time_t instance_end, gpointer data)
-{
-       GSList **recur_dates = (GSList **) data;
-       gchar *rdate;
-
-       rdate = isodate_from_time_t (instance_start);
-       /* convert this into a date */
-       rdate[8] ='\0';
-       *recur_dates = g_slist_append (*recur_dates, rdate);
-       return TRUE;
-}
-
-static gboolean
-get_recur_count (ECalComponent *comp, time_t instance_start, time_t instance_end, gpointer data)
-{
-       gint *count = (gint *) data;
-
-       *count = *count + 1;
-
-       return TRUE;
-}
-
-static icaltimezone *
-resolve_tzid_cb (const gchar *tzid, gpointer data)
-{
-       icaltimezone *zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
-
-       return zone;
-}
-
-const gchar *
-e_cal_component_get_gw_id (ECalComponent *comp)
-{
-       icalproperty *prop;
-
-       prop = icalcomponent_get_first_property (e_cal_component_get_icalcomponent (comp),
-                                                ICAL_X_PROPERTY);
-       while (prop) {
-               const gchar *x_name, *x_val;
-
-               x_name = icalproperty_get_x_name (prop);
-               x_val = icalproperty_get_x (prop);
-               if (!strcmp (x_name, "X-GWRECORDID")) {
-                       return x_val;
-               }
-
-               prop = icalcomponent_get_next_property (e_cal_component_get_icalcomponent (comp),
-                                                       ICAL_X_PROPERTY);
-       }
-       return NULL;
-}
-
-static void
-set_categories_for_gw_item (EGwItem *item, GSList *category_names, ECalBackendGroupwise *cbgw)
-{
-       GHashTable *categories_by_name, *categories_by_id;
-       EGwConnection *cnc;
-       GList *category_ids;
-       gchar *id;
-       gint status;
-
-       category_ids = NULL;
-       id = NULL;
-
-       categories_by_name = e_cal_backend_groupwise_get_categories_by_name (cbgw);
-       categories_by_id = e_cal_backend_groupwise_get_categories_by_id (cbgw);
-       cnc = e_cal_backend_groupwise_get_connection (cbgw);
-
-       g_return_if_fail (categories_by_id != NULL || categories_by_name != NULL || cnc != NULL);
-
-       for (; category_names != NULL; category_names = g_slist_next (category_names)) {
-                    if (!category_names->data || strlen (category_names->data) == 0 )
-                            continue;
-                    id = g_hash_table_lookup (categories_by_name, category_names->data);
-                    if (id)
-                           category_ids = g_list_append (category_ids, g_strdup (id));
-                    else {
-                            EGwItem *category_item;
-                           category_item = e_gw_item_new_empty ();
-                            e_gw_item_set_item_type (category_item,  E_GW_ITEM_TYPE_CATEGORY);
-                            e_gw_item_set_category_name (category_item, category_names->data);
-                            status = e_gw_connection_create_item (cnc, category_item, &id);
-                            if (status == E_GW_CONNECTION_STATUS_OK && id != NULL) {
-                                     gchar **components = g_strsplit (id, "@", -1);
-                                    gchar *temp_id = components[0];
-
-                                    g_hash_table_insert (categories_by_name, g_strdup (category_names->data), g_strdup (temp_id));
-                                    g_hash_table_insert (categories_by_id, g_strdup (temp_id), g_strdup (category_names->data));
-                                    category_ids = g_list_append (category_ids, g_strdup (temp_id));
-                                    g_free (id);
-                                    g_strfreev (components);
-                            }
-                            g_object_unref (category_item);
-                    }
-            }
-            e_gw_item_set_categories (item, category_ids);
-}
-
-static void
-add_send_options_data_to_item (EGwItem *item, ECalComponent *comp, icaltimezone *default_zone)
-{
-       const gchar *x_val;
-       const gchar *x_name;
-       icalcomponent *icalcomp;
-       icalproperty *icalprop;
-       struct icaltimetype temp;
-       gboolean sendoptions_set = FALSE;
-       icaltimezone *utc;
-
-       utc = icaltimezone_get_utc_timezone ();
-       icalcomp = e_cal_component_get_icalcomponent (comp);
-       icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY);
-
-       while (icalprop) {
-
-               x_name = icalproperty_get_x_name (icalprop);
-
-               if (!strcmp (x_name, "X-EVOLUTION-OPTIONS-PRIORITY")) {
-                       sendoptions_set = TRUE;
-                       x_val = icalproperty_get_x (icalprop);
-                       switch (atoi (x_val)) {
-                               case 1:  e_gw_item_set_priority (item, E_GW_ITEM_PRIORITY_HIGH);
-                                        break;
-                               case 2:  e_gw_item_set_priority (item, E_GW_ITEM_PRIORITY_STANDARD);
-                                        break;
-                               case 3:  e_gw_item_set_priority (item, E_GW_ITEM_PRIORITY_LOW);
-                                        break;
-                               default: e_gw_item_set_priority (item, NULL);
-                                        break;
-                       }
-               } else if (!strcmp (x_name, "X-EVOLUTION-OPTIONS-REPLY")) {
-                       e_gw_item_set_reply_request (item, TRUE);
-                       x_val = icalproperty_get_x (icalprop);
-                       if (strcmp (x_val, "convenient")) {
-                               gchar *value;
-                               gint i = atoi (x_val);
-                               temp = icaltime_current_time_with_zone (default_zone ? default_zone : utc);
-                               icaltime_adjust (&temp, i, 0, 0, 0);
-                               icaltime_set_timezone (&temp, default_zone);
-                               temp = icaltime_convert_to_zone (temp, utc);
-                               value = icaltime_as_ical_string_r (temp);
-                               e_gw_item_set_reply_within (item, value);
-                               g_free (value);
-                       }
-               } else if (!strcmp (x_name, "X-EVOLUTION-OPTIONS-EXPIRE")) {
-                       gchar *expire = NULL;
-                       x_val = icalproperty_get_x (icalprop);
-                       temp = icaltime_current_time_with_zone (default_zone ? default_zone : utc);
-                       icaltime_adjust (&temp, atoi (x_val), 0, 0, 0);
-                       icaltime_set_timezone (&temp, default_zone);
-                       temp = icaltime_convert_to_zone (temp, utc);
-                       expire = icaltime_as_ical_string_r (temp);
-                       e_gw_item_set_expires (item, expire);
-                       g_free (expire);
-
-               } else if (!strcmp (x_name, "X-EVOLUTION-OPTIONS-DELAY")) {
-                       gchar *delay = NULL;
-                       x_val = icalproperty_get_x (icalprop);
-                       temp = icaltime_from_string (x_val);
-                       icaltime_set_timezone (&temp, default_zone);
-                       temp = icaltime_convert_to_zone (temp, utc);
-                       delay = icaltime_as_ical_string_r (temp);
-                       e_gw_item_set_delay_until (item, delay);
-                       g_free (delay);
-
-               } else if (!strcmp (x_name, "X-EVOLUTION-OPTIONS-TRACKINFO")) {
-                       sendoptions_set = TRUE;
-                       x_val = icalproperty_get_x (icalprop);
-                       switch (atoi (x_val)) {
-                               case 1: e_gw_item_set_track_info (item, E_GW_ITEM_DELIVERED);
-                                       break;
-                               case 2: e_gw_item_set_track_info (item, E_GW_ITEM_DELIVERED_OPENED);
-                                       break;
-                               case 3: e_gw_item_set_track_info (item, E_GW_ITEM_ALL);
-                                       break;
-                               default: e_gw_item_set_track_info (item, E_GW_ITEM_NONE);
-                                        break;
-                       }
-               } else if (!strcmp (x_name, "X-EVOLUTION-OPTIONS-OPENED")) {
-                       gint i = 0;
-                       x_val = icalproperty_get_x (icalprop);
-                       i = atoi (x_val);
-                       switch (i) {
-                               case 0: e_gw_item_set_notify_opened (item, E_GW_ITEM_NOTIFY_NONE);
-                                       break;
-                               case 1: e_gw_item_set_notify_opened (item, E_GW_ITEM_NOTIFY_MAIL);
-                       }
-
-               } else if (!strcmp (x_name, "X-EVOLUTION-OPTIONS-ACCEPTED")) {
-                       gint i = 0;
-                       x_val = icalproperty_get_x (icalprop);
-                       i = atoi (x_val);
-                       switch (i) {
-                               case 0: e_gw_item_set_notify_accepted (item, E_GW_ITEM_NOTIFY_NONE);
-                                       break;
-                               case 1: e_gw_item_set_notify_accepted (item, E_GW_ITEM_NOTIFY_MAIL);
-                       }
-
-               } else if (!strcmp (x_name, "X-EVOLUTION-OPTIONS-DECLINED")) {
-                       gint i = 0;
-                       x_val = icalproperty_get_x (icalprop);
-                       i = atoi (x_val);
-                       switch (i) {
-                               case 0: e_gw_item_set_notify_declined (item, E_GW_ITEM_NOTIFY_NONE);
-                                       break;
-                               case 1: e_gw_item_set_notify_declined (item, E_GW_ITEM_NOTIFY_MAIL);
-                       }
-
-               } else if (!strcmp (x_name, "X-EVOLUTION-OPTIONS-COMPLETED")) {
-                       gint i = 0;
-                       x_val = icalproperty_get_x (icalprop);
-                       i = atoi (x_val);
-                       switch (i) {
-                               case 0: e_gw_item_set_notify_completed (item, E_GW_ITEM_NOTIFY_NONE);
-                                       break;
-                               case 1: e_gw_item_set_notify_completed (item, E_GW_ITEM_NOTIFY_MAIL);
-                       }
-               }
-
-               icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY);
-       }
-
-       e_gw_item_set_sendoptions (item, sendoptions_set);
-
-}
-
-static gchar *
-get_mime_type (const gchar *uri)
-{
-       GFile *file;
-       GFileInfo *fi;
-       gchar *mime_type;
-
-       g_return_val_if_fail (uri != NULL, NULL);
-
-       file = g_file_new_for_uri (uri);
-       if (!file)
-               return NULL;
-
-       fi = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, G_FILE_QUERY_INFO_NONE, NULL, NULL);
-       if (!fi) {
-               g_object_unref (file);
-               return NULL;
-       }
-
-       mime_type = g_content_type_get_mime_type (g_file_info_get_content_type (fi));
-
-       g_object_unref (fi);
-       g_object_unref (file);
-
-       return mime_type;
-}
-
-static void
-e_cal_backend_groupwise_set_attachments_from_comp (ECalComponent *comp,
-               EGwItem *item)
-{
-       GSList *attach_list = NULL, *attach_file_list = NULL;
-       GSList *l;
-
-       e_cal_component_get_attachment_list (comp, &attach_file_list);
-
-       for (l = attach_file_list; l; l = l->next) {
-
-               EGwItemAttachment *attach_item;
-               gchar *file_contents, *encoded_data;
-               gsize file_len;
-               gchar *attach_filename_full, *filename;
-               const gchar *uid;
-
-               attach_filename_full = g_filename_from_uri ((gchar *)l->data, NULL, NULL);
-               if (!g_file_get_contents (attach_filename_full, &file_contents, &file_len, NULL)) {
-                       g_message ("DEBUG: could not read %s\n", attach_filename_full);
-                       g_free (attach_filename_full);
-                       continue;
-               }
-
-               /* Extract the simple file name from the
-                * attach_filename_full which is of the form
-                * file://<path>/compuid-<simple filename>
-                */
-               e_cal_component_get_uid (comp, &uid);
-               filename = g_strrstr (attach_filename_full, uid);
-               if (filename == NULL) {
-                       g_message ("DEBUG: This is an invalid attachment file\n");
-                       g_free (attach_filename_full);
-                       g_free (file_contents);
-                       continue;
-               }
-
-               attach_item = g_new0 (EGwItemAttachment, 1);
-               /* FIXME the member does not follow the naming convention.
-                * Should be fixed in e-gw-item*/
-               attach_item->contentType = get_mime_type ((gchar *)l->data);
-
-               attach_item->name = g_strdup (filename + strlen (uid) + 1);
-               /* do a base64 encoding so it can be embedded in a soap
-                * message */
-               encoded_data = g_base64_encode ((guchar *) file_contents, file_len);
-               attach_item->data = encoded_data;
-               attach_item->size = strlen (encoded_data);
-
-               g_free (attach_filename_full);
-               g_free (file_contents);
-               attach_list = g_slist_append (attach_list, attach_item);
-       }
-
-       e_gw_item_set_attach_id_list (item, attach_list);
-}
-
-/* Returns the icalproperty for the Attendee associted with email id */
-static icalproperty *
-get_attendee_prop (icalcomponent *icalcomp, const gchar *attendee)
-{
-       icalproperty *prop;
-
-       for (prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTENDEE_PROPERTY);
-                       prop;
-                       prop = icalcomponent_get_next_property (icalcomp, ICAL_ATTENDEE_PROPERTY)) {
-               const gchar *att = icalproperty_get_attendee (prop);
-
-               if (!g_ascii_strcasecmp (att, attendee)) {
-                       return prop;
-               }
-       }
-
-       return NULL;
-}
-
-/* get_attendee_list from cal comp and convert into
- * egwitemrecipient and set it on recipient_list*/
-static void
-set_attendees_to_item (EGwItem *item, ECalComponent *comp, icaltimezone *default_zone, gboolean delegate, const gchar *user_email)
-{
-       if (e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_JOURNAL) {
-               if  (e_cal_component_has_organizer (comp)) {
-                       icalcomponent *icalcomp = e_cal_component_get_icalcomponent (comp);
-                       icalproperty *icalprop;
-                       GSList *recipient_list = NULL;
-                       const gchar *attendees = NULL;
-                       gchar **emails, **iter;
-
-                       for (icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY); icalprop;
-                                       icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY)) {
-                               if (g_str_equal (icalproperty_get_x_name (icalprop), "X-EVOLUTION-RECIPIENTS")) {
-                                       break;
-                               }
-                       }
-
-                       if (icalprop)    {
-                               attendees = icalproperty_get_x (icalprop);
-                               emails = g_strsplit (attendees, ";", -1);
-
-                               iter = emails;
-                               while (*iter) {
-                                       EGwItemRecipient *recipient;
-
-                                       recipient = g_new0 (EGwItemRecipient, 1);
-
-                                       recipient->email = g_strdup (*iter);
-                                       recipient->type = E_GW_ITEM_RECIPIENT_TO;
-
-                                       recipient_list = g_slist_prepend (recipient_list, recipient);
-                                       iter++;
-                               }
-
-                               e_gw_item_set_recipient_list (item, recipient_list);
-
-                               g_strfreev (emails);
-                               icalcomponent_remove_property (icalcomp, icalprop);
-                               icalproperty_free (icalprop);
-                       }
-               }
-       } else if (e_cal_component_has_attendees (comp)) {
-               GSList *attendee_list, *recipient_list = NULL, *al;
-
-               e_cal_component_get_attendee_list (comp, &attendee_list);
-               for (al = attendee_list; al != NULL; al = al->next) {
-                       ECalComponentAttendee *attendee = (ECalComponentAttendee *) al->data;
-                       EGwItemRecipient *recipient;
-
-                       if (delegate && (g_str_equal (attendee->value + 7, user_email) || !(attendee->delfrom && *attendee->delfrom)))
-                               continue;
-
-                       if (delegate) {
-                               icalproperty *prop = get_attendee_prop (e_cal_component_get_icalcomponent (comp),
-                                               attendee->value);
-                               if (prop)
-                                       icalproperty_remove_parameter_by_kind (prop, ICAL_DELEGATEDFROM_PARAMETER);
-                       }
-
-                       recipient = g_new0 (EGwItemRecipient, 1);
-
-                       /* len (MAILTO:) + 1 = 7 */
-                       recipient->email = g_strdup (attendee->value + 7);
-                       if (attendee->cn != NULL)
-                               recipient->display_name = g_strdup (attendee->cn);
-                       if (attendee->role == ICAL_ROLE_REQPARTICIPANT)
-                               recipient->type = E_GW_ITEM_RECIPIENT_TO;
-                       else if (attendee->role == ICAL_ROLE_OPTPARTICIPANT)
-                               recipient->type = E_GW_ITEM_RECIPIENT_CC;
-                       else recipient->type = E_GW_ITEM_RECIPIENT_NONE;
-
-                       if (attendee->status == ICAL_PARTSTAT_ACCEPTED)
-                               recipient->status = E_GW_ITEM_STAT_ACCEPTED;
-                       else if (attendee->status == ICAL_PARTSTAT_DECLINED)
-                               recipient->status = E_GW_ITEM_STAT_DECLINED;
-                       else
-                               recipient->status = E_GW_ITEM_STAT_NONE;
-
-                       recipient_list = g_slist_append (recipient_list, recipient);
-               }
-
-               e_cal_component_free_attendee_list (attendee_list);
-
-               /* recipient_list shouldn't be freed. Look into the function below. */
-               e_gw_item_set_recipient_list (item, recipient_list);
-       }
-
-       if (e_cal_component_has_organizer (comp)) {
-               /* Send Options */
-               add_send_options_data_to_item (item, comp, default_zone);
-       }
-
-       if (!delegate && e_cal_component_has_organizer (comp)) {
-               ECalComponentOrganizer cal_organizer;
-               EGwItemOrganizer *organizer = NULL;
-
-               e_cal_component_get_organizer (comp, &cal_organizer);
-               organizer = g_new0 (EGwItemOrganizer, 1);
-               organizer->display_name = g_strdup (cal_organizer.cn);
-               organizer->email = g_strdup (cal_organizer.value + 7);
-               e_gw_item_set_organizer (item, organizer);
-       }
-
-}
-
-static gint
-get_actual_count (ECalComponent *comp, ECalBackendGroupwise *cbgw)
-{
-       gint count = 0;
-       icaltimezone *dzone, *utc;
-
-       dzone = e_cal_backend_groupwise_get_default_zone (cbgw);
-       utc = icaltimezone_get_utc_timezone ();
-
-       if (dzone)
-               e_cal_recur_generate_instances (comp, -1, -1,get_recur_count, &count, resolve_tzid_cb, NULL, (icaltimezone *) dzone);
-       else
-               e_cal_recur_generate_instances (comp, -1, -1,get_recur_count, &count, resolve_tzid_cb, NULL, utc);
-
-       return count;
-}
-
-static void
-set_rrule_from_comp (ECalComponent *comp, EGwItem *item, ECalBackendGroupwise *cbgw)
-{
-
-       EGwItemRecurrenceRule *item_rrule;
-       struct icalrecurrencetype *ical_recur;
-       GSList *rrule_list = NULL, *exdate_list;
-       gint i;
-
-       item_rrule = g_new0 (EGwItemRecurrenceRule, 1);
-       e_cal_component_get_rrule_list (comp, &rrule_list);
-       if (rrule_list) {
-               /* assumes only one rrule is present  */
-               ical_recur = (struct icalrecurrencetype *) rrule_list->data;
-
-               /*set the data */
-               switch (ical_recur->freq) {
-                       case ICAL_DAILY_RECURRENCE :
-                               item_rrule->frequency = E_GW_ITEM_RECURRENCE_FREQUENCY_DAILY;
-                               break;
-                       case ICAL_WEEKLY_RECURRENCE:
-                               item_rrule->frequency = E_GW_ITEM_RECURRENCE_FREQUENCY_WEEKLY;
-                               break;
-                       case ICAL_MONTHLY_RECURRENCE:
-                               item_rrule->frequency = E_GW_ITEM_RECURRENCE_FREQUENCY_MONTHLY;
-                               break;
-                       case ICAL_YEARLY_RECURRENCE:
-                               item_rrule->frequency = E_GW_ITEM_RECURRENCE_FREQUENCY_YEARLY;
-                               break;
-                       default:
-                               break;
-               }
-
-               if (ical_recur->count != 0) {
-                       if (ical_recur->freq != ICAL_DAILY_RECURRENCE)
-                               item_rrule->count = get_actual_count (comp, cbgw);
-                       else
-                               item_rrule->count = ical_recur->count;
-               } else
-                       item_rrule->until =  icaltime_as_ical_string_r (ical_recur->until);
-
-               item_rrule->interval = ical_recur->interval;
-
-               /*xxx -byday, bymonthday and byyearday not handled FIXME*/
-               for (i = 0; i < ICAL_BY_DAY_SIZE; i++)
-                       item_rrule->by_day[i] = ical_recur->by_day[i];
-               for (i = 0; i < ICAL_BY_MONTHDAY_SIZE; i++)
-                       item_rrule->by_month_day[i] = ical_recur->by_month_day[i];
-               for (i = 0; i < ICAL_BY_YEARDAY_SIZE; i++)
-                       item_rrule->by_year_day[i] = ical_recur->by_year_day[i];
-               for (i = 0; i < ICAL_BY_MONTH_SIZE; i++)
-                       item_rrule->by_month[i] = ical_recur->by_month[i];
-               for (i = 0; i < ICAL_BY_SETPOS_SIZE; i++)
-                       item_rrule->by_setpos[i] = ical_recur->by_set_pos[i];
-
-               e_gw_item_set_rrule (item, item_rrule);
-
-               /* set exceptions */
-               if (e_cal_component_has_exdates (comp)) {
-                       GSList *l, *item_exdate_list = NULL;
-                       icaltimezone *default_zone, *utc;
-                       struct icaltimetype itt_utc;
-
-                       e_cal_component_get_exdate_list (comp, &exdate_list);
-                       default_zone = e_cal_backend_groupwise_get_default_zone (cbgw);
-                       utc = icaltimezone_get_utc_timezone ();
-                       for (l = exdate_list; l; l = l->next) {
-                               ECalComponentDateTime *dt = (ECalComponentDateTime *) l->data;
-                               if (dt->value) {
-                                       if (!icaltime_get_timezone (*(dt->value)))
-                                               icaltime_set_timezone (dt->value, default_zone ? default_zone : utc);
-                                       itt_utc = icaltime_convert_to_zone (*dt->value, utc);
-                                       item_exdate_list = g_slist_append (item_exdate_list, icaltime_as_ical_string_r (itt_utc));
-                               }
-                       }
-                       e_gw_item_set_exdate_list (item, item_exdate_list);
-                       e_cal_component_free_exdate_list (exdate_list);
-               }
-       }
-}
-
-static EGwItem *
-set_properties_from_cal_component (EGwItem *item, ECalComponent *comp, ECalBackendGroupwise *cbgw)
-{
-       const gchar *uid, *location;
-       gchar *value;
-       ECalComponentDateTime dt;
-       ECalComponentClassification classif;
-       ECalComponentTransparency transp;
-       ECalComponentText text;
-       gint *priority;
-       GSList *categories;
-       GSList *slist, *sl;
-       icaltimezone *default_zone, *utc;
-       struct icaltimetype itt_utc;
-       gboolean dtstart_has_timezone;
-
-       default_zone = e_cal_backend_groupwise_get_default_zone (cbgw);
-       utc = icaltimezone_get_utc_timezone ();
-
-       /* first set specific properties */
-       switch (e_cal_component_get_vtype (comp)) {
-       case E_CAL_COMPONENT_EVENT :
-               e_gw_item_set_item_type (item, E_GW_ITEM_TYPE_APPOINTMENT);
-
-               /* transparency */
-               e_cal_component_get_transparency (comp, &transp);
-               if (transp == E_CAL_COMPONENT_TRANSP_OPAQUE)
-                       e_gw_item_set_accept_level (item, E_GW_ITEM_ACCEPT_LEVEL_BUSY);
-               else
-                       e_gw_item_set_accept_level (item, E_GW_ITEM_ACCEPT_LEVEL_FREE);
-
-               /* location */
-               e_cal_component_get_location (comp, &location);
-               e_gw_item_set_place (item, location);
-
-               /* categories */
-               e_cal_component_get_categories_list (comp, &categories);
-               set_categories_for_gw_item (item, categories, cbgw);
-
-               /* alarms */
-               if (e_cal_component_has_alarms (comp)) {
-                       ECalComponentAlarm *alarm;
-                       ECalComponentAlarmTrigger trigger;
-                       gint duration;
-                       GList *l = e_cal_component_get_alarm_uids (comp);
-
-                       alarm = e_cal_component_get_alarm (comp, l->data);
-                       e_cal_component_alarm_get_trigger (alarm, &trigger);
-                       e_cal_component_alarm_free (alarm);
-                       duration = abs (icaldurationtype_as_int (trigger.u.rel_duration));
-                       e_gw_item_set_trigger (item, duration);
-                       cal_obj_uid_list_free (l);
-               }
-
-               /* end date */
-               e_cal_component_get_dtend (comp, &dt);
-               if (dt.value) {
-                       if (!icaltime_get_timezone (*dt.value))
-                               icaltime_set_timezone (dt.value, default_zone ? default_zone : utc);
-                       itt_utc = icaltime_convert_to_zone (*dt.value, utc);
-                       value = icaltime_as_ical_string_r (itt_utc);
-                       e_gw_item_set_end_date (item, value);
-                       g_free (value);
-                       e_cal_component_free_datetime (&dt);
-               }
-
-               break;
-
-       case E_CAL_COMPONENT_TODO :
-               e_gw_item_set_item_type (item, E_GW_ITEM_TYPE_TASK);
-
-               /* due date */
-               e_cal_component_get_due (comp, &dt);
-               if (dt.value) {
-                       if (!icaltime_get_timezone (*dt.value))
-                               icaltime_set_timezone (dt.value, default_zone);
-                       itt_utc = icaltime_convert_to_zone (*dt.value, utc);
-                       value = icaltime_as_ical_string_r (itt_utc);
-                       e_gw_item_set_due_date (item,  value);
-                       g_free (value);
-                       e_cal_component_free_datetime (&dt);
-               }
-
-               /* priority */
-               priority = NULL;
-               e_cal_component_get_priority (comp, &priority);
-               if (priority && *priority) {
-                       if (*priority >= 7)
-                               e_gw_item_set_task_priority (item, E_GW_ITEM_PRIORITY_LOW);
-                       else if (*priority >= 5)
-                               e_gw_item_set_task_priority (item, E_GW_ITEM_PRIORITY_STANDARD);
-                       else if (*priority >= 1)
-                               e_gw_item_set_task_priority (item, E_GW_ITEM_PRIORITY_HIGH);
-                       else
-                               e_gw_item_set_task_priority (item, NULL);
-
-                       e_cal_component_free_priority (priority);
-               }
-
-               /* completed */
-               e_cal_component_get_completed (comp, &dt.value);
-               if (dt.value) {
-                       e_gw_item_set_completed (item, TRUE);
-                       e_cal_component_free_icaltimetype (dt.value);
-                       dt.value = NULL;
-               } else
-                       e_gw_item_set_completed (item, FALSE);
-
-               break;
-       case E_CAL_COMPONENT_JOURNAL:
-               e_gw_item_set_item_type (item, E_GW_ITEM_TYPE_NOTE);
-               break;
-       default :
-               g_object_unref (item);
-               return NULL;
-       }
-
-       /* set common properties */
-       /* GW server ID */
-       e_gw_item_set_id (item, e_cal_component_get_gw_id (comp));
-
-       /* UID */
-       e_cal_component_get_uid (comp, &uid);
-       e_gw_item_set_icalid (item, uid);
-
-       /* subject */
-       e_cal_component_get_summary (comp, &text);
-       e_gw_item_set_subject (item, text.value);
-
-       /* description */
-       e_cal_component_get_description_list (comp, &slist);
-       if (slist) {
-               GString *str = g_string_new ("");
-
-               for (sl = slist; sl != NULL; sl = sl->next) {
-                       ECalComponentText *pt = sl->data;
-
-                       if (pt && pt->value)
-                               str = g_string_append (str, pt->value);
-               }
-
-               e_gw_item_set_message (item, (const gchar *) str->str);
-
-               g_string_free (str, TRUE);
-               e_cal_component_free_text_list (slist);
-       }
-
-       /* start date */
-       e_cal_component_get_dtstart (comp, &dt);
-       if (dt.value) {
-               if (!icaltime_get_timezone (*dt.value))
-                       icaltime_set_timezone (dt.value, default_zone);
-               itt_utc = icaltime_convert_to_zone (*dt.value, utc);
-               value = icaltime_as_ical_string_r (itt_utc);
-               e_gw_item_set_start_date (item, value);
-               g_free (value);
-       } else if (e_gw_item_get_item_type (item) == E_GW_ITEM_TYPE_APPOINTMENT) {
-               e_cal_component_free_datetime (&dt);
-               /* appointments need the start date property */
-               g_object_unref (item);
-               return NULL;
-       }
-
-       /* all day event */
-       if (dt.value && dt.value->is_date && e_gw_item_get_item_type (item) == E_GW_ITEM_TYPE_APPOINTMENT)
-               e_gw_item_set_is_allday_event (item, TRUE);
-
-       dtstart_has_timezone = dt.tzid != NULL;
-       e_cal_component_free_datetime (&dt);
-
-       /* creation date */
-       e_cal_component_get_created (comp, &dt.value);
-       if (dt.value) {
-               if (!icaltime_get_timezone (*dt.value))
-                       icaltime_set_timezone (dt.value, default_zone);
-               itt_utc = icaltime_convert_to_zone (*dt.value, utc);
-               value = icaltime_as_ical_string_r (itt_utc);
-               e_gw_item_set_creation_date (item, value);
-               g_free (value);
-               e_cal_component_free_icaltimetype (dt.value);
-       } else {
-               struct icaltimetype itt;
-
-               e_cal_component_get_dtstamp (comp, &itt);
-               value = icaltime_as_ical_string_r (itt);
-               e_gw_item_set_creation_date (item, value);
-               g_free (value);
-       }
-
-       dt.value = NULL;
-
-       /* classification */
-       e_cal_component_get_classification (comp, &classif);
-       switch (classif) {
-       case E_CAL_COMPONENT_CLASS_PUBLIC :
-               e_gw_item_set_classification (item, E_GW_ITEM_CLASSIFICATION_PUBLIC);
-               break;
-       case E_CAL_COMPONENT_CLASS_PRIVATE :
-               e_gw_item_set_classification (item, E_GW_ITEM_CLASSIFICATION_PRIVATE);
-               break;
-       case E_CAL_COMPONENT_CLASS_CONFIDENTIAL :
-               e_gw_item_set_classification (item, E_GW_ITEM_CLASSIFICATION_CONFIDENTIAL);
-               break;
-       default :
-               e_gw_item_set_classification (item, NULL);
-       }
-
-       set_attendees_to_item (item, comp, default_zone, FALSE, NULL);
-
-       /* check if recurrences exist and update the item */
-       if (e_cal_component_has_recurrences (comp)) {
-               if (e_cal_component_has_rrules (comp))
-                       set_rrule_from_comp (comp, item, cbgw);
-               else {
-
-                       GSList *recur_dates = NULL;
-
-                       if (dtstart_has_timezone)
-                               e_cal_recur_generate_instances (comp, -1, -1,get_recur_instance, &recur_dates, resolve_tzid_cb, NULL, (icaltimezone *) default_zone);
-                       else
-                               e_cal_recur_generate_instances (comp, -1, -1,get_recur_instance, &recur_dates, resolve_tzid_cb, NULL, utc);
-
-                       recur_dates = g_slist_delete_link (recur_dates, recur_dates);
-
-                       e_gw_item_set_recurrence_dates (item, recur_dates);
-               }
-       }
-
-       /* attachments */
-       if (e_cal_component_has_attachments (comp)) {
-               e_cal_backend_groupwise_set_attachments_from_comp (comp, item);
-       }
-
-       return item;
-}
-
-EGwItem *
-e_gw_item_new_from_cal_component (const gchar *container, ECalBackendGroupwise *cbgw, ECalComponent *comp)
-{
-       EGwItem *item;
-
-       g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), NULL);
-
-       e_cal_backend_groupwise_priv_lock (cbgw);
-
-       item = e_gw_item_new_empty ();
-       e_gw_item_set_container_id (item, container);
-       item = set_properties_from_cal_component (item, comp, cbgw);
-
-       e_cal_backend_groupwise_priv_unlock (cbgw);
-
-       return item;
-}
-
-/* Set the attendee list and send options to EGwItem */
-EGwItem *
-e_gw_item_new_for_delegate_from_cal (ECalBackendGroupwise *cbgw, ECalComponent *comp)
-{
-       EGwItem *item;
-       icaltimezone *default_zone;
-       const gchar *user_email;
-
-       g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), NULL);
-       default_zone = e_cal_backend_groupwise_get_default_zone (cbgw);
-       item = e_gw_item_new_empty ();
-       e_gw_item_set_id (item, e_cal_component_get_gw_id (comp));
-       user_email = e_gw_connection_get_user_email (e_cal_backend_groupwise_get_connection (cbgw));
-
-       e_cal_backend_groupwise_priv_lock (cbgw);
-       set_attendees_to_item (item, comp, default_zone, TRUE, user_email);
-       add_send_options_data_to_item (item, comp, default_zone);
-       e_cal_backend_groupwise_priv_unlock (cbgw);
-
-       return item;
-}
-
-/* Fetch data from the server and unencode it to the actual data
- * and populate the attach_data
- */
-static gboolean
-get_attach_data_from_server (EGwItemAttachment *attach_item, ECalBackendGroupwise *cbgw)
-{
-       EGwConnection *cnc;
-       EGwConnectionStatus status;
-       gchar *data = NULL;
-       gint len;
-
-       cnc = e_cal_backend_groupwise_get_connection (cbgw);
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_CONNECTION);
-
-       status = e_gw_connection_get_attachment (cnc, attach_item->id, 0, -1, (const gchar **) &data, &len);
-
-       if (status != E_GW_CONNECTION_STATUS_OK ) {
-               g_warning ("Failed to read the attachment from the server\n");
-               return FALSE;
-       }
-       attach_item->data = data;
-       attach_item->size = len;
-
-       return TRUE;
-}
-
-static void
-set_attachments_to_cal_component (EGwItem *item, ECalComponent *comp, ECalBackendGroupwise *cbgw)
-{
-       GSList *fetch_list = NULL, *l;
-       GSList *comp_attachment_list = NULL;
-       const gchar *cache_dir;
-       const gchar *uid;
-       gchar *attach_file_url;
-
-       fetch_list = e_gw_item_get_attach_id_list (item);
-       if (fetch_list == NULL)
-               return; /* No attachments exist */
-
-       cache_dir = e_cal_backend_get_cache_dir (E_CAL_BACKEND (cbgw));
-
-       e_cal_component_get_uid (comp, &uid);
-       for (l = fetch_list; l; l = l->next) {
-               gint fd;
-               EGwItemAttachment *attach_item;
-               gchar *attach_data = NULL;
-               struct stat st;
-               GError *error = NULL;
-               gchar *filename;
-
-               attach_item = (EGwItemAttachment *) l->data;
-               filename = g_strconcat (
-                       cache_dir, G_DIR_SEPARATOR_S, uid, "-", attach_item->name, NULL);
-
-               attach_file_url = g_filename_to_uri (filename, NULL, &error);
-
-               if (!attach_file_url) {
-                       g_message ("Could not get attach_file_url %s \n", error->message);
-                       g_clear_error (&error);
-                       g_free (filename);
-                       return;
-               }
-
-               if (g_stat (filename, &st) == -1) {
-                       if (!get_attach_data_from_server (attach_item, cbgw)) {
-                               g_free (filename);
-                               return; /* Could not get the attachment from the server */
-                       }
-                       fd = g_open (filename, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, 0600);
-                       if (fd == -1) {
-                               /* skip gracefully */
-                               g_warning ("DEBUG: could not serialize attachments\n");
-                       } else if (write (fd, attach_item->data, attach_item->size) == -1) {
-                               /* skip gracefully */
-                               g_warning ("DEBUG: attachment write failed.\n");
-                       }
-                       g_free (attach_data);
-                       if (fd != -1)
-                               close (fd);
-               }
-               g_free (filename);
-
-               comp_attachment_list = g_slist_append (comp_attachment_list, attach_file_url);
-       }
-
-       e_cal_component_set_attachment_list (comp, comp_attachment_list);
-
-       for (l = comp_attachment_list; l != NULL; l = l->next)
-               g_free (l->data);
-       g_slist_free (comp_attachment_list);
-}
-
-static void
-set_default_alarms (ECalComponent *comp)
-{
-
-       GConfClient *gconf = gconf_client_get_default ();
-
-       if (gconf_client_get_bool (gconf, CALENDAR_CONFIG_DEFAULT_REMINDER, NULL)) {
-
-                       ECalComponentAlarm *acomp;
-                       gint interval;
-                       gchar * units;
-                       enum {
-                               DAYS,
-                               HOURS,
-                               MINUTES
-                       } duration;
-                       ECalComponentAlarmTrigger trigger;
-
-                       interval = gconf_client_get_int (gconf, CALENDAR_CONFIG_DEFAULT_REMINDER_INTERVAL, NULL);
-                       units = gconf_client_get_string (gconf, CALENDAR_CONFIG_DEFAULT_REMINDER_UNITS, NULL);
-
-                       if (units == NULL)
-                               duration = MINUTES;
-                       else {
-                               if (!strcmp (units, "days"))
-                                       duration = DAYS;
-                               else if (!strcmp (units, "hours"))
-                                       duration = HOURS;
-                               else
-                                       duration = MINUTES;
-                               g_free (units);
-                       }
-                       acomp = e_cal_component_alarm_new ();
-
-                       e_cal_component_alarm_set_action (acomp, E_CAL_COMPONENT_ALARM_DISPLAY);
-
-                       trigger.type = E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START;
-                       memset (&trigger.u.rel_duration, 0, sizeof (trigger.u.rel_duration));
-
-                       trigger.u.rel_duration.is_neg = TRUE;
-
-                       switch (duration) {
-                       case MINUTES:
-                               trigger.u.rel_duration.minutes = interval;
-                               break;
-                       case HOURS:
-                               trigger.u.rel_duration.hours = interval;
-                               break;
-                       case DAYS:
-                               trigger.u.rel_duration.days = interval;
-                               break;
-                       default:
-                               e_cal_component_alarm_free (acomp);
-                               g_object_unref (gconf);
-                               return;
-                       }
-
-                       e_cal_component_alarm_set_trigger (acomp, trigger);
-                       e_cal_component_add_alarm (comp, acomp);
-
-                       e_cal_component_alarm_free (acomp);
-               }
-               g_object_unref (gconf);
-}
-
-static gchar *
-get_cn_from_display_name (gchar *display_name)
-{
-       gchar *dn;
-
-       /* Strip the name part alone as the display name might contain email also*/
-       dn = g_strstr_len (display_name, strlen (display_name), " <");
-
-       if (!dn)
-               return g_strdup (display_name);
-       else {
-               dn = g_strndup (display_name, (dn - display_name));
-               dn = g_strdelimit (dn, "\"", ' ');
-               return dn;
-       }
-}
-
-static void
-sanitize_component (ECalComponent *comp, const gchar *server_uid, const gchar *container_id)
-{
-       icalproperty *icalprop;
-       gint i;
-       GString *str = g_string_new ("");;
-
-       if (server_uid) {
-
-               /* the ID returned by sendItemResponse includes the container ID of the
-                  inbox folder, so we need to replace that with our container ID */
-               for (i = 0; i < strlen (server_uid); i++) {
-                       str = g_string_append_c (str, server_uid[i]);
-                       if (server_uid[i] == ':') {
-                               str = g_string_append (str, container_id);
-                               break;
-                       }
-               }
-
-               /* add the extra property to the component */
-               icalprop = icalproperty_new_x (str->str);
-               icalproperty_set_x_name (icalprop, "X-GWRECORDID");
-               icalcomponent_add_property (e_cal_component_get_icalcomponent (comp), icalprop);
-
-       }
-       g_string_free (str, TRUE);
-}
-
-ECalComponent *
-e_gw_item_to_cal_component (EGwItem *item, ECalBackendGroupwise *cbgw)
-{
-       ECalComponent *comp;
-       ECalComponentText text;
-       ECalComponentDateTime dt;
-       const gchar *description, *uid, *item_id;
-       const gchar *t;
-       gchar *name;
-       GList *category_ids;
-       GSList *categories;
-       GHashTable *categories_by_id;
-       gboolean is_allday;
-       icaltimezone *default_zone;
-
-       struct icaltimetype itt, itt_utc;
-       gint priority;
-       gint percent;
-       gint alarm_duration;
-       GSList *recipient_list, *rl, *attendee_list = NULL;
-       EGwItemOrganizer *organizer;
-       EGwItemType item_type;
-
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-
-       e_cal_backend_groupwise_priv_lock (cbgw);
-
-       default_zone = e_cal_backend_groupwise_get_default_zone (cbgw);
-       categories_by_id = e_cal_backend_groupwise_get_categories_by_id (cbgw);
-
-       comp = e_cal_component_new ();
-
-       item_type = e_gw_item_get_item_type (item);
-
-       if (item_type == E_GW_ITEM_TYPE_APPOINTMENT)
-               e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_EVENT);
-       else if (item_type == E_GW_ITEM_TYPE_TASK)
-               e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_TODO);
-       else if (item_type == E_GW_ITEM_TYPE_NOTE)
-               e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_JOURNAL);
-       else {
-               g_object_unref (comp);
-               e_cal_backend_groupwise_priv_unlock (cbgw);
-               return NULL;
-       }
-
-       /* set common properties */
-       /* GW server ID */
-       item_id = e_gw_item_get_id (item);
-       if (item_id) {
-               const gchar *container_id = e_cal_backend_groupwise_get_container_id (cbgw);
-               sanitize_component (comp, item_id, container_id);
-       }
-
-       if (e_gw_item_get_reply_request (item)) {
-               gchar *reply_within;
-               const gchar *mess = e_gw_item_get_message (item);
-               gchar *value;
-
-               reply_within = e_gw_item_get_reply_within (item);
-               if (reply_within) {
-                       time_t t;
-                       gchar *temp;
-
-                       t = e_gw_connection_get_date_from_string (reply_within);
-                       temp = ctime (&t);
-                       temp[strlen (temp)-1] = '\0';
-                       value = g_strconcat (N_("Reply Requested: by "), temp, "\n\n", mess ? mess : "", NULL);
-                       e_gw_item_set_message (item, (const gchar *) value);
-                       g_free (value);
-
-               } else {
-                       value = g_strconcat (N_("Reply Requested: When convenient"), "\n\n", mess ? mess : "", NULL);
-                       e_gw_item_set_message (item, (const gchar *) value);
-                       g_free (value);
-               }
-       }
-
-       /* summary */
-       text.value = e_gw_item_get_subject (item);
-       text.altrep = NULL;
-
-       if (text.value)
-               e_cal_component_set_summary (comp, &text);
-
-       /* description */
-       description = e_gw_item_get_message (item);
-       if (description) {
-               GSList l;
-
-               text.value = description;
-               text.altrep = NULL;
-               l.data = &text;
-               l.next = NULL;
-
-               e_cal_component_set_description_list (comp, &l);
-       }
-
-       /* creation date */
-       t = e_gw_item_get_creation_date (item);
-       if (t) {
-               itt_utc = icaltime_from_string (t);
-
-               /* RFC 2445 - CREATED/DTSTAMP/LAST-MODIFIED always in UTC */
-               icaltimezone_convert_time (&itt_utc, (icaltimezone*) icaltime_get_timezone (itt_utc), icaltimezone_get_utc_timezone ());
-               icaltime_set_timezone (&itt_utc, icaltimezone_get_utc_timezone ());
-
-               e_cal_component_set_created (comp, &itt_utc);
-               e_cal_component_set_dtstamp (comp, &itt_utc);
-       }
-
-       t = e_gw_item_get_modified_date (item);
-       if (t) {
-               itt_utc = icaltime_from_string (t);
-
-               icaltimezone_convert_time (&itt_utc, (icaltimezone*) icaltime_get_timezone (itt_utc), icaltimezone_get_utc_timezone ());
-               icaltime_set_timezone (&itt_utc, icaltimezone_get_utc_timezone ());
-
-               e_cal_component_set_last_modified (comp, &itt_utc);
-       }
-
-       /* categories */
-       category_ids = e_gw_item_get_categories (item);
-       categories = NULL;
-       if (category_ids && categories_by_id) {
-               for (; category_ids != NULL; category_ids = g_list_next (category_ids)) {
-                       name = g_hash_table_lookup (categories_by_id, category_ids->data);
-                       if (name)
-                               categories = g_slist_append (categories, name);
-               }
-               if (categories) {
-                       e_cal_component_set_categories_list (comp,categories);
-                       g_slist_free (categories);
-               }
-       }
-
-       /* all day event */
-       is_allday = e_gw_item_get_is_allday_event (item);
-
-       /* start date */
-       t = e_gw_item_get_start_date (item);
-       if (t) {
-               itt_utc = icaltime_from_string (t);
-
-               if (!is_allday && (item_type != E_GW_ITEM_TYPE_NOTE)) {
-                       if (!icaltime_get_timezone (itt_utc))
-                               icaltime_set_timezone (&itt_utc, icaltimezone_get_utc_timezone ());
-                       if (default_zone) {
-                               itt = icaltime_convert_to_zone (itt_utc, default_zone);
-                               icaltime_set_timezone (&itt, default_zone);
-                               dt.value = &itt;
-                               dt.tzid = icaltimezone_get_tzid (default_zone);
-                       } else {
-                               dt.value = &itt_utc;
-                               dt.tzid = g_strdup ("UTC");
-                       }
-               } else {
-                       dt.value = &itt_utc;
-                       dt.tzid = NULL;
-                       dt.value->is_date = 1;
-               }
-
-               e_cal_component_set_dtstart (comp, &dt);
-       } else {
-               e_cal_backend_groupwise_priv_unlock (cbgw);
-               return NULL;
-       }
-
-       /* UID */
-       if (e_gw_item_get_recurrence_key (item) != 0) {
-
-               ECalComponentRange *recur_id;
-               gchar *recur_key = g_strdup_printf ("%d", e_gw_item_get_recurrence_key (item));
-
-               e_cal_component_set_uid (comp, (const gchar *) recur_key);
-               g_free (recur_key);
-
-               /* set the recurrence id and the X-GW-RECORDID  too */
-               recur_id = g_new0 (ECalComponentRange, 1);
-               recur_id->type = E_CAL_COMPONENT_RANGE_SINGLE;
-               recur_id->datetime = dt;
-               e_cal_component_set_recurid (comp, recur_id);
-               g_free (recur_id);
-       } else {
-
-               uid = e_gw_item_get_icalid (item);
-               if (uid)
-                       e_cal_component_set_uid (comp, uid);
-               else {
-                       g_object_unref (comp);
-                       e_cal_backend_groupwise_priv_unlock (cbgw);
-                       return NULL;
-               }
-       }
-
-       /* classification */
-       description = e_gw_item_get_classification (item);
-       if (description) {
-               if (strcmp (description, E_GW_ITEM_CLASSIFICATION_PUBLIC) == 0)
-                       e_cal_component_set_classification (comp, E_CAL_COMPONENT_CLASS_PUBLIC);
-               else if (strcmp (description, E_GW_ITEM_CLASSIFICATION_PRIVATE) == 0)
-                       e_cal_component_set_classification (comp, E_CAL_COMPONENT_CLASS_PRIVATE);
-               else if (strcmp (description, E_GW_ITEM_CLASSIFICATION_CONFIDENTIAL) == 0)
-                       e_cal_component_set_classification (comp, E_CAL_COMPONENT_CLASS_CONFIDENTIAL);
-               else
-                       e_cal_component_set_classification (comp, E_CAL_COMPONENT_CLASS_NONE);
-       } else
-               e_cal_component_set_classification (comp, E_CAL_COMPONENT_CLASS_NONE);
-
-       if (item_type != E_GW_ITEM_TYPE_NOTE) {
-               recipient_list = e_gw_item_get_recipient_list (item);
-               if (recipient_list != NULL) {
-                       for (rl = recipient_list; rl != NULL; rl = rl->next) {
-                               EGwItemRecipient *recipient = (EGwItemRecipient *) rl->data;
-                               ECalComponentAttendee *attendee = g_new0 (ECalComponentAttendee, 1);
-
-                               attendee->cn = get_cn_from_display_name (recipient->display_name);
-                               attendee->value = g_strconcat("MAILTO:", recipient->email, NULL);
-                               if (recipient->type == E_GW_ITEM_RECIPIENT_TO)
-                                       attendee->role = ICAL_ROLE_REQPARTICIPANT;
-                               else if (recipient->type == E_GW_ITEM_RECIPIENT_CC || recipient->type == E_GW_ITEM_RECIPIENT_BC)
-                                       attendee->role = ICAL_ROLE_OPTPARTICIPANT;
-                               else
-                                       attendee->role = ICAL_ROLE_NONE;
-                               /* FIXME  needs a server fix on the interface
-                                * for getting cutype and the status */
-                               attendee->cutype = ICAL_CUTYPE_INDIVIDUAL;
-
-                               if (recipient->status == E_GW_ITEM_STAT_ACCEPTED) {
-                                       const gchar *accept_level = e_gw_item_get_accept_level (item);
-
-                                       if (accept_level && !strcmp (e_gw_item_get_accept_level (item),"Tentative"))
-                                               attendee->status = ICAL_PARTSTAT_TENTATIVE;
-                                       else
-                                               attendee->status = ICAL_PARTSTAT_ACCEPTED;
-                               }
-                               else if (recipient->status == E_GW_ITEM_STAT_DECLINED)
-                                       attendee->status = ICAL_PARTSTAT_DECLINED;
-                               else
-                                       attendee->status = ICAL_PARTSTAT_NEEDSACTION;
-
-                               attendee_list = g_slist_append (attendee_list, attendee);
-                       }
-
-                       e_cal_component_set_attendee_list (comp, attendee_list);
-
-                       for (rl = attendee_list; rl != NULL; rl = rl->next) {
-                               ECalComponentAttendee *att = rl->data;
-                               g_free ((gchar *) att->cn);
-                               g_free ((gchar *) att->value);
-                               g_free (att);
-                       }
-                       g_slist_free (attendee_list);
-               }
-       }
-
-       /* set organizer if it exists */
-       organizer = e_gw_item_get_organizer (item);
-       if (organizer) {
-               ECalComponentOrganizer *cal_organizer;
-
-               cal_organizer = g_new0 (ECalComponentOrganizer, 1);
-               cal_organizer->cn = get_cn_from_display_name (organizer->display_name);
-               cal_organizer->value = g_strconcat("MAILTO:", organizer->email, NULL);
-               e_cal_component_set_organizer (comp, cal_organizer);
-
-               g_free ((gchar *) cal_organizer->cn);
-               g_free ((gchar *) cal_organizer->value);
-               g_free (cal_organizer);
-       }
-
-       /* set attachments, if any */
-       set_attachments_to_cal_component (item, comp, cbgw);
-
-       /* set specific properties */
-       switch (item_type) {
-       case E_GW_ITEM_TYPE_APPOINTMENT :
-               /* transparency */
-               description = e_gw_item_get_accept_level (item);
-               if (description &&
-                   (!strcmp (description, E_GW_ITEM_ACCEPT_LEVEL_BUSY) ||
-                    !strcmp (description, E_GW_ITEM_ACCEPT_LEVEL_OUT_OF_OFFICE)))
-                       e_cal_component_set_transparency (comp, E_CAL_COMPONENT_TRANSP_OPAQUE);
-               else
-                       e_cal_component_set_transparency (comp, E_CAL_COMPONENT_TRANSP_TRANSPARENT);
-
-               /* location */
-               e_cal_component_set_location (comp, e_gw_item_get_place (item));
-
-               /* end date */
-               t = e_gw_item_get_end_date (item);
-               if (t) {
-                       itt_utc = icaltime_from_string (t);
-
-                       if (!is_allday) {
-                               if (!icaltime_get_timezone (itt_utc))
-                                       icaltime_set_timezone (&itt_utc, icaltimezone_get_utc_timezone ());
-                               if (default_zone) {
-                                       itt = icaltime_convert_to_zone (itt_utc, default_zone);
-                                       icaltime_set_timezone (&itt, default_zone);
-                                       dt.value = &itt;
-                                       dt.tzid = icaltimezone_get_tzid (default_zone);
-                               } else {
-                                       dt.value = &itt_utc;
-                                       dt.tzid = g_strdup ("UTC");
-                               }
-                       } else {
-                               dt.value = &itt_utc;
-                               dt.tzid = NULL;
-                               dt.value->is_date = 1;
-                       }
-
-                       e_cal_component_set_dtend (comp, &dt);
-               }
-
-               /* alarms*/
-               /* we negate the value as GW supports only "before" the start of event alarms */
-               alarm_duration = 0 - e_gw_item_get_trigger (item);
-               if (alarm_duration != 0) {
-                       ECalComponentAlarm *alarm;
-                       ECalComponentAlarmTrigger trigger;
-
-                       alarm = e_cal_component_alarm_new ();
-                       e_cal_component_alarm_set_action (alarm, E_CAL_COMPONENT_ALARM_DISPLAY);
-                       trigger.type = E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START;
-                       trigger.u.rel_duration = icaldurationtype_from_int (alarm_duration);
-                       e_cal_component_alarm_set_trigger (alarm, trigger);
-                       e_cal_component_add_alarm (comp, alarm);
-                       e_cal_component_alarm_free (alarm);
-
-               } else
-                       set_default_alarms (comp);
-
-               break;
-       case E_GW_ITEM_TYPE_TASK :
-               /* due date */
-               t = e_gw_item_get_due_date (item);
-               if (t) {
-                       itt_utc = icaltime_from_string (t);
-                       if (!icaltime_get_timezone (itt_utc))
-                               icaltime_set_timezone (&itt_utc, icaltimezone_get_utc_timezone ());
-                       if (default_zone) {
-                               itt = icaltime_convert_to_zone (itt_utc, default_zone);
-                               icaltime_set_timezone (&itt, default_zone);
-                               dt.value = &itt;
-                               dt.tzid = icaltimezone_get_tzid (default_zone);
-                       } else {
-                               dt.value = &itt_utc;
-                               dt.tzid = g_strdup ("UTC");
-                       }
-                       e_cal_component_set_due (comp, &dt);
-               }
-               /* priority */
-               description = e_gw_item_get_task_priority (item);
-               if (description) {
-                       if (!strcmp (description, E_GW_ITEM_PRIORITY_STANDARD))
-                               priority = 5;
-                       else if (!strcmp (description, E_GW_ITEM_PRIORITY_HIGH))
-                               priority = 3;
-                       else
-                               priority = 7;
-               } else
-                       priority = 7;
-
-               e_cal_component_set_priority (comp, &priority);
-
-               /* EGwItem's completed is a boolean */
-               if (e_gw_item_get_completed (item)) {
-                       percent = 100;
-
-                       t = e_gw_item_get_completed_date (item);
-                       if (t) {
-                               itt_utc = icaltime_from_string (t);
-                               if (!icaltime_get_timezone (itt_utc))
-                                       icaltime_set_timezone (&itt_utc, icaltimezone_get_utc_timezone ());
-                               if (default_zone) {
-                                       itt = icaltime_convert_to_zone (itt_utc, default_zone);
-                                       icaltime_set_timezone (&itt, default_zone);
-                                       e_cal_component_set_completed (comp, &itt);
-                               } else
-                                       e_cal_component_set_completed (comp, &itt_utc);
-                       } else {
-                               /* We are setting the completion date as the current time due to
-                                  the absence of completion element in the soap interface for posted
-                                  tasks */
-                               itt = icaltime_today ();
-                               e_cal_component_set_completed (comp,&itt);
-                       }
-               } else
-                       percent =0;
-               e_cal_component_set_percent (comp, &percent);
-
-               break;
-       case E_GW_ITEM_TYPE_NOTE:
-               break;
-       default :
-               e_cal_backend_groupwise_priv_unlock (cbgw);
-               return NULL;
-       }
-
-       e_cal_component_commit_sequence (comp);
-       e_cal_backend_groupwise_priv_unlock (cbgw);
-
-       return comp;
-}
-
-EGwConnectionStatus
-e_gw_connection_send_appointment (ECalBackendGroupwise *cbgw, const gchar *container, ECalComponent *comp, icalproperty_method method, gboolean all_instances, ECalComponent **created_comp, icalparameter_partstat *pstatus)
-{
-       EGwConnection *cnc;
-       EGwConnectionStatus status;
-       icalparameter_partstat partstat;
-       gchar *item_id = NULL;
-       const gchar *gw_id;
-       const gchar *recurrence_key = NULL;
-       gboolean need_to_get = FALSE, decline = FALSE;
-       ECalComponentVType type;
-
-       cnc = e_cal_backend_groupwise_get_connection (cbgw);
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_CONNECTION);
-       g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       e_cal_component_commit_sequence (comp);
-       type = e_cal_component_get_vtype (comp);
-
-       gw_id = e_cal_component_get_gw_id (comp);
-
-       switch  (type) {
-
-               case E_CAL_COMPONENT_EVENT:
-               case E_CAL_COMPONENT_TODO:
-               case E_CAL_COMPONENT_JOURNAL:
-                       if (!g_str_has_suffix (gw_id, container)) {
-                               item_id = g_strconcat (e_cal_component_get_gw_id (comp), GW_EVENT_TYPE_ID, container, NULL);
-                               need_to_get = TRUE;
-
-                       }
-                       else
-                               item_id = g_strdup (gw_id);
-                       break;
-               default:
-                       return E_GW_CONNECTION_STATUS_INVALID_OBJECT;
-       }
-
-       if (all_instances)
-               e_cal_component_get_uid (comp, &recurrence_key);
-
-       /*FIXME - remove this once the server returns us the same iCalid in both interfaces */
-
-       if (need_to_get) {
-               EGwItem *item = NULL;
-
-               status = e_gw_connection_get_item (cnc, container, item_id, "recipients message recipientStatus attachments default", &item);
-               if (status == E_GW_CONNECTION_STATUS_OK)
-                       *created_comp = e_gw_item_to_cal_component (item, cbgw);
-
-               g_object_unref (item);
-       }
-
-       if (type == E_CAL_COMPONENT_JOURNAL) {
-               icalcomponent *icalcomp = e_cal_component_get_icalcomponent (comp);
-               icalproperty *icalprop;
-
-               icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY);
-               while (icalprop) {
-                       const gchar *x_name;
-
-                       x_name = icalproperty_get_x_name (icalprop);
-                       if (!strcmp (x_name, "X-GW-DECLINED")) {
-                               decline = TRUE;
-                               *pstatus = ICAL_PARTSTAT_DECLINED;
-                               break;
-                       }
-                       icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY);
-               }
-       }
-
-       switch (method) {
-       case ICAL_METHOD_REQUEST:
-               /* get attendee here and add the list along. */
-               if (e_cal_component_has_attendees (comp)) {
-                       GSList *attendee_list, *l;
-                       const gchar *email_id;
-                       ECalComponentAttendee  *attendee = NULL, *tmp;
-
-                       e_cal_component_get_attendee_list (comp, &attendee_list);
-                       for (l = attendee_list; l; l = g_slist_next (l)) {
-                               tmp = (ECalComponentAttendee *) (l->data);
-                               email_id = tmp->value;
-
-                               if (!g_ascii_strncasecmp (email_id, "mailto:", 7))
-                                       email_id += 7;
-
-                               if (!g_ascii_strcasecmp (email_id, e_gw_connection_get_user_email (cnc))) {
-                                       attendee = tmp;
-                                       break;
-                               }
-                       }
-                       if (attendee) {
-                               partstat = attendee->status;
-                       }
-                       else {
-                               status = E_GW_CONNECTION_STATUS_INVALID_OBJECT;
-                               break;
-                       }
-                       if (attendee_list)
-                               e_cal_component_free_attendee_list (attendee_list);
-
-               }
-               else {
-                       status = E_GW_CONNECTION_STATUS_INVALID_OBJECT;
-                       break;
-               }
-               *pstatus = partstat;
-               switch (partstat) {
-               ECalComponentTransparency transp;
-
-               case ICAL_PARTSTAT_ACCEPTED:
-                       e_cal_component_get_transparency (comp, &transp);
-                       if (transp == E_CAL_COMPONENT_TRANSP_OPAQUE)  {
-                               if (all_instances)
-                                       status = e_gw_connection_accept_request (cnc, item_id, "Busy",  NULL, recurrence_key);
-                               else
-                                       status = e_gw_connection_accept_request (cnc, item_id, "Busy", NULL, NULL);
-                       }
-                       else {
-                               if (all_instances)
-                                       status = e_gw_connection_accept_request (cnc, item_id, "Free",  NULL, recurrence_key);
-                               else
-                                       status = e_gw_connection_accept_request (cnc, item_id, "Free", NULL, NULL);
-                       }
-                       break;
-               case ICAL_PARTSTAT_DECLINED:
-                       if (all_instances)
-                               status = e_gw_connection_decline_request (cnc, item_id, NULL, recurrence_key);
-                       else
-                               status = e_gw_connection_decline_request (cnc, item_id, NULL, NULL);
-
-                       break;
-               case ICAL_PARTSTAT_TENTATIVE:
-                       if (all_instances)
-                               status = e_gw_connection_accept_request (cnc, item_id, "Tentative", NULL, recurrence_key);
-                       else
-                               status = e_gw_connection_accept_request (cnc, item_id, "Tentative", NULL, NULL);
-                       break;
-               case ICAL_PARTSTAT_COMPLETED:
-                       status = e_gw_connection_complete_request (cnc, item_id);
-
-               default :
-                       status = E_GW_CONNECTION_STATUS_INVALID_OBJECT;
-
-               }
-
-               break;
-
-       case ICAL_METHOD_CANCEL:
-               status = e_gw_connection_retract_request (cnc, item_id, NULL, FALSE, FALSE);
-               break;
-       case ICAL_METHOD_PUBLISH:
-               if (decline)
-                       status = e_gw_connection_decline_request (cnc, item_id, NULL, NULL);
-               else
-                       status = e_gw_connection_accept_request (cnc, item_id, "Free",  NULL, NULL);
-               break;
-       default:
-               return E_GW_CONNECTION_STATUS_INVALID_OBJECT;
-       }
-
-       return status;
-}
-
-EGwConnectionStatus
-e_gw_connection_create_appointment (EGwConnection *cnc, const gchar *container, ECalBackendGroupwise *cbgw, ECalComponent *comp, GSList **id_list)
-{
-       EGwItem *item;
-       EGwConnectionStatus status;
-       icalproperty *icalprop;
-       gboolean move_cal = FALSE;
-       icalcomponent *icalcomp;
-       gchar *id = NULL;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_CONNECTION);
-       g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       icalcomp = e_cal_component_get_icalcomponent (comp);
-
-       icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY);
-       while (icalprop) {
-               const gchar *x_name;
-
-               x_name = icalproperty_get_x_name (icalprop);
-               if (!strcmp (x_name, "X-EVOLUTION-MOVE-CALENDAR")) {
-                       move_cal = TRUE;
-                       break;
-               }
-
-               icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY);
-       }
-
-       item = e_gw_item_new_from_cal_component (container, cbgw, comp);
-       e_gw_item_set_container_id (item, container);
-       if (!move_cal)
-               status = e_gw_connection_send_item (cnc, item, id_list);
-       else {
-               e_gw_item_set_source (item, "personal");
-               status = e_gw_connection_create_item (cnc, item, &id);
-               *id_list = g_slist_append (*id_list, id);
-       }
-       g_object_unref (item);
-
-       return status;
-}
-
-static EGwConnectionStatus
-start_freebusy_session (EGwConnection *cnc, GList *users,
-               time_t start, time_t end, gchar **session)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-       SoupSoapParameter *param;
-       GList *l;
-       icaltimetype icaltime;
-       icaltimezone *utc;
-       gchar *start_date, *end_date;
-
-       if (users == NULL)
-               return E_GW_CONNECTION_STATUS_INVALID_OBJECT;
-
-        /* build the SOAP message */
-       msg = e_gw_message_new_with_header (e_gw_connection_get_uri (cnc),
-                                           e_gw_connection_get_session_id (cnc),
-                                           "startFreeBusySessionRequest");
-        /* FIXME users is just a buch of user names - associate it with uid,
-         * email id apart from the name*/
-
-        soup_soap_message_start_element (msg, "users", NULL, NULL);
-       for ( l = users; l != NULL; l = g_list_next (l)) {
-               soup_soap_message_start_element (msg, "user", NULL, NULL);
-                e_gw_message_write_string_parameter (msg, "email", NULL, l->data);
-               soup_soap_message_end_element (msg);
-       }
-
-       soup_soap_message_end_element (msg);
-
-       utc = icaltimezone_get_utc_timezone ();
-       icaltime = icaltime_from_timet_with_zone (start, FALSE, utc);
-       start_date = icaltime_as_ical_string_r (icaltime);
-
-       icaltime = icaltime_from_timet_with_zone (end, FALSE, utc);
-       end_date = icaltime_as_ical_string_r (icaltime);
-
-        e_gw_message_write_string_parameter (msg, "startDate", NULL, start_date);
-        e_gw_message_write_string_parameter (msg, "endDate", NULL, end_date);
-       g_free (start_date);
-       g_free (end_date);
-
-       e_gw_message_write_footer (msg);
-
-       /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status != E_GW_CONNECTION_STATUS_OK)
-       {
-               g_object_unref (msg);
-               g_object_unref (response);
-               return status;
-       }
-
-       /* if status is OK - parse result, return the list */
-        param = soup_soap_response_get_first_parameter_by_name (response, "freeBusySessionId");
-       if (!param) {
-               g_object_unref (response);
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-       }
-
-       *session = soup_soap_parameter_get_string_value (param);
-        /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       return status;
-}
-
-static EGwConnectionStatus
-close_freebusy_session (EGwConnection *cnc, const gchar *session)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-
-        /* build the SOAP message */
-       msg = e_gw_message_new_with_header (e_gw_connection_get_uri (cnc),
-                                           e_gw_connection_get_session_id (cnc),
-                                           "closeFreeBusySessionRequest");
-       e_gw_message_write_string_parameter (msg, "freeBusySessionId", NULL, session);
-       e_gw_message_write_footer (msg);
-
-       /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-
-       g_object_unref (msg);
-       g_object_unref (response);
-       return status;
-}
-
-EGwConnectionStatus
-e_gw_connection_get_freebusy_info (ECalBackendGroupwise *cbgw, GList *users, time_t start, time_t end, GList **freebusy)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-       SoupSoapParameter *param, *subparam, *param_outstanding;
-       EGwConnection *cnc;
-       gchar *session;
-       gchar *outstanding = NULL;
-       gboolean resend_request = TRUE;
-       gint request_iteration = 0;
-       icaltimezone *default_zone;
-
-       default_zone = e_cal_backend_groupwise_get_default_zone (cbgw);
-       cnc = e_cal_backend_groupwise_get_connection (cbgw);
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_CONNECTION);
-
-       /* Perform startFreeBusySession */
-       status = start_freebusy_session (cnc, users, start, end, &session);
-        /*FIXME log error messages  */
-       if (status != E_GW_CONNECTION_STATUS_OK)
-               return status;
-
-       resend :
-       while (resend_request) {
-
-        /* getFreeBusy */
-        /* build the SOAP message */
-       msg = e_gw_message_new_with_header (e_gw_connection_get_uri (cnc),
-                                           e_gw_connection_get_session_id (cnc),
-                                           "getFreeBusyRequest");
-       e_gw_message_write_string_parameter (msg, "freeBusySessionId", NULL, session);
-       e_gw_message_write_footer (msg);
-
-       /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               g_free (session);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               g_object_unref (msg);
-               g_object_unref (response);
-               g_free (session);
-               return status;
-       }
-
-       param = soup_soap_response_get_first_parameter_by_name (response, "freeBusyStats");
-       if (!param) {
-               g_object_unref (response);
-               g_object_unref (msg);
-               g_free (session);
-               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-       }
-
-       param_outstanding = soup_soap_parameter_get_first_child_by_name (param, "outstanding");
-       if (param_outstanding)
-               outstanding = soup_soap_parameter_get_string_value (param_outstanding);
-       /* Try 12 times - this is approximately 2 minutes of time to
-        * obtain the free/busy information from the server */
-       if (outstanding && strcmp (outstanding, "0") && (request_iteration < 12)) {
-               request_iteration++;
-               g_object_unref (msg);
-               g_object_unref (response);
-               g_usleep (10000000);
-               g_free (outstanding); outstanding = NULL;
-               goto resend;
-       }
-       g_free (outstanding); outstanding = NULL;
-
-        /* FIXME  the FreeBusyStats are not used currently.  */
-        param = soup_soap_response_get_first_parameter_by_name (response, "freeBusyInfo");
-       if (!param) {
-               g_object_unref (response);
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-       }
-
-       resend_request = FALSE;
-
-        for (subparam = soup_soap_parameter_get_first_child_by_name (param, "user");
-            subparam != NULL;
-            subparam = soup_soap_parameter_get_next_child_by_name (subparam, "user")) {
-               SoupSoapParameter *param_blocks, *subparam_block, *tmp;
-               gchar *uuid = NULL, *email = NULL, *name = NULL;
-               ECalComponent *comp;
-               ECalComponentAttendee attendee;
-               GSList *attendee_list = NULL;
-               icalcomponent *icalcomp = NULL;
-               icaltimetype start_time, end_time;
-
-               e_cal_backend_groupwise_priv_lock (cbgw);
-
-               tmp = soup_soap_parameter_get_first_child_by_name (subparam, "email");
-               if (tmp)
-                       email = soup_soap_parameter_get_string_value (tmp);
-               tmp = soup_soap_parameter_get_first_child_by_name (subparam, "uuid");
-               if (tmp)
-                       uuid = soup_soap_parameter_get_string_value (tmp);
-               tmp = soup_soap_parameter_get_first_child_by_name (subparam, "displayName");
-               if (tmp)
-                       name = soup_soap_parameter_get_string_value (tmp);
-
-               comp = e_cal_component_new ();
-               e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_FREEBUSY);
-               e_cal_component_commit_sequence (comp);
-               icalcomp = e_cal_component_get_icalcomponent (comp);
-
-               start_time = icaltime_from_timet_with_zone (start, 0, default_zone ? default_zone : NULL);
-               end_time = icaltime_from_timet_with_zone (end, 0, default_zone ? default_zone : NULL);
-               icalcomponent_set_dtstart (icalcomp, start_time);
-               icalcomponent_set_dtend (icalcomp, end_time);
-
-               memset (&attendee, 0, sizeof (ECalComponentAttendee));
-               if (name)
-                       attendee.cn = name;
-               if (email)
-                       attendee.value = email;
-
-               attendee.cutype = ICAL_CUTYPE_INDIVIDUAL;
-               attendee.role = ICAL_ROLE_REQPARTICIPANT;
-               attendee.status = ICAL_PARTSTAT_NEEDSACTION;
-
-               /* XXX the uuid is not currently used. hence it is
-                * discarded */
-               g_free (uuid); uuid = NULL;
-
-               attendee_list = g_slist_append (attendee_list, &attendee);
-
-               e_cal_component_set_attendee_list (comp, attendee_list);
-               g_slist_free (attendee_list);
-               g_free ((gchar *) name);
-               g_free ((gchar *) email);
-
-               param_blocks = soup_soap_parameter_get_first_child_by_name (subparam, "blocks");
-               if (!param_blocks) {
-                       g_object_unref (response);
-                       g_object_unref (msg);
-                       e_cal_backend_groupwise_priv_unlock (cbgw);
-                       return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-               }
-
-               subparam_block = soup_soap_parameter_get_first_child_by_name (param_blocks, "block");
-               /* The GW server only returns 'Busy', 'OOF' and 'Tentative' periods. The rest are
-                * assumed to be 'Free' periods. In case of an attendee having only 'Free' periods,
-                * ensure to send a block to the frontend saying so. */
-               if (subparam_block == NULL) {
-                       struct icalperiodtype ipt;
-                       icaltimetype sitt, eitt;
-                       icalproperty *icalprop;
-                       sitt = icaltime_from_timet_with_zone (start, 0, default_zone ? default_zone : NULL);
-                       ipt.start = sitt;
-                       eitt = icaltime_from_timet_with_zone (end, 0, default_zone ? default_zone : NULL);
-                       ipt.end = eitt;
-                       icalprop = icalproperty_new_freebusy (ipt);
-                       icalproperty_set_parameter_from_string (icalprop, "FBTYPE", "FREE");
-                       icalcomponent_add_property (icalcomp, icalprop);
-               }
-
-               for (;
-                    subparam_block != NULL;
-                    subparam_block = soup_soap_parameter_get_next_child_by_name (subparam_block, "block")) {
-
-                       /* process each block and create ECal free/busy components.*/
-                       SoupSoapParameter *tmp;
-                       struct icalperiodtype ipt;
-                       icalproperty *icalprop;
-                       icaltimetype itt;
-                       time_t t;
-                       gchar *start, *end, *accept_level;
-
-                       memset (&ipt, 0, sizeof (struct icalperiodtype));
-                       tmp = soup_soap_parameter_get_first_child_by_name (subparam_block, "startDate");
-                       if (tmp) {
-                               start = soup_soap_parameter_get_string_value (tmp);
-                               t = e_gw_connection_get_date_from_string (start);
-                               itt = icaltime_from_timet_with_zone (t, 0, icaltimezone_get_utc_timezone ());
-                               ipt.start = itt;
-                               g_free (start);
-                       }
-
-                       tmp = soup_soap_parameter_get_first_child_by_name (subparam_block, "endDate");
-                       if (tmp) {
-                               end = soup_soap_parameter_get_string_value (tmp);
-                               t = e_gw_connection_get_date_from_string (end);
-                               itt = icaltime_from_timet_with_zone (t, 0, icaltimezone_get_utc_timezone ());
-                               ipt.end = itt;
-                               g_free (end);
-                       }
-                       icalprop = icalproperty_new_freebusy (ipt);
-
-                       tmp = soup_soap_parameter_get_first_child_by_name (subparam_block, "acceptLevel");
-                       if (tmp) {
-                               accept_level = soup_soap_parameter_get_string_value (tmp);
-                               if (!strcmp (accept_level, "Busy"))
-                                       icalproperty_set_parameter_from_string (icalprop, "FBTYPE", "BUSY");
-                               else if (!strcmp (accept_level, "Tentative"))
-                                       icalproperty_set_parameter_from_string (icalprop, "FBTYPE", "BUSY-TENTATIVE");
-                               else if (!strcmp (accept_level, "OutOfOffice"))
-                                       icalproperty_set_parameter_from_string (icalprop, "FBTYPE", "BUSY-UNAVAILABLE");
-                               else if (!strcmp (accept_level, "Free"))
-                                       icalproperty_set_parameter_from_string (icalprop, "FBTYPE", "FREE");
-                               g_free (accept_level);
-                       }
-                       icalcomponent_add_property (icalcomp, icalprop);
-               }
-
-               e_cal_component_commit_sequence (comp);
-               *freebusy = g_list_append (*freebusy, e_cal_component_get_as_string (comp));
-               g_object_unref (comp);
-               e_cal_backend_groupwise_priv_unlock (cbgw);
-       }
-
-       g_object_unref (msg);
-       g_object_unref (response);
-
-       } /* end of while loop */
-
-        /* closeFreeBusySession*/
-       status = close_freebusy_session (cnc, session);
-       g_free (session);
-
-       return status;
-}
-
-#define SET_DELTA(fieldname) G_STMT_START{                                                                \
-       fieldname = e_gw_item_get_##fieldname (item);                                                       \
-       cache_##fieldname = e_gw_item_get_##fieldname (cache_item);                                           \
-       if (cache_##fieldname) {                                                                            \
-               if (!fieldname )                                                                               \
-                       e_gw_item_set_change (item, E_GW_ITEM_CHANGE_TYPE_DELETE, #fieldname, (gpointer) cache_##fieldname );\
-               else if (strcmp ( fieldname, cache_##fieldname ))                                               \
-                       e_gw_item_set_change (item, E_GW_ITEM_CHANGE_TYPE_UPDATE, #fieldname, (gpointer) fieldname );\
-       }                                                                                                 \
-       else if (fieldname)                                                                               \
-               e_gw_item_set_change (item, E_GW_ITEM_CHANGE_TYPE_ADD, #fieldname, (gpointer) fieldname );           \
-       }G_STMT_END
-
-static void
-set_categories_changes (EGwItem *new_item, EGwItem *old_item)
-{
-       GList *old_category_list;
-       GList *new_category_list;
-       GList *temp, *old_categories_copy, *added_categories = NULL;
-       gboolean categories_matched;
-       gchar *category1, *category2;
-       old_category_list = e_gw_item_get_categories (old_item);
-       new_category_list = e_gw_item_get_categories (new_item);
-       if (old_category_list && new_category_list) {
-               old_categories_copy = g_list_copy (old_category_list);
-               for (; new_category_list != NULL; new_category_list = g_list_next (new_category_list)) {
-
-                       category1  = new_category_list->data;
-                       temp = old_category_list;
-                       categories_matched  = FALSE;
-                       for (; temp != NULL; temp = g_list_next (temp)) {
-                               category2 = temp->data;
-                               if ( g_str_equal (category1, category2)) {
-                                       categories_matched = TRUE;
-                                       old_categories_copy = g_list_remove (old_categories_copy, category2);
-                                       break;
-                               }
-
-                       }
-                       if (!categories_matched)
-                               added_categories = g_list_append (added_categories, category1);
-               }
-
-               e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_ADD, "categories", added_categories);
-               e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_DELETE, "categories", old_categories_copy);
-
-       } else if (!new_category_list && old_category_list) {
-               e_gw_item_set_change (new_item,  E_GW_ITEM_CHANGE_TYPE_DELETE, "categories", old_category_list);
-       } else if (new_category_list && !old_category_list) {
-               e_gw_item_set_change (new_item, E_GW_ITEM_CHANGE_TYPE_ADD, "categories", new_category_list);
-       }
-
-}
-
-void
-e_gw_item_set_changes (EGwItem *item, EGwItem *cache_item)
-{
-       const gchar *subject, *cache_subject;
-       const gchar *message, *cache_message;
-       const gchar *classification, *cache_classification;
-       const gchar *accept_level, *cache_accept_level;
-       const gchar *place, *cache_place;
-       const gchar *task_priority, *cache_task_priority;
-       gint trigger, cache_trigger;
-       gchar *due_date, *cache_due_date;
-       gchar *start_date, *cache_start_date;
-       gchar *end_date, *cache_end_date;
-       gboolean is_allday, cache_is_allday;
-
-       /* TODO assert the types of the items are the same */
-
-       SET_DELTA (subject);
-       SET_DELTA (message);
-       SET_DELTA (classification);
-
-       SET_DELTA (start_date);
-       set_categories_changes (item, cache_item);
-       /*FIXME  recipient_list modifications need go here after server starts
-        * supporting retraction */
-       if (e_gw_item_get_item_type (item) == E_GW_ITEM_TYPE_APPOINTMENT) {
-
-               SET_DELTA (end_date);
-               SET_DELTA (accept_level);
-               SET_DELTA (place);
-               trigger = e_gw_item_get_trigger (item);
-               cache_trigger = e_gw_item_get_trigger (cache_item);
-               if (cache_trigger) {
-                       if (!trigger)
-                               e_gw_item_set_change (item, E_GW_ITEM_CHANGE_TYPE_DELETE, "alarm", &cache_trigger);
-                       else if (trigger != cache_trigger)
-                               e_gw_item_set_change (item, E_GW_ITEM_CHANGE_TYPE_UPDATE, "alarm", &trigger);
-               }
-               else if (trigger)
-                       e_gw_item_set_change (item, E_GW_ITEM_CHANGE_TYPE_ADD, "alarm", &trigger);
-               is_allday = e_gw_item_get_is_allday_event (item);
-               cache_is_allday = e_gw_item_get_is_allday_event (cache_item);
-
-               if ((is_allday && !cache_is_allday) || (!is_allday && cache_is_allday))
-                       e_gw_item_set_change (item, E_GW_ITEM_CHANGE_TYPE_UPDATE, "allDayEvent", &is_allday);
-       }
-       else if ( e_gw_item_get_item_type (item) == E_GW_ITEM_TYPE_TASK) {
-               SET_DELTA (due_date);
-               SET_DELTA (task_priority);
-       }
-}
-
-static void
-add_return_value (EGwSendOptionsReturnNotify track, ESource *source, const gchar *notify)
-{
-       gchar *value;
-
-       switch (track) {
-               case E_GW_RETURN_NOTIFY_MAIL:
-                       value =  g_strdup ("mail");
-                       break;
-               default:
-                       value = g_strdup ("none");
-       }
-
-       e_source_set_property (source, notify, value);
-       g_free (value), value = NULL;
-}
-
-gboolean
-e_cal_backend_groupwise_store_settings (GwSettings *hold)
-{
-       ECalBackendGroupwise *cbgw;
-       EGwSendOptions *opts;
-       EGwSendOptionsGeneral *gopts;
-       EGwSendOptionsStatusTracking *sopts;
-       icaltimetype tt;
-       icalcomponent_kind kind;
-       GConfClient *gconf = gconf_client_get_default ();
-       ESource *source;
-       ESourceList *source_list;
-       const gchar *uid;
-       gchar *value;
-
-       cbgw = hold->cbgw;
-       opts = hold->opts;
-       source = e_cal_backend_get_source (E_CAL_BACKEND (cbgw));
-       kind = e_cal_backend_get_kind (E_CAL_BACKEND (cbgw));
-
-       /* TODO implement send options for Notes */
-       if (kind == ICAL_VJOURNAL_COMPONENT) {
-               g_object_unref (gconf);
-               g_object_unref (hold->opts);
-               g_free (hold);
-
-               return FALSE;
-       }
-
-       gopts = e_gw_sendoptions_get_general_options (opts);
-       if (kind == ICAL_VEVENT_COMPONENT) {
-               source_list = e_source_list_new_for_gconf (gconf, "/apps/evolution/calendar/sources");
-               sopts = e_gw_sendoptions_get_status_tracking_options (opts, "calendar");
-       } else {
-               source_list = e_source_list_new_for_gconf (gconf, "/apps/evolution/tasks/sources");
-               sopts = e_gw_sendoptions_get_status_tracking_options (opts, "task");
-       }
-
-       uid = e_source_peek_uid (source);
-       source = e_source_list_peek_source_by_uid (source_list, uid);
-       if (gopts) {
-               /* priority */
-               switch (gopts->priority) {
-                       case E_GW_PRIORITY_HIGH:
-                               value = g_strdup ("high");
-                               break;
-                       case E_GW_PRIORITY_STANDARD:
-                               value = g_strdup ("standard");
-                               break;
-                       case E_GW_PRIORITY_LOW:
-                               value =  g_strdup ("low");
-                               break;
-                       default:
-                               value = g_strdup ("undefined");
-               }
-               e_source_set_property (source, "priority", value);
-               g_free (value), value = NULL;
-
-               /* Reply Requested */
-               if (gopts->reply_enabled) {
-                       if (gopts->reply_convenient)
-                               value = g_strdup ("convinient");
-                       else
-                               value = g_strdup_printf ("%d",gopts->reply_within);
-               } else
-                       value = g_strdup ("none");
-               e_source_set_property (source, "reply-requested", value);
-               g_free (value), value = NULL;
-
-               /* Delay delivery */
-               if (gopts->delay_enabled) {
-                       tt = icaltime_today ();
-                       icaltime_adjust (&tt, gopts->delay_until, 0, 0, 0);
-                       value = icaltime_as_ical_string_r (tt);
-               } else
-                       value = g_strdup ("none");
-               e_source_set_property (source, "delay-delivery", value);
-               g_free (value), value = NULL;
-
-               /* Expiration date */
-               if (gopts->expiration_enabled)
-                       value =  g_strdup_printf ("%d", gopts->expire_after);
-               else
-                       value = g_strdup ("none");
-               e_source_set_property (source, "expiration", value);
-               g_free (value), value = NULL;
-       }
-
-       if (sopts) {
-               /* status tracking */
-               if (sopts->tracking_enabled) {
-                       switch (sopts->track_when) {
-                               case E_GW_DELIVERED :
-                                       value = g_strdup ("delivered");
-                                       break;
-                               case E_GW_DELIVERED_OPENED:
-                                       value = g_strdup ("delivered-opened");
-                                       break;
-                               default:
-                                       value = g_strdup ("all");
-                       }
-               } else
-                       value = g_strdup ("none");
-               e_source_set_property (source, "status-tracking", value);
-               g_free (value), value = NULL;
-
-               add_return_value (sopts->opened, source, "return-open");
-               add_return_value (sopts->accepted, source, "return-accept");
-               add_return_value (sopts->declined, source, "return-decline");
-               add_return_value (sopts->completed, source, "return-complete");
-       }
-
-       e_source_list_sync (source_list, NULL);
-
-       g_object_unref (hold->opts);
-       g_free (hold);
-
-       g_object_unref (gconf);
-       g_object_unref (source_list);
-
-       return FALSE;
-}
-
-gboolean
-e_cal_backend_groupwise_utils_check_delegate (ECalComponent *comp, const gchar *email)
-{
-       icalproperty *prop;
-       icalcomponent *icalcomp = e_cal_component_get_icalcomponent (comp);
-
-       /*TODO remove the argument email */
-       prop = icalcomponent_get_first_property (icalcomp,
-                                                ICAL_X_PROPERTY);
-       while (prop) {
-               const gchar *x_name;
-
-               x_name = icalproperty_get_x_name (prop);
-               if (!strcmp (x_name, "X-EVOLUTION-DELEGATED")) {
-                       icalcomponent_remove_property (icalcomp, prop);
-                       return TRUE;
-               }
-
-               prop = icalcomponent_get_next_property (e_cal_component_get_icalcomponent (comp),
-                                                       ICAL_X_PROPERTY);
-       }
-
-       return FALSE;
-
-}
-
diff --git a/calendar/backends/groupwise/e-cal-backend-groupwise-utils.h b/calendar/backends/groupwise/e-cal-backend-groupwise-utils.h
deleted file mode 100644 (file)
index 838f846..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors :
- *  JP Rosevear <jpr@ximian.com>
- *  Rodrigo Moya <rodrigo@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- */
-
-#ifndef E_CAL_BACKEND_GROUPWISE_UTILS_H
-#define E_CAL_BACKEND_GROUPWISE_UTILS_H
-
-#include <e-gw-connection.h>
-#include <libecal/e-cal-component.h>
-#include <e-cal-backend-groupwise.h>
-
-G_BEGIN_DECLS
-
-#define GW_EVENT_TYPE_ID "@4:"
-#define GW_TODO_TYPE_ID "@3:"
-
-/* Default reminder */
-#define CALENDAR_CONFIG_PREFIX "/apps/evolution/calendar"
-#define CALENDAR_CONFIG_DEFAULT_REMINDER CALENDAR_CONFIG_PREFIX "/other/use_default_reminder"
-#define CALENDAR_CONFIG_DEFAULT_REMINDER_INTERVAL CALENDAR_CONFIG_PREFIX "/other/default_reminder_interval"
-#define CALENDAR_CONFIG_DEFAULT_REMINDER_UNITS CALENDAR_CONFIG_PREFIX "/other/default_reminder_units"
-
-/*
- * Items management
- */
-EGwItem       *e_gw_item_new_from_cal_component (const gchar *container, ECalBackendGroupwise *cbgw, ECalComponent *comp);
-EGwItem  *e_gw_item_new_for_delegate_from_cal (ECalBackendGroupwise *cbgw, ECalComponent *comp);
-ECalComponent *e_gw_item_to_cal_component (EGwItem *item, ECalBackendGroupwise *cbgw);
-void          e_gw_item_set_changes (EGwItem *item, EGwItem *cached_item);
-
-/*
- * Connection-related utility functions
- */
-EGwConnectionStatus e_gw_connection_create_appointment (EGwConnection *cnc, const gchar *container, ECalBackendGroupwise *cbgw, ECalComponent *comp, GSList **id_list);
-EGwConnectionStatus e_gw_connection_send_appointment (ECalBackendGroupwise *cbgw, const gchar *container, ECalComponent *comp, icalproperty_method method, gboolean all_instances, ECalComponent **created_comp, icalparameter_partstat *pstatus);
-EGwConnectionStatus e_gw_connection_get_freebusy_info (ECalBackendGroupwise *cbgw, GList *users, time_t start, time_t end, GList **freebusy);
-gboolean e_cal_backend_groupwise_store_settings (GwSettings *hold);
-gboolean e_cal_backend_groupwise_utils_check_delegate (ECalComponent *comp, const gchar *email);
-
-/*
- * Component related utility functions
- */
-
-const gchar *e_cal_component_get_gw_id (ECalComponent *comp);
-G_END_DECLS
-
-#endif
diff --git a/calendar/backends/groupwise/e-cal-backend-groupwise.c b/calendar/backends/groupwise/e-cal-backend-groupwise.c
deleted file mode 100644 (file)
index 11d717c..0000000
+++ /dev/null
@@ -1,2830 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors :
- *  JP Rosevear <jpr@ximian.com>
- *  Rodrigo Moya <rodrigo@ximian.com>
- *  Harish Krishnaswamy <kharish@novell.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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 <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <glib/gstdio.h>
-#include <glib/gi18n-lib.h>
-#include <libedataserver/e-data-server-util.h>
-#include <libedataserver/e-xml-hash-utils.h>
-#include <libedataserver/e-url.h>
-#include <libedata-cal/e-cal-backend-cache.h>
-#include <libedata-cal/e-cal-backend-file-store.h>
-#include <libedata-cal/e-cal-backend-util.h>
-#include <libecal/e-cal-component.h>
-#include <libecal/e-cal-time-util.h>
-#include "e-cal-backend-groupwise.h"
-#include "e-cal-backend-groupwise-utils.h"
-#include "e-gw-connection.h"
-
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
-#ifdef G_OS_WIN32
-#ifdef gmtime_r
-#undef gmtime_r
-#endif
-
-/* The gmtime() in Microsoft's C library is MT-safe */
-#define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0)
-#endif
-
-#define SERVER_UTC_TIME "server_utc_time"
-#define LOCAL_UTC_TIME "local_utc_time"
-#define CACHE_MARKER "populated"
-
-#define EDC_ERROR(_code) e_data_cal_create_error (_code, NULL)
-#define EDC_ERROR_EX(_code, _msg) e_data_cal_create_error (_code, _msg)
-#define EDC_ERROR_FAILED_STATUS(_code, _status) e_data_cal_create_error_fmt (_code, "Failed with status 0x%x", _status)
-
-G_DEFINE_TYPE (ECalBackendGroupwise, e_cal_backend_groupwise, E_TYPE_CAL_BACKEND_SYNC)
-
-typedef struct {
-       GCond *cond;
-       GMutex *mutex;
-       gboolean exit;
-} SyncDelta;
-
-/* Private part of the CalBackendGroupwise structure */
-struct _ECalBackendGroupwisePrivate {
-       EGwConnection *cnc;
-       ECalBackendStore *store;
-       gboolean read_only;
-       gchar *uri;
-       gchar *username;
-       gchar *password;
-       gchar *container_id;
-       CalMode mode;
-       gboolean mode_changed;
-       GHashTable *categories_by_id;
-       GHashTable *categories_by_name;
-
-       /* number of calendar items in the folder */
-       guint32 total_count;
-
-       /* timeout handler for syncing sendoptions */
-       guint sendoptions_sync_timeout;
-
-       /* fields for storing info while offline */
-       gchar *user_email;
-
-       gboolean first_delta_fetch;
-
-       /* A mutex to control access to the private structure for the following */
-       GStaticRecMutex rec_mutex;
-       icaltimezone *default_zone;
-       guint timeout_id;
-       GThread *dthread;
-       SyncDelta *dlock;
-};
-
-#define PRIV_LOCK(p)   (g_static_rec_mutex_lock (&(p)->rec_mutex))
-#define PRIV_UNLOCK(p) (g_static_rec_mutex_unlock (&(p)->rec_mutex))
-
-static void e_cal_backend_groupwise_finalize (GObject *object);
-static void e_cal_backend_groupwise_add_timezone (ECalBackendSync *backend, EDataCal *cal, const gchar *tzobj, GError **perror);
-static const gchar * get_gw_item_id (icalcomponent *icalcomp);
-static void get_retract_data (ECalComponent *comp, const gchar **retract_comment, gboolean *all_instances);
-static const gchar * get_element_type (icalcomponent_kind kind);
-
-#define PARENT_TYPE E_TYPE_CAL_BACKEND_SYNC
-static ECalBackendClass *parent_class = NULL;
-
-/* Time interval in milliseconds for obtaining changes from server and refresh the cache. */
-#define CACHE_REFRESH_INTERVAL 600000
-#define CURSOR_ITEM_LIMIT 100
-#define CURSOR_ICALID_LIMIT 500
-
-static guint get_cache_refresh_interval (ECalBackendGroupwise *cbgw);
-
-EGwConnection *
-e_cal_backend_groupwise_get_connection (ECalBackendGroupwise *cbgw) {
-
-       g_return_val_if_fail (E_IS_CAL_BACKEND_GROUPWISE (cbgw), NULL);
-
-       return cbgw->priv->cnc;
-}
-
-GHashTable *
-e_cal_backend_groupwise_get_categories_by_id (ECalBackendGroupwise *cbgw) {
-
-       g_return_val_if_fail (E_IS_CAL_BACKEND_GROUPWISE (cbgw), NULL);
-
-       return cbgw->priv->categories_by_id;
-}
-
-GHashTable *
-e_cal_backend_groupwise_get_categories_by_name (ECalBackendGroupwise *cbgw) {
-
-       g_return_val_if_fail (E_IS_CAL_BACKEND_GROUPWISE (cbgw), NULL);
-
-       return cbgw->priv->categories_by_name;
-}
-
-icaltimezone *
-e_cal_backend_groupwise_get_default_zone (ECalBackendGroupwise *cbgw) {
-
-       g_return_val_if_fail (E_IS_CAL_BACKEND_GROUPWISE (cbgw), NULL);
-
-       return cbgw->priv->default_zone;
-}
-
-const gchar *
-e_cal_backend_groupwise_get_container_id (ECalBackendGroupwise *cbgw)
-{
-       return cbgw->priv->container_id;
-}
-
-void
-e_cal_backend_groupwise_priv_lock (ECalBackendGroupwise *cbgw)
-{
-       PRIV_LOCK (cbgw->priv);
-}
-
-void
-e_cal_backend_groupwise_priv_unlock (ECalBackendGroupwise *cbgw)
-{
-       PRIV_UNLOCK (cbgw->priv);
-}
-
-static const gchar *
-get_element_type (icalcomponent_kind kind)
-{
-
-       const gchar *type;
-
-       if (kind == ICAL_VEVENT_COMPONENT)
-               type = "Appointment";
-       else if (kind == ICAL_VTODO_COMPONENT)
-               type = "Task";
-       else
-               type = "Note";
-
-       return type;
-
-}
-
-/* TODO Do not replicate this in every backend */
-static icaltimezone *
-resolve_tzid (const gchar *tzid, gpointer user_data)
-{
-       icaltimezone *zone;
-
-       zone = (!strcmp (tzid, "UTC"))
-               ? icaltimezone_get_utc_timezone ()
-               : icaltimezone_get_builtin_timezone_from_tzid (tzid);
-
-       if (!zone)
-               zone = e_cal_backend_internal_get_timezone (E_CAL_BACKEND (user_data), tzid);
-
-       return zone;
-}
-
-static void
-put_component_to_store (ECalBackendGroupwise *cbgw,
-                       ECalComponent *comp)
-{
-       time_t time_start, time_end;
-       ECalBackendGroupwisePrivate *priv;
-
-       priv = cbgw->priv;
-
-       e_cal_util_get_component_occur_times (comp, &time_start, &time_end,
-                                  resolve_tzid, cbgw, priv->default_zone,
-                                  e_cal_backend_get_kind (E_CAL_BACKEND (cbgw)));
-
-       e_cal_backend_store_put_component_with_time_range (priv->store, comp, time_start, time_end);
-}
-
-/* Initialy populate the cache from the server */
-static EGwConnectionStatus
-populate_cache (ECalBackendGroupwise *cbgw)
-{
-       ECalBackendGroupwisePrivate *priv;
-       EGwConnectionStatus status;
-       ECalComponent *comp;
-       GList *list = NULL, *l;
-       gboolean done = FALSE,  forward = FALSE;
-       gint cursor = 0;
-       guint32 total, num = 0;
-       gint percent = 0, i;
-       const gchar *position = E_GW_CURSOR_POSITION_END;
-       icalcomponent_kind kind;
-       const gchar *type;
-       EGwFilter* filter[3];
-       gchar l_str[26];
-       gchar h_str[26];
-       icaltimetype temp;
-       struct tm tm;
-       time_t h_time, l_time;
-
-       priv = cbgw->priv;
-       kind = e_cal_backend_get_kind (E_CAL_BACKEND (cbgw));
-       total = priv->total_count;
-
-       type = get_element_type (kind);
-
-       /* Fetch the data with a bias to present, near past/future */
-       temp = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
-       i = g_ascii_strtod (g_getenv ("PRELOAD_WINDOW_DAYS")? g_getenv ("PRELOAD_WINDOW_DAYS"):"15", NULL);
-       temp.day -= i;
-       icaltime_normalize (temp);
-       l_time = icaltime_as_timet_with_zone (temp, icaltimezone_get_utc_timezone ());
-       gmtime_r (&l_time, &tm);
-       strftime (l_str, 26, "%Y-%m-%dT%H:%M:%SZ", &tm);
-       temp.day += (2*i);
-       icaltime_normalize (temp);
-       h_time = icaltime_as_timet_with_zone (temp, icaltimezone_get_utc_timezone ());
-       gmtime_r (&h_time, &tm);
-       strftime (h_str, 26, "%Y-%m-%dT%H:%M:%SZ", &tm);
-
-       filter[0] = e_gw_filter_new ();
-       e_gw_filter_add_filter_component (filter[0], E_GW_FILTER_OP_GREATERTHAN_OR_EQUAL, "startDate", l_str);
-       e_gw_filter_add_filter_component (filter[0], E_GW_FILTER_OP_LESSTHAN_OR_EQUAL, "startDate", h_str);
-       e_gw_filter_add_filter_component (filter[0], E_GW_FILTER_OP_EQUAL, "@type", type);
-       e_gw_filter_group_conditions (filter[0], E_GW_FILTER_OP_AND, 3);
-       filter[1] = e_gw_filter_new ();
-       e_gw_filter_add_filter_component (filter[1], E_GW_FILTER_OP_GREATERTHAN, "startDate", h_str);
-       e_gw_filter_add_filter_component (filter[1], E_GW_FILTER_OP_EQUAL, "@type", type);
-       e_gw_filter_group_conditions (filter[1], E_GW_FILTER_OP_AND, 2);
-       filter[2] = e_gw_filter_new ();
-       e_gw_filter_add_filter_component (filter[2], E_GW_FILTER_OP_LESSTHAN, "startDate", l_str);
-       e_gw_filter_add_filter_component (filter[2], E_GW_FILTER_OP_EQUAL, "@type", type);
-       e_gw_filter_group_conditions (filter[2], E_GW_FILTER_OP_AND, 2);
-
-       for (i = 0; i < 3; i++) {
-               status = e_gw_connection_create_cursor (priv->cnc,
-                               priv->container_id,
-                               "recipients message recipientStatus attachments default peek", filter[i], &cursor);
-               if (status != E_GW_CONNECTION_STATUS_OK) {
-                       e_cal_backend_groupwise_notify_error_code (cbgw, status);
-                       return status;
-               }
-               done = FALSE;
-               if (i == 1) {
-                       position = E_GW_CURSOR_POSITION_START;
-                       forward = TRUE;
-
-               } else {
-                       position = E_GW_CURSOR_POSITION_END;
-                       forward = FALSE;
-               }
-
-               e_cal_backend_notify_view_progress_start (E_CAL_BACKEND (cbgw));
-
-               while (!done) {
-
-                       status = e_gw_connection_read_cursor (priv->cnc, priv->container_id, cursor, forward, CURSOR_ITEM_LIMIT, position, &list);
-                       if (status != E_GW_CONNECTION_STATUS_OK) {
-                               e_cal_backend_groupwise_notify_error_code (cbgw, status);
-                               return status;
-                       }
-                       for (l = list; l != NULL; l = g_list_next (l)) {
-                               EGwItem *item;
-
-                               item = E_GW_ITEM (l->data);
-                               comp = e_gw_item_to_cal_component (item, cbgw);
-                               g_object_unref (item);
-
-                               /* Show the progress information */
-                               num++;
-                               percent = ((gfloat) num/total) * 100;
-
-                               /* FIXME The total obtained from the server is wrong. Sometimes the num can
-                               be greater than the total. The following makes sure that the percentage is not >= 100 */
-
-                               if (percent > 100)
-                                       percent = 99;
-
-                               if (g_str_equal (type, "Appointment"))
-                                       e_cal_backend_notify_view_progress (E_CAL_BACKEND (cbgw), _("Loading Appointment items"), percent);
-                               else if (g_str_equal (type, "Task"))
-                                       e_cal_backend_notify_view_progress (E_CAL_BACKEND (cbgw), _("Loading Task items"), percent);
-                               else if (g_str_equal (type, "Note"))
-                                       e_cal_backend_notify_view_progress (E_CAL_BACKEND (cbgw), _("Loading Note items"), percent);
-                               else
-                                       e_cal_backend_notify_view_progress (E_CAL_BACKEND (cbgw), _("Loading items"), percent);
-
-                               if (E_IS_CAL_COMPONENT (comp)) {
-                                       gchar *comp_str;
-
-                                       e_cal_component_commit_sequence (comp);
-                                       comp_str = e_cal_component_get_as_string (comp);
-                                       e_cal_backend_notify_object_created (E_CAL_BACKEND (cbgw), (const gchar *) comp_str);
-                                       g_free (comp_str);
-                                       put_component_to_store (cbgw, comp);
-                                       g_object_unref (comp);
-                               }
-                       }
-
-                       if (!list  || g_list_length (list) == 0)
-                               done = TRUE;
-                       g_list_free (list);
-                       list = NULL;
-                       position = E_GW_CURSOR_POSITION_CURRENT;
-               }
-               e_gw_connection_destroy_cursor (priv->cnc, priv->container_id, cursor);
-               g_object_unref (filter[i]);
-       }
-       e_cal_backend_notify_view_progress (E_CAL_BACKEND (cbgw), "", 100);
-
-       return E_GW_CONNECTION_STATUS_OK;
-}
-
-typedef struct
-{
-       EGwItemCalId *calid;
-       ECalBackendStore *store;
-} CompareIdData;
-
-static gint
-compare_ids (gconstpointer a, gconstpointer b)
-{
-       ECalComponentId *cache_id = (ECalComponentId *) a;
-       CompareIdData *data = (CompareIdData *) b;
-       EGwItemCalId *calid = data->calid;
-       ECalBackendStore *store = data->store;
-
-       if (!calid->recur_key)
-               return g_strcmp0 (cache_id->uid, calid->ical_id);
-       else {
-               ECalComponent *comp;
-               gint ret = 1;
-               const gchar *cache_item_id;
-
-               if (strcmp (cache_id->uid, calid->recur_key))
-                       return 1;
-
-               comp = e_cal_backend_store_get_component (store, cache_id->uid, cache_id->rid);
-               cache_item_id = e_cal_component_get_gw_id (comp);
-               if (!strcmp (cache_item_id, calid->item_id))
-                       ret = 0;
-
-               g_object_unref (comp);
-               return ret;
-       }
-}
-
-#define ATTEMPTS_KEY "attempts"
-
-static gboolean
-get_deltas (gpointer handle)
-{
-       ECalBackendGroupwise *cbgw;
-       ECalBackendGroupwisePrivate *priv;
-       EGwConnection *cnc;
-       ECalBackendStore *store;
-       EGwConnectionStatus status;
-       icalcomponent_kind kind;
-       GList *item_list = NULL, *total_list = NULL, *l;
-       GSList *cache_ids = NULL, *ls;
-       GPtrArray *uid_array = NULL;
-       gchar t_str[26];
-       const gchar *local_utc_time = NULL, *time_string = NULL, *serv_time, *position;
-       gchar *attempts;
-       icaltimetype current;
-       EGwFilter *filter;
-       gboolean done = FALSE;
-       gint cursor = 0;
-       struct tm tm;
-       time_t current_time;
-       gboolean needs_to_get = FALSE;
-
-       if (!handle)
-               return FALSE;
-
-       cbgw = (ECalBackendGroupwise *) handle;
-       priv = cbgw->priv;
-       if (priv->mode == CAL_MODE_LOCAL)
-               return FALSE;
-
-       kind = e_cal_backend_get_kind (E_CAL_BACKEND (cbgw));
-       cnc = priv->cnc;
-
-       store = priv->store;
-       item_list = NULL;
-
-       attempts = g_strdup (e_cal_backend_store_get_key_value (store, ATTEMPTS_KEY));
-
-       serv_time = e_cal_backend_store_get_key_value (store, SERVER_UTC_TIME);
-       if (serv_time) {
-               time_string = e_cal_backend_store_get_key_value (store, SERVER_UTC_TIME);
-               if (!time_string || !*time_string)
-                       time_string = e_gw_connection_get_server_time (priv->cnc);
-       } else
-               time_string = e_gw_connection_get_server_time (priv->cnc);
-
-       filter = e_gw_filter_new ();
-       /* Items modified after the time-stamp */
-       e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_GREATERTHAN, "modified", time_string);
-       e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_EQUAL, "@type", get_element_type (kind));
-       e_gw_filter_group_conditions (filter, E_GW_FILTER_OP_AND, 2);
-
-       status = e_gw_connection_get_items (cnc, priv->container_id, "attachments recipients message recipientStatus default peek", filter, &item_list);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               status = e_gw_connection_get_items (cnc, priv->container_id, "attachments recipients message recipientStatus default peek", filter, &item_list);
-
-       g_object_unref (filter);
-
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-
-               gint failures;
-
-               if (!attempts)
-                       failures = 2;
-               else
-                       failures = g_ascii_strtod (attempts, NULL) + 1;
-               g_free (attempts);
-               attempts = g_strdup_printf ("%d", failures);
-               e_cal_backend_store_put_key_value (store, ATTEMPTS_KEY, attempts);
-               g_free (attempts);
-
-               return TRUE;
-       }
-
-       e_cal_backend_store_freeze_changes (store);
-
-       for (; item_list != NULL; item_list = g_list_next (item_list)) {
-               EGwItem *item = NULL;
-               ECalComponent *modified_comp = NULL, *cache_comp = NULL;
-               gchar *cache_comp_str = NULL, *modif_comp_str, *rid = NULL;
-               icaltimetype *tt = NULL, *c_tt = NULL;
-               const gchar *uid;
-
-               item = E_GW_ITEM (item_list->data);
-               modified_comp = e_gw_item_to_cal_component (item, cbgw);
-               if (!modified_comp) {
-                       continue;
-               }
-               if (e_gw_item_get_recurrence_key (item) != 0)
-                       rid = e_cal_component_get_recurid_as_string (modified_comp);
-
-               e_cal_component_get_uid (modified_comp, &uid);
-               cache_comp = e_cal_backend_store_get_component (store, uid, rid);
-               g_free (rid);
-               e_cal_component_commit_sequence (modified_comp);
-
-               e_cal_component_get_last_modified (modified_comp, &tt);
-
-               if (cache_comp) {
-                       e_cal_component_get_last_modified (cache_comp, &c_tt);
-                       e_cal_component_commit_sequence (cache_comp);
-               }
-
-               if (!c_tt || icaltime_compare (*tt, *c_tt) == 1)
-               {
-                       modif_comp_str = e_cal_component_get_as_string (modified_comp);
-
-                       if (cache_comp) {
-                               cache_comp_str = e_cal_component_get_as_string (cache_comp);
-                               e_cal_backend_notify_object_modified (E_CAL_BACKEND (cbgw), cache_comp_str, modif_comp_str);
-                       } else {
-                               e_cal_backend_notify_object_created (E_CAL_BACKEND (cbgw), modif_comp_str);
-                       }
-
-                       g_free (modif_comp_str);
-                       g_free (cache_comp_str);
-                       cache_comp_str = NULL;
-                       put_component_to_store (cbgw, modified_comp);
-               }
-
-               e_cal_component_free_icaltimetype (tt);
-
-               if (c_tt)
-                       e_cal_component_free_icaltimetype (c_tt);
-               g_object_unref (item);
-               g_object_unref (modified_comp);
-
-               if (cache_comp)
-                       g_object_unref (cache_comp);
-       }
-       e_cal_backend_store_thaw_changes (store);
-
-       /* Server utc time is the time when we lasted updated changes from server. local_utc_time is the system utc time. As
-          there is no way to get the server time on demand, we use the store system utc time to calculate server's time */
-       local_utc_time = e_cal_backend_store_get_key_value (store, LOCAL_UTC_TIME);
-       current = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
-
-       if (priv->first_delta_fetch || !local_utc_time || !*local_utc_time) {
-               e_cal_backend_store_put_key_value (store, SERVER_UTC_TIME, e_gw_connection_get_server_time (cnc));
-       } else {
-               icaltimetype old_local, server_utc;
-               struct icaldurationtype dur;
-
-               old_local = icaltime_from_string (local_utc_time);
-
-               dur = icaltime_subtract (current, old_local);
-               server_utc = icaltime_from_string (time_string);
-               icaltime_adjust (&server_utc, dur.days, dur.hours, dur.minutes, dur.seconds);
-
-               current_time = icaltime_as_timet_with_zone (server_utc, icaltimezone_get_utc_timezone ());
-               gmtime_r (&current_time, &tm);
-
-               strftime (t_str, 26, "%Y-%m-%dT%H:%M:%SZ", &tm);
-               time_string = t_str;
-
-               e_cal_backend_store_put_key_value (store, SERVER_UTC_TIME, time_string);
-       }
-
-       priv->first_delta_fetch = FALSE;
-
-       current_time = icaltime_as_timet_with_zone (current, icaltimezone_get_utc_timezone ());
-       gmtime_r (&current_time, &tm);
-       strftime (t_str, 26, "%Y-%m-%dT%H:%M:%SZ", &tm);
-       time_string = t_str;
-       e_cal_backend_store_put_key_value (store, LOCAL_UTC_TIME, time_string);
-
-       if (attempts) {
-               e_cal_backend_store_put_key_value (store, ATTEMPTS_KEY, NULL);
-               g_free (attempts);
-       }
-
-       if (item_list) {
-               g_list_free (item_list);
-               item_list = NULL;
-       }
-
-       /* handle deleted items here by going over the entire cache and
-        * checking for deleted items.*/
-       position = E_GW_CURSOR_POSITION_END;
-       cursor = 0;
-       filter = e_gw_filter_new ();
-       e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_EQUAL, "@type", get_element_type (kind));
-
-       status = e_gw_connection_create_cursor (cnc, priv->container_id, "id iCalId recurrenceKey startDate", filter, &cursor);
-
-       g_object_unref (filter);
-
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               if (status == E_GW_CONNECTION_STATUS_NO_RESPONSE) {
-                       return TRUE;
-               }
-
-               e_cal_backend_groupwise_notify_error_code (cbgw, status);
-               return TRUE;
-       }
-
-       cache_ids = e_cal_backend_store_get_component_ids (store);
-
-       done = FALSE;
-       while (!done) {
-               status = e_gw_connection_read_cal_ids (cnc, priv->container_id, cursor, FALSE, CURSOR_ICALID_LIMIT, position, &item_list);
-               if (status != E_GW_CONNECTION_STATUS_OK) {
-                       if (status == E_GW_CONNECTION_STATUS_NO_RESPONSE) {
-                               goto err_done;
-                       }
-                       e_cal_backend_groupwise_notify_error_code (cbgw, status);
-                       goto err_done;
-               }
-
-               if (!item_list  || g_list_length (item_list) == 0)
-                       done = TRUE;
-               else {
-                       if (!total_list)
-                               total_list = item_list;
-                       else
-                               total_list = g_list_concat (total_list, item_list);
-               }
-
-               item_list = NULL;
-
-               position = E_GW_CURSOR_POSITION_CURRENT;
-
-       }
-       e_gw_connection_destroy_cursor (cnc, priv->container_id, cursor);
-       e_cal_backend_store_freeze_changes (store);
-
-       uid_array = g_ptr_array_new ();
-       for (l = total_list; l != NULL; l = g_list_next (l)) {
-               EGwItemCalId *calid = (EGwItemCalId *)  l->data;
-               GSList *remove = NULL;
-               CompareIdData data;
-
-               data.calid = calid;
-               data.store = store;
-
-               if (!(remove = g_slist_find_custom (cache_ids, &data,  (GCompareFunc) compare_ids))) {
-                       g_ptr_array_add (uid_array, g_strdup (calid->item_id));
-                       needs_to_get = TRUE;
-               } else  {
-                       cache_ids = g_slist_remove_link (cache_ids, remove);
-                       e_cal_component_free_id (remove->data);
-               }
-       }
-
-       for (ls = cache_ids; ls; ls = g_slist_next (ls)) {
-               ECalComponent *comp = NULL;
-               icalcomponent *icalcomp = NULL;
-               ECalComponentId *id = ls->data;
-
-               comp = e_cal_backend_store_get_component (store, id->uid, id->rid);
-
-               if (!comp)
-                       continue;
-
-               icalcomp = e_cal_component_get_icalcomponent (comp);
-               if (kind == icalcomponent_isa (icalcomp)) {
-                       gchar *comp_str = NULL;
-                       ECalComponentId *id = e_cal_component_get_id (comp);
-
-                       comp_str = e_cal_component_get_as_string (comp);
-                       e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbgw),
-                                       id, comp_str, NULL);
-                       e_cal_backend_store_remove_component (store, id->uid, id->rid);
-
-                       e_cal_component_free_id (id);
-                       g_free (comp_str);
-               }
-               g_object_unref (comp);
-       }
-
-       if (needs_to_get) {
-               e_gw_connection_get_items_from_ids (
-                       cnc, priv->container_id,
-                       "attachments recipients message recipientStatus recurrenceKey default peek",
-                       uid_array, &item_list);
-
-               for (l = item_list; l != NULL; l = l->next) {
-                       ECalComponent *comp = NULL;
-                       EGwItem *item = NULL;
-                       gchar *tmp = NULL;
-
-                       item = (EGwItem *) l->data;
-                       comp = e_gw_item_to_cal_component (item, cbgw);
-                       if (comp) {
-                               e_cal_component_commit_sequence (comp);
-                               put_component_to_store (cbgw, comp);
-                               if (kind == icalcomponent_isa (e_cal_component_get_icalcomponent (comp))) {
-                                       tmp = e_cal_component_get_as_string (comp);
-                                       e_cal_backend_notify_object_created (E_CAL_BACKEND (cbgw), tmp);
-                                       g_free (tmp);
-                               }
-                               g_object_unref (comp);
-                       }
-
-                       g_object_unref (item);
-               }
-       }
-
-       e_cal_backend_store_thaw_changes (store);
-
-       g_ptr_array_foreach (uid_array, (GFunc) g_free, NULL);
-       g_ptr_array_free (uid_array, TRUE);
-
- err_done:
-       if (item_list) {
-               g_list_free (item_list);
-               item_list = NULL;
-       }
-
-       if (total_list) {
-               g_list_foreach (total_list, (GFunc) e_gw_item_free_cal_id, NULL);
-               g_list_free (total_list);
-       }
-
-       if (cache_ids) {
-               g_slist_foreach (cache_ids, (GFunc) e_cal_component_free_id, NULL);
-               g_slist_free (cache_ids);
-       }
-
-       return TRUE;
-}
-
-static guint
-get_cache_refresh_interval (ECalBackendGroupwise *cbgw)
-{
-       guint time_interval;
-       const gchar *time_interval_string = NULL;
-       gchar *temp = NULL;
-       ECalBackend *backend = E_CAL_BACKEND (cbgw);
-       ESource *source;
-
-       time_interval = CACHE_REFRESH_INTERVAL;
-       source = e_cal_backend_get_source (backend);
-
-       time_interval_string = g_getenv ("GETQM_TIME_INTERVAL");
-
-       if (!time_interval_string)
-               time_interval_string = temp = e_source_get_duped_property (source, "refresh");
-
-       if (time_interval_string) {
-               time_interval = g_ascii_strtod (time_interval_string, NULL);
-               time_interval *= (60*1000);
-       }
-
-       g_free (temp);
-
-       return time_interval;
-}
-
-static gpointer
-delta_thread (gpointer data)
-{
-       ECalBackendGroupwise *cbgw = data;
-       ECalBackendGroupwisePrivate *priv = cbgw->priv;
-       GTimeVal timeout;
-
-       timeout.tv_sec = 0;
-       timeout.tv_usec = 0;
-
-       while (TRUE)    {
-               gboolean succeeded = get_deltas (cbgw);
-
-               g_mutex_lock (priv->dlock->mutex);
-
-               if (!succeeded || priv->dlock->exit)
-                       break;
-
-               g_get_current_time (&timeout);
-               g_time_val_add (&timeout, get_cache_refresh_interval (cbgw) * 1000);
-               g_cond_timed_wait (priv->dlock->cond, priv->dlock->mutex, &timeout);
-
-               if (priv->dlock->exit)
-                       break;
-
-               g_mutex_unlock (priv->dlock->mutex);
-       }
-
-       g_mutex_unlock (priv->dlock->mutex);
-       priv->dthread = NULL;
-       return NULL;
-}
-
-static gboolean
-fetch_deltas (ECalBackendGroupwise *cbgw)
-{
-       ECalBackendGroupwisePrivate *priv = cbgw->priv;
-       GError *error = NULL;
-
-       /* If the thread is already running just return back */
-       if (priv->dthread)
-               return FALSE;
-
-       if (!priv->dlock) {
-               priv->dlock = g_new0 (SyncDelta, 1);
-               priv->dlock->mutex = g_mutex_new ();
-               priv->dlock->cond = g_cond_new ();
-       }
-
-       priv->dlock->exit = FALSE;
-       priv->dthread = g_thread_create ((GThreadFunc) delta_thread, cbgw, TRUE, &error);
-       if (!priv->dthread) {
-               g_warning (G_STRLOC ": %s", error->message);
-               g_error_free (error);
-       }
-
-       return TRUE;
-}
-
-static gboolean
-start_fetch_deltas (gpointer data)
-{
-       ECalBackendGroupwise *cbgw = data;
-
-       fetch_deltas (cbgw);
-
-       cbgw->priv->timeout_id = 0;
-       return FALSE;
-}
-
-#if 0
-/* TODO call it when a user presses SEND/RECEIVE or refresh*/
-static void
-e_cal_backend_groupwise_refresh_calendar (ECalBackendGroupwise *cbgw)
-{
-       ECalBackendGroupwisePrivate *priv = cbgw->priv;
-       gboolean delta_started = FALSE;
-
-       if (priv->mode == CAL_MODE_LOCAL)
-               return;
-
-       PRIV_LOCK (priv);
-       delta_started = fetch_deltas (cbgw);
-       PRIV_UNLOCK (priv);
-
-       /* Emit the signal if the delta is already running */
-       if (!delta_started)
-               g_cond_signal (priv->dlock->cond);
-}
-#endif
-
-static gchar *
-form_uri (ESource *source)
-{
-       gchar *uri;
-       const gchar *port;
-       gchar *formed_uri;
-       const gchar *use_ssl;
-
-       EUri *parsed_uri;
-
-       uri = e_source_get_uri (source);
-       if (uri == NULL)
-               return NULL;
-
-       parsed_uri = e_uri_new (uri);
-       if (parsed_uri == NULL)
-               return NULL;
-
-       port = e_source_get_property (source, "port");
-       if (port == NULL)
-               port = "7191";
-       use_ssl = e_source_get_property (source, "use_ssl");
-
-       if (use_ssl && !g_str_equal (use_ssl, "never"))
-               formed_uri = g_strconcat ("https://", parsed_uri->host,":", port, "/soap", NULL );
-       else
-               formed_uri = g_strconcat ("http://", parsed_uri->host,":", port, "/soap", NULL );
-
-       g_free (uri);
-       e_uri_free (parsed_uri);
-       return formed_uri;
-
-}
-
-static gpointer
-cache_init (ECalBackendGroupwise *cbgw)
-{
-       ECalBackendGroupwisePrivate *priv = cbgw->priv;
-       EGwConnectionStatus cnc_status;
-       EGwSendOptions *opts;
-
-       cnc_status = e_gw_connection_get_settings (priv->cnc, &opts);
-       if (cnc_status == E_GW_CONNECTION_STATUS_OK) {
-               GwSettings *hold = g_new0 (GwSettings, 1);
-
-               hold->cbgw = cbgw;
-               hold->opts = opts;
-
-               /* We now sync the sendoptions into e-source using the GLIB main loop. Doing this operation
-                   in a thread causes crashes. */
-               priv->sendoptions_sync_timeout = g_idle_add ((GSourceFunc ) e_cal_backend_groupwise_store_settings, hold);
-       } else
-               g_warning (G_STRLOC ": Could not get the settings from the server");
-
-       /* get the list of category ids and corresponding names from the server */
-       cnc_status = e_gw_connection_get_categories (priv->cnc, &priv->categories_by_id, &priv->categories_by_name);
-       if (cnc_status != E_GW_CONNECTION_STATUS_OK) {
-               g_warning (G_STRLOC ": Could not get the categories from the server");
-       }
-
-       priv->mode = CAL_MODE_REMOTE;
-
-       /* We poke the cache for a default timezone. Its
-        * absence indicates that the cache file has not been
-        * populated before. */
-       if (!e_cal_backend_store_get_key_value (priv->store, CACHE_MARKER)) {
-               /* Populate the cache for the first time.*/
-               /* start a timed polling thread set to 1 minute*/
-               cnc_status = populate_cache (cbgw);
-               if (cnc_status != E_GW_CONNECTION_STATUS_OK) {
-                       g_warning (G_STRLOC ": Could not populate the cache");
-                       /*FIXME  why dont we do a notify here */
-                       return NULL;
-               } else {
-                       gint time_interval;
-                       gchar *utc_str;
-
-                       time_interval = get_cache_refresh_interval (cbgw);
-                       utc_str = (gchar *) e_gw_connection_get_server_time (priv->cnc);
-                       e_cal_backend_store_put_key_value (priv->store, CACHE_MARKER, "1");
-                       e_cal_backend_store_put_key_value (priv->store, SERVER_UTC_TIME, utc_str);
-
-                       priv->timeout_id = g_timeout_add (time_interval, start_fetch_deltas, cbgw);
-
-                       return NULL;
-               }
-       }
-
-       PRIV_LOCK (priv);
-       fetch_deltas (cbgw);
-       PRIV_UNLOCK (priv);
-
-       return NULL;
-}
-
-static gboolean
-set_container_id_with_count (ECalBackendGroupwise *cbgw, GError **perror)
-{
-       ECalBackendGroupwisePrivate *priv;
-       GList *container_list = NULL, *l;
-       EGwConnectionStatus status;
-       icalcomponent_kind kind;
-
-       priv = cbgw->priv;
-
-       kind = e_cal_backend_get_kind (E_CAL_BACKEND (cbgw));
-
-       switch (kind) {
-       case ICAL_VEVENT_COMPONENT:
-       case ICAL_VTODO_COMPONENT:
-       case ICAL_VJOURNAL_COMPONENT:
-               e_source_set_name (e_cal_backend_get_source (E_CAL_BACKEND (cbgw)), _("Calendar"));
-               break;
-       default:
-               priv->container_id = NULL;
-               g_propagate_error (perror, EDC_ERROR (UnsupportedMethod));
-               return FALSE;
-       }
-
-       status = e_gw_connection_get_container_list (priv->cnc, "folders", &container_list);
-
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               status = e_gw_connection_get_container_list (priv->cnc, "folders", &container_list);
-
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               g_propagate_error (perror, EDC_ERROR_FAILED_STATUS (OtherError, status));
-               return FALSE;
-       }
-
-       for (l = container_list; l != NULL; l = l->next) {
-               EGwContainer *container = E_GW_CONTAINER (l->data);
-
-               if (e_gw_container_get_is_system_folder (container) &&
-                               e_gw_container_get_container_type (container) == E_GW_CONTAINER_TYPE_CALENDAR) {
-
-                       priv->container_id = g_strdup (e_gw_container_get_id (container));
-                       priv->total_count = e_gw_container_get_total_count (container);
-                       break;
-               }
-       }
-
-       if (l == NULL) {
-               g_propagate_error (perror, EDC_ERROR (ObjectNotFound));
-               return FALSE;
-       }
-
-       e_gw_connection_free_container_list (container_list);
-
-       return TRUE;
-}
-
-static void
-connect_to_server (ECalBackendGroupwise *cbgw, GError **perror)
-{
-       gchar *real_uri;
-       ECalBackendGroupwisePrivate *priv;
-       ESource *source;
-       const gchar *use_ssl;
-       gchar *http_uri;
-       gint permissions;
-       GThread *thread;
-       GError *error = NULL;
-       gchar *parent_user = NULL;
-       icalcomponent_kind kind;
-       EGwConnectionErrors errors;
-       priv = cbgw->priv;
-
-       source = e_cal_backend_get_source (E_CAL_BACKEND (cbgw));
-       real_uri = NULL;
-       if (source)
-               real_uri = form_uri (source);
-       use_ssl = e_source_get_property (source, "use_ssl");
-
-       if (!real_uri) {
-               g_propagate_error (perror, EDC_ERROR_EX (NoSuchCal, _("Invalid server URI")));
-               return;
-       }
-
-       errors.status = E_GW_CONNECTION_STATUS_OK;
-       errors.description = NULL;
-
-       kind = e_cal_backend_get_kind (E_CAL_BACKEND (cbgw));
-
-       parent_user = (gchar *) e_source_get_property (source, "parent_id_name");
-       /* create connection to server */
-       if (parent_user) {
-               EGwConnection *cnc;
-               /* create connection to server */
-               cnc = e_gw_connection_new (real_uri, parent_user, priv->password);
-               if (!E_IS_GW_CONNECTION(cnc) && use_ssl && g_str_equal (use_ssl, "when-possible")) {
-                       http_uri = g_strconcat ("http://", real_uri + 8, NULL);
-                       cnc = e_gw_connection_new (http_uri, parent_user, priv->password);
-                       g_free (http_uri);
-               }
-
-               if (!cnc) {
-                       g_propagate_error (perror, EDC_ERROR (AuthenticationFailed));
-                       return;
-               }
-
-               priv->cnc = e_gw_connection_get_proxy_connection (cnc, parent_user, priv->password, priv->username, &permissions);
-
-               g_object_unref (cnc);
-
-               if (!priv->cnc) {
-                       g_propagate_error (perror, EDC_ERROR (AuthenticationFailed));
-                       return;
-               }
-
-               cbgw->priv->read_only = TRUE;
-
-               if (kind == ICAL_VEVENT_COMPONENT && (permissions & E_GW_PROXY_APPOINTMENT_WRITE) )
-                       cbgw->priv->read_only = FALSE;
-               else if (kind == ICAL_VTODO_COMPONENT && (permissions & E_GW_PROXY_TASK_WRITE))
-                       cbgw->priv->read_only = FALSE;
-               else if (kind == ICAL_VJOURNAL_COMPONENT && (permissions & E_GW_PROXY_NOTES_WRITE))
-                       cbgw->priv->read_only = FALSE;
-
-       } else {
-
-               priv->cnc = e_gw_connection_new_with_error_handler ( real_uri, priv->username, priv->password, &errors);
-
-               if (!E_IS_GW_CONNECTION(priv->cnc) && use_ssl && g_str_equal (use_ssl, "when-possible")) {
-                       http_uri = g_strconcat ("http://", real_uri + 8, NULL);
-                       priv->cnc = e_gw_connection_new_with_error_handler (http_uri, priv->username, priv->password, &errors);
-                       g_free (http_uri);
-               }
-               cbgw->priv->read_only = FALSE;
-       }
-       g_free (real_uri);
-
-       if (priv->cnc ) {
-               if (priv->store && priv->container_id) {
-                       priv->mode = CAL_MODE_REMOTE;
-                       if (priv->mode_changed && !priv->dthread) {
-                               priv->mode_changed = FALSE;
-                               fetch_deltas (cbgw);
-                       }
-
-                       return;
-               }
-       } else {
-               if (errors.status == E_GW_CONNECTION_STATUS_INVALID_PASSWORD) {
-                       g_propagate_error (perror, EDC_ERROR (AuthenticationFailed));
-                       return;
-               } else if (errors.status == E_GW_CONNECTION_STATUS_UNKNOWN) {
-                       g_propagate_error (perror,EDC_ERROR (OtherError));
-                       return;
-               }
-
-               g_propagate_error (perror, EDC_ERROR_EX (OtherError, _(errors.description)));
-               if (errors.description)
-                       g_free (errors.description);
-               return;
-       }
-       priv->mode_changed = FALSE;
-
-       if (E_IS_GW_CONNECTION (priv->cnc)) {
-               ECalBackend *backend;
-               const gchar *cache_dir;
-
-               /* get the ID for the container */
-               if (priv->container_id)
-                       g_free (priv->container_id);
-
-               if (!set_container_id_with_count (cbgw, perror)) {
-                       return;
-               }
-
-               backend = E_CAL_BACKEND (cbgw);
-               cache_dir = e_cal_backend_get_cache_dir (backend);
-
-               e_cal_backend_cache_remove (cache_dir, "cache.xml");
-               priv->store = e_cal_backend_file_store_new (cache_dir);
-               if (!priv->store) {
-                       g_propagate_error (perror, EDC_ERROR_EX (OtherError, _("Could not create cache file")));
-                       return;
-               }
-
-               e_cal_backend_store_load (priv->store);
-
-               /* spawn a new thread for opening the calendar */
-               thread = g_thread_create ((GThreadFunc) cache_init, cbgw, FALSE, &error);
-               if (!thread) {
-                       g_warning (G_STRLOC ": %s", error->message);
-                       g_error_free (error);
-
-                       g_propagate_error (perror, EDC_ERROR_EX (OtherError, _("Could not create thread for populating cache")));
-                       return;
-               }
-
-       } else {
-               g_propagate_error (perror, EDC_ERROR (AuthenticationFailed));
-               return;
-       }
-
-       if (!e_gw_connection_get_version (priv->cnc)) {
-               g_propagate_error (perror, EDC_ERROR (InvalidServerVersion));
-       }
-}
-
-/* Finalize handler for the file backend */
-static void
-e_cal_backend_groupwise_finalize (GObject *object)
-{
-       ECalBackendGroupwise *cbgw;
-       ECalBackendGroupwisePrivate *priv;
-
-       g_return_if_fail (object != NULL);
-       g_return_if_fail (E_IS_CAL_BACKEND_GROUPWISE (object));
-
-       cbgw = E_CAL_BACKEND_GROUPWISE (object);
-       priv = cbgw->priv;
-
-       /* Clean up */
-
-       if (priv->timeout_id) {
-               g_source_remove (priv->timeout_id);
-               priv->timeout_id = 0;
-       }
-
-       if (priv->dlock) {
-               g_mutex_lock (priv->dlock->mutex);
-               priv->dlock->exit = TRUE;
-               g_mutex_unlock (priv->dlock->mutex);
-
-               g_cond_signal (priv->dlock->cond);
-
-               if (priv->dthread)
-                       g_thread_join (priv->dthread);
-
-               g_mutex_free (priv->dlock->mutex);
-               g_cond_free (priv->dlock->cond);
-               g_free (priv->dlock);
-               priv->dthread = NULL;
-       }
-
-       g_static_rec_mutex_free (&priv->rec_mutex);
-
-       if (priv->cnc) {
-               g_object_unref (priv->cnc);
-               priv->cnc = NULL;
-       }
-
-       if (priv->store) {
-               g_object_unref (priv->store);
-               priv->store = NULL;
-       }
-
-       if (priv->username) {
-               g_free (priv->username);
-               priv->username = NULL;
-       }
-
-       if (priv->password) {
-               g_free (priv->password);
-               priv->password = NULL;
-       }
-
-       if (priv->container_id) {
-               g_free (priv->container_id);
-               priv->container_id = NULL;
-       }
-
-       if (priv->user_email) {
-               g_free (priv->user_email);
-               priv->user_email = NULL;
-       }
-
-       if (priv->sendoptions_sync_timeout) {
-               g_source_remove (priv->sendoptions_sync_timeout);
-               priv->sendoptions_sync_timeout = 0;
-       }
-
-       if (priv->default_zone) {
-               icaltimezone_free (priv->default_zone, 1);
-               priv->default_zone = NULL;
-       }
-
-       g_free (priv);
-       cbgw->priv = NULL;
-
-       /* Chain up to parent's finalize() method. */
-       G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/* Calendar backend methods */
-
-/* Is_read_only handler for the file backend */
-static void
-e_cal_backend_groupwise_is_read_only (ECalBackendSync *backend, EDataCal *cal, gboolean *read_only, GError **perror)
-{
-       ECalBackendGroupwise *cbgw;
-
-       cbgw = E_CAL_BACKEND_GROUPWISE (backend);
-       *read_only = cbgw->priv->read_only;
-}
-
-/* return email address of the person who opened the calendar */
-static void
-e_cal_backend_groupwise_get_cal_address (ECalBackendSync *backend, EDataCal *cal, gchar **address, GError **perror)
-{
-       ECalBackendGroupwise *cbgw;
-       ECalBackendGroupwisePrivate *priv;
-
-       cbgw = E_CAL_BACKEND_GROUPWISE (backend);
-       priv = cbgw->priv;
-
-       if (priv->mode == CAL_MODE_REMOTE) {
-               if (priv->user_email)
-                       g_free (priv->user_email);
-
-               priv->user_email = g_strdup (e_gw_connection_get_user_email (cbgw->priv->cnc));
-       }
-
-       *address = g_strdup (priv->user_email);
-}
-
-static void
-e_cal_backend_groupwise_get_ldap_attribute (ECalBackendSync *backend, EDataCal *cal, gchar **attribute, GError **perror)
-{
-       /* ldap attribute is specific to Sun ONE connector to get free busy information*/
-       /* retun NULL here as group wise backend know how to get free busy information */
-
-       *attribute = NULL;
-}
-
-static void
-e_cal_backend_groupwise_get_alarm_email_address (ECalBackendSync *backend, EDataCal *cal, gchar **address, GError **perror)
-{
-       /*group wise does not support email based alarms */
-
-       *address = NULL;
-}
-
-static void
-e_cal_backend_groupwise_get_static_capabilities (ECalBackendSync *backend, EDataCal *cal, gchar **capabilities, GError **perror)
-{
-       *capabilities = g_strdup (CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS ","
-                                 CAL_STATIC_CAPABILITY_ONE_ALARM_ONLY ","
-                                 CAL_STATIC_CAPABILITY_REMOVE_ALARMS ","
-                                 CAL_STATIC_CAPABILITY_NO_THISANDPRIOR ","
-                                 CAL_STATIC_CAPABILITY_NO_THISANDFUTURE ","
-                                 CAL_STATIC_CAPABILITY_NO_CONV_TO_ASSIGN_TASK ","
-                                 CAL_STATIC_CAPABILITY_NO_CONV_TO_RECUR ","
-                                 CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS ","
-                                 CAL_STATIC_CAPABILITY_SAVE_SCHEDULES ","
-                                 CAL_STATIC_CAPABILITY_ORGANIZER_MUST_ACCEPT ","
-                                 CAL_STATIC_CAPABILITY_DELEGATE_SUPPORTED ","
-                                 CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY ","
-                                 CAL_STATIC_CAPABILITY_NO_ORGANIZER ","
-                                 CAL_STATIC_CAPABILITY_RECURRENCES_NO_MASTER ","
-                                 CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING ","
-                                 CAL_STATIC_CAPABILITY_SAVE_SCHEDULES);
-}
-
-static void
-in_offline (ECalBackendGroupwise *cbgw) {
-       ECalBackendGroupwisePrivate *priv;
-
-       priv= cbgw->priv;
-       priv->read_only = TRUE;
-
-       if (priv->dlock) {
-               g_mutex_lock (priv->dlock->mutex);
-               priv->dlock->exit = TRUE;
-               g_mutex_unlock (priv->dlock->mutex);
-
-               g_cond_signal (priv->dlock->cond);
-       }
-
-       if (priv->timeout_id) {
-               g_source_remove (priv->timeout_id);
-               priv->timeout_id = 0;
-       }
-
-       if (priv->cnc) {
-               g_object_unref (priv->cnc);
-               priv->cnc = NULL;
-       }
-
-}
-
-/* Open handler for the file backend */
-static void
-e_cal_backend_groupwise_open (ECalBackendSync *backend, EDataCal *cal, gboolean only_if_exists,
-                             const gchar *username, const gchar *password, GError **perror)
-{
-       ECalBackendGroupwise *cbgw;
-       ECalBackendGroupwisePrivate *priv;
-       const gchar *cache_dir;
-
-       cbgw = E_CAL_BACKEND_GROUPWISE (backend);
-       priv = cbgw->priv;
-
-       cache_dir = e_cal_backend_get_cache_dir (E_CAL_BACKEND (backend));
-
-       PRIV_LOCK (priv);
-
-       cbgw->priv->read_only = FALSE;
-
-       if (priv->mode == CAL_MODE_LOCAL) {
-               ESource *esource;
-               const gchar *display_contents = NULL;
-
-               cbgw->priv->read_only = TRUE;
-               esource = e_cal_backend_get_source (E_CAL_BACKEND (cbgw));
-               display_contents = e_source_get_property (esource, "offline_sync");
-
-               if (!display_contents || !g_str_equal (display_contents, "1")) {
-                       PRIV_UNLOCK (priv);
-                       g_propagate_error (perror, EDC_ERROR (RepositoryOffline));
-                       return;
-               }
-
-               if (!priv->store) {
-                       /* remove the old cache while migrating to ECalBackendStore */
-                       e_cal_backend_cache_remove (cache_dir, "cache.xml");
-                       priv->store = e_cal_backend_file_store_new (cache_dir);
-                       if (!priv->store) {
-                               PRIV_UNLOCK (priv);
-                               g_propagate_error (perror, EDC_ERROR_EX (OtherError, _("Could not create cache file")));
-                               return;
-                       }
-               }
-
-               e_cal_backend_store_load (priv->store);
-               PRIV_UNLOCK (priv);
-               return;
-       }
-
-       priv->username = g_strdup (username);
-       priv->password = g_strdup (password);
-
-       /* FIXME: no need to set it online here when we implement the online/offline stuff correctly */
-       connect_to_server (cbgw, perror);
-
-       PRIV_UNLOCK (priv);
-}
-
-static void
-e_cal_backend_groupwise_remove (ECalBackendSync *backend, EDataCal *cal, GError **perror)
-{
-       ECalBackendGroupwise *cbgw;
-       ECalBackendGroupwisePrivate *priv;
-
-       cbgw = E_CAL_BACKEND_GROUPWISE (backend);
-       priv = cbgw->priv;
-
-       PRIV_LOCK (priv);
-
-       /* remove the cache */
-       if (priv->store)
-               e_cal_backend_store_remove (priv->store);
-
-       PRIV_UNLOCK (priv);
-}
-
-/* is_loaded handler for the file backend */
-static gboolean
-e_cal_backend_groupwise_is_loaded (ECalBackend *backend)
-{
-       ECalBackendGroupwise *cbgw;
-       ECalBackendGroupwisePrivate *priv;
-
-       cbgw = E_CAL_BACKEND_GROUPWISE (backend);
-       priv = cbgw->priv;
-
-       return priv->store ? TRUE : FALSE;
-}
-
-/* is_remote handler for the file backend */
-static CalMode
-e_cal_backend_groupwise_get_mode (ECalBackend *backend)
-{
-       ECalBackendGroupwise *cbgw;
-       ECalBackendGroupwisePrivate *priv;
-
-       cbgw = E_CAL_BACKEND_GROUPWISE (backend);
-       priv = cbgw->priv;
-
-       return priv->mode;
-}
-
-/* Set_mode handler for the file backend */
-static void
-e_cal_backend_groupwise_set_mode (ECalBackend *backend, CalMode mode)
-{
-       ECalBackendGroupwise *cbgw;
-       ECalBackendGroupwisePrivate *priv;
-
-       cbgw = E_CAL_BACKEND_GROUPWISE (backend);
-       priv = cbgw->priv;
-
-       if (priv->mode == mode) {
-               e_cal_backend_notify_mode (backend, ModeSet,
-                                          cal_mode_to_corba (mode));
-               return;
-       }
-
-       PRIV_LOCK (priv);
-
-       priv->mode_changed = TRUE;
-       switch (mode) {
-       case CAL_MODE_REMOTE :/* go online */
-               priv->mode = CAL_MODE_REMOTE;
-               priv->read_only = FALSE;
-               e_cal_backend_notify_mode (backend, ModeSet, Remote);
-               e_cal_backend_notify_readonly (backend, priv->read_only);
-               if (e_cal_backend_groupwise_is_loaded (backend))
-                             e_cal_backend_notify_auth_required (backend);
-               break;
-
-       case CAL_MODE_LOCAL : /* go offline */
-               /* FIXME: make sure we update the cache before closing the connection */
-               priv->mode = CAL_MODE_LOCAL;
-               in_offline (cbgw);
-               e_cal_backend_notify_readonly (backend, priv->read_only);
-               e_cal_backend_notify_mode (backend, ModeSet, Local);
-
-               break;
-       default :
-               e_cal_backend_notify_mode (backend, ModeNotSupported,
-                                          cal_mode_to_corba (mode));
-       }
-
-       PRIV_UNLOCK (priv);
-}
-
-static void
-e_cal_backend_groupwise_get_default_object (ECalBackendSync *backend, EDataCal *cal, gchar **object, GError **perror)
-{
-
-       ECalComponent *comp;
-
-       comp = e_cal_component_new ();
-
-       switch (e_cal_backend_get_kind (E_CAL_BACKEND (backend))) {
-       case ICAL_VEVENT_COMPONENT:
-               e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_EVENT);
-               break;
-       case ICAL_VTODO_COMPONENT:
-               e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_TODO);
-               break;
-       default:
-               g_object_unref (comp);
-               g_propagate_error (perror, EDC_ERROR (ObjectNotFound));
-               return;
-       }
-
-       *object = e_cal_component_get_as_string (comp);
-       g_object_unref (comp);
-}
-
-/* Get_object_component handler for the groupwise backend */
-static void
-e_cal_backend_groupwise_get_object (ECalBackendSync *backend, EDataCal *cal, const gchar *uid, const gchar *rid, gchar **object, GError **error)
-{
-       ECalComponent *comp;
-       ECalBackendGroupwisePrivate *priv;
-       ECalBackendGroupwise *cbgw = (ECalBackendGroupwise *) backend;
-
-       e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_GROUPWISE (cbgw), InvalidArg);
-
-       priv = cbgw->priv;
-
-       PRIV_LOCK (priv);
-
-       /* search the object in the cache */
-       comp = e_cal_backend_store_get_component (priv->store, uid, rid);
-       if (comp) {
-               PRIV_UNLOCK (priv);
-               if (e_cal_backend_get_kind (E_CAL_BACKEND (backend)) ==
-                   icalcomponent_isa (e_cal_component_get_icalcomponent (comp)))
-                       *object = e_cal_component_get_as_string (comp);
-               else
-                       *object = NULL;
-
-               g_object_unref (comp);
-
-               if (!*object)
-                       g_propagate_error (error, EDC_ERROR (ObjectNotFound));
-               return;
-       }
-
-       PRIV_UNLOCK (priv);
-
-       /* callers will never have a uuid that is in server but not in cache */
-       g_propagate_error (error, EDC_ERROR (ObjectNotFound));
-}
-
-/* Add_timezone handler for the groupwise backend */
-static void
-e_cal_backend_groupwise_add_timezone (ECalBackendSync *backend, EDataCal *cal, const gchar *tzobj, GError **error)
-{
-       icalcomponent *tz_comp;
-       ECalBackendGroupwise *cbgw;
-       ECalBackendGroupwisePrivate *priv;
-
-       cbgw = (ECalBackendGroupwise *) backend;
-
-       e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_GROUPWISE (cbgw), InvalidArg);
-       e_return_data_cal_error_if_fail (tzobj != NULL, InvalidArg);
-
-       priv = cbgw->priv;
-
-       tz_comp = icalparser_parse_string (tzobj);
-       if (!tz_comp) {
-               g_propagate_error (error, EDC_ERROR (InvalidObject));
-               return;
-       }
-
-       if (icalcomponent_isa (tz_comp) == ICAL_VTIMEZONE_COMPONENT) {
-               icaltimezone *zone;
-
-               zone = icaltimezone_new ();
-               icaltimezone_set_component (zone, tz_comp);
-               if (e_cal_backend_store_put_timezone (priv->store, zone) == FALSE) {
-                       icaltimezone_free (zone, 1);
-                       g_propagate_error (error, EDC_ERROR_EX (OtherError, "Put timezone failed"));
-                       return;
-               }
-               icaltimezone_free (zone, 1);
-       }
-}
-
-static void
-e_cal_backend_groupwise_set_default_zone (ECalBackendSync *backend, EDataCal *cal, const gchar *tzobj, GError **error)
-{
-       icalcomponent *tz_comp;
-       ECalBackendGroupwise *cbgw;
-       ECalBackendGroupwisePrivate *priv;
-       icaltimezone *zone;
-
-       cbgw = (ECalBackendGroupwise *) backend;
-
-       e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_GROUPWISE (cbgw), InvalidArg);
-       e_return_data_cal_error_if_fail (tzobj != NULL, InvalidArg);
-
-       priv = cbgw->priv;
-
-       tz_comp = icalparser_parse_string (tzobj);
-       if (!tz_comp) {
-               g_propagate_error (error, EDC_ERROR (InvalidObject));
-               return;
-       }
-
-       zone = icaltimezone_new ();
-       icaltimezone_set_component (zone, tz_comp);
-
-       PRIV_LOCK (priv);
-
-       if (priv->default_zone)
-               icaltimezone_free (priv->default_zone, 1);
-
-       /* Set the default timezone to it. */
-       priv->default_zone = zone;
-
-       PRIV_UNLOCK (priv);
-}
-
-/* Gets the list of attachments */
-static void
-e_cal_backend_groupwise_get_attachment_list (ECalBackendSync *backend, EDataCal *cal, const gchar *uid, const gchar *rid, GSList **list, GError **perror)
-{
-       /* TODO implement the function */
-}
-
-/* Get_objects_in_range handler for the groupwise backend */
-static void
-e_cal_backend_groupwise_get_object_list (ECalBackendSync *backend, EDataCal *cal, const gchar *sexp, GList **objects, GError **perror)
-{
-       ECalBackendGroupwise *cbgw;
-       ECalBackendGroupwisePrivate *priv;
-       GSList *components, *l;
-       ECalBackendSExp *cbsexp;
-       gboolean search_needed = TRUE;
-       time_t occur_start = -1, occur_end = -1;
-       gboolean prunning_by_time;
-
-       cbgw = E_CAL_BACKEND_GROUPWISE (backend);
-       priv = cbgw->priv;
-
-       if (!strcmp (sexp, "#t"))
-               search_needed = FALSE;
-
-       cbsexp = e_cal_backend_sexp_new (sexp);
-       if (!cbsexp) {
-               g_propagate_error (perror, EDC_ERROR (InvalidQuery));
-               return;
-       }
-
-       *objects = NULL;
-
-       prunning_by_time = e_cal_backend_sexp_evaluate_occur_times (cbsexp,
-                                                                           &occur_start,
-                                                                           &occur_end);
-       components = prunning_by_time ?
-               e_cal_backend_store_get_components_occuring_in_range (priv->store, occur_start, occur_end)
-               : e_cal_backend_store_get_components (priv->store);
-
-       for (l = components; l != NULL; l = l->next) {
-               ECalComponent *comp = E_CAL_COMPONENT (l->data);
-
-               if (e_cal_backend_get_kind (E_CAL_BACKEND (backend)) ==
-                   icalcomponent_isa (e_cal_component_get_icalcomponent (comp))) {
-                       if ((!search_needed) ||
-                           (e_cal_backend_sexp_match_comp (cbsexp, comp, E_CAL_BACKEND (backend)))) {
-                               *objects = g_list_append (*objects, e_cal_component_get_as_string (comp));
-                       }
-               }
-       }
-
-       g_object_unref (cbsexp);
-       g_slist_foreach (components, (GFunc) g_object_unref, NULL);
-       g_slist_free (components);
-}
-
-/* get_query handler for the groupwise backend */
-static void
-e_cal_backend_groupwise_start_query (ECalBackend *backend, EDataCalView *query)
-{
-       GList *objects = NULL;
-       GError *err = NULL;
-
-       e_cal_backend_groupwise_get_object_list (E_CAL_BACKEND_SYNC (backend), NULL,
-                                                         e_data_cal_view_get_text (query), &objects, &err);
-       if (err) {
-               e_data_cal_view_notify_done (query, err);
-               g_error_free (err);
-               return;
-       }
-
-       /* notify listeners of all objects */
-       if (objects) {
-               e_data_cal_view_notify_objects_added (query, (const GList *) objects);
-
-               /* free memory */
-               g_list_foreach (objects, (GFunc) g_free, NULL);
-               g_list_free (objects);
-       }
-
-       e_data_cal_view_notify_done (query, NULL);
-}
-
-/* Get_free_busy handler for the file backend */
-static void
-e_cal_backend_groupwise_get_free_busy (ECalBackendSync *backend, EDataCal *cal, GList *users,
-                                      time_t start, time_t end, GList **freebusy, GError **perror)
-{
-       EGwConnectionStatus status;
-       ECalBackendGroupwise *cbgw;
-
-       cbgw = E_CAL_BACKEND_GROUPWISE (backend);
-
-       if (cbgw->priv->mode == CAL_MODE_LOCAL) {
-               in_offline (cbgw);
-               g_propagate_error (perror, EDC_ERROR (RepositoryOffline));
-               return;
-       }
-
-       status = e_gw_connection_get_freebusy_info (cbgw, users, start, end, freebusy);
-
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               status = e_gw_connection_get_freebusy_info (cbgw, users, start, end, freebusy);
-
-       if (status != E_GW_CONNECTION_STATUS_OK)
-               g_propagate_error (perror, EDC_ERROR_FAILED_STATUS (OtherError, status));
-}
-
-typedef struct {
-       ECalBackendGroupwise *backend;
-       icalcomponent_kind kind;
-       GList *deletes;
-       EXmlHash *ehash;
-} ECalBackendGroupwiseComputeChangesData;
-
-static void
-e_cal_backend_groupwise_compute_changes_foreach_key (const gchar *key, const gchar *value, gpointer data)
-{
-       ECalBackendGroupwiseComputeChangesData *be_data = data;
-
-       if (!e_cal_backend_store_get_component (be_data->backend->priv->store, key, NULL)) {
-               ECalComponent *comp;
-
-               comp = e_cal_component_new ();
-               if (be_data->kind == ICAL_VTODO_COMPONENT)
-                       e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_TODO);
-               else
-                       e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_EVENT);
-
-               e_cal_component_set_uid (comp, key);
-               be_data->deletes = g_list_prepend (be_data->deletes, e_cal_component_get_as_string (comp));
-
-               e_xmlhash_remove (be_data->ehash, key);
-               g_object_unref (comp);
-       }
-}
-
-static void
-e_cal_backend_groupwise_compute_changes (ECalBackendGroupwise *cbgw, const gchar *change_id,
-                                        GList **adds, GList **modifies, GList **deletes, GError **perror)
-{
-       gchar    *filename;
-       EXmlHash *ehash;
-       ECalBackendGroupwiseComputeChangesData be_data;
-       GList *i, *list = NULL;
-       gchar *unescaped_uri;
-       GError *err = NULL;
-
-       /* FIXME Will this always work? */
-       unescaped_uri = g_uri_unescape_string (cbgw->priv->uri, "");
-       filename = g_strdup_printf ("%s-%s.db", unescaped_uri, change_id);
-       ehash = e_xmlhash_new (filename);
-       g_free (filename);
-       g_free (unescaped_uri);
-
-        e_cal_backend_groupwise_get_object_list (E_CAL_BACKEND_SYNC (cbgw), NULL, "#t", &list, &err);
-       if (err) {
-               g_propagate_error (perror, err);
-               return;
-       }
-
-        /* Calculate adds and modifies */
-       for (i = list; i != NULL; i = g_list_next (i)) {
-               const gchar *uid;
-               gchar *calobj;
-               ECalComponent *comp;
-
-               comp = e_cal_component_new_from_string (i->data);
-               e_cal_component_get_uid (comp, &uid);
-               calobj = i->data;
-
-               g_assert (calobj != NULL);
-
-               /* check what type of change has occurred, if any */
-               switch (e_xmlhash_compare (ehash, uid, calobj)) {
-               case E_XMLHASH_STATUS_SAME:
-                       break;
-               case E_XMLHASH_STATUS_NOT_FOUND:
-                       *adds = g_list_prepend (*adds, g_strdup (calobj));
-                       e_xmlhash_add (ehash, uid, calobj);
-                       break;
-               case E_XMLHASH_STATUS_DIFFERENT:
-                       *modifies = g_list_prepend (*modifies, g_strdup (calobj));
-                       e_xmlhash_add (ehash, uid, calobj);
-                       break;
-               }
-
-               g_free (calobj);
-               g_object_unref (comp);
-       }
-       g_list_free (list);
-
-       /* Calculate deletions */
-       be_data.backend = cbgw;
-       be_data.kind = e_cal_backend_get_kind (E_CAL_BACKEND (cbgw));
-       be_data.deletes = NULL;
-       be_data.ehash = ehash;
-       e_xmlhash_foreach_key (ehash, (EXmlHashFunc)e_cal_backend_groupwise_compute_changes_foreach_key, &be_data);
-
-       *deletes = be_data.deletes;
-
-       e_xmlhash_write (ehash);
-       e_xmlhash_destroy (ehash);
-}
-
-/* Get_changes handler for the groupwise backend */
-static void
-e_cal_backend_groupwise_get_changes (ECalBackendSync *backend, EDataCal *cal, const gchar *change_id,
-                                    GList **adds, GList **modifies, GList **deletes, GError **error)
-{
-       ECalBackendGroupwise *cbgw;
-       cbgw = E_CAL_BACKEND_GROUPWISE (backend);
-
-       e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_GROUPWISE (cbgw), InvalidArg);
-       e_return_data_cal_error_if_fail (change_id != NULL, InvalidArg);
-
-       e_cal_backend_groupwise_compute_changes (cbgw, change_id, adds, modifies, deletes, error);
-}
-
-/* Discard_alarm handler for the file backend */
-static void
-e_cal_backend_groupwise_discard_alarm (ECalBackendSync *backend, EDataCal *cal, const gchar *uid, const gchar *auid, GError **perror)
-{
-       g_propagate_error (perror, EDC_ERROR (NotSupported));
-}
-
-static icaltimezone *
-e_cal_backend_groupwise_internal_get_default_timezone (ECalBackend *backend)
-{
-       ECalBackendGroupwise *cbgw = E_CAL_BACKEND_GROUPWISE (backend);
-
-       return cbgw->priv->default_zone;
-}
-
-static icaltimezone *
-e_cal_backend_groupwise_internal_get_timezone (ECalBackend *backend, const gchar *tzid)
-{
-       icaltimezone *zone = NULL;
-       ECalBackendGroupwise *cbgw;
-
-       cbgw = E_CAL_BACKEND_GROUPWISE (backend);
-       g_return_val_if_fail (cbgw != NULL, NULL);
-       g_return_val_if_fail (cbgw->priv != NULL, NULL);
-
-       if (cbgw->priv->store)
-               zone = (icaltimezone *) e_cal_backend_store_get_timezone (cbgw->priv->store, tzid);
-
-       if (!zone && E_CAL_BACKEND_CLASS (parent_class)->internal_get_timezone)
-               zone = E_CAL_BACKEND_CLASS (parent_class)->internal_get_timezone (backend, tzid);
-
-       return zone;
-}
-
-static EGwConnectionStatus
-update_from_server (ECalBackendGroupwise *cbgw, GSList *uid_list, gchar **calobj, ECalComponent *comp)
-{
-       EGwConnectionStatus stat;
-       ECalBackendGroupwisePrivate *priv;
-       GList *list = NULL, *tmp;
-       GSList *l;
-       GPtrArray *uid_array = g_ptr_array_new ();
-       gint i;
-
-       priv = cbgw->priv;
-
-       for (l = uid_list; l; l = g_slist_next (l)) {
-               g_ptr_array_add (uid_array, l->data);
-       }
-
-       /* convert uid_list to GPtrArray and get the items in a list */
-       stat = e_gw_connection_get_items_from_ids (priv->cnc,
-                       priv->container_id,
-                       "attachments recipients message recipientStatus default peek",
-                       uid_array, &list);
-
-       if (stat != E_GW_CONNECTION_STATUS_OK || (list == NULL) || (g_list_length (list) == 0)) {
-               g_ptr_array_free (uid_array, TRUE);
-               return stat;
-       }
-
-       comp = g_object_ref ( (ECalComponent *) list->data );
-       /* convert items into components and add them to the cache */
-       for (i=0, tmp = list; tmp; tmp = g_list_next (tmp), i++) {
-               ECalComponent *e_cal_comp;
-               EGwItem *item;
-
-               item = (EGwItem *) tmp->data;
-               e_cal_comp = e_gw_item_to_cal_component (item, cbgw);
-               e_cal_component_commit_sequence (e_cal_comp);
-               put_component_to_store (cbgw, e_cal_comp);
-
-               if (i == 0) {
-                       *calobj = e_cal_component_get_as_string (e_cal_comp);
-               }
-
-               if (i != 0) {
-                       gchar *temp;
-                       temp = e_cal_component_get_as_string (e_cal_comp);
-                       e_cal_backend_notify_object_created (E_CAL_BACKEND (cbgw), temp);
-                       g_free (temp);
-               }
-
-               g_object_unref (e_cal_comp);
-       }
-       g_ptr_array_free (uid_array, TRUE);
-
-       return E_GW_CONNECTION_STATUS_OK;
-}
-
-static void
-e_cal_backend_groupwise_create_object (ECalBackendSync *backend, EDataCal *cal, gchar **calobj, gchar **uid, GError **error)
-{
-       ECalBackendGroupwise *cbgw;
-       ECalBackendGroupwisePrivate *priv;
-       icalcomponent *icalcomp;
-       ECalComponent *comp;
-       EGwConnectionStatus status;
-       GSList *uid_list = NULL;
-
-       cbgw = E_CAL_BACKEND_GROUPWISE (backend);
-       priv = cbgw->priv;
-
-       e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_GROUPWISE (cbgw), InvalidArg);
-       e_return_data_cal_error_if_fail (calobj != NULL && *calobj != NULL, InvalidArg);
-
-       if (priv->mode == CAL_MODE_LOCAL) {
-               in_offline (cbgw);
-               g_propagate_error (error, EDC_ERROR (RepositoryOffline));
-               return;
-       }
-
-       /* check the component for validity */
-       icalcomp = icalparser_parse_string (*calobj);
-       if (!icalcomp) {
-               g_propagate_error (error, EDC_ERROR (InvalidObject));
-               return;
-       }
-
-       if (e_cal_backend_get_kind (E_CAL_BACKEND (backend)) != icalcomponent_isa (icalcomp)) {
-               icalcomponent_free (icalcomp);
-               g_propagate_error (error, EDC_ERROR (InvalidObject));
-               return;
-       }
-
-       comp = e_cal_component_new ();
-       e_cal_component_set_icalcomponent (comp, icalcomp);
-
-       /* check if the object exists */
-       switch (priv->mode) {
-       case CAL_MODE_ANY :
-       case CAL_MODE_REMOTE :
-               /* when online, send the item to the server */
-               status = e_gw_connection_create_appointment (priv->cnc, priv->container_id, cbgw, comp, &uid_list);
-
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       status = e_gw_connection_create_appointment (priv->cnc, priv->container_id, cbgw, comp, &uid_list);
-
-               if (status != E_GW_CONNECTION_STATUS_OK) {
-                       g_object_unref (comp);
-
-                       if (status == E_GW_CONNECTION_STATUS_UNKNOWN_USER) {
-                               g_propagate_error (error, EDC_ERROR (UnknownUser));
-                               return;
-                       } else if (status == E_GW_CONNECTION_STATUS_OVER_QUOTA) {
-                               g_propagate_error (error, EDC_ERROR (PermissionDenied));
-                               return;
-                       } else {
-                               g_propagate_error (error, EDC_ERROR_FAILED_STATUS (OtherError, status));
-                               return;
-                       }
-               }
-
-               /* If delay deliver has been set, server will not send the uid */
-               if (!uid_list || ((e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_JOURNAL) && e_cal_component_has_organizer (comp))) {
-                       g_object_unref (comp);
-                       return;
-               }
-
-               /* Get the item back from server to update the last-modified time */
-               status = update_from_server (cbgw, uid_list, calobj, comp);
-               if (status != E_GW_CONNECTION_STATUS_OK) {
-                       g_propagate_error (error, EDC_ERROR_FAILED_STATUS (OtherError, status));
-                       return;
-               }
-
-               break;
-       default :
-               break;
-       }
-
-       g_object_unref (comp);
-}
-
-static void
-get_retract_data (ECalComponent *comp, const gchar **retract_comment, gboolean *all_instances)
-{
-       icalcomponent *icalcomp = NULL;
-       icalproperty *icalprop = NULL;
-       gboolean is_instance = FALSE;
-       const gchar *x_ret = NULL, *x_recur = NULL;
-
-       is_instance = e_cal_component_is_instance (comp);
-       icalcomp = e_cal_component_get_icalcomponent (comp);
-       icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY);
-       while (icalprop) {
-               const gchar *x_name;
-
-               x_name = icalproperty_get_x_name (icalprop);
-               /* This property will be set only if the user is an organizer */
-               if (!strcmp (x_name, "X-EVOLUTION-RETRACT-COMMENT")) {
-                       x_ret = icalproperty_get_x (icalprop);
-                       if (!strcmp (x_ret, "0")) {
-                               *retract_comment = NULL;
-                       } else
-                               *retract_comment = x_ret;
-               }
-
-               if (is_instance && !strcmp (x_name, "X-EVOLUTION-RECUR-MOD")) {
-                       x_recur = icalproperty_get_x (icalprop);
-                       if (!strcmp (x_recur, "All"))
-                               *all_instances = TRUE;
-                       else
-                               *all_instances = FALSE;
-               }
-
-               if (x_ret && (!is_instance || x_recur))
-                       break;
-               icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY);
-       }
-}
-
-static void
-e_cal_backend_groupwise_modify_object (ECalBackendSync *backend, EDataCal *cal, const gchar *calobj,
-                                      CalObjModType mod, gchar **old_object, gchar **new_object, GError **error)
-{
-       ECalBackendGroupwise *cbgw;
-       ECalBackendGroupwisePrivate *priv;
-       icalcomponent *icalcomp;
-       ECalComponent *comp, *cache_comp = NULL;
-       EGwConnectionStatus status;
-       EGwItem *item, *cache_item;
-       const gchar *uid = NULL;
-       gchar *rid = NULL;
-
-       *old_object = NULL;
-       cbgw = E_CAL_BACKEND_GROUPWISE (backend);
-       priv = cbgw->priv;
-
-       e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_GROUPWISE (cbgw), InvalidArg);
-       e_return_data_cal_error_if_fail (calobj != NULL, InvalidArg);
-
-       if (priv->mode == CAL_MODE_LOCAL) {
-               in_offline (cbgw);
-               g_propagate_error (error, EDC_ERROR (RepositoryOffline));
-               return;
-       }
-
-       /* check the component for validity */
-       icalcomp = icalparser_parse_string (calobj);
-       if (!icalcomp) {
-               g_propagate_error (error, EDC_ERROR (InvalidObject));
-               return;
-       }
-       comp = e_cal_component_new ();
-       e_cal_component_set_icalcomponent (comp, icalcomp);
-       e_cal_component_get_uid (comp, &uid);
-       rid = e_cal_component_get_recurid_as_string (comp);
-
-       /* check if the object exists */
-       switch (priv->mode) {
-       case CAL_MODE_ANY :
-       case CAL_MODE_REMOTE :
-               /* when online, send the item to the server */
-               cache_comp = e_cal_backend_store_get_component (priv->store, uid, rid);
-               if (!cache_comp) {
-                       g_critical ("Could not find the object in cache");
-                       g_free (rid);
-                       g_propagate_error (error, EDC_ERROR (ObjectNotFound));
-                       return;
-               }
-
-               if (e_cal_component_has_attendees (comp) &&
-                               e_cal_backend_groupwise_utils_check_delegate (comp, e_gw_connection_get_user_email (priv->cnc))) {
-                       const gchar *id = NULL, *recur_key = NULL;
-
-                       item = e_gw_item_new_for_delegate_from_cal (cbgw, comp);
-
-                       if (mod == CALOBJ_MOD_ALL && e_cal_component_is_instance (comp)) {
-                               recur_key = uid;
-                       }
-                       id = e_gw_item_get_id (item);
-
-                       status = e_gw_connection_delegate_request (priv->cnc, item, id, NULL, NULL, recur_key);
-
-                       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                               status = e_gw_connection_delegate_request (priv->cnc, item, id, NULL, NULL, recur_key);
-                       if (status != E_GW_CONNECTION_STATUS_OK) {
-                               g_object_unref (comp);
-                               g_object_unref (cache_comp);
-                               g_free (rid);
-                               g_propagate_error (error, EDC_ERROR_FAILED_STATUS (OtherError, status));
-                               return;
-                       }
-
-                       put_component_to_store (cbgw, comp);
-                       *new_object = e_cal_component_get_as_string (comp);
-                       break;
-               }
-
-               item = e_gw_item_new_from_cal_component (priv->container_id, cbgw, comp);
-               cache_item =  e_gw_item_new_from_cal_component (priv->container_id, cbgw, cache_comp);
-               if ( e_gw_item_get_item_type (item) == E_GW_ITEM_TYPE_TASK) {
-                       gboolean completed, cache_completed;
-
-                       completed = e_gw_item_get_completed (item);
-                       cache_completed = e_gw_item_get_completed (cache_item);
-                       if (completed && !cache_completed) {
-                               /*FIXME  return values. */
-                               status = e_gw_connection_complete_request (priv->cnc, e_gw_item_get_id (item));
-
-                               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                                       status = e_gw_connection_complete_request (priv->cnc, e_gw_item_get_id (item));
-
-                               if (status != E_GW_CONNECTION_STATUS_OK) {
-                                       g_object_unref (comp);
-                                       g_object_unref (cache_comp);
-                                       g_free (rid);
-
-                                       if (status == E_GW_CONNECTION_STATUS_OVER_QUOTA) {
-                                               g_propagate_error (error, EDC_ERROR (PermissionDenied));
-                                               return;
-                                       }
-
-                                       g_propagate_error (error, EDC_ERROR_FAILED_STATUS (OtherError, status));
-                                       return;
-                               }
-                               put_component_to_store (cbgw, comp);
-                               break;
-                       }
-               }
-
-               e_gw_item_set_changes (item, cache_item);
-
-               /* the second argument is redundant */
-               status = e_gw_connection_modify_item (priv->cnc, e_gw_item_get_id (item), item);
-
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       status = e_gw_connection_modify_item (priv->cnc, e_gw_item_get_id (item), item);
-
-               if (status != E_GW_CONNECTION_STATUS_OK) {
-                       g_object_unref (comp);
-                       g_object_unref (cache_comp);
-                       g_free (rid);
-                       g_propagate_error (error, EDC_ERROR_FAILED_STATUS (OtherError, status));
-                       return;
-               }
-               /* if successful, update the cache */
-
-       case CAL_MODE_LOCAL :
-               /* in offline mode, we just update the cache */
-               put_component_to_store (cbgw, comp);
-               break;
-       default :
-               break;
-       }
-
-       *old_object = e_cal_component_get_as_string (cache_comp);
-       g_object_unref (cache_comp);
-       g_object_unref (comp);
-       g_free (rid);
-}
-
-static const gchar *
-get_gw_item_id (icalcomponent *icalcomp)
-{
-       icalproperty *icalprop;
-
-       /* search the component for the X-GWRECORDID property */
-       icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY);
-       while (icalprop) {
-               const gchar *x_name, *x_val;
-
-               x_name = icalproperty_get_x_name (icalprop);
-               x_val = icalproperty_get_x (icalprop);
-               if (!strcmp (x_name, "X-GWRECORDID")) {
-                       return x_val;
-               }
-
-               icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY);
-       }
-       return NULL;
-}
-
-/* Remove_object handler for the file backend */
-static void
-e_cal_backend_groupwise_remove_object (ECalBackendSync *backend, EDataCal *cal,
-                                      const gchar *uid, const gchar *rid,
-                                      CalObjModType mod, gchar **old_object,
-                                      gchar **object, GError **perror)
-{
-       ECalBackendGroupwise *cbgw;
-       ECalBackendGroupwisePrivate *priv;
-       EGwConnectionStatus status;
-       gchar *calobj = NULL;
-       GError *err = NULL;
-
-       cbgw = E_CAL_BACKEND_GROUPWISE (backend);
-       priv = cbgw->priv;
-
-       *old_object = *object = NULL;
-
-       /* if online, remove the item from the server */
-       if (priv->mode == CAL_MODE_REMOTE) {
-               const gchar *id_to_remove = NULL;
-               icalcomponent *icalcomp;
-
-               e_cal_backend_groupwise_get_object (backend, cal, uid, rid, &calobj, &err);
-               if (err) {
-                       g_propagate_error (perror, err);
-                       return;
-               }
-
-               icalcomp = icalparser_parse_string (calobj);
-               if (!icalcomp) {
-                       g_free (calobj);
-                       g_propagate_error (perror, EDC_ERROR (InvalidObject));
-                       return;
-               }
-
-               if (mod == CALOBJ_MOD_THIS) {
-                       id_to_remove = get_gw_item_id (icalcomp);
-                       if (!id_to_remove) {
-                               /* use the iCalId to remove the object */
-                               id_to_remove = uid;
-                       }
-
-                       /* remove the object */
-                       status = e_gw_connection_remove_item (priv->cnc, priv->container_id, id_to_remove);
-
-                       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                               status = e_gw_connection_remove_item (priv->cnc, priv->container_id, id_to_remove);
-
-                       icalcomponent_free (icalcomp);
-                       if (status == E_GW_CONNECTION_STATUS_OK) {
-                               /* remove the component from the cache */
-                               if (!e_cal_backend_store_remove_component (priv->store, uid, rid)) {
-                                       g_free (calobj);
-                                       g_propagate_error (perror, EDC_ERROR (ObjectNotFound));
-                                       return;
-                               }
-                               *object = NULL;
-                               *old_object = strdup (calobj);
-                               g_free (calobj);
-                               return;
-                       } else {
-                               g_free (calobj);
-                               g_propagate_error (perror, EDC_ERROR_FAILED_STATUS (OtherError, status));
-                               return;
-                       }
-               } else if (mod == CALOBJ_MOD_ALL) {
-                       GSList *l, *comp_list = e_cal_backend_store_get_components_by_uid (priv->store, uid);
-
-                       if (e_cal_component_has_attendees (E_CAL_COMPONENT (comp_list->data))) {
-                               /* get recurrence key and send it to
-                                * e_gw_connection_remove_recurrence_item */
-
-                               id_to_remove = get_gw_item_id (e_cal_component_get_icalcomponent (comp_list->data));
-                               status = e_gw_connection_decline_request (priv->cnc, id_to_remove, NULL, uid);
-                               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                                       status = e_gw_connection_decline_request (priv->cnc, id_to_remove, NULL, uid);
-                       } else {
-                               GList *item_ids = NULL;
-
-                               for (l = comp_list; l; l = l->next) {
-                                       ECalComponent *comp = E_CAL_COMPONENT (l->data);
-
-                                       id_to_remove = get_gw_item_id (e_cal_component_get_icalcomponent (comp));
-                                       item_ids = g_list_append (item_ids, (gchar *) id_to_remove);
-                               }
-                               status = e_gw_connection_remove_items (priv->cnc, priv->container_id, item_ids);
-
-                               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                                       status = e_gw_connection_remove_items (priv->cnc, priv->container_id, item_ids);
-                       }
-
-                       if (status == E_GW_CONNECTION_STATUS_OK) {
-
-                               for (l = comp_list; l; l = l->next) {
-                                       ECalComponent *comp = E_CAL_COMPONENT (l->data);
-                                       ECalComponentId *id = e_cal_component_get_id (comp);
-
-                                       e_cal_backend_store_remove_component (priv->store, id->uid,
-                                                       id->rid);
-                                       if (!id->rid || !g_str_equal (id->rid, rid)) {
-                                               gchar *comp_str = e_cal_component_get_as_string (comp);
-                                               e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbgw), id, comp_str, NULL);
-                                               g_free (comp_str);
-                                       }
-                                       e_cal_component_free_id (id);
-
-                                       g_object_unref (comp);
-
-                               }
-                               /* Setting NULL would trigger another signal.
-                                * We do not set the *object to NULL  */
-                               g_slist_free (comp_list);
-                               *old_object = strdup (calobj);
-                               *object = NULL;
-                               g_free (calobj);
-                               return;
-                       } else {
-                               g_free (calobj);
-                               g_propagate_error (perror, EDC_ERROR_FAILED_STATUS (OtherError, status));
-                               return;
-                       }
-               } else {
-                       g_propagate_error (perror, EDC_ERROR (UnsupportedMethod));
-                       return;
-               }
-       } else if (priv->mode == CAL_MODE_LOCAL) {
-               in_offline (cbgw);
-               g_propagate_error (perror, EDC_ERROR (RepositoryOffline));
-               return;
-       } else {
-               g_propagate_error (perror, EDC_ERROR_EX (OtherError, "Incorrect online mode set"));
-               return;
-       }
-}
-
-/* This function is largely duplicated in
- * ../file/e-cal-backend-file.c
- */
-static void
-fetch_attachments (ECalBackendGroupwise *cbgw, ECalComponent *comp)
-{
-       GSList *attach_list = NULL, *new_attach_list = NULL;
-       GSList *l;
-       gchar *dest_url, *dest_file;
-       gint fd;
-       const gchar *cache_dir;
-       const gchar *uid;
-
-       e_cal_component_get_attachment_list (comp, &attach_list);
-       e_cal_component_get_uid (comp, &uid);
-       /*FIXME  get the uri rather than computing the path */
-       cache_dir = e_cal_backend_get_cache_dir (E_CAL_BACKEND (cbgw));
-
-       for (l = attach_list; l; l = l->next) {
-               gchar *sfname = (gchar *)l->data;
-               gchar *filename, *new_filename;
-               GMappedFile *mapped_file;
-               GError *error = NULL;
-
-               mapped_file = g_mapped_file_new (sfname, FALSE, &error);
-               if (!mapped_file) {
-                       g_error_free (error);
-                       continue;
-               }
-               filename = g_path_get_basename (sfname);
-               new_filename = g_strconcat (uid, "-", filename, NULL);
-               g_free (filename);
-               dest_file = g_build_filename (cache_dir, new_filename, NULL);
-               g_free (new_filename);
-               fd = g_open (dest_file, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, 0600);
-               if (fd == -1) {
-                       /* TODO handle error conditions */
-               } else if (write (fd, g_mapped_file_get_contents (mapped_file),
-                                 g_mapped_file_get_length (mapped_file)) == -1) {
-                       /* TODO handle error condition */
-               }
-
-#if GLIB_CHECK_VERSION(2,21,3)
-               g_mapped_file_unref (mapped_file);
-#else
-               g_mapped_file_free (mapped_file);
-#endif
-               if (fd != -1)
-                       close (fd);
-               dest_url = g_filename_to_uri (dest_file, NULL, NULL);
-               g_free (dest_file);
-               new_attach_list = g_slist_append (new_attach_list, dest_url);
-       }
-       e_cal_component_set_attachment_list (comp, new_attach_list);
-
-       for (l = new_attach_list; l != NULL; l = l->next)
-               g_free (l->data);
-       g_slist_free (new_attach_list);
-
-}
-
-static void
-change_status (ECalComponent *comp, icalparameter_partstat status, const gchar *email)
-{
-       icalproperty *prop;
-       icalparameter *param;
-       gboolean found = FALSE;
-       icalcomponent *icalcomp = e_cal_component_get_icalcomponent (comp);
-
-       for (prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTENDEE_PROPERTY);
-                       prop;
-                       prop = icalcomponent_get_next_property (icalcomp, ICAL_ATTENDEE_PROPERTY)) {
-               const gchar *attendee = icalproperty_get_attendee (prop);
-
-               if (!g_ascii_strncasecmp (attendee, "mailto:", 7))
-                       attendee += 7;
-
-               if (!g_ascii_strcasecmp (attendee, email)) {
-                       found = TRUE;
-                       param = icalparameter_new_partstat (status);
-                       icalproperty_set_parameter (prop, param);
-                       break;
-               }
-       }
-
-       /* We couldn find the attendee in the component, so add a new attendee */
-       if (!found) {
-               gchar *temp = g_strdup_printf ("MAILTO:%s", email);
-
-               prop = icalproperty_new_attendee ((const gchar *) temp);
-               icalcomponent_add_property (icalcomp, prop);
-
-               param = icalparameter_new_partstat (ICAL_PARTSTAT_DELEGATED);
-               icalproperty_add_parameter (prop, param);
-
-               param = icalparameter_new_role (ICAL_ROLE_NONPARTICIPANT);
-               icalproperty_add_parameter (prop, param);
-
-               param = icalparameter_new_cutype (ICAL_CUTYPE_INDIVIDUAL);
-               icalproperty_add_parameter (prop, param);
-
-               param = icalparameter_new_rsvp (ICAL_RSVP_TRUE);
-               icalproperty_add_parameter (prop, param);
-
-               g_free (temp);
-       }
-}
-
-static void
-receive_object (ECalBackendGroupwise *cbgw, EDataCal *cal, icalcomponent *icalcomp, GError **perror)
-{
-       ECalComponent *comp, *modif_comp = NULL;
-       ECalBackendGroupwisePrivate *priv;
-       icalproperty_method method;
-       EGwConnectionStatus status;
-       gboolean all_instances = FALSE;
-       icalparameter_partstat pstatus;
-       icalproperty *icalprop;
-
-       priv = cbgw->priv;
-
-       /* When the icalcomponent is obtained through the itip message rather
-        * than from the SOAP protocol, the container id has to be explicitly
-        * added to the xgwrecordid inorder to obtain the item id. */
-       icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY);
-       while (icalprop) {
-               const gchar *x_name;
-
-               x_name = icalproperty_get_x_name (icalprop);
-               if (!strcmp (x_name, "X-GW-RECUR-INSTANCES-MOD-TYPE")) {
-                       if (!strcmp (icalproperty_get_x (icalprop), "All")) {
-                               all_instances = TRUE;
-                               icalcomponent_remove_property (icalcomp, icalprop);
-                               break;
-                       }
-               }
-
-               icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY);
-       }
-
-       comp = e_cal_component_new ();
-       e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
-       method = icalcomponent_get_method (icalcomp);
-
-       /* handle attachments */
-       if (e_cal_component_has_attachments (comp))
-               fetch_attachments (cbgw, comp);
-
-       status = e_gw_connection_send_appointment (cbgw, priv->container_id, comp, method, all_instances, &modif_comp, &pstatus);
-
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               status = e_gw_connection_send_appointment (cbgw, priv->container_id, comp, method, all_instances, &modif_comp, &pstatus);
-
-       if (!modif_comp)
-               modif_comp = g_object_ref (comp);
-
-       /* update the cache */
-       if (status == E_GW_CONNECTION_STATUS_OK || status == E_GW_CONNECTION_STATUS_ITEM_ALREADY_ACCEPTED) {
-               GSList *comps = NULL, *l;
-               gboolean found = FALSE;
-
-               if (all_instances) {
-                       const gchar *uid;
-
-                       e_cal_component_get_uid (modif_comp, (const gchar **) &uid);
-                       comps = e_cal_backend_store_get_components_by_uid (priv->store, uid);
-
-                       if (!comps)
-                               comps = g_slist_append (comps, g_object_ref (modif_comp));
-                       else
-                               found = TRUE;
-               } else {
-                       ECalComponentId *id = e_cal_component_get_id (modif_comp);
-                       ECalComponent *component = NULL;
-
-                       component = e_cal_backend_store_get_component (priv->store, id->uid, id->rid);
-
-                       if (!component)
-                               comps = g_slist_append (comps, g_object_ref (modif_comp));
-                       else {
-                               comps = g_slist_append (comps, component);
-                               found = TRUE;
-                       }
-
-                       e_cal_component_free_id (id);
-               }
-
-               for (l = comps; l != NULL; l = l->next) {
-                       ECalComponent *component = E_CAL_COMPONENT (l->data);
-
-                       if (pstatus == ICAL_PARTSTAT_DECLINED) {
-                               ECalComponentId *id = e_cal_component_get_id (component);
-
-                               if (e_cal_backend_store_remove_component (priv->store, id->uid, id->rid)) {
-                                       gchar *comp_str = e_cal_component_get_as_string (component);
-                                       e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbgw), id, comp_str, NULL);
-                                       g_free (comp_str);
-                               }
-
-                               e_cal_component_free_id (id);
-                       } else {
-                               gchar *comp_str = NULL;
-                               ECalComponentTransparency transp;
-
-                               change_status (component, pstatus, e_gw_connection_get_user_email (priv->cnc));
-                               e_cal_component_get_transparency (comp, &transp);
-                               e_cal_component_set_transparency (component, transp);
-                               put_component_to_store (cbgw, comp);
-                               comp_str = e_cal_component_get_as_string (component);
-
-                               if (found)
-                                       e_cal_backend_notify_object_modified (E_CAL_BACKEND (cbgw), comp_str, comp_str);
-                               else
-                                       e_cal_backend_notify_object_created (E_CAL_BACKEND (cbgw), comp_str);
-
-                               g_free (comp_str);
-                       }
-               }
-
-               g_slist_foreach (comps, (GFunc) g_object_unref, NULL);
-               g_slist_free (comps);
-               g_object_unref (comp);
-               g_object_unref (modif_comp);
-       }
-
-       g_object_unref (comp);
-       if (status == E_GW_CONNECTION_STATUS_OK)
-               return;
-       else if (status == E_GW_CONNECTION_STATUS_INVALID_OBJECT)
-               g_propagate_error (perror, EDC_ERROR (InvalidObject));
-       else if (status == E_GW_CONNECTION_STATUS_OVER_QUOTA)
-               g_propagate_error (perror, EDC_ERROR (PermissionDenied));
-       else
-               g_propagate_error (perror, EDC_ERROR_FAILED_STATUS (OtherError, status));
-}
-
-/* Update_objects handler for the file backend. */
-static void
-e_cal_backend_groupwise_receive_objects (ECalBackendSync *backend, EDataCal *cal, const gchar *calobj, GError **perror)
-{
-       ECalBackendGroupwise *cbgw;
-       ECalBackendGroupwisePrivate *priv;
-       icalcomponent *icalcomp, *subcomp;
-       icalcomponent_kind kind;
-       GError *err = NULL;
-
-       cbgw = E_CAL_BACKEND_GROUPWISE (backend);
-       priv = cbgw->priv;
-
-       if (priv->mode == CAL_MODE_LOCAL) {
-               in_offline (cbgw);
-               g_propagate_error (perror, EDC_ERROR (RepositoryOffline));
-               return;
-       }
-
-       icalcomp = icalparser_parse_string (calobj);
-       if (!icalcomp) {
-               g_propagate_error (perror, EDC_ERROR (InvalidObject));
-               return;
-       }
-
-       kind = icalcomponent_isa (icalcomp);
-       if (kind == ICAL_VCALENDAR_COMPONENT) {
-               subcomp = icalcomponent_get_first_component (icalcomp,
-                                                            e_cal_backend_get_kind (E_CAL_BACKEND (backend)));
-               while (subcomp) {
-                       icalcomponent_set_method (subcomp, icalcomponent_get_method (icalcomp));
-                       receive_object (cbgw, cal, subcomp, &err);
-                       if (err)
-                               break;
-                       subcomp = icalcomponent_get_next_component (icalcomp,
-                                                                   e_cal_backend_get_kind (E_CAL_BACKEND (backend)));
-               }
-       } else if (kind == e_cal_backend_get_kind (E_CAL_BACKEND (backend))) {
-               receive_object (cbgw, cal, icalcomp, &err);
-       } else
-               err = EDC_ERROR (InvalidObject);
-
-       icalcomponent_free (icalcomp);
-
-       if (err)
-               g_propagate_error (perror, err);
-}
-
-static void
-send_object (ECalBackendGroupwise *cbgw, EDataCal *cal, icalcomponent *icalcomp, icalproperty_method method, GError **perror)
-{
-       ECalComponent *comp, *found_comp = NULL;
-       ECalBackendGroupwisePrivate *priv;
-       const gchar *uid = NULL;
-       gchar *rid = NULL;
-
-       priv = cbgw->priv;
-
-       comp = e_cal_component_new ();
-       e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
-       rid = e_cal_component_get_recurid_as_string (comp);
-
-       e_cal_component_get_uid (comp, (const gchar **) &uid);
-       found_comp = e_cal_backend_store_get_component (priv->store, uid, rid);
-       g_free (rid);
-       rid = NULL;
-
-       if (!found_comp) {
-               g_object_unref (comp);
-               g_propagate_error (perror, EDC_ERROR (ObjectNotFound));
-               return;
-       }
-
-       switch (priv->mode) {
-       case CAL_MODE_ANY :
-       case CAL_MODE_REMOTE :
-               if (method == ICAL_METHOD_CANCEL) {
-                       const gchar *retract_comment = NULL;
-                       gboolean all_instances = FALSE;
-                       const gchar *id = NULL;
-                       EGwConnectionStatus status;
-
-                       get_retract_data (comp, &retract_comment, &all_instances);
-                       id = get_gw_item_id (icalcomp);
-                       status = e_gw_connection_retract_request (priv->cnc, id, retract_comment,
-                                       all_instances, FALSE);
-
-                       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                               status = e_gw_connection_retract_request (priv->cnc, id, retract_comment,
-                                               all_instances, FALSE);
-
-                       if (status != E_GW_CONNECTION_STATUS_OK)
-                               g_propagate_error (perror, EDC_ERROR_FAILED_STATUS (OtherError, status));
-               }
-               break;
-       case CAL_MODE_LOCAL :
-               /* in offline mode, we just update the cache */
-               g_propagate_error (perror, EDC_ERROR (RepositoryOffline));
-               break;
-       default:
-               g_propagate_error (perror, EDC_ERROR (OtherError));
-               break;
-       }
-
-       g_object_unref (comp);
-       g_object_unref (found_comp);
-}
-
-static void
-e_cal_backend_groupwise_send_objects (ECalBackendSync *backend, EDataCal *cal, const gchar *calobj, GList **users,
-                                     gchar **modified_calobj, GError **perror)
-{
-       icalcomponent *icalcomp, *subcomp;
-       icalcomponent_kind kind;
-       icalproperty_method method;
-       ECalBackendGroupwise *cbgw;
-       ECalBackendGroupwisePrivate *priv;
-       GError *err = NULL;
-
-       *users = NULL;
-       *modified_calobj = NULL;
-
-       cbgw = E_CAL_BACKEND_GROUPWISE (backend);
-       priv = cbgw->priv;
-
-       if (priv->mode == CAL_MODE_LOCAL) {
-               in_offline (cbgw);
-               g_propagate_error (perror, EDC_ERROR (RepositoryOffline));
-               return;
-       }
-
-       icalcomp = icalparser_parse_string (calobj);
-       if (!icalcomp) {
-               g_propagate_error (perror, EDC_ERROR (InvalidObject));
-               return;
-       }
-
-       method = icalcomponent_get_method (icalcomp);
-       kind = icalcomponent_isa (icalcomp);
-       if (kind == ICAL_VCALENDAR_COMPONENT) {
-               subcomp = icalcomponent_get_first_component (icalcomp,
-                                                            e_cal_backend_get_kind (E_CAL_BACKEND (backend)));
-               while (subcomp) {
-
-                       send_object (cbgw, cal, subcomp, method, &err);
-                       if (err)
-                               break;
-                       subcomp = icalcomponent_get_next_component (icalcomp,
-                                                                   e_cal_backend_get_kind (E_CAL_BACKEND (backend)));
-               }
-       } else if (kind == e_cal_backend_get_kind (E_CAL_BACKEND (backend))) {
-               send_object (cbgw, cal, icalcomp, method, &err);
-       } else {
-               err = EDC_ERROR (InvalidObject);
-       }
-
-       if (!err) {
-               ECalComponent *comp;
-
-               comp = e_cal_component_new ();
-
-               if (e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp))) {
-                       GSList *attendee_list = NULL, *tmp;
-                       e_cal_component_get_attendee_list (comp, &attendee_list);
-                       /* convert this into GList */
-                       for (tmp = attendee_list; tmp; tmp = g_slist_next (tmp)) {
-                               ECalComponentAttendee *attendee = NULL;
-                               const gchar *email_id = NULL;
-                               attendee = (ECalComponentAttendee *) (tmp->data);
-                               if (attendee) {
-                                       email_id = attendee->value;
-                                       if (!g_ascii_strncasecmp (email_id, "mailto:", 7))
-                                               email_id += 7;
-                                       *users = g_list_append (*users, g_strdup (email_id));
-                               }
-                       }
-
-                       g_object_unref (comp);
-               }
-               *modified_calobj = g_strdup (calobj);
-       }
-       icalcomponent_free (icalcomp);
-
-       if (err)
-               g_propagate_error (perror, err);
-}
-
-/* Object initialization function for the file backend */
-static void
-e_cal_backend_groupwise_init (ECalBackendGroupwise *cbgw)
-{
-       ECalBackendGroupwisePrivate *priv;
-
-       priv = g_new0 (ECalBackendGroupwisePrivate, 1);
-
-       priv->cnc = NULL;
-       priv->sendoptions_sync_timeout = 0;
-       priv->first_delta_fetch = TRUE;
-
-       /* create the mutex for thread safety */
-       g_static_rec_mutex_init (&priv->rec_mutex);
-
-       cbgw->priv = priv;
-
-       e_cal_backend_sync_set_lock (E_CAL_BACKEND_SYNC (cbgw), TRUE);
-}
-
-/* Class initialization function for the gw backend */
-static void
-e_cal_backend_groupwise_class_init (ECalBackendGroupwiseClass *class)
-{
-       GObjectClass *object_class;
-       ECalBackendClass *backend_class;
-       ECalBackendSyncClass *sync_class;
-
-       object_class = (GObjectClass *) class;
-       backend_class = (ECalBackendClass *) class;
-       sync_class = (ECalBackendSyncClass *) class;
-
-       parent_class = g_type_class_peek_parent (class);
-
-       object_class->finalize = e_cal_backend_groupwise_finalize;
-
-       sync_class->is_read_only_sync = e_cal_backend_groupwise_is_read_only;
-       sync_class->get_cal_address_sync = e_cal_backend_groupwise_get_cal_address;
-       sync_class->get_alarm_email_address_sync = e_cal_backend_groupwise_get_alarm_email_address;
-       sync_class->get_ldap_attribute_sync = e_cal_backend_groupwise_get_ldap_attribute;
-       sync_class->get_static_capabilities_sync = e_cal_backend_groupwise_get_static_capabilities;
-       sync_class->open_sync = e_cal_backend_groupwise_open;
-       sync_class->remove_sync = e_cal_backend_groupwise_remove;
-       sync_class->create_object_sync = e_cal_backend_groupwise_create_object;
-       sync_class->modify_object_sync = e_cal_backend_groupwise_modify_object;
-       sync_class->remove_object_sync = e_cal_backend_groupwise_remove_object;
-       sync_class->discard_alarm_sync = e_cal_backend_groupwise_discard_alarm;
-       sync_class->receive_objects_sync = e_cal_backend_groupwise_receive_objects;
-       sync_class->send_objects_sync = e_cal_backend_groupwise_send_objects;
-       sync_class->get_default_object_sync = e_cal_backend_groupwise_get_default_object;
-       sync_class->get_object_sync = e_cal_backend_groupwise_get_object;
-       sync_class->get_object_list_sync = e_cal_backend_groupwise_get_object_list;
-       sync_class->get_attachment_list_sync = e_cal_backend_groupwise_get_attachment_list;
-       sync_class->add_timezone_sync = e_cal_backend_groupwise_add_timezone;
-       sync_class->set_default_zone_sync = e_cal_backend_groupwise_set_default_zone;
-       sync_class->get_freebusy_sync = e_cal_backend_groupwise_get_free_busy;
-       sync_class->get_changes_sync = e_cal_backend_groupwise_get_changes;
-
-       backend_class->is_loaded = e_cal_backend_groupwise_is_loaded;
-       backend_class->start_query = e_cal_backend_groupwise_start_query;
-       backend_class->get_mode = e_cal_backend_groupwise_get_mode;
-       backend_class->set_mode = e_cal_backend_groupwise_set_mode;
-       backend_class->internal_get_default_timezone = e_cal_backend_groupwise_internal_get_default_timezone;
-       backend_class->internal_get_timezone = e_cal_backend_groupwise_internal_get_timezone;
-}
-
-void
-e_cal_backend_groupwise_notify_error_code (ECalBackendGroupwise *cbgw, EGwConnectionStatus status)
-{
-       const gchar *msg;
-
-       g_return_if_fail (E_IS_CAL_BACKEND_GROUPWISE (cbgw));
-
-       msg = e_gw_connection_get_error_message (status);
-       if (msg)
-               e_cal_backend_notify_error (E_CAL_BACKEND (cbgw), msg);
-}
diff --git a/calendar/backends/groupwise/e-cal-backend-groupwise.h b/calendar/backends/groupwise/e-cal-backend-groupwise.h
deleted file mode 100644 (file)
index 9a315f9..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors :
- *  JP Rosevear <jpr@ximian.com>
- *  Rodrigo Moya <rodrigo@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- */
-
-#ifndef E_CAL_BACKEND_GROUPWISE_H
-#define E_CAL_BACKEND_GROUPWISE_H
-
-#include <libedata-cal/e-cal-backend-sync.h>
-#include <servers/groupwise/e-gw-connection.h>
-
-G_BEGIN_DECLS
-
-#define E_TYPE_CAL_BACKEND_GROUPWISE            (e_cal_backend_groupwise_get_type ())
-#define E_CAL_BACKEND_GROUPWISE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CAL_BACKEND_GROUPWISE,      ECalBackendGroupwise))
-#define E_CAL_BACKEND_GROUPWISE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CAL_BACKEND_GROUPWISE,       ECalBackendGroupwiseClass))
-#define E_IS_CAL_BACKEND_GROUPWISE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CAL_BACKEND_GROUPWISE))
-#define E_IS_CAL_BACKEND_GROUPWISE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_CAL_BACKEND_GROUPWISE))
-
-typedef struct _ECalBackendGroupwise        ECalBackendGroupwise;
-typedef struct _ECalBackendGroupwiseClass   ECalBackendGroupwiseClass;
-
-typedef struct _ECalBackendGroupwisePrivate ECalBackendGroupwisePrivate;
-
-struct _ECalBackendGroupwise {
-       ECalBackendSync backend;
-
-       /* Private data */
-       ECalBackendGroupwisePrivate *priv;
-};
-
-struct _ECalBackendGroupwiseClass {
-       ECalBackendSyncClass parent_class;
-};
-
-typedef struct {
-       ECalBackendGroupwise *cbgw;
-       EGwSendOptions *opts;
-} GwSettings;
-
-GType   e_cal_backend_groupwise_get_type (void);
-EGwConnection* e_cal_backend_groupwise_get_connection (ECalBackendGroupwise *cbgw);
-GHashTable* e_cal_backend_groupwise_get_categories_by_id (ECalBackendGroupwise *cbgw);
-GHashTable* e_cal_backend_groupwise_get_categories_by_name (ECalBackendGroupwise *cbgw);
-icaltimezone* e_cal_backend_groupwise_get_default_zone (ECalBackendGroupwise *cbgw);
-void    e_cal_backend_groupwise_notify_error_code (ECalBackendGroupwise *cbgw, EGwConnectionStatus status);
-const gchar *e_cal_backend_groupwise_get_container_id (ECalBackendGroupwise *cbgw);
-void e_cal_backend_groupwise_priv_lock (ECalBackendGroupwise *cbgw);
-void e_cal_backend_groupwise_priv_unlock (ECalBackendGroupwise *cbgw);
-
-G_END_DECLS
-
-#endif
index 6040920..8c4f41a 100644 (file)
@@ -7,6 +7,6 @@ else
 SENDMAIL_DIR=sendmail
 endif
 
-SUBDIRS = pop3 $(SENDMAIL_DIR) smtp imap imapx $(NNTP_DIR) local groupwise
+SUBDIRS = pop3 $(SENDMAIL_DIR) smtp imap imapx $(NNTP_DIR) local
 
 -include $(top_srcdir)/git.mk
diff --git a/camel/providers/groupwise/Makefile.am b/camel/providers/groupwise/Makefile.am
deleted file mode 100644 (file)
index faa3812..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-camel_provider_LTLIBRARIES = libcamelgroupwise.la
-camel_provider_DATA = libcamelgroupwise.urls
-
-libcamelgroupwise_la_CPPFLAGS = \
-       $(AM_CPPFLAGS)                          \
-       -I$(top_srcdir)                         \
-       -I$(top_srcdir)/camel                   \
-       -I$(top_srcdir)/camel/providers         \
-       -I$(top_srcdir)/camel/providers/imap    \
-       -I$(top_srcdir)/libedataserver          \
-       -I$(top_srcdir)/servers/groupwise       \
-       $(CAMEL_CFLAGS)                         \
-       $(GNOME_INCLUDEDIR)                     \
-       $(SOUP_CFLAGS)                          \
-       $(E_DATA_SERVER_CFLAGS)                 \
-       -DG_LOG_DOMAIN=\"camel-groupwise-provider\"
-
-libcamelgroupwise_la_SOURCES =                         \
-       camel-groupwise-provider.c              \
-       camel-groupwise-folder.c                \
-       camel-groupwise-journal.c               \
-       camel-groupwise-store.c                 \
-       camel-groupwise-summary.c               \
-       camel-groupwise-store-summary.c         \
-       camel-groupwise-utils.c                 \
-       camel-groupwise-transport.c                     
-
-noinst_HEADERS =                               \
-       camel-groupwise-folder.h                \
-       camel-groupwise-journal.h               \
-       camel-groupwise-private.h               \
-       camel-groupwise-store.h                 \
-       camel-groupwise-summary.h               \
-       camel-groupwise-store-summary.h         \
-       camel-groupwise-utils.h                 \
-       camel-groupwise-transport.h             
-
-libcamelgroupwise_la_LDFLAGS = -avoid-version -module $(NO_UNDEFINED)
-
-libcamelgroupwise_la_LIBADD =                                            \
-       $(top_builddir)/servers/groupwise/libegroupwise-1.2.la           \
-       $(top_builddir)/libedataserver/libedataserver-1.2.la             \
-       $(top_builddir)/camel/libcamel-provider-1.2.la                   \
-       $(top_builddir)/camel/libcamel-1.2.la                            \
-       $(CAMEL_LIBS)                                                    \
-       $(SOUP_LIBS)                                                     \
-       $(E_DATA_SERVER_LIBS)
-
-EXTRA_DIST = libcamelgroupwise.urls
-
--include $(top_srcdir)/git.mk
diff --git a/camel/providers/groupwise/camel-groupwise-folder.c b/camel/providers/groupwise/camel-groupwise-folder.c
deleted file mode 100644 (file)
index bbb0fde..0000000
+++ /dev/null
@@ -1,3329 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-groupwise-folder.c: class for an groupwise folder */
-
-/*
- * Authors:
- *  Sivaiah Nallagatla <snallagatla@novell.com>
- *  parthasarathi susarla <sparthasarathi@novell.com>
- *  Sankar P <psankar@novell.com>
- *
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- */
-
-/* This file is broken and suffers from multiple author syndrome.
-This needs to be rewritten with a lot of functions cleaned up.
-
-There are a lot of places where code is unneccesarily duplicated,
-which needs to be better organized via functions */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <errno.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include <glib/gi18n-lib.h>
-
-#include <e-gw-connection.h>
-#include <e-gw-item.h>
-
-#include "camel-groupwise-folder.h"
-#include "camel-groupwise-journal.h"
-#include "camel-groupwise-private.h"
-#include "camel-groupwise-store.h"
-#include "camel-groupwise-summary.h"
-#include "camel-groupwise-utils.h"
-
-#define ADD_JUNK_ENTRY 1
-#define REMOVE_JUNK_ENTRY -1
-#define JUNK_FOLDER "Junk Mail"
-#define READ_CURSOR_MAX_IDS 50
-#define MAX_ATTACHMENT_SIZE 1*1024*1024   /*In bytes*/
-#define GROUPWISE_BULK_DELETE_LIMIT 100
-
-struct _CamelGroupwiseFolderPrivate {
-
-#ifdef ENABLE_THREADS
-       GStaticMutex search_lock;       /* for locking the search object */
-       GStaticRecMutex cache_lock;     /* for locking the cache object */
-#endif
-
-};
-
-extern gint camel_application_is_exiting;
-
-/*prototypes*/
-static gboolean groupwise_transfer_messages_to_sync (CamelFolder *source, GPtrArray *uids, CamelFolder *destination, gboolean delete_originals, GPtrArray **transferred_uids, GCancellable *cancellable, GError **error);
-void convert_to_calendar (EGwItem *item, gchar **str, gint *len);
-static void convert_to_task (EGwItem *item, gchar **str, gint *len);
-static void convert_to_note (EGwItem *item, gchar **str, gint *len);
-static void gw_update_all_items ( CamelFolder *folder, GList *item_list, GCancellable *cancellable, GError **error);
-static void groupwise_populate_details_from_item (CamelMimeMessage *msg, EGwItem *item);
-static void groupwise_populate_msg_body_from_item (EGwConnection *cnc, CamelMultipart *multipart, EGwItem *item, gchar *body);
-static void groupwise_msg_set_recipient_list (CamelMimeMessage *msg, EGwItem *item);
-static void gw_update_cache ( CamelFolder *folder, GList *item_list, gboolean uid_flag, GCancellable *cancellable, GError **error);
-static CamelMimeMessage *groupwise_folder_item_to_msg ( CamelFolder *folder, EGwItem *item, GError **error );
-static gchar * groupwise_get_filename (CamelFolder *folder, const gchar *uid, GError **error);
-static const gchar *get_from_from_org (EGwItemOrganizer *org);
-static void groupwise_refresh_folder (CamelFolder *folder, GCancellable *cancellable, GError **error);
-static gboolean groupwise_sync (CamelFolder *folder, gboolean expunge, CamelMessageInfo *update_single, GCancellable *cancellable, GError **error);
-
-#define d(x)
-
-static const gchar * GET_ITEM_VIEW_WITH_CACHE = "peek default recipient threading attachments subject status priority startDate created delivered size recurrenceKey message notification";
-static const gchar * GET_ITEM_VIEW_WITHOUT_CACHE = "peek default recipient threading hasAttachment subject status priority startDate created delivered size recurrenceKey";
-
-G_DEFINE_TYPE (CamelGroupwiseFolder, camel_groupwise_folder, CAMEL_TYPE_OFFLINE_FOLDER)
-
-static gchar *
-groupwise_get_filename (CamelFolder *folder, const gchar *uid, GError **error)
-{
-       CamelGroupwiseFolder *gw_folder = CAMEL_GROUPWISE_FOLDER (folder);
-
-       return camel_data_cache_get_filename (gw_folder->cache, "cache", uid, error);
-}
-
-/* create a mime message out of an gwitem */
-static void
-groupwise_set_mail_message_dates (CamelMimeMessage *msg, EGwItem *item)
-{
-       gchar *dtstring = NULL;
-
-       dtstring = e_gw_item_get_creation_date (item);
-       if (dtstring) {
-               gint offset = 0;
-               time_t actual_time = e_gw_connection_get_date_from_string (dtstring);
-               camel_mime_message_set_date (msg, actual_time, offset);
-       } else {
-               time_t actual_time;
-               gint offset = 0;
-               dtstring = e_gw_item_get_delivered_date (item);
-               if (dtstring) {
-                       actual_time = e_gw_connection_get_date_from_string (dtstring);
-               } else
-                       actual_time = (time_t) 0;
-               camel_mime_message_set_date (msg, actual_time, offset);
-       }
-}
-
-static void
-groupwise_set_mail_mi_dates (CamelGroupwiseMessageInfo *mi, EGwItem *item)
-{
-       gchar *sent_date = NULL, *received_date = NULL;
-       time_t actual_time = (time_t) 0;
-
-       sent_date = e_gw_item_get_creation_date (item);
-       received_date = e_gw_item_get_delivered_date (item);
-
-       if (sent_date) {
-               actual_time = e_gw_connection_get_date_from_string (sent_date);
-               mi->info.date_sent = actual_time;
-       }
-
-       if (received_date) {
-               actual_time = e_gw_connection_get_date_from_string (received_date);
-               mi->info.date_received = actual_time;
-       } else
-               mi->info.date_received = actual_time;
-
-       if (!sent_date)
-               mi->info.date_sent = actual_time;
-}
-
-static void
-groupwise_populate_details_from_item (CamelMimeMessage *msg, EGwItem *item)
-{
-       EGwItemType type;
-       gchar *dtstring = NULL;
-       gchar *temp_str = NULL;
-
-       temp_str = (gchar *)e_gw_item_get_subject (item);
-       if (temp_str)
-               camel_mime_message_set_subject (msg, temp_str);
-       type = e_gw_item_get_item_type (item);
-
-       if (type == E_GW_ITEM_TYPE_APPOINTMENT  || type == E_GW_ITEM_TYPE_NOTE || type == E_GW_ITEM_TYPE_TASK) {
-               time_t actual_time;
-               gint offset = 0;
-               dtstring = e_gw_item_get_start_date (item);
-               actual_time = e_gw_connection_get_date_from_string (dtstring);
-               camel_mime_message_set_date (msg, actual_time, offset);
-               return;
-       }
-
-       groupwise_set_mail_message_dates (msg, item);
-}
-
-/* convert an item to a msg body. set content type etc. */
-static void
-groupwise_populate_msg_body_from_item (EGwConnection *cnc, CamelMultipart *multipart, EGwItem *item, gchar *body)
-{
-       CamelMimePart *part;
-       EGwItemType type;
-       const gchar *temp_body = NULL;
-
-       part = camel_mime_part_new ();
-       camel_mime_part_set_encoding (part, CAMEL_TRANSFER_ENCODING_8BIT);
-
-       if (!body) {
-               temp_body = e_gw_item_get_message (item);
-               if (!temp_body) {
-                       gint len = 0;
-                       EGwConnectionStatus status;
-                       status = e_gw_connection_get_attachment (cnc,
-                                       e_gw_item_get_msg_body_id (item), 0, -1,
-                                       (const gchar **)&temp_body, &len);
-                       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                               status = e_gw_connection_get_attachment (cnc,
-                                       e_gw_item_get_msg_body_id (item), 0, -1,
-                                       (const gchar **)&temp_body, &len);
-                       if (status != E_GW_CONNECTION_STATUS_OK) {
-                               g_warning ("Could not get Messagebody\n");
-                       }
-               }
-       }
-
-       type = e_gw_item_get_item_type (item);
-       switch (type) {
-
-               case E_GW_ITEM_TYPE_APPOINTMENT:
-               case E_GW_ITEM_TYPE_TASK:
-               case E_GW_ITEM_TYPE_NOTE:
-                       {
-                               gchar *cal_buffer = NULL;
-                               gint len = 0;
-                               if (type==E_GW_ITEM_TYPE_APPOINTMENT)
-                                       convert_to_calendar (item, &cal_buffer, &len);
-                               else if (type == E_GW_ITEM_TYPE_TASK)
-                                       convert_to_task (item, &cal_buffer, &len);
-                               else
-                                       convert_to_note (item, &cal_buffer, &len);
-
-                               camel_mime_part_set_content(part, cal_buffer, len, "text/calendar");
-                               g_free (cal_buffer);
-                               break;
-                       }
-               case E_GW_ITEM_TYPE_NOTIFICATION:
-               case E_GW_ITEM_TYPE_MAIL:
-                       if (body)
-                               camel_mime_part_set_content(part, body, strlen(body), "text/html");
-                       else if (temp_body)
-                               camel_mime_part_set_content (part, temp_body, strlen (temp_body), e_gw_item_get_msg_content_type (item));
-                       else
-                               camel_mime_part_set_content(part, " ", strlen(" "), "text/html");
-                       break;
-
-               default:
-                       break;
-
-       }
-
-       camel_multipart_set_boundary (multipart, NULL);
-       camel_multipart_add_part (multipart, part);
-       g_object_unref (part);
-}
-
-/* Set the recipients list in the message from the item */
-static void
-groupwise_msg_set_recipient_list (CamelMimeMessage *msg, EGwItem *item)
-{
-       GSList *recipient_list;
-       EGwItemOrganizer *org;
-       struct _camel_header_address *ha;
-       gchar *subs_email;
-       struct _camel_header_address *to_list = NULL, *cc_list = NULL, *bcc_list=NULL;
-
-       org = e_gw_item_get_organizer (item);
-       recipient_list = e_gw_item_get_recipient_list (item);
-
-       if (recipient_list) {
-               GSList *rl;
-               gchar *status_opt = NULL;
-               gboolean enabled;
-
-               for (rl = recipient_list; rl != NULL; rl = rl->next) {
-                       EGwItemRecipient *recp = (EGwItemRecipient *) rl->data;
-                       enabled = recp->status_enabled;
-
-                       if (!recp->email) {
-                               ha=camel_header_address_new_group (recp->display_name);
-                       } else {
-                               ha=camel_header_address_new_name (recp->display_name,recp->email);
-                       }
-
-                       if (recp->type == E_GW_ITEM_RECIPIENT_TO) {
-                               if (recp->status_enabled)
-                                       status_opt = g_strconcat (status_opt ? status_opt : "" , "TO", ";",NULL);
-                               camel_header_address_list_append (&to_list, ha);
-                       } else if (recp->type == E_GW_ITEM_RECIPIENT_CC) {
-                               if (recp->status_enabled)
-                                       status_opt = g_strconcat (status_opt ? status_opt : "", "CC", ";",NULL);
-                               camel_header_address_list_append (&cc_list,ha);
-
-                       } else if (recp->type == E_GW_ITEM_RECIPIENT_BC) {
-                               if (recp->status_enabled)
-                                       status_opt = g_strconcat (status_opt ? status_opt : "", "BCC", ";",NULL);
-                               camel_header_address_list_append (&bcc_list,ha);
-                       } else {
-                               camel_header_address_unref (ha);
-                       }
-                       if (recp->status_enabled) {
-                               status_opt = g_strconcat (status_opt,
-                                               recp->display_name,";",
-                                               recp->email,";",
-                                               recp->delivered_date ? recp->delivered_date :  "", ";",
-                                               recp->opened_date ? recp->opened_date : "", ";",
-                                               recp->accepted_date ? recp->accepted_date : "", ";",
-                                               recp->deleted_date ? recp->deleted_date : "", ";",
-                                               recp->declined_date ? recp->declined_date : "", ";",
-                                               recp->completed_date ? recp->completed_date : "", ";",
-                                               recp->undelivered_date ? recp->undelivered_date : "", ";",
-                                               "::", NULL);
-
-                       }
-               }
-
-               /* The status tracking code is working fine. someone need to remove this */
-               if (enabled) {
-                       camel_medium_add_header ( CAMEL_MEDIUM (msg), "X-gw-status-opt", (const gchar *)status_opt);
-                       g_free (status_opt);
-               }
-       }
-
-       if (to_list) {
-               subs_email=camel_header_address_list_encode (to_list);
-               camel_medium_set_header( CAMEL_MEDIUM(msg), "To", subs_email);
-               g_free (subs_email);
-               camel_header_address_list_clear (&to_list);
-       }
-
-       if (cc_list) {
-               subs_email=camel_header_address_list_encode (cc_list);
-               camel_medium_set_header( CAMEL_MEDIUM(msg), "Cc", subs_email);
-               g_free (subs_email);
-               camel_header_address_list_clear (&cc_list);
-       }
-
-       if (bcc_list) {
-               subs_email=camel_header_address_list_encode (bcc_list);
-               camel_medium_set_header( CAMEL_MEDIUM(msg), "Bcc", subs_email);
-               g_free (subs_email);
-               camel_header_address_list_clear (&bcc_list);
-       }
-
-       if (org) {
-               if (org->display_name && org->display_name[0] && org->email != NULL && org->email[0] != '\0') {
-                       org->display_name = g_strdelimit (org->display_name, "<>", ' ');
-                       ha=camel_header_address_new_name (org->display_name, org->email);
-               } else if (org->email)
-                       ha=camel_header_address_new_name (org->email, org->email);
-               else if (org->display_name)
-                       ha=camel_header_address_new_group (org->display_name);
-               else
-                       ha = NULL;
-               if (ha) {
-                       subs_email = camel_header_address_list_encode (ha);
-                       camel_medium_set_header (CAMEL_MEDIUM (msg), "From", subs_email);
-                       camel_header_address_unref (ha);
-                       g_free (subs_email);
-               }
-       }
-}
-
-/* code to rename a folder. all the "meta nonsense" code should simply go away */
-static void
-groupwise_folder_rename (CamelFolder *folder, const gchar *new)
-{
-       CamelGroupwiseFolder *gw_folder;
-       CamelStore *parent_store;
-       CamelService *service;
-       const gchar *user_data_dir;
-       gchar *folder_dir, *summary_path, *state_file;
-       gchar *folders;
-
-       parent_store = camel_folder_get_parent_store (folder);
-
-       gw_folder = CAMEL_GROUPWISE_FOLDER (folder);
-
-       service = CAMEL_SERVICE (parent_store);
-       user_data_dir = camel_service_get_user_data_dir (service);
-
-       folders = g_strconcat (user_data_dir, "/folders", NULL);
-       folder_dir = e_path_to_physical (folders, new);
-       g_free (folders);
-
-       summary_path = g_strdup_printf ("%s/summary", folder_dir);
-
-       CAMEL_GROUPWISE_FOLDER_REC_LOCK (folder, cache_lock);
-       camel_data_cache_set_path (gw_folder->cache, folder_dir);
-       CAMEL_GROUPWISE_FOLDER_REC_UNLOCK (folder, cache_lock);
-
-       ((CamelFolderClass *)camel_groupwise_folder_parent_class)->rename (folder, new);
-       camel_folder_summary_set_filename (folder->summary, summary_path);
-
-       state_file = g_strdup_printf ("%s/cmeta", folder_dir);
-       camel_object_set_state_filename (CAMEL_OBJECT (folder), state_file);
-       g_free (state_file);
-
-       g_free (summary_path);
-       g_free (folder_dir);
-}
-
-static GPtrArray *
-groupwise_folder_search_by_expression (CamelFolder *folder, const gchar *expression, GError **error)
-{
-       CamelGroupwiseFolder *gw_folder = CAMEL_GROUPWISE_FOLDER (folder);
-       GPtrArray *matches;
-
-       CAMEL_GROUPWISE_FOLDER_LOCK (gw_folder, search_lock);
-       camel_folder_search_set_folder (gw_folder->search, folder);
-       matches = camel_folder_search_search (gw_folder->search, expression, NULL, error);
-       CAMEL_GROUPWISE_FOLDER_UNLOCK (gw_folder, search_lock);
-
-       return matches;
-}
-
-static guint32
-groupwise_folder_count_by_expression (CamelFolder *folder, const gchar *expression, GError **error)
-{
-       CamelGroupwiseFolder *gw_folder = CAMEL_GROUPWISE_FOLDER (folder);
-       guint32 matches;
-
-       CAMEL_GROUPWISE_FOLDER_LOCK (gw_folder, search_lock);
-       camel_folder_search_set_folder (gw_folder->search, folder);
-       matches = camel_folder_search_count (gw_folder->search, expression, error);
-       CAMEL_GROUPWISE_FOLDER_UNLOCK (gw_folder, search_lock);
-
-       return matches;
-}
-
-static GPtrArray *
-groupwise_folder_search_by_uids (CamelFolder *folder, const gchar *expression, GPtrArray *uids, GError **error)
-{
-       CamelGroupwiseFolder *gw_folder = CAMEL_GROUPWISE_FOLDER (folder);
-       GPtrArray *matches;
-
-       if (uids->len == 0)
-               return g_ptr_array_new ();
-
-       CAMEL_GROUPWISE_FOLDER_LOCK (gw_folder, search_lock);
-
-       camel_folder_search_set_folder (gw_folder->search, folder);
-       matches = camel_folder_search_search (gw_folder->search, expression, uids, error);
-
-       CAMEL_GROUPWISE_FOLDER_UNLOCK (gw_folder, search_lock);
-
-       return matches;
-}
-
-static void
-groupwise_folder_search_free (CamelFolder *folder, GPtrArray *uids)
-{
-       CamelGroupwiseFolder *gw_folder = CAMEL_GROUPWISE_FOLDER (folder);
-
-       g_return_if_fail (gw_folder->search);
-
-       CAMEL_GROUPWISE_FOLDER_LOCK (gw_folder, search_lock);
-
-       camel_folder_search_free_result (gw_folder->search, uids);
-
-       CAMEL_GROUPWISE_FOLDER_UNLOCK (gw_folder, search_lock);
-
-}
-
-/******************* functions specific to Junk Mail Handling**************/
-static void
-free_node (EGwJunkEntry *entry)
-{
-       if (entry) {
-               g_free (entry->id);
-               g_free (entry->match);
-               g_free (entry->matchType);
-               g_free (entry->lastUsed);
-               g_free (entry->modified);
-               g_free (entry);
-       }
-}
-
-/* This is a point of contention. We behave like the GW client and update our junk list
-in the same way as the GroupWise client. Add senders to junk list */
-static void
-update_junk_list (CamelStore *store, CamelMessageInfo *info, gint flag)
-{
-       gchar **email = NULL, *from = NULL;
-       gint index = 0;
-       CamelGroupwiseStore *gw_store= CAMEL_GROUPWISE_STORE (store);
-       CamelGroupwiseStorePrivate  *priv = gw_store->priv;
-       EGwConnection *cnc = cnc_lookup (priv);
-       EGwConnectionStatus status;
-
-       if (!(from = g_strdup (camel_message_info_from (info))))
-               goto error;
-
-       email = g_strsplit_set (from, "<>", -1);
-
-       if (from[0] == '<') {
-               /* g_strsplit_set will add a dummy empty string as the first string if the first character in the
-               original string is one of the delimiters that you want to suppress.
-               Refer to g_strsplit_set documentation */
-               index = 1;
-       }
-
-       if (!email || !email[index])
-               goto error;
-
-       if (flag == ADD_JUNK_ENTRY) {
-               status = e_gw_connection_create_junk_entry (cnc, email[index], "email", "junk");
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       status = e_gw_connection_create_junk_entry (cnc, email[index], "email", "junk");
-
-       } else if (flag == REMOVE_JUNK_ENTRY) {
-               GList *list = NULL;
-               EGwJunkEntry *entry;
-               status = e_gw_connection_get_junk_entries (cnc, &list);
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       status = e_gw_connection_get_junk_entries (cnc, &list);
-
-               if (status == E_GW_CONNECTION_STATUS_OK) {
-                       while (list) {
-                               entry = list->data;
-                               if (!g_ascii_strcasecmp (entry->match, email[index])) {
-                                       e_gw_connection_remove_junk_entry (cnc, entry->id);
-                               }
-                               list = list->next;
-                       }
-                       g_list_foreach (list, (GFunc) free_node, NULL);
-               }
-       }
-
-error:
-       g_free (from);
-       g_strfreev (email);
-}
-
-static void
-move_to_mailbox (CamelFolder *folder,
-                 CamelMessageInfo *info,
-                 GCancellable *cancellable,
-                 GError **error)
-{
-       CamelFolder *dest;
-       CamelStore *parent_store;
-       GPtrArray *uids;
-       const gchar *uid = camel_message_info_uid (info);
-
-       parent_store = camel_folder_get_parent_store (folder);
-
-       uids = g_ptr_array_new ();
-       g_ptr_array_add (uids, (gpointer) uid);
-
-       dest = camel_store_get_folder_sync (
-               parent_store, "Mailbox", 0, cancellable, error);
-       camel_message_info_set_flags (
-               info, CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_JUNK |
-               CAMEL_MESSAGE_JUNK_LEARN | CAMEL_GW_MESSAGE_NOJUNK |
-               CAMEL_GW_MESSAGE_JUNK, 0);
-       if (dest)
-               groupwise_transfer_messages_to_sync (
-                       folder, uids, dest, TRUE, NULL, cancellable, error);
-       else
-               g_warning ("No Mailbox folder found");
-
-       update_junk_list (parent_store, info, REMOVE_JUNK_ENTRY);
-}
-
-static void
-move_to_junk (CamelFolder *folder,
-              CamelMessageInfo *info,
-              GCancellable *cancellable,
-              GError **error)
-{
-       CamelFolder *dest;
-       CamelStore *parent_store;
-       GPtrArray *uids;
-       const gchar *uid = camel_message_info_uid (info);
-
-       parent_store = camel_folder_get_parent_store (folder);
-
-       uids = g_ptr_array_new ();
-       g_ptr_array_add (uids, (gpointer) uid);
-
-       dest = camel_store_get_folder_sync (
-               parent_store, JUNK_FOLDER, 0, cancellable, error);
-
-       if (dest)
-               groupwise_transfer_messages_to_sync (
-                       folder, uids, dest, TRUE, NULL, cancellable, error);
-       else {
-               create_junk_folder (parent_store);
-               dest = camel_store_get_folder_sync (
-                       parent_store, JUNK_FOLDER, 0, cancellable, error);
-               if (!dest)
-                       g_warning ("Could not get JunkFolder:Message not moved");
-               else
-                       groupwise_transfer_messages_to_sync (
-                               folder, uids, dest, TRUE, NULL, cancellable, error);
-       }
-       update_junk_list (parent_store, info, ADD_JUNK_ENTRY);
-}
-
-/********************* back to folder functions*************************/
-
-static gboolean
-groupwise_sync_summary (CamelFolder *folder, GError **error)
-{
-       CamelStoreInfo *si;
-       CamelStore *parent_store;
-       guint32 unread, total;
-       const gchar *full_name;
-
-       full_name = camel_folder_get_full_name (folder);
-       parent_store = camel_folder_get_parent_store (folder);
-
-       camel_folder_summary_save_to_db (folder->summary, error);
-
-       si = camel_store_summary_path ((CamelStoreSummary *) ((CamelGroupwiseStore *) parent_store)->summary, full_name);
-
-       total = camel_folder_summary_count (folder->summary);
-       unread = folder->summary->unread_count;
-
-       if (si) {
-               si->unread = unread;
-               si->total = total;
-       }
-
-       camel_store_summary_touch ((CamelStoreSummary *)((CamelGroupwiseStore *)parent_store)->summary);
-       camel_store_summary_save ((CamelStoreSummary *)((CamelGroupwiseStore *)parent_store)->summary);
-
-       return TRUE;
-}
-
-static void
-sync_flags (CamelFolder *folder, GList *uids)
-{
-       GList *l;
-       CamelMessageInfo *info = NULL;
-       CamelGroupwiseMessageInfo *gw_info;
-
-       for (l = uids; l != NULL; l = g_list_next (l))
-       {
-               info = camel_folder_summary_uid (folder->summary, l->data);
-               gw_info = (CamelGroupwiseMessageInfo *) info;
-
-               if (!info)
-                       continue;
-
-               gw_info->info.flags &= ~CAMEL_MESSAGE_FOLDER_FLAGGED;
-               gw_info->info.dirty = 1;
-               gw_info->server_flags = gw_info->info.flags;
-               camel_folder_summary_touch (folder->summary);
-
-               camel_message_info_free (info);
-       }
-}
-
-static gboolean
-groupwise_set_message_flags (CamelFolder *folder,
-                             const gchar *uid,
-                             CamelMessageFlags flags,
-                             CamelMessageFlags set)
-{
-       CamelMessageInfo *info;
-       gint res;
-       const gchar *sync_immediately;
-
-       g_return_val_if_fail (folder->summary != NULL, FALSE);
-
-       info = camel_folder_summary_uid (folder->summary, uid);
-       if (info == NULL)
-               return FALSE;
-
-       res = camel_message_info_set_flags (info, flags, set);
-
-       sync_immediately = g_getenv ("GW_SYNC_IMMEDIATE");
-
-       /* FIXME groupwise_sync() blocks, but this method is
-        *       not supposed to block.  Potential hang here. */
-       if (sync_immediately)
-               groupwise_sync (folder, FALSE, info, NULL, NULL);
-
-       camel_message_info_free (info);
-       return res;
-}
-
-/* This may need to be reorganized. */
-static gboolean
-groupwise_sync (CamelFolder *folder,
-                gboolean expunge,
-                CamelMessageInfo *update_single,
-                GCancellable *cancellable,
-                GError **error)
-{
-       CamelGroupwiseStore *gw_store;
-       CamelGroupwiseFolder *gw_folder;
-       CamelMessageInfo *info = NULL;
-       CamelGroupwiseMessageInfo *gw_info;
-       CamelStore *parent_store;
-       GList *read_items = NULL, *deleted_read_items = NULL, *unread_items = NULL;
-       flags_diff_t diff, unset_flags;
-       const gchar *container_id;
-       CamelFolderChangeInfo *changes;
-       EGwConnectionStatus status;
-       EGwConnection *cnc;
-       const gchar *full_name;
-       gint count, i;
-       gboolean success;
-       GList *deleted_items, *deleted_head;
-
-       full_name = camel_folder_get_full_name (folder);
-       parent_store = camel_folder_get_parent_store (folder);
-
-       gw_folder = CAMEL_GROUPWISE_FOLDER (folder);
-       gw_store = CAMEL_GROUPWISE_STORE (parent_store);
-
-       deleted_items = deleted_head = NULL;
-
-       if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (gw_store)))
-               return groupwise_sync_summary (folder, error);
-
-       camel_service_lock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-       if (!camel_groupwise_store_connected (gw_store, cancellable, NULL)) {
-               camel_service_unlock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-               return TRUE;
-       }
-       camel_service_unlock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       cnc = cnc_lookup (gw_store->priv);
-       container_id =  camel_groupwise_store_container_id_lookup (gw_store, full_name);
-
-       if (folder->folder_flags & CAMEL_FOLDER_HAS_BEEN_DELETED)
-               return TRUE;
-
-       changes = camel_folder_change_info_new ();
-       camel_folder_summary_prepare_fetch_all (folder->summary, error);
-       count = camel_folder_summary_count (folder->summary);
-       CAMEL_GROUPWISE_FOLDER_REC_LOCK (folder, cache_lock);
-       for (i=0; i < count; i++) {
-               guint32 flags = 0;
-
-               if (update_single != NULL) {
-                       info = update_single;
-                       camel_message_info_ref (info);
-                       count = 1;
-               } else
-                       info = camel_folder_summary_index (folder->summary, i);
-
-               gw_info = (CamelGroupwiseMessageInfo *) info;
-
-               /**Junk Mail handling**/
-               if (!info)
-                       continue;
-               flags = camel_message_info_flags (info);
-
-               if (!(flags & CAMEL_MESSAGE_FOLDER_FLAGGED)) {
-                               camel_message_info_free (info);
-                               continue;
-               }
-
-               if ((flags & CAMEL_MESSAGE_JUNK) && strcmp (camel_folder_get_name (folder), JUNK_FOLDER)) {
-                       /*marked a message junk*/
-                       move_to_junk (folder, info, cancellable, error);
-                       camel_folder_summary_remove_uid (folder->summary, camel_message_info_uid (info));
-                       camel_data_cache_remove (gw_folder->cache, "cache", camel_message_info_uid(info), NULL);
-                       continue;
-               }
-
-               if ((flags & CAMEL_GW_MESSAGE_NOJUNK) && !strcmp (camel_folder_get_name (folder), JUNK_FOLDER)) {
-                       /*message was marked as junk, now unjunk*/
-                       move_to_mailbox (folder, info, cancellable, error);
-                       camel_folder_summary_remove_uid (folder->summary, camel_message_info_uid (info));
-                       camel_data_cache_remove (gw_folder->cache, "cache", camel_message_info_uid(info), NULL);
-                       continue;
-               }
-
-               if (gw_info && (gw_info->info.flags & CAMEL_MESSAGE_FOLDER_FLAGGED)) {
-                       do_flags_diff (&diff, gw_info->server_flags, gw_info->info.flags);
-                       do_flags_diff (&unset_flags, flags, gw_info->server_flags);
-
-                       diff.changed &= folder->permanent_flags;
-
-                       /* weed out flag changes that we can't sync to the server */
-                       if (!diff.changed) {
-                               camel_message_info_free (info);
-                               continue;
-                       } else {
-                               const gchar *uid;
-
-                               uid = camel_message_info_uid (info);
-                               if (diff.bits & CAMEL_MESSAGE_DELETED) {
-
-                                       /* In case a new message is READ and then deleted immediately */
-                                       if (diff.bits & CAMEL_MESSAGE_SEEN)
-                                               deleted_read_items = g_list_prepend (deleted_read_items, (gchar *) uid);
-
-                                       if (deleted_items) {
-                                               deleted_items = g_list_prepend (deleted_items, (gchar *)camel_message_info_uid (info));
-                                       } else {
-                                               g_list_free (deleted_head);
-                                               deleted_head = NULL;
-                                               deleted_head = deleted_items = g_list_prepend (deleted_items, (gchar *)camel_message_info_uid (info));
-                                       }
-
-                                       if (g_list_length (deleted_items) == GROUPWISE_BULK_DELETE_LIMIT ) {
-                                               camel_service_lock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-                                               /*
-                                                       Sync up the READ changes before deleting the message.
-                                                       Note that if a message is marked as unread and then deleted,
-                                                       Evo doesnt not take care of it, as I find that scenario to be impractical.
-                                               */
-
-                                               if (deleted_read_items) {
-
-                                                       /* FIXME: As in many places, we need to handle the return value
-                                                       and do some error handling. But, we do not have all error codes also
-                                                       and errors are not returned always either */
-
-                                                       status = e_gw_connection_mark_read (cnc, deleted_read_items);
-                                                       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                                                               status = e_gw_connection_mark_read (cnc, deleted_read_items);
-                                                       g_list_free (deleted_read_items);
-                                                       deleted_read_items = NULL;
-                                               }
-
-                                               /* And now delete the messages */
-                                               status = e_gw_connection_remove_items (cnc, container_id, deleted_items);
-                                               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                                                       status = e_gw_connection_remove_items (cnc, container_id, deleted_items);
-                                               camel_service_unlock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-                                               if (status == E_GW_CONNECTION_STATUS_OK) {
-                                                       gchar *uid;
-                                                       while (deleted_items) {
-                                                               uid = (gchar *)deleted_items->data;
-                                                               CAMEL_GROUPWISE_FOLDER_REC_LOCK (folder, cache_lock);
-                                                               camel_folder_summary_remove_uid (folder->summary, uid);
-                                                               camel_data_cache_remove(gw_folder->cache, "cache", uid, NULL);
-                                                               camel_folder_change_info_remove_uid (changes, uid);
-                                                               CAMEL_GROUPWISE_FOLDER_REC_UNLOCK (folder, cache_lock);
-                                                               deleted_items = g_list_next (deleted_items);
-                                                               count -= GROUPWISE_BULK_DELETE_LIMIT;
-                                                               i -= GROUPWISE_BULK_DELETE_LIMIT;
-                                                       }
-                                               }
-                                       }
-                               } else if (diff.bits & CAMEL_MESSAGE_SEEN) {
-                                       read_items = g_list_prepend (read_items, (gchar *)uid);
-                               } else if (unset_flags.bits & CAMEL_MESSAGE_SEEN) {
-                                       unread_items = g_list_prepend (unread_items, (gchar *)uid);
-                               }
-                       }
-               }
-
-               camel_message_info_free (info);
-       }
-
-       CAMEL_GROUPWISE_FOLDER_REC_UNLOCK (folder, cache_lock);
-
-       /* Do things in bulk. Reduces server calls, network latency etc.  */
-       if (deleted_read_items)
-               read_items = g_list_concat (read_items, deleted_read_items);
-
-       if (read_items) {
-               camel_service_lock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-               status = e_gw_connection_mark_read (cnc, read_items);
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       status = e_gw_connection_mark_read (cnc, read_items);
-
-               if (status == E_GW_CONNECTION_STATUS_OK)
-                       sync_flags (folder, read_items);
-
-               g_list_free (read_items);
-               camel_service_unlock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-       }
-
-       if (deleted_items) {
-               camel_service_lock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-               if (!strcmp (full_name, "Trash")) {
-                       status = e_gw_connection_purge_selected_items (cnc, deleted_items);
-                       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                               status = e_gw_connection_purge_selected_items (cnc, deleted_items);
-               } else {
-                       status = e_gw_connection_remove_items (cnc, container_id, deleted_items);
-                       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                               status = e_gw_connection_remove_items (cnc, container_id, deleted_items);
-               }
-               if (status == E_GW_CONNECTION_STATUS_OK) {
-                       gchar *uid;
-                       while (deleted_items) {
-                               uid = (gchar *)deleted_items->data;
-                               CAMEL_GROUPWISE_FOLDER_REC_LOCK (folder, cache_lock);
-                               camel_folder_summary_remove_uid (folder->summary, uid);
-                               camel_data_cache_remove(gw_folder->cache, "cache", uid, NULL);
-                               camel_folder_change_info_remove_uid (changes, uid);
-                               CAMEL_GROUPWISE_FOLDER_REC_UNLOCK (folder, cache_lock);
-                               deleted_items = g_list_next (deleted_items);
-                       }
-               }
-               g_list_free (deleted_items);
-               camel_service_unlock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-       }
-
-       if (unread_items) {
-               camel_service_lock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-               status = e_gw_connection_mark_unread (cnc, unread_items);
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       status = e_gw_connection_mark_unread (cnc, unread_items);
-
-               if (status == E_GW_CONNECTION_STATUS_OK)
-                       sync_flags (folder, unread_items);
-
-               g_list_free (unread_items);
-               camel_service_unlock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-       }
-
-       if (expunge) {
-               camel_service_lock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-               status = e_gw_connection_purge_deleted_items (cnc);
-               if (status == E_GW_CONNECTION_STATUS_OK) {
-                       g_message ("Purged deleted items in %s", camel_folder_get_name (folder));
-               }
-               camel_service_unlock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-       }
-
-       camel_service_lock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-       success = groupwise_sync_summary (folder, error);
-       camel_service_unlock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       camel_folder_changed (folder, changes);
-       camel_folder_change_info_free (changes);
-
-       return success;
-}
-
-CamelFolder *
-camel_gw_folder_new (CamelStore *store,
-                     const gchar *folder_name,
-                     const gchar *folder_dir,
-                     GCancellable *cancellable,
-                     GError **error)
-{
-       CamelFolder *folder;
-       CamelGroupwiseFolder *gw_folder;
-       CamelURL *url;
-       gchar *summary_file, *state_file, *journal_file;
-       gchar *short_name;
-
-       url = camel_service_get_camel_url (CAMEL_SERVICE (store));
-
-       short_name = strrchr (folder_name, '/');
-       if (short_name)
-               short_name++;
-       else
-               short_name = (gchar *) folder_name;
-
-       folder = g_object_new (
-               CAMEL_TYPE_GROUPWISE_FOLDER,
-               "name", short_name, "full-name", folder_name,
-               "parent_store", store, NULL);
-
-       gw_folder = CAMEL_GROUPWISE_FOLDER (folder);
-
-       summary_file = g_strdup_printf ("%s/summary",folder_dir);
-       folder->summary = camel_groupwise_summary_new (folder, summary_file);
-       g_free (summary_file);
-       if (!folder->summary) {
-               g_object_unref (CAMEL_OBJECT (folder));
-               g_set_error (
-                       error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
-                       _("Could not load summary for %s"), folder_name);
-               return NULL;
-       }
-
-       /* set/load persistent state */
-       state_file = g_strdup_printf ("%s/cmeta", folder_dir);
-       camel_object_set_state_filename (CAMEL_OBJECT (folder), state_file);
-       g_free (state_file);
-       camel_object_state_read (CAMEL_OBJECT (folder));
-
-       gw_folder->cache = camel_data_cache_new (folder_dir, error);
-       if (!gw_folder->cache) {
-               g_object_unref (folder);
-               return NULL;
-       }
-
-       journal_file = g_strdup_printf ("%s/journal",folder_dir);
-       gw_folder->journal = camel_groupwise_journal_new (gw_folder, journal_file);
-       g_free (journal_file);
-       if (!gw_folder->journal) {
-               g_object_unref (folder);
-               return NULL;
-       }
-
-       if (!strcmp (folder_name, "Mailbox")) {
-               if (camel_url_get_param (url, "filter"))
-                       folder->folder_flags |= CAMEL_FOLDER_FILTER_RECENT;
-       }
-
-       gw_folder->search = camel_folder_search_new ();
-       if (!gw_folder->search) {
-               g_object_unref (folder);
-               return NULL;
-       }
-
-       return folder;
-}
-
-typedef struct _FolderUpdateData FolderUpdateData;
-
-struct _FolderUpdateData {
-       EGwConnection *cnc;
-       CamelFolder *folder;
-       gchar *container_id;
-       gchar *t_str;
-       GSList *slist;
-};
-
-static void
-folder_update_data_free (FolderUpdateData *data)
-{
-       g_free (data->t_str);
-       g_free (data->container_id);
-       g_object_unref (data->folder);
-       g_slist_foreach (data->slist, (GFunc) g_free, NULL);
-       g_slist_free (data->slist);
-
-       g_slice_free (FolderUpdateData, data);
-}
-
-static void
-update_update (CamelSession *session,
-               GCancellable *cancellable,
-               FolderUpdateData *data,
-               GError **error)
-{
-       EGwConnectionStatus status;
-       CamelGroupwiseStore *gw_store;
-       CamelStore *parent_store;
-       CamelService *service;
-       CamelServiceConnectionStatus conn_status;
-       GList *item_list, *items_full_list = NULL, *last_element=NULL;
-       gint cursor = 0;
-       const gchar *position = E_GW_CURSOR_POSITION_END;
-       gboolean done;
-
-       parent_store = camel_folder_get_parent_store (data->folder);
-       gw_store = CAMEL_GROUPWISE_STORE (parent_store);
-
-       service = CAMEL_SERVICE (gw_store);
-
-       /* Hold the connect_lock.
-          In case if user went offline, don't do anything.
-          data->cnc would have become invalid, as the store disconnect unrefs it.
-        */
-       camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       conn_status = camel_service_get_connection_status (service);
-       if (!camel_offline_store_get_online (
-                       CAMEL_OFFLINE_STORE (gw_store)) ||
-                       conn_status == CAMEL_SERVICE_DISCONNECTED) {
-               goto end1;
-       }
-
-       camel_operation_push_message (
-               cancellable,
-               _("Checking for deleted messages %s"),
-               camel_folder_get_name (data->folder));
-
-       status = e_gw_connection_create_cursor (data->cnc, data->container_id, "id", NULL, &cursor);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               status = e_gw_connection_create_cursor (data->cnc, data->container_id, "id", NULL, &cursor);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               g_warning ("ERROR update update\n");
-               goto end1;
-       }
-
-       done = FALSE;
-       data->slist = NULL;
-
-       while (!done) {
-
-               if (camel_application_is_exiting) {
-                               camel_service_unlock (
-                                       service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-                               return;
-               }
-
-               item_list = NULL;
-               status = e_gw_connection_get_all_mail_uids (data->cnc, data->container_id, cursor, FALSE, READ_CURSOR_MAX_IDS, position, &item_list);
-               if (status != E_GW_CONNECTION_STATUS_OK) {
-                       g_warning ("ERROR update update\n");
-                       e_gw_connection_destroy_cursor (data->cnc, data->container_id, cursor);
-                       goto end1;
-               }
-
-               if (!item_list)
-                       done = TRUE;
-               else {
-
-                       /* item_list is prepended to items_full_list and not the other way
-                          because when we have a large number of items say 50000,
-                          for each iteration there will be more elements in items_full_list
-                          and less elements in item_list */
-
-                       last_element = g_list_last (item_list);
-                       if (items_full_list) {
-                               last_element->next = items_full_list;
-                               items_full_list->prev = last_element;
-                       }
-                       items_full_list = item_list;
-               }
-               position = E_GW_CURSOR_POSITION_CURRENT;
-       }
-       e_gw_connection_destroy_cursor (data->cnc, data->container_id, cursor);
-
-       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-       /* Take out only the first part in the list until the @ since it is guaranteed
-          to be unique only until that symbol */
-
-       /*if (items_full_list) {
-         gint i;
-         item_list = items_full_list;
-
-         while (item_list->next) {
-         i = 0;
-         while (((const gchar *)item_list->data)[i++]!='@');
-         ((gchar *)item_list->data)[i-1] = '\0';
-         item_list = item_list->next;
-         }
-
-         i = 0;
-         while (((const gchar *)item_list->data)[i++]!='@');
-         ((gchar *)item_list->data)[i-1] = '\0';
-         }*/
-
-       g_print ("\nNumber of items in the folder: %d \n", g_list_length(items_full_list));
-       gw_update_all_items (data->folder, items_full_list, NULL, NULL);
-       camel_operation_pop_message (cancellable);
-
-       return;
- end1:
-       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-       camel_operation_pop_message (cancellable);
-       if (items_full_list) {
-               g_list_foreach (items_full_list, (GFunc)g_free, NULL);
-               g_list_free (items_full_list);
-       }
-       return;
-}
-
-static gint
-check_for_new_mails_count (CamelGroupwiseSummary *gw_summary, GSList *ids)
-{
-       CamelFolderSummary *summary = (CamelFolderSummary *) gw_summary;
-       GSList *l = NULL;
-       gint count = 0;
-
-       for (l = ids; l != NULL; l = g_slist_next (l)) {
-               EGwItem *item = l->data;
-               const gchar *id = e_gw_item_get_id (item);
-               CamelMessageInfo *info  = camel_folder_summary_uid (summary, id);
-
-               if (!info)
-                       count++;
-               else
-                       camel_message_info_free (info);
-       }
-
-       return count;
-}
-
-static gint
-compare_ids (gpointer a, gpointer b, gpointer data)
-{
-       EGwItem *item1 = (EGwItem *) a;
-       EGwItem *item2 = (EGwItem *) b;
-       const gchar *id1 = NULL, *id2 = NULL;
-
-       id1 = e_gw_item_get_id (item1);
-       id2 = e_gw_item_get_id (item2);
-
-       return strcmp (id1, id2);
-}
-
-static gint
-get_merge_lists_new_count (CamelGroupwiseSummary *summary, GSList *new, GSList *modified, GSList **merged)
-{
-       GSList *l, *element;
-       gint count = 0;
-
-       if (new == NULL && modified == NULL) {
-               *merged = NULL;
-               return 0;
-       } if (new == NULL) {
-               *merged = modified;
-
-               return check_for_new_mails_count (summary, modified);
-       } else if (modified == NULL) {
-               *merged = new;
-
-               return check_for_new_mails_count (summary, new);
-       }
-
-       /* now merge both the lists */
-       for (l = new; l != NULL; l = g_slist_next (l)) {
-               element = g_slist_find_custom (modified, l->data, (GCompareFunc) compare_ids);
-               if (element != NULL) {
-                       g_object_unref (element->data);
-                       element->data = NULL;
-                       modified = g_slist_delete_link (modified, element);
-               }
-       }
-
-       /* There might some new items which come through modified also */
-       *merged = g_slist_concat (new, modified);
-       count = check_for_new_mails_count (summary, *merged);
-
-       return count;
-}
-
-static void
-update_summary_string (CamelFolder *folder, const gchar *time_string)
-{
-       CamelGroupwiseSummary *summary = (CamelGroupwiseSummary *) folder->summary;
-
-       if (summary->time_string)
-               g_free (summary->time_string);
-
-       ((CamelGroupwiseSummary *) folder->summary)->time_string = g_strdup (time_string);
-       camel_folder_summary_touch (folder->summary);
-       camel_folder_summary_save_to_db (folder->summary, NULL);
-}
-
-static void
-groupwise_refresh_folder (CamelFolder *folder,
-                          GCancellable *cancellable,
-                          GError **error)
-{
-       CamelGroupwiseStore *gw_store;
-       CamelGroupwiseFolder *gw_folder;
-       CamelGroupwiseSummary *summary = (CamelGroupwiseSummary *)folder->summary;
-       EGwConnection *cnc;
-       CamelService *service;
-       CamelSession *session;
-       CamelStore *parent_store;
-       gboolean is_proxy;
-       gboolean is_locked = TRUE;
-       gint status;
-       GList *list = NULL;
-       GSList *new_items = NULL, *modified_items = NULL, *merged = NULL;
-       const gchar *full_name;
-       gchar *container_id = NULL;
-       gchar *old_sync_time = NULL, *new_sync_time = NULL, *modified_sync_time = NULL;
-       gboolean sync_deleted = FALSE;
-       EGwContainer *container;
-       gint new_item_count = 0;
-
-       full_name = camel_folder_get_full_name (folder);
-       parent_store = camel_folder_get_parent_store (folder);
-
-       service = CAMEL_SERVICE (parent_store);
-       session = camel_service_get_session (service);
-       is_proxy = (parent_store->flags & CAMEL_STORE_PROXY);
-
-       gw_folder = CAMEL_GROUPWISE_FOLDER (folder);
-       gw_store = CAMEL_GROUPWISE_STORE (parent_store);
-
-       cnc = cnc_lookup (gw_store->priv);
-
-       /* Sync-up the (un)read changes before getting updates,
-       so that the getFolderList will reflect the most recent changes too */
-       groupwise_sync (folder, FALSE, NULL, cancellable, error);
-
-       if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (gw_store))) {
-               g_warning ("In offline mode. Cannot refresh!!!\n");
-               return;
-       }
-
-       container_id = g_strdup (camel_groupwise_store_container_id_lookup (gw_store, full_name));
-
-       if (!container_id) {
-               d (printf ("\nERROR - Container id not present. Cannot refresh info for %s\n", full_name));
-               return;
-       }
-
-       if (!cnc)
-               return;
-
-       if (camel_folder_is_frozen (folder) ) {
-               gw_folder->need_refresh = TRUE;
-       }
-
-       camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       if (!camel_groupwise_store_connected (gw_store, cancellable, error))
-               goto end1;
-
-       if (!strcmp (full_name, "Trash")) {
-               is_proxy = TRUE;
-       }
-
-       /*Get the New Items*/
-       if (!is_proxy) {
-               const gchar *source;
-
-               if (!strcmp (full_name, RECEIVED) || !strcmp (full_name, SENT)) {
-                       source = NULL;
-               } else {
-                       source = "sent received";
-               }
-
-               old_sync_time = g_strdup (((CamelGroupwiseSummary *) folder->summary)->time_string);
-               new_sync_time = g_strdup (old_sync_time);
-
-               status = e_gw_connection_get_quick_messages (cnc, container_id,
-                               "peek id",
-                               &new_sync_time, "New", NULL, source, -1, &new_items);
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       status = e_gw_connection_get_quick_messages (cnc, container_id,
-                                       "peek id",
-                                       &new_sync_time, "New", NULL, source, -1, &new_items);
-               if (status != E_GW_CONNECTION_STATUS_OK) {
-                       g_set_error (
-                               error, CAMEL_SERVICE_ERROR,
-                               CAMEL_SERVICE_ERROR_INVALID,
-                               _("Authentication failed"));
-                       goto end2;
-               }
-
-               modified_sync_time = g_strdup (old_sync_time);
-
-               /*Get those items which have been modifed*/
-               status = e_gw_connection_get_quick_messages (cnc, container_id,
-                               "peek id",
-                               &modified_sync_time, "Modified", NULL, source, -1, &modified_items);
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       status = e_gw_connection_get_quick_messages (cnc, container_id,
-                                       "peek id",
-                                       &modified_sync_time, "Modified", NULL, source, -1, &modified_items);
-               if (status != E_GW_CONNECTION_STATUS_OK) {
-                       g_set_error (
-                               error, CAMEL_SERVICE_ERROR,
-                               CAMEL_SERVICE_ERROR_INVALID,
-                               _("Authentication failed"));
-                       goto end3;
-               }
-
-               if (gw_store->current_folder != folder)
-                       groupwise_store_set_current_folder (gw_store, folder);
-
-               new_item_count = get_merge_lists_new_count (summary, new_items, modified_items, &merged);
-
-               /* FIXME need to cleanup the code which uses GList. Ideally GSList would just suffice. */
-               if (merged != NULL) {
-                       GSList *sl = NULL;
-
-                       for (sl = merged; sl != NULL; sl = g_slist_next (sl))
-                               list = g_list_prepend (list, sl->data);
-               }
-               g_slist_free (merged);
-
-               container = e_gw_connection_get_container (cnc, container_id);
-               if (container) {
-                       /* HACK: Refer to Novell bugzilla bug #464379 */
-                       if ((camel_folder_summary_count (folder->summary) + new_item_count) == e_gw_container_get_total_count (container))
-                               sync_deleted = FALSE;
-                       else
-                               sync_deleted = TRUE;
-
-               } else
-                       sync_deleted = FALSE;
-
-               g_object_unref (container);
-
-               if (list)
-                       gw_update_cache (folder, list, FALSE, cancellable, error);
-
-               /* update the new_sync_time to summary */
-               update_summary_string (folder, new_sync_time);
-       }
-
-       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-       is_locked = FALSE;
-
-       /*
-        * The New and Modified items in the server have been updated in the summary.
-        * Now we have to make sure that all the deleted items in the server are deleted
-        * from Evolution as well. So we get the id's of all the items on the sever in
-        * this folder, and update the summary.
-        */
-       /*create a new session thread for the update all operation*/
-       if (sync_deleted || is_proxy) {
-               FolderUpdateData *data;
-
-               data = g_slice_new0 (FolderUpdateData);
-               data->cnc = cnc;
-               data->t_str = g_strdup (old_sync_time);
-               data->container_id = g_strdup (container_id);
-               data->folder = g_object_ref (folder);
-
-               camel_session_submit_job (
-                       session, (CamelSessionCallback)
-                       update_update, data,
-                       (GDestroyNotify) folder_update_data_free);
-       }
-
-end3:
-       g_list_foreach (list, (GFunc) g_object_unref, NULL);
-       g_list_free (list);
-       list = NULL;
-end2:
-       g_free (old_sync_time);
-       g_free (new_sync_time);
-       g_free (modified_sync_time);
-       g_free (container_id);
-end1:
-       if (is_locked)
-               camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-       return;
-}
-
-static guint8 *
-get_md5_digest (const guchar *str)
-{
-       guint8 *digest;
-       gsize length;
-       GChecksum *checksum;
-
-       length = g_checksum_type_get_length (G_CHECKSUM_MD5);
-       digest = g_malloc0 (length);
-
-       checksum = g_checksum_new (G_CHECKSUM_MD5);
-       g_checksum_update (checksum, str, -1);
-       g_checksum_get_digest (checksum, digest, &length);
-       g_checksum_free (checksum);
-
-       return digest;
-}
-
-static void
-groupwise_folder_set_threading_data (CamelGroupwiseMessageInfo *mi, EGwItem *item)
-{
-       const gchar *parent_threads;
-       gint count = 0;
-       const gchar *message_id = e_gw_item_get_message_id (item);
-       struct _camel_header_references *refs, *scan;
-       guint8 *digest;
-       gchar *msgid;
-
-       if (!message_id)
-               return;
-
-       /* set message id */
-       msgid = camel_header_msgid_decode (message_id);
-       digest = get_md5_digest ((const guchar *)msgid);
-       memcpy (mi->info.message_id.id.hash, digest, sizeof (mi->info.message_id.id.hash));
-       g_free (digest);
-       g_free (msgid);
-
-       parent_threads = e_gw_item_get_parent_thread_ids (item);
-
-       if (!parent_threads)
-               return;
-
-       refs = camel_header_references_decode (parent_threads);
-       count = camel_header_references_list_size (&refs);
-       mi->info.references = g_malloc (sizeof (*mi->info.references) + ((count-1) * sizeof (mi->info.references->references[0])));
-       scan = refs;
-       count = 0;
-
-       while (scan) {
-               digest = get_md5_digest ((const guchar *) scan->id);
-               memcpy (mi->info.references->references[count].id.hash, digest, sizeof (mi->info.message_id.id.hash));
-               g_free (digest);
-
-               count++;
-               scan = scan->next;
-       }
-
-       mi->info.references->size = count;
-       camel_header_references_list_clear (&refs);
-}
-
-/* Update the GroupWise cache with the list of items passed. should happen in thread. */
-static void
-gw_update_cache (CamelFolder *folder,
-                 GList *list,
-                 gboolean uid_flag,
-                 GCancellable *cancellable,
-                 GError **error)
-{
-       CamelGroupwiseMessageInfo *mi = NULL;
-       CamelMessageInfo *pmi = NULL;
-       CamelGroupwiseStore *gw_store;
-       CamelGroupwiseFolder *gw_folder;
-       CamelOfflineFolder *offline_folder;
-       CamelStore *parent_store;
-       EGwConnection *cnc;
-       guint32 item_status;
-       CamelFolderChangeInfo *changes = NULL;
-       gboolean exists = FALSE;
-       GString *str_to = g_string_new (NULL);
-       GString *str_cc = g_string_new (NULL);
-       const gchar *priority = NULL;
-       gchar *container_id = NULL;
-       gboolean is_junk = FALSE;
-       EGwConnectionStatus status;
-       GList *item_list = list;
-       gint total_items = g_list_length (item_list), i=0;
-       gboolean is_proxy;
-       const gchar *full_name;
-
-       gboolean folder_needs_caching;
-
-       full_name = camel_folder_get_full_name (folder);
-       parent_store = camel_folder_get_parent_store (folder);
-
-       is_proxy = (parent_store->flags & CAMEL_STORE_WRITE);
-
-       gw_folder = CAMEL_GROUPWISE_FOLDER (folder);
-       gw_store = CAMEL_GROUPWISE_STORE (parent_store);
-
-       cnc = cnc_lookup (gw_store->priv);
-
-       offline_folder = CAMEL_OFFLINE_FOLDER (folder);
-       folder_needs_caching = camel_offline_folder_get_offline_sync (offline_folder);
-
-       changes = camel_folder_change_info_new ();
-       container_id = g_strdup (camel_groupwise_store_container_id_lookup (gw_store, full_name));
-       if (!container_id) {
-               d (printf("\nERROR - Container id not present. Cannot refresh info\n"));
-               camel_folder_change_info_free (changes);
-               return;
-       }
-
-       if (!strcmp (full_name, JUNK_FOLDER)) {
-               is_junk = TRUE;
-       }
-
-       camel_operation_push_message (
-               cancellable,
-               _("Fetching summary information for new messages in %s"),
-               camel_folder_get_name (folder));
-
-       for (; item_list != NULL; item_list = g_list_next (item_list) ) {
-               EGwItem *temp_item;
-               EGwItem *item;
-               EGwItemType type = E_GW_ITEM_TYPE_UNKNOWN;
-               EGwItemOrganizer *org;
-               gchar *temp_date = NULL;
-               const gchar *id;
-               GSList *recp_list = NULL;
-               CamelStream *cache_stream, *t_cache_stream;
-               CamelMimeMessage *mail_msg = NULL;
-               const gchar *recurrence_key = NULL;
-               gint rk;
-
-               exists = FALSE;
-
-               if (uid_flag == FALSE) {
-                       temp_item = (EGwItem *)item_list->data;
-                       id = e_gw_item_get_id (temp_item);
-               } else
-                       id = (gchar *) item_list->data;
-
-               camel_operation_progress (
-                       cancellable, (i * 100) / total_items);
-
-               if (folder_needs_caching)
-                       status = e_gw_connection_get_item (cnc, container_id, id, GET_ITEM_VIEW_WITH_CACHE, &item);
-               else
-                       status = e_gw_connection_get_item (cnc, container_id, id, GET_ITEM_VIEW_WITHOUT_CACHE, &item);
-
-               if (status != E_GW_CONNECTION_STATUS_OK) {
-                       g_message ("Could not get the item from the server, item id %s \n", id);
-                       i++;
-                       continue;
-               }
-
-               /************************ First populate summary *************************/
-
-               item_status = e_gw_item_get_item_status (item);
-
-               /* skip the deleted items */
-               if (item_status & E_GW_ITEM_STAT_DELETED && strcmp (full_name, "Trash")) {
-                       i++;
-                       continue;
-               }
-
-               mi = NULL;
-               pmi = NULL;
-               pmi = camel_folder_summary_uid (folder->summary, id);
-               if (pmi) {
-                       exists = TRUE;
-                       camel_message_info_ref (pmi);
-                       mi = (CamelGroupwiseMessageInfo *)pmi;
-               }
-
-               type = e_gw_item_get_item_type (item);
-               if (!exists) {
-                       if ((type == E_GW_ITEM_TYPE_CONTACT) || (type == E_GW_ITEM_TYPE_UNKNOWN)) {
-                               exists = FALSE;
-                               continue;
-                       }
-
-                       mi = (CamelGroupwiseMessageInfo *)camel_message_info_new (folder->summary);
-                       if (mi->info.content == NULL) {
-                               mi->info.content = camel_folder_summary_content_info_new (folder->summary);
-                               mi->info.content->type = camel_content_type_new ("multipart", "mixed");
-                       }
-
-                       mi->info.flags = 0;
-
-                       if (type == E_GW_ITEM_TYPE_APPOINTMENT || type == E_GW_ITEM_TYPE_TASK || type == E_GW_ITEM_TYPE_NOTE)
-                               camel_message_info_set_user_flag ((CamelMessageInfo*)mi, "$has_cal", TRUE);
-               }
-
-               rk = e_gw_item_get_recurrence_key (item);
-               if (rk > 0) {
-                       recurrence_key = g_strdup_printf("%d", rk);
-                       camel_message_info_set_user_tag ((CamelMessageInfo*)mi, "recurrence-key", recurrence_key);
-               }
-
-               /*all items in the Junk Mail folder should have this flag set*/
-               if (is_junk)
-                       mi->info.flags |= CAMEL_GW_MESSAGE_JUNK;
-
-               if (item_status & E_GW_ITEM_STAT_READ)
-                       mi->info.flags |= CAMEL_MESSAGE_SEEN;
-               else
-                       mi->info.flags &= ~CAMEL_MESSAGE_SEEN;
-
-               if (item_status & E_GW_ITEM_STAT_REPLIED)
-                       mi->info.flags |= CAMEL_MESSAGE_ANSWERED;
-
-               priority = e_gw_item_get_priority (item);
-               if (priority && !(g_ascii_strcasecmp (priority,"High"))) {
-                       mi->info.flags |= CAMEL_MESSAGE_FLAGGED;
-               }
-
-               if (e_gw_item_has_attachment (item))
-                       mi->info.flags |= CAMEL_MESSAGE_ATTACHMENTS;
-               if (is_proxy)
-                       mi->info.flags |= CAMEL_MESSAGE_USER_NOT_DELETABLE;
-
-               mi->server_flags = mi->info.flags;
-
-               org = e_gw_item_get_organizer (item);
-               mi->info.from = get_from_from_org (org);
-
-               g_string_truncate (str_to, 0);
-               g_string_truncate (str_cc, 0);
-               recp_list = e_gw_item_get_recipient_list (item);
-               if (recp_list) {
-                       GSList *rl;
-                       gint i_to = 0, i_cc = 0;
-                       for (rl = recp_list; rl != NULL; rl = rl->next) {
-                               EGwItemRecipient *recp = (EGwItemRecipient *) rl->data;
-                               if (recp->type == E_GW_ITEM_RECIPIENT_TO) {
-                                       if (i_to)
-                                               str_to = g_string_append (str_to, ", ");
-                                       g_string_append_printf (str_to,"%s <%s>", recp->display_name, recp->email);
-                                       i_to++;
-                               } else if (recp->type == E_GW_ITEM_RECIPIENT_CC) {
-                                       if (i_cc)
-                                               str_cc = g_string_append (str_cc, ", ");
-                                       g_string_append_printf (str_cc,"%s <%s>", recp->display_name, recp->email);
-                                       i_cc++;
-                               }
-                       }
-                       if (exists)
-                               camel_pstring_free (mi->info.to);
-                       mi->info.to = camel_pstring_strdup (str_to->str);
-                       mi->info.cc = camel_pstring_strdup (str_cc->str);
-
-                       g_string_truncate (str_to, 0);
-                       g_string_truncate (str_cc, 0);
-               }
-
-               if (type == E_GW_ITEM_TYPE_APPOINTMENT
-                               || type ==  E_GW_ITEM_TYPE_NOTE
-                               || type ==  E_GW_ITEM_TYPE_TASK ) {
-                       temp_date = e_gw_item_get_start_date (item);
-                       if (temp_date) {
-                               time_t actual_time = e_gw_connection_get_date_from_string (temp_date);
-                               mi->info.date_sent = mi->info.date_received = actual_time;
-                       }
-               } else
-                       groupwise_set_mail_mi_dates (mi, item);
-
-               mi->info.dirty = TRUE;
-               if (exists) {
-                       camel_folder_change_info_change_uid (changes, mi->info.uid);
-                       camel_message_info_free (pmi);
-               } else {
-                       mi->info.uid = camel_pstring_strdup (e_gw_item_get_id (item));
-                       mi->info.size = e_gw_item_get_mail_size (item);
-                       mi->info.subject = camel_pstring_strdup (e_gw_item_get_subject (item));
-                       groupwise_folder_set_threading_data (mi, item);
-
-                       camel_folder_summary_add (folder->summary,(CamelMessageInfo *)mi);
-                       camel_folder_change_info_add_uid (changes, mi->info.uid);
-                       camel_folder_change_info_recent_uid (changes, mi->info.uid);
-               }
-
-               /********************* Summary ends *************************/
-               if (!strcmp (full_name, "Junk Mail"))
-                       continue;
-
-               if (folder_needs_caching) {
-                               /******************** Begine Caching ************************/
-                               /* add to cache if its a new message*/
-                               t_cache_stream  = camel_data_cache_get (gw_folder->cache, "cache", id, error);
-                               if (t_cache_stream) {
-                                               g_object_unref (t_cache_stream);
-
-                                               mail_msg = groupwise_folder_item_to_msg (folder, item, error);
-                                               if (mail_msg)
-                                                               camel_medium_set_header (CAMEL_MEDIUM (mail_msg), "X-Evolution-Source", groupwise_base_url_lookup (gw_store->priv));
-
-                                               CAMEL_GROUPWISE_FOLDER_REC_LOCK (folder, cache_lock);
-                                               if ((cache_stream = camel_data_cache_add (gw_folder->cache, "cache", id, NULL))) {
-                                                               if (camel_data_wrapper_write_to_stream_sync ((CamelDataWrapper *) mail_msg,     cache_stream, cancellable, NULL) == -1 || camel_stream_flush (cache_stream, cancellable, NULL) == -1)
-                                                                               camel_data_cache_remove (gw_folder->cache, "cache", id, NULL);
-                                                               g_object_unref (cache_stream);
-                                               }
-
-                                               g_object_unref (mail_msg);
-                                               CAMEL_GROUPWISE_FOLDER_REC_UNLOCK (folder, cache_lock);
-                               }
-                               /******************** Caching stuff ends *************************/
-               }
-
-               i++;
-               g_object_unref (item);
-       }
-
-       camel_operation_pop_message (cancellable);
-
-       g_free (container_id);
-       g_string_free (str_to, TRUE);
-       g_string_free (str_cc, TRUE);
-       groupwise_sync_summary (folder, error);
-
-       camel_folder_changed (folder, changes);
-       camel_folder_change_info_free (changes);
-}
-
-static const gchar *
-get_from_from_org (EGwItemOrganizer *org)
-{
-       const gchar *ret = NULL;
-
-       if (org) {
-               GString *str;
-
-               str = g_string_new ("");
-               if (org->display_name && org->display_name[0]) {
-                       org->display_name = g_strdelimit (org->display_name, "<>", ' ');
-                       str = g_string_append (str, org->display_name);
-                       str = g_string_append (str, " ");
-               } else if (org->email && org->email[0]) {
-                       str = g_string_append (str, org->email);
-                       str = g_string_append (str, " ");
-               }
-
-               if (org->email && org->email[0]) {
-                       g_string_append (str, "<");
-                       str = g_string_append (str, org->email);
-                       g_string_append (str, ">");
-               }
-               ret = camel_pstring_strdup (str->str);
-               g_string_free (str, TRUE);
-
-               return ret;
-       } else
-              return camel_pstring_strdup ("");
-}
-
-/* Update summary, if there is none existing, create one */
-void
-gw_update_summary (CamelFolder *folder,
-                   GList *list,
-                   GCancellable *cancellable,
-                   GError **error)
-{
-       CamelGroupwiseMessageInfo *mi = NULL;
-       CamelGroupwiseStore *gw_store;
-       guint32 item_status, status_flags = 0;
-       CamelFolderChangeInfo *changes = NULL;
-       CamelStore *parent_store;
-       gboolean exists = FALSE;
-       GString *str_to = g_string_new (NULL);
-       GString *str_cc = g_string_new (NULL);
-       const gchar *priority = NULL;
-       gchar *container_id = NULL;
-       gboolean is_junk = FALSE;
-       GList *item_list = list;
-       const gchar *full_name;
-       gboolean is_proxy;
-
-       full_name = camel_folder_get_full_name (folder);
-       parent_store = camel_folder_get_parent_store (folder);
-
-       is_proxy = (parent_store->flags & CAMEL_STORE_WRITE);
-
-       gw_store = CAMEL_GROUPWISE_STORE (parent_store);
-
-       /*Assert lock???*/
-       changes = camel_folder_change_info_new ();
-       container_id = g_strdup (camel_groupwise_store_container_id_lookup (gw_store, full_name));
-       if (!container_id) {
-               d (printf("\nERROR - Container id not present. Cannot refresh info\n"));
-               camel_folder_change_info_free (changes);
-               return;
-       }
-
-       if (!strcmp (full_name, JUNK_FOLDER)) {
-               is_junk = TRUE;
-       }
-
-       for (; item_list != NULL; item_list = g_list_next (item_list) ) {
-               EGwItem *item = (EGwItem *)item_list->data;
-               EGwItemType type = E_GW_ITEM_TYPE_UNKNOWN;
-               EGwItemOrganizer *org;
-               gchar *temp_date = NULL;
-               const gchar *id;
-               GSList *recp_list = NULL;
-               const gchar *recurrence_key = NULL;
-               gint rk;
-
-               status_flags = 0;
-               id = e_gw_item_get_id (item);
-
-               mi = (CamelGroupwiseMessageInfo *)camel_folder_summary_uid (folder->summary, id);
-               if (mi)
-                       exists = TRUE;
-
-               type = e_gw_item_get_item_type (item);
-               if (!exists) {
-                       if ((type == E_GW_ITEM_TYPE_CONTACT) || (type == E_GW_ITEM_TYPE_UNKNOWN)) {
-                               exists = FALSE;
-                               continue;
-                       }
-
-                       mi = camel_message_info_new (folder->summary);
-                       if (mi->info.content == NULL) {
-                               mi->info.content = camel_folder_summary_content_info_new (folder->summary);
-                               mi->info.content->type = camel_content_type_new ("multipart", "mixed");
-                       }
-
-                       if (type == E_GW_ITEM_TYPE_APPOINTMENT || type == E_GW_ITEM_TYPE_TASK || type == E_GW_ITEM_TYPE_NOTE)
-                               camel_message_info_set_user_flag ((CamelMessageInfo*)mi, "$has_cal", TRUE);
-               }
-
-               rk = e_gw_item_get_recurrence_key (item);
-               if (rk > 0) {
-                       recurrence_key = g_strdup_printf("%d", rk);
-                       camel_message_info_set_user_tag ((CamelMessageInfo*)mi, "recurrence-key", recurrence_key);
-               }
-
-               /*all items in the Junk Mail folder should have this flag set*/
-               if (is_junk)
-                       mi->info.flags |= CAMEL_GW_MESSAGE_JUNK;
-
-               item_status = e_gw_item_get_item_status (item);
-               if (item_status & E_GW_ITEM_STAT_READ)
-                       status_flags |= CAMEL_MESSAGE_SEEN;
-               if (item_status & E_GW_ITEM_STAT_REPLIED)
-                       status_flags |= CAMEL_MESSAGE_ANSWERED;
-
-               if (!strcmp (full_name, "Trash"))
-                       status_flags |= CAMEL_MESSAGE_SEEN;
-
-               mi->info.flags |= status_flags;
-
-               priority = e_gw_item_get_priority (item);
-               if (priority && !(g_ascii_strcasecmp (priority,"High"))) {
-                       mi->info.flags |= CAMEL_MESSAGE_FLAGGED;
-               }
-
-               if (e_gw_item_has_attachment (item))
-                       mi->info.flags |= CAMEL_MESSAGE_ATTACHMENTS;
-
-               if (is_proxy)
-                       mi->info.flags |= CAMEL_MESSAGE_USER_NOT_DELETABLE;
-
-               mi->server_flags = mi->info.flags;
-
-               org = e_gw_item_get_organizer (item);
-               mi->info.from = get_from_from_org (org);
-
-               g_string_truncate (str_to, 0);
-               g_string_truncate (str_cc, 0);
-               recp_list = e_gw_item_get_recipient_list (item);
-               if (recp_list) {
-                       GSList *rl;
-                       gint i_to = 0, i_cc = 0;
-                       for (rl = recp_list; rl != NULL; rl = rl->next) {
-                               EGwItemRecipient *recp = (EGwItemRecipient *) rl->data;
-                               if (recp->type == E_GW_ITEM_RECIPIENT_TO) {
-                                       if (i_to)
-                                               str_to = g_string_append (str_to, ", ");
-                                       g_string_append_printf (str_to,"%s <%s>", recp->display_name, recp->email);
-                                       i_to++;
-                               } else if (recp->type == E_GW_ITEM_RECIPIENT_CC) {
-                                       if (i_cc)
-                                               str_cc = g_string_append (str_cc, ", ");
-                                       g_string_append_printf (str_cc,"%s <%s>", recp->display_name, recp->email);
-                                       i_cc++;
-                               }
-                       }
-                       mi->info.to = camel_pstring_strdup (str_to->str);
-                       mi->info.cc = camel_pstring_strdup (str_cc->str);
-
-                       g_string_truncate (str_to, 0);
-                       g_string_truncate (str_cc, 0);
-               }
-
-               if (type == E_GW_ITEM_TYPE_APPOINTMENT ||
-                   type ==  E_GW_ITEM_TYPE_NOTE ||
-                   type ==  E_GW_ITEM_TYPE_TASK ) {
-                       temp_date = e_gw_item_get_start_date (item);
-                       if (temp_date) {
-                               time_t actual_time = e_gw_connection_get_date_from_string (temp_date);
-                               mi->info.date_sent = mi->info.date_received = actual_time;
-                       }
-               } else
-                       groupwise_set_mail_mi_dates (mi, item);
-
-               mi->info.uid = camel_pstring_strdup (e_gw_item_get_id (item));
-               if (!exists)
-                       mi->info.size = e_gw_item_get_mail_size (item);
-               mi->info.subject = camel_pstring_strdup (e_gw_item_get_subject (item));
-               groupwise_folder_set_threading_data (mi, item);
-
-               if (exists) {
-                       camel_folder_change_info_change_uid (changes, e_gw_item_get_id (item));
-                       camel_message_info_free (&mi->info);
-               } else {
-                       camel_folder_summary_add (folder->summary,(CamelMessageInfo *)mi);
-                       camel_folder_change_info_add_uid (changes, mi->info.uid);
-                       camel_folder_change_info_recent_uid (changes, mi->info.uid);
-               }
-
-               exists = FALSE;
-       }
-       g_free (container_id);
-       g_string_free (str_to, TRUE);
-       g_string_free (str_cc, TRUE);
-
-       camel_folder_changed (folder, changes);
-       camel_folder_change_info_free (changes);
-}
-
-static CamelMimeMessage *
-groupwise_folder_item_to_msg ( CamelFolder *folder,
-               EGwItem *item,
-               GError **error )
-{
-       CamelMimeMessage *msg = NULL;
-       CamelGroupwiseStore *gw_store;
-       const gchar *container_id = NULL;
-       GSList *attach_list = NULL;
-       EGwItemType type;
-       EGwConnectionStatus status;
-       EGwConnection *cnc;
-       CamelMultipart *multipart = NULL;
-       CamelStore *parent_store;
-       gchar *body = NULL;
-       gint body_len = 0;
-       const gchar *uid = NULL, *message_id, *parent_threads;
-       gboolean has_mime_822 = FALSE, ignore_mime_822 = FALSE;
-       gboolean is_text_html_embed = FALSE;
-       gboolean is_base64_encoded = FALSE;
-       CamelStream *temp_stream;
-       const gchar *full_name;
-
-       full_name = camel_folder_get_full_name (folder);
-       parent_store = camel_folder_get_parent_store (folder);
-
-       gw_store = CAMEL_GROUPWISE_STORE (parent_store);
-
-       uid = e_gw_item_get_id (item);
-       cnc = cnc_lookup (gw_store->priv);
-       container_id = camel_groupwise_store_container_id_lookup (gw_store, full_name);
-
-       /* The item is already in calendar. We need to ignore the mime 822 since it would not have the item id of the appointmnet
-          in calendar */
-       if (e_gw_item_get_item_type (item) == E_GW_ITEM_TYPE_APPOINTMENT && e_gw_item_is_from_internet (item))
-               ignore_mime_822 = TRUE;
-
-       attach_list = e_gw_item_get_attach_id_list (item);
-       if (attach_list) {
-               /*int attach_count = g_slist_length (attach_list);*/
-               GSList *al = attach_list;
-               EGwItemAttachment *attach = (EGwItemAttachment *)al->data;
-               gchar *attachment = NULL;
-               gint len = 0;
-
-               if (!g_ascii_strcasecmp (attach->name, "Text.htm") ||
-                   !g_ascii_strcasecmp (attach->name, "Header")) {
-
-                       status = e_gw_connection_get_attachment (cnc,
-                                       attach->id, 0, -1,
-                                       (const gchar **)&attachment, &len);
-                       if (status != E_GW_CONNECTION_STATUS_OK) {
-                               g_warning ("Could not get attachment\n");
-                               g_set_error (
-                                       error, CAMEL_SERVICE_ERROR,
-                                       CAMEL_SERVICE_ERROR_INVALID,
-                                       _("Could not get message"));
-                               return NULL;
-                       }
-                       if (attachment && attachment[0] && (len !=0) ) {
-                               if (!g_ascii_strcasecmp (attach->name, "TEXT.htm")) {
-                                       body = g_strdup (attachment);
-                                       g_free (attachment);
-                               }
-                       }/* if attachment and len */
-               } /* if Mime.822 or TEXT.htm */
-
-               if (!ignore_mime_822) {
-                       for (al = attach_list; al != NULL; al = al->next) {
-                               EGwItemAttachment *attach = (EGwItemAttachment *)al->data;
-                               if (!g_ascii_strcasecmp (attach->name, "Mime.822")) {
-                                       if (attach->size > MAX_ATTACHMENT_SIZE) {
-                                               gint t_len , offset = 0, t_offset = 0;
-                                               gchar *t_attach = NULL;
-                                               GString *gstr = g_string_new (NULL);
-
-                                               len = 0;
-                                               do {
-                                                       status = e_gw_connection_get_attachment_base64 (cnc,
-                                                                       attach->id, t_offset, MAX_ATTACHMENT_SIZE,
-                                                                       (const gchar **)&t_attach, &t_len, &offset);
-                                                       if (status == E_GW_CONNECTION_STATUS_OK) {
-
-                                                               if (t_len) {
-                                                                       gsize len_iter = 0;
-                                                                       gchar *temp = NULL;
-
-                                                                       temp = (gchar *) g_base64_decode (t_attach, &len_iter);
-                                                                       gstr = g_string_append_len (gstr, temp, len_iter);
-                                                                       g_free (temp);
-                                                                       len += len_iter;
-                                                                       g_free (t_attach);
-                                                                       t_attach = NULL;
-                                                               }
-                                                               t_offset = offset;
-                                                       }
-                                               } while (t_offset);
-                                               body = gstr->str;
-                                               body_len = len;
-                                               g_string_free (gstr, FALSE);
-                                       } else {
-                                               status = e_gw_connection_get_attachment (cnc,
-                                                               attach->id, 0, -1,
-                                                               (const gchar **)&attachment, &len);
-                                               if (status != E_GW_CONNECTION_STATUS_OK) {
-                                                       g_warning ("Could not get attachment\n");
-                                                       g_set_error (
-                                                               error, CAMEL_SERVICE_ERROR,
-                                                               CAMEL_SERVICE_ERROR_INVALID,
-                                                               _("Could not get message"));
-                                                       return NULL;
-                                               }
-                                               body = g_strdup (attachment);
-                                               body_len = len;
-                                               g_free (attachment);
-                                       }
-                                       has_mime_822 = TRUE;
-                               }
-                       }
-               }
-
-       } /* if attach_list */
-
-       msg = camel_mime_message_new ();
-       if (has_mime_822 && body) {
-               temp_stream = camel_stream_mem_new_with_buffer (body, body_len);
-               if (!camel_data_wrapper_construct_from_stream_sync ((CamelDataWrapper *) msg, temp_stream, NULL, error)) {
-                       g_object_unref (msg);
-                       g_object_unref (temp_stream);
-                       msg = NULL;
-                       goto end;
-               }
-       } else {
-               multipart = camel_multipart_new ();
-       }
-
-       if (!has_mime_822 ) {
-               /* Set Message Id */
-               message_id = e_gw_item_get_message_id (item);
-               if (message_id)
-                       camel_medium_add_header (CAMEL_MEDIUM (msg), "Message-ID", message_id);
-
-               /* Set parent threads */
-               parent_threads = e_gw_item_get_parent_thread_ids (item);
-               if (parent_threads)
-                       camel_medium_add_header (CAMEL_MEDIUM (msg), "References", parent_threads);
-       }
-
-       /* set item id */
-       camel_medium_add_header (CAMEL_MEDIUM (msg), "X-GW-ITEM-ID", uid);
-
-       type = e_gw_item_get_item_type (item);
-       if (type == E_GW_ITEM_TYPE_NOTIFICATION)
-               camel_medium_add_header ( CAMEL_MEDIUM (msg), "X-Notification", "shared-folder");
-
-       /*If the reply-requested flag is set. Append the mail message with the
-        *          * approprite detail*/
-       if (e_gw_item_get_reply_request (item)) {
-               gchar *reply_within;
-               const gchar *mess = e_gw_item_get_message (item);
-               gchar *value;
-
-               reply_within = e_gw_item_get_reply_within (item);
-               if (reply_within) {
-                       time_t t;
-                       gchar *temp;
-
-                       t = e_gw_connection_get_date_from_string (reply_within);
-                       temp = ctime (&t);
-                       temp[strlen (temp)-1] = '\0';
-                       value = g_strconcat (N_("Reply Requested: by "), temp, "\n\n", mess ? mess : "", NULL);
-                       e_gw_item_set_message (item, (const gchar *) value);
-                       g_free (value);
-
-               } else {
-                       value = g_strconcat (N_("Reply Requested: When convenient"), "\n\n", mess ? mess : "", NULL);
-                       e_gw_item_set_message (item, (const gchar *) value);
-                       g_free (value);
-               }
-       }
-
-       if (has_mime_822)
-               goto end;
-       else
-               groupwise_populate_msg_body_from_item (cnc, multipart, item, body);
-       /*Set recipient details*/
-       groupwise_msg_set_recipient_list (msg, item);
-       groupwise_populate_details_from_item (msg, item);
-       /*Now set attachments*/
-       if (attach_list) {
-               gboolean has_boundary = FALSE;
-               GSList *al;
-
-               for (al = attach_list; al != NULL; al = al->next) {
-                       EGwItemAttachment *attach = (EGwItemAttachment *)al->data;
-                       gchar *attachment = NULL;
-                       gint len = 0;
-                       CamelMimePart *part;
-                       EGwItem *temp_item;
-                       is_base64_encoded = FALSE;
-
-                       if (attach->contentid && (is_text_html_embed != TRUE))
-                               is_text_html_embed = TRUE;
-
-                       /* MIME.822 from server for the weak hearted client programmer */
-
-                       if ( (!g_ascii_strcasecmp (attach->name, "TEXT.htm") ||
-                            !g_ascii_strcasecmp (attach->name, "Mime.822") ||
-                            !g_ascii_strcasecmp (attach->name, "Header") ||
-                            !g_ascii_strcasecmp (attach->name, "meeting.ics")) && (attach->hidden == TRUE))
-                               continue;
-
-                       if ((attach->item_reference) && (!g_ascii_strcasecmp (attach->item_reference, "1"))) {
-                               CamelMimeMessage *temp_msg = NULL;
-                               status = e_gw_connection_get_item (cnc, container_id, attach->id, GET_ITEM_VIEW_WITH_CACHE, &temp_item);
-                               if (status != E_GW_CONNECTION_STATUS_OK) {
-                                       g_warning ("Could not get attachment\n");
-                                       continue;
-                               }
-                               temp_msg = groupwise_folder_item_to_msg (folder, temp_item, error);
-                               if (temp_msg) {
-                                       CamelContentType *ct = camel_content_type_new("message", "rfc822");
-                                       part = camel_mime_part_new ();
-                                       camel_data_wrapper_set_mime_type_field (CAMEL_DATA_WRAPPER (temp_msg), ct);
-                                       camel_content_type_unref (ct);
-                                       camel_medium_set_content (CAMEL_MEDIUM (part),CAMEL_DATA_WRAPPER (temp_msg));
-
-                                       camel_multipart_add_part (multipart,part);
-                                       g_object_unref (temp_msg);
-                                       g_object_unref (part);
-                               }
-                               g_object_unref (temp_item);
-                       } else {
-                               if (attach->size > MAX_ATTACHMENT_SIZE) {
-                                       gint t_len=0, offset=0, t_offset=0;
-                                       gchar *t_attach = NULL;
-                                       GString *gstr = g_string_new (NULL);
-
-                                       len = 0;
-                                       do {
-                                               status = e_gw_connection_get_attachment_base64 (cnc,
-                                                               attach->id, t_offset, MAX_ATTACHMENT_SIZE,
-                                                               (const gchar **)&t_attach, &t_len, &offset);
-                                               if (status == E_GW_CONNECTION_STATUS_OK) {
-
-                                                       if (t_len) {
-                                                               gsize len_iter = 0;
-                                                               gchar *temp = NULL;
-
-                                                               temp = (gchar *) g_base64_decode (t_attach, &len_iter);
-                                                               gstr = g_string_append_len (gstr, temp, len_iter);
-                                                               g_free (temp);
-                                                               len += len_iter;
-                                                               g_free (t_attach);
-                                                               t_attach = NULL;
-                                                               t_len = 0;
-                                                       }
-                                                       t_offset = offset;
-                                               }
-                                       } while (t_offset);
-                                       attachment =  gstr->str;
-                                       g_string_free (gstr, FALSE);
-                                       is_base64_encoded = FALSE;
-                               } else {
-                                       status = e_gw_connection_get_attachment (cnc,
-                                                       attach->id, 0, -1,
-                                                       (const gchar **)&attachment, &len);
-                               }
-                               if (status != E_GW_CONNECTION_STATUS_OK) {
-                                       g_warning ("Could not get attachment\n");
-                                       continue;
-                               }
-                               if (attachment && (len !=0) ) {
-                                       part = camel_mime_part_new ();
-                                       /*multiparts*/
-                                       if (is_text_html_embed) {
-                                               camel_mime_part_set_filename (part, g_strdup (attach->name));
-                                               camel_data_wrapper_set_mime_type(CAMEL_DATA_WRAPPER (multipart), "multipart/related");
-                                               has_boundary = TRUE;
-                                               camel_content_type_set_param(CAMEL_DATA_WRAPPER (multipart)->mime_type, "type", "multipart/alternative");
-                                               if (attach->contentid) {
-                                                       gchar **t;
-                                                       t= g_strsplit_set (attach->contentid, "<>", -1);
-                                                       if (!t[1])
-                                                               camel_mime_part_set_content_id (part, attach->contentid);
-                                                       else
-                                                               camel_mime_part_set_content_id (part, t[1]);
-                                                       g_strfreev (t);
-                                                       camel_mime_part_set_content_location (part, attach->name);
-                                               }
-                                       } else {
-                                               camel_mime_part_set_filename (part, g_strdup (attach->name));
-                                               camel_mime_part_set_content_id (part, attach->contentid);
-                                       }
-
-                                       /*camel_mime_part_set_filename(part, g_strdup(attach->name));*/
-                                       if (attach->contentType) {
-                                               if (is_base64_encoded)
-                                                       camel_mime_part_set_encoding (part, CAMEL_TRANSFER_ENCODING_BASE64);
-                                               camel_mime_part_set_content (part, attachment, len, attach->contentType);
-                                               camel_content_type_set_param (((CamelDataWrapper *) part)->mime_type, "name", attach->name);
-                                       } else {
-                                                       camel_mime_part_set_content(part, attachment, len, "text/plain");
-                                       }
-                                       if (!has_boundary)
-                                               camel_data_wrapper_set_mime_type(CAMEL_DATA_WRAPPER (multipart),"multipart/digest");
-
-                                       camel_multipart_set_boundary (multipart, NULL);
-                                       camel_multipart_add_part (multipart, part);
-
-                                       g_object_unref (part);
-                                       g_free (attachment);
-                               } /* if attachment */
-                       }
-               } /* end of for*/
-
-       }/* if attach_list */
-       /********************/
-
-       /* this is broken for translations. someone should care to fix these hacks. nobody except groupwise users are affected though */
-       if (e_gw_item_get_priority (item))
-               camel_medium_add_header ( CAMEL_MEDIUM (msg), "Priority", e_gw_item_get_priority(item));
-
-       if (e_gw_item_get_security (item))
-               camel_medium_add_header ( CAMEL_MEDIUM (msg), "Security", e_gw_item_get_security(item));
-
-       camel_medium_set_content (CAMEL_MEDIUM (msg), CAMEL_DATA_WRAPPER (multipart));
-       g_object_unref (multipart);
-
-end:
-       if (body)
-               g_free (body);
-
-       return msg;
-}
-
-static void
-gw_update_all_items (CamelFolder *folder,
-                     GList *item_list,
-                     GCancellable *cancellable,
-                     GError **error)
-{
-       CamelGroupwiseFolder *gw_folder = CAMEL_GROUPWISE_FOLDER (folder);
-       GPtrArray *summary = NULL;
-       gint index = 0;
-       GList *temp;
-       CamelFolderChangeInfo *changes = NULL;
-       gchar *uid;
-
-       changes = camel_folder_change_info_new ();
-
-       item_list = g_list_reverse (item_list);
-
-       summary = camel_folder_get_summary (folder);
-       /*item_ids : List of ids from the summary*/
-       while (index < summary->len) {
-               uid = g_ptr_array_index (summary, index);
-               temp = NULL;
-
-               if (item_list) {
-                       temp = g_list_find_custom (item_list, (const gchar *)uid, (GCompareFunc) strcmp);
-               }
-
-               if (!temp) {
-                       CAMEL_GROUPWISE_FOLDER_REC_LOCK (folder, cache_lock);
-                       camel_folder_summary_remove_uid (folder->summary, uid);
-                       camel_data_cache_remove (gw_folder->cache, "cache", uid, NULL);
-                       camel_folder_change_info_remove_uid (changes, uid);
-                       CAMEL_GROUPWISE_FOLDER_REC_UNLOCK (folder, cache_lock);
-               } else {
-                       g_free (temp->data);
-                       item_list = g_list_delete_link (item_list, temp);
-               }
-               index++;
-       }
-
-       groupwise_sync_summary (folder, error);
-       camel_folder_changed (folder, changes);
-
-       if (item_list) {
-               CamelStore *parent_store;
-
-               parent_store = camel_folder_get_parent_store (folder);
-
-               camel_service_lock (CAMEL_SERVICE (parent_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-               gw_update_cache (folder, item_list, TRUE, cancellable, error);
-               camel_service_unlock (CAMEL_SERVICE (parent_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-               g_list_foreach (item_list, (GFunc)g_free, NULL);
-               g_list_free (item_list);
-       }
-
-       camel_folder_free_summary (folder, summary);
-}
-
-/* A function to compare uids, inspired by strcmp .
-This code was used in some other provider also , imap4rev1 iirc */
-static gint
-uid_compar (gconstpointer va, gconstpointer vb)
-{
-       const gchar **sa = (const gchar **)va, **sb = (const gchar **)vb;
-       gulong a, b;
-
-       a = strtoul (*sa, NULL, 10);
-       b = strtoul (*sb, NULL, 10);
-       if (a < b)
-               return -1;
-       else if (a == b)
-               return 0;
-       else
-               return 1;
-}
-
-static gint
-groupwise_cmp_uids (CamelFolder *folder, const gchar *uid1, const gchar *uid2)
-{
-       g_return_val_if_fail (uid1 != NULL, 0);
-       g_return_val_if_fail (uid2 != NULL, 0);
-
-       return strcmp (uid1, uid2);
-}
-
-static void
-groupwise_folder_dispose (GObject *object)
-{
-       CamelGroupwiseFolder *gw_folder = CAMEL_GROUPWISE_FOLDER (object);
-
-       if (gw_folder->cache != NULL) {
-               g_object_unref (gw_folder->cache);
-               gw_folder->cache = NULL;
-       }
-
-       if (gw_folder->search != NULL) {
-               g_object_unref (gw_folder->search);
-               gw_folder->search = NULL;
-       }
-
-       /* Chain up to parent's dispose() method. */
-       G_OBJECT_CLASS (camel_groupwise_folder_parent_class)->dispose (object);
-}
-
-static void
-groupwise_folder_constructed (GObject *object)
-{
-       CamelFolder *folder;
-       CamelStore *parent_store;
-       CamelURL *url;
-       const gchar *full_name;
-       gchar *description;
-
-       folder = CAMEL_FOLDER (object);
-       full_name = camel_folder_get_full_name (folder);
-       parent_store = camel_folder_get_parent_store (folder);
-       url = camel_service_get_camel_url (CAMEL_SERVICE (parent_store));
-
-       description = g_strdup_printf (
-               "%s@%s:%s", url->user, url->host, full_name);
-       camel_folder_set_description (folder, description);
-       g_free (description);
-}
-
-static gboolean
-groupwise_append_message_sync (CamelFolder *folder,
-                               CamelMimeMessage *message,
-                               CamelMessageInfo *info,
-                               gchar **appended_uid,
-                               GCancellable *cancellable,
-                               GError **error)
-{
-       const gchar *container_id = NULL;
-       CamelGroupwiseStore *gw_store;
-       CamelOfflineStore *offline;
-       CamelStore *parent_store;
-       EGwConnectionStatus status = { 0, };
-       EGwConnection *cnc;
-       EGwItem *item;
-       const gchar *full_name;
-       const gchar *name;
-       gchar *id;
-       gboolean is_ok = FALSE;
-
-       name = camel_folder_get_name (folder);
-       full_name = camel_folder_get_full_name (folder);
-       parent_store = camel_folder_get_parent_store (folder);
-
-       if (!strcmp (name, RECEIVED))
-               is_ok = TRUE;
-       if (!strcmp (name, SENT))
-               is_ok = TRUE;
-
-       if (!is_ok) {
-               g_set_error (
-                       error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
-                       _("Cannot append message to folder '%s': %s"),
-                       full_name, e_gw_connection_get_error_message (status));
-               return FALSE;
-       }
-
-       gw_store = CAMEL_GROUPWISE_STORE (parent_store);
-       offline = CAMEL_OFFLINE_STORE (parent_store);
-
-       if (!camel_offline_store_get_online (offline)) {
-               camel_groupwise_journal_append ((CamelGroupwiseJournal *) ((CamelGroupwiseFolder *)folder)->journal, message, info, appended_uid, cancellable, error);
-               return FALSE;
-       }
-       cnc = cnc_lookup (gw_store->priv);
-
-       camel_service_lock (CAMEL_SERVICE (parent_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-       /*Get the container id*/
-       container_id = camel_groupwise_store_container_id_lookup (gw_store, full_name);
-
-       item = camel_groupwise_util_item_from_message (cnc, message, CAMEL_ADDRESS (message->from));
-       /*Set the source*/
-       /* FIXME: use flags and avoid such name comparisons in future */
-       if (!strcmp (name, RECEIVED))
-               e_gw_item_set_source (item, "received");
-       if (!strcmp (name, SENT))
-               e_gw_item_set_source (item, "sent");
-       if (!strcmp (name, DRAFT))
-               e_gw_item_set_source (item, "draft");
-       if (!strcmp (name, PERSONAL))
-               e_gw_item_set_source (item, "personal");
-       /*set container id*/
-       e_gw_item_set_container_id (item, container_id);
-
-       status = e_gw_connection_create_item (cnc, item, &id);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               g_set_error (
-                       error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
-                       _("Cannot create message: %s"),
-                       e_gw_connection_get_error_message (status));
-
-               if (appended_uid)
-                       *appended_uid = NULL;
-               camel_service_unlock (CAMEL_SERVICE (parent_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-               return FALSE;
-       }
-
-       status = e_gw_connection_add_item (cnc, container_id, id);
-       g_message ("Adding %s to %s", id, container_id);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               g_set_error (
-                       error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
-                       _("Cannot append message to folder '%s': %s"),
-                       full_name, e_gw_connection_get_error_message (status));
-
-               if (appended_uid)
-                       *appended_uid = NULL;
-
-               camel_service_unlock (CAMEL_SERVICE (parent_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-               return FALSE;
-       }
-
-       if (appended_uid)
-               *appended_uid = g_strdup (id);
-       g_free (id);
-       camel_service_unlock (CAMEL_SERVICE (parent_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       return TRUE;
-}
-
-static gboolean
-groupwise_expunge_sync (CamelFolder *folder,
-                        GCancellable *cancellable,
-                        GError **error)
-{
-       CamelGroupwiseStore *gw_store;
-       CamelGroupwiseFolder *gw_folder;
-       CamelGroupwiseMessageInfo *ginfo;
-       CamelMessageInfo *info;
-       CamelStore *parent_store;
-       gchar *container_id;
-       EGwConnection *cnc;
-       EGwConnectionStatus status;
-       CamelFolderChangeInfo *changes;
-       gint i, max;
-       gboolean delete = FALSE;
-       GList *deleted_items, *deleted_head;
-       const gchar *full_name;
-
-       full_name = camel_folder_get_full_name (folder);
-       parent_store = camel_folder_get_parent_store (folder);
-
-       gw_folder = CAMEL_GROUPWISE_FOLDER (folder);
-       gw_store = CAMEL_GROUPWISE_STORE (parent_store);
-
-       deleted_items = deleted_head = NULL;
-       cnc = cnc_lookup (gw_store->priv);
-       if (!cnc)
-               return TRUE;
-
-       if (!strcmp (full_name, "Trash")) {
-               camel_service_lock (CAMEL_SERVICE (parent_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-               status = e_gw_connection_purge_deleted_items (cnc);
-               if (status == E_GW_CONNECTION_STATUS_OK) {
-                       camel_folder_freeze (folder);
-                       groupwise_summary_clear (folder->summary, TRUE);
-                       camel_folder_thaw (folder);
-               } else
-                       g_warning ("Could not Empty Trash\n");
-               camel_service_unlock (CAMEL_SERVICE (parent_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-               return TRUE;
-       }
-
-       changes = camel_folder_change_info_new ();
-
-       container_id =  g_strdup (camel_groupwise_store_container_id_lookup (gw_store, full_name));
-
-       camel_folder_summary_prepare_fetch_all (folder->summary, error);
-       max = camel_folder_summary_count (folder->summary);
-       for (i = 0; i < max; i++) {
-               info = camel_folder_summary_index (folder->summary, i);
-               ginfo = (CamelGroupwiseMessageInfo *) info;
-               if (ginfo && (ginfo->info.flags & CAMEL_MESSAGE_DELETED)) {
-
-                       if (deleted_items)
-                               deleted_items = g_list_prepend (deleted_items, (gchar *)camel_message_info_uid (info));
-                       else {
-                               g_list_free (deleted_head);
-                               deleted_head = NULL;
-                               deleted_head = deleted_items = g_list_prepend (deleted_items, (gchar *)camel_message_info_uid (info));
-                       }
-                       if (g_list_length (deleted_items) == GROUPWISE_BULK_DELETE_LIMIT ) {
-                               /* Read the FIXME below */
-                               camel_service_lock (CAMEL_SERVICE (parent_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-                               status = e_gw_connection_remove_items (cnc, container_id, deleted_items);
-                               camel_service_unlock (CAMEL_SERVICE (parent_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-                               if (status == E_GW_CONNECTION_STATUS_OK) {
-                                       gchar *uid;
-                                       while (deleted_items) {
-                                               uid = (gchar *)deleted_items->data;
-                                               CAMEL_GROUPWISE_FOLDER_REC_LOCK (folder, cache_lock);
-                                               camel_folder_change_info_remove_uid (changes, uid);
-                                               camel_folder_summary_remove_uid (folder->summary, uid);
-                                               camel_data_cache_remove(gw_folder->cache, "cache", uid, NULL);
-                                               CAMEL_GROUPWISE_FOLDER_REC_UNLOCK (folder, cache_lock);
-                                               deleted_items = g_list_next (deleted_items);
-                                               max -= GROUPWISE_BULK_DELETE_LIMIT;
-                                               i -= GROUPWISE_BULK_DELETE_LIMIT;
-                                       }
-                               }
-                               delete = TRUE;
-                       }
-               }
-               camel_message_info_free (info);
-       }
-
-       if (deleted_items) {
-               /* FIXME: Put these in a function and reuse it inside the above loop, here and in groupwise_sync*/
-               camel_service_lock (CAMEL_SERVICE (parent_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-               status = e_gw_connection_remove_items (cnc, container_id, deleted_items);
-               camel_service_unlock (CAMEL_SERVICE (parent_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-               if (status == E_GW_CONNECTION_STATUS_OK) {
-                       gchar *uid;
-                       while (deleted_items) {
-                               uid = (gchar *)deleted_items->data;
-                               CAMEL_GROUPWISE_FOLDER_REC_LOCK (folder, cache_lock);
-                               camel_folder_change_info_remove_uid (changes, uid);
-                               camel_folder_summary_remove_uid (folder->summary, uid);
-                               camel_data_cache_remove(gw_folder->cache, "cache", uid, NULL);
-                               CAMEL_GROUPWISE_FOLDER_REC_UNLOCK (folder, cache_lock);
-                               deleted_items = g_list_next (deleted_items);
-                       }
-               }
-               delete = TRUE;
-               g_list_free (deleted_head);
-       }
-
-       if (delete)
-               camel_folder_changed (folder, changes);
-
-       g_free (container_id);
-       camel_folder_change_info_free (changes);
-
-       return TRUE;
-}
-
-/* Get a message from cache if available otherwise get it from server */
-static CamelMimeMessage *
-groupwise_folder_get_message_sync (CamelFolder *folder,
-                                   const gchar *uid,
-                                   GCancellable *cancellable,
-                                   GError **error)
-{
-       CamelMimeMessage *msg = NULL;
-       CamelGroupwiseFolder *gw_folder;
-       CamelGroupwiseStore *gw_store;
-       CamelGroupwiseMessageInfo *mi = NULL;
-       CamelStore *parent_store;
-       gchar *container_id;
-       EGwConnectionStatus status;
-       EGwConnection *cnc;
-       EGwItem *item;
-       CamelStream *stream, *cache_stream;
-       const gchar *full_name;
-
-       full_name = camel_folder_get_full_name (folder);
-       parent_store = camel_folder_get_parent_store (folder);
-
-       gw_folder = CAMEL_GROUPWISE_FOLDER (folder);
-       gw_store = CAMEL_GROUPWISE_STORE (parent_store);
-
-       /* see if it is there in cache */
-
-       mi = (CamelGroupwiseMessageInfo *) camel_folder_summary_uid (folder->summary, uid);
-       if (mi == NULL) {
-               g_set_error (
-                       error, CAMEL_FOLDER_ERROR,
-                       CAMEL_FOLDER_ERROR_INVALID_UID,
-                       _("Cannot get message: %s\n  %s"), uid, _("No such message"));
-               return NULL;
-       }
-       cache_stream  = camel_data_cache_get (gw_folder->cache, "cache", uid, NULL);
-       stream = camel_stream_mem_new ();
-       if (cache_stream) {
-               msg = camel_mime_message_new ();
-               camel_stream_reset (stream, NULL);
-               camel_stream_write_to_stream (cache_stream, stream, cancellable, NULL);
-               camel_stream_reset (stream, NULL);
-               if (!camel_data_wrapper_construct_from_stream_sync ((CamelDataWrapper *) msg, stream, cancellable, error)) {
-                       if (errno == EINTR) {
-                               g_object_unref (msg);
-                               g_object_unref (cache_stream);
-                               g_object_unref (stream);
-                               camel_message_info_free (&mi->info);
-                               return NULL;
-                       } else {
-                               g_prefix_error (
-                                       error, _("Cannot get message %s: "), uid);
-                               g_object_unref (msg);
-                               msg = NULL;
-                       }
-               }
-               g_object_unref (cache_stream);
-       }
-       g_object_unref (stream);
-
-       if (msg != NULL) {
-               camel_message_info_free (&mi->info);
-               return msg;
-       }
-
-       if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (gw_store))) {
-               g_set_error (
-                       error, CAMEL_SERVICE_ERROR,
-                       CAMEL_SERVICE_ERROR_UNAVAILABLE,
-                       _("This message is not available in offline mode."));
-               camel_message_info_free (&mi->info);
-               return NULL;
-       }
-
-       /* Check if we are really offline */
-       if (!camel_groupwise_store_connected (gw_store, cancellable, NULL)) {
-               g_set_error (
-                       error, CAMEL_SERVICE_ERROR,
-                       CAMEL_SERVICE_ERROR_UNAVAILABLE,
-                       _("This message is not available in offline mode."));
-               camel_message_info_free (&mi->info);
-               return NULL;
-       }
-
-       container_id =  g_strdup (camel_groupwise_store_container_id_lookup (gw_store, full_name));
-
-       cnc = cnc_lookup (gw_store->priv);
-
-       status = e_gw_connection_get_item (cnc, container_id, uid, GET_ITEM_VIEW_WITH_CACHE, &item);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               status = e_gw_connection_get_item (cnc, container_id, uid, GET_ITEM_VIEW_WITH_CACHE, &item);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               g_free (container_id);
-               g_set_error (
-                       error, CAMEL_SERVICE_ERROR,
-                       CAMEL_SERVICE_ERROR_INVALID,
-                       _("Could not get message"));
-               camel_message_info_free (&mi->info);
-               return NULL;
-       }
-
-       msg = groupwise_folder_item_to_msg (folder, item, NULL);
-       if (!msg) {
-               g_set_error (
-                       error, CAMEL_SERVICE_ERROR,
-                       CAMEL_SERVICE_ERROR_INVALID,
-                       _("Could not get message"));
-               g_free (container_id);
-               camel_message_info_free (&mi->info);
-
-               return NULL;
-       }
-
-       if (msg) {
-               camel_medium_set_header (CAMEL_MEDIUM (msg), "X-Evolution-Source", groupwise_base_url_lookup (gw_store->priv));
-               mi->info.dirty = TRUE;
-               camel_folder_summary_touch (folder->summary);
-       }
-
-       /* add to cache */
-       CAMEL_GROUPWISE_FOLDER_REC_LOCK (folder, cache_lock);
-       if ((cache_stream = camel_data_cache_add (gw_folder->cache, "cache", uid, NULL))) {
-               if (camel_data_wrapper_write_to_stream_sync ((CamelDataWrapper *) msg, cache_stream, cancellable, NULL) == -1
-                               || camel_stream_flush (cache_stream, cancellable, NULL) == -1)
-                       camel_data_cache_remove (gw_folder->cache, "cache", uid, NULL);
-               g_object_unref (cache_stream);
-       }
-
-       CAMEL_GROUPWISE_FOLDER_REC_UNLOCK (folder, cache_lock);
-
-       camel_message_info_free (&mi->info);
-       g_free (container_id);
-       g_object_unref (item);
-       return msg;
-}
-
-static gboolean
-groupwise_refresh_info_sync (CamelFolder *folder,
-                             GCancellable *cancellable,
-                             GError **error)
-{
-       CamelGroupwiseSummary *summary = (CamelGroupwiseSummary *) folder->summary;
-       CamelStoreInfo *si;
-       CamelGroupwiseStore *gw_store;
-       CamelStore *parent_store;
-       const gchar *full_name;
-
-       full_name = camel_folder_get_full_name (folder);
-       parent_store = camel_folder_get_parent_store (folder);
-
-       gw_store = CAMEL_GROUPWISE_STORE (parent_store);
-
-       /*
-        * Checking for the summary->time_string here since the first the a
-        * user views a folder, the read cursor is in progress, and the getQM
-        * should not interfere with the process
-        */
-       if (summary->time_string && (strlen (summary->time_string) > 0))  {
-               groupwise_refresh_folder (folder, cancellable, error);
-               si = camel_store_summary_path ((CamelStoreSummary *)((CamelGroupwiseStore *)parent_store)->summary, full_name);
-               if (si) {
-                       guint32 unread, total;
-
-                       total = camel_folder_summary_count (folder->summary);
-                       unread = folder->summary->unread_count;
-
-                       if (si->total != total || si->unread != unread) {
-                               si->total = total;
-                               si->unread = unread;
-                               camel_store_summary_touch ((CamelStoreSummary *)((CamelGroupwiseStore *)parent_store)->summary);
-                       }
-                       camel_store_summary_info_free ((CamelStoreSummary *)((CamelGroupwiseStore *)parent_store)->summary, si);
-               }
-               /* camel_folder_summary_save_to_db (folder->summary, ex); */
-               camel_store_summary_save ((CamelStoreSummary *)((CamelGroupwiseStore *)parent_store)->summary);
-       } else {
-               /* We probably could not get the messages the first time. (get_folder) failed???!
-                * so do a get_folder again. And hope that it works
-                */
-               g_print("Reloading folder...something wrong with the summary....\n");
-               gw_store_reload_folder (gw_store, folder, 0, cancellable, error);
-       }
-
-       return TRUE;
-}
-
-static gboolean
-groupwise_synchronize_sync (CamelFolder *folder,
-                            gboolean expunge,
-                            GCancellable *cancellable,
-                            GError **error)
-{
-       return groupwise_sync (folder, expunge, NULL, cancellable, error);
-}
-
-static gboolean
-groupwise_transfer_messages_to_sync (CamelFolder *source,
-                                     GPtrArray *uids,
-                                     CamelFolder *destination,
-                                     gboolean delete_originals,
-                                     GPtrArray **transferred_uids,
-                                     GCancellable *cancellable,
-                                     GError **error)
-{
-       gint index = 0;
-       GList *item_ids = NULL;
-       const gchar *source_container_id = NULL, *dest_container_id = NULL;
-       CamelGroupwiseStore *gw_store;
-       CamelOfflineStore *offline;
-       CamelStore *source_parent_store;
-       CamelStore *destination_parent_store;
-       EGwConnectionStatus status = E_GW_CONNECTION_STATUS_OK;
-       EGwConnection *cnc;
-       CamelFolderChangeInfo *changes = NULL;
-       gboolean destination_is_trash;
-       const gchar *source_full_name;
-       const gchar *destination_full_name;
-
-       source_full_name = camel_folder_get_full_name (source);
-       source_parent_store = camel_folder_get_parent_store (source);
-
-       destination_full_name = camel_folder_get_full_name (destination);
-       destination_parent_store = camel_folder_get_parent_store (destination);
-
-       gw_store = CAMEL_GROUPWISE_STORE (source_parent_store);
-       offline = CAMEL_OFFLINE_STORE (destination_parent_store);
-
-       if (destination == camel_store_get_trash_folder_sync (
-               source_parent_store, cancellable, NULL))
-               destination_is_trash = TRUE;
-       else
-               destination_is_trash = FALSE;
-
-       qsort (uids->pdata, uids->len, sizeof (gpointer), uid_compar);
-
-       changes = camel_folder_change_info_new ();
-       while (index < uids->len) {
-               item_ids = g_list_append (item_ids, g_ptr_array_index (uids, index));
-               index++;
-       }
-
-       if (transferred_uids)
-               *transferred_uids = NULL;
-
-       if (delete_originals)
-               source_container_id = camel_groupwise_store_container_id_lookup (gw_store, source_full_name);
-       else
-               source_container_id = NULL;
-       dest_container_id = camel_groupwise_store_container_id_lookup (gw_store, destination_full_name);
-
-       camel_service_lock (CAMEL_SERVICE (source_parent_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-       /* check for offline operation */
-       if (!camel_offline_store_get_online (offline)) {
-               CamelGroupwiseJournal *journal = (CamelGroupwiseJournal *) ((CamelGroupwiseFolder *) destination)->journal;
-               CamelMimeMessage *message;
-               GList *l;
-               gint i;
-
-               if (destination_is_trash)
-                       delete_originals = TRUE;
-
-               for (l = item_ids, i = 0; l; l = l->next, i++) {
-                       CamelMessageInfo *info;
-                       gboolean success;
-
-                       if (!(info = camel_folder_summary_uid (source->summary, uids->pdata[i])))
-                               continue;
-
-                       if (!(message = groupwise_folder_get_message_sync (source, camel_message_info_uid (info), cancellable, error)))
-                               break;
-
-                       success = camel_groupwise_journal_transfer (journal, (CamelGroupwiseFolder *)source, message, info, uids->pdata[i], NULL, cancellable, error);
-                       g_object_unref (message);
-
-                       if (!success)
-                               break;
-
-                       if (delete_originals) {
-                               if (!strcmp (source_full_name, SENT)) {
-                                       g_set_error (
-                                               error, CAMEL_SERVICE_ERROR,
-                                               CAMEL_SERVICE_ERROR_UNAVAILABLE,
-                                               _("This message is not available in offline mode."));
-
-                               } else {
-                                       camel_folder_summary_remove_uid (source->summary, uids->pdata[i]);
-                                       camel_folder_change_info_remove_uid (changes, uids->pdata[i]);
-                               }
-                       }
-               }
-
-               camel_service_unlock (CAMEL_SERVICE (source_parent_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-               return TRUE;
-       }
-
-       cnc = cnc_lookup (gw_store->priv);
-       index = 0;
-       while (index < uids->len) {
-               CamelMessageInfo *info = NULL;
-               CamelGroupwiseMessageInfo *gw_info = NULL;
-               flags_diff_t diff, unset_flags;
-
-               info = camel_folder_summary_uid (source->summary, uids->pdata[index]);
-               if (!info) {
-                       g_warning ("Could not find the message: its either deleted or moved already");
-                       index++;
-                       continue;
-               }
-
-               gw_info = (CamelGroupwiseMessageInfo *) info;
-               if (gw_info && (gw_info->info.flags & CAMEL_MESSAGE_FOLDER_FLAGGED)) {
-                       do_flags_diff (&diff, gw_info->server_flags, gw_info->info.flags);
-                       do_flags_diff (&unset_flags, gw_info->info.flags, gw_info->server_flags);
-                       diff.changed &= source->permanent_flags;
-
-                       /* sync the read changes */
-                       if (diff.changed) {
-                               const gchar *uid = camel_message_info_uid (info);
-                               GList *wrapper = NULL;
-                               gw_info->info.flags &= ~CAMEL_MESSAGE_FOLDER_FLAGGED;
-                               gw_info->server_flags = gw_info->info.flags;
-
-                               if (diff.bits & CAMEL_MESSAGE_SEEN) {
-
-                                       /*
-                                       wrapper is a list wrapper bcos e_gw_connection_mark_read
-                                       is designed for passing multiple uids. Also, there are is not much
-                                       need/use for a e_gw_connection_mark_ITEM_[un]read
-                                       */
-
-                                       wrapper = g_list_prepend (wrapper, (gchar *)uid);
-                                       camel_service_lock (CAMEL_SERVICE (source_parent_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-                                       e_gw_connection_mark_read (cnc, wrapper);
-                                       camel_service_unlock (CAMEL_SERVICE (source_parent_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-                                       g_list_free (wrapper);
-                                       wrapper = NULL;
-                               }
-
-                               /* A User may mark a message as Unread and then immediately move it to
-                               some other folder. The following piece of code take care of such scenario.
-
-                               However, Remember that When a mail is deleted after being marked as unread,
-                               I am not syncing the read-status.
-                               */
-
-                               if (unset_flags.bits & CAMEL_MESSAGE_SEEN) {
-                                       wrapper = g_list_prepend (wrapper, (gchar *)uid);
-                                       camel_service_lock (CAMEL_SERVICE (source_parent_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-                                       e_gw_connection_mark_unread (cnc, wrapper);
-                                       camel_service_unlock (CAMEL_SERVICE (source_parent_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-                                       g_list_free (wrapper);
-                                       wrapper = NULL;
-                               }
-                       }
-               }
-
-               if (destination_is_trash) {
-                               e_gw_connection_remove_item (cnc, source_container_id, (const gchar *) uids->pdata[index]);
-                               camel_folder_summary_remove_uid (source->summary, uids->pdata[index]);
-                               camel_folder_change_info_remove_uid (changes, uids->pdata[index]);
-               } else {
-                               if (delete_originals) {
-                                       if (strcmp(source_full_name, "Sent Items")) {
-                                                       status = e_gw_connection_move_item (cnc, (const gchar *)uids->pdata[index],
-                                                                                       dest_container_id, source_container_id);
-                                       } else {
-                                                       gchar *container_id = NULL;
-                                                       container_id = e_gw_connection_get_container_id (cnc, "Mailbox");
-                                                       status = e_gw_connection_move_item (cnc, (const gchar *)uids->pdata[index],
-                                                                                       dest_container_id, container_id);
-                                                       g_free (container_id);
-                                       }
-
-                               } else
-                                               status = e_gw_connection_move_item (cnc, (const gchar *)uids->pdata[index],
-                                                                               dest_container_id, NULL);
-
-                               if (status == E_GW_CONNECTION_STATUS_OK) {
-                                               if (delete_originals) {
-                                                               if (!(gw_info->info.flags & CAMEL_MESSAGE_SEEN))
-                                                                               source->summary->unread_count--;
-
-                                                               camel_folder_summary_remove_uid (source->summary, uids->pdata[index]);
-                                                               camel_folder_change_info_remove_uid (changes, uids->pdata[index]);
-                                                               /*}*/
-                                               }
-                               } else {
-                                               g_warning ("Warning!! Could not move item : %s\n", (gchar *)uids->pdata[index]);
-                               }
-
-               }
-               index++;
-       }
-
-       camel_folder_changed (source, changes);
-       camel_folder_change_info_free (changes);
-
-       /* Refresh the destination folder, if its not refreshed already */
-       if (gw_store->current_folder != destination )
-               camel_folder_refresh_info_sync (destination, cancellable, error);
-
-       camel_folder_summary_touch (source->summary);
-       camel_folder_summary_touch (destination->summary);
-
-       groupwise_store_set_current_folder (gw_store, source);
-
-       camel_service_unlock (CAMEL_SERVICE (source_parent_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       return TRUE;
-}
-
-static void
-camel_groupwise_folder_class_init (CamelGroupwiseFolderClass *class)
-{
-       GObjectClass *object_class;
-       CamelFolderClass *folder_class;
-
-       g_type_class_add_private (class, sizeof (CamelGroupwiseFolderPrivate));
-
-       object_class = G_OBJECT_CLASS (class);
-       object_class->dispose = groupwise_folder_dispose;
-       object_class->constructed = groupwise_folder_constructed;
-
-       folder_class = CAMEL_FOLDER_CLASS (class);
-       folder_class->rename = groupwise_folder_rename;
-       folder_class->search_by_expression = groupwise_folder_search_by_expression;
-       folder_class->count_by_expression = groupwise_folder_count_by_expression;
-       folder_class->cmp_uids = groupwise_cmp_uids;
-       folder_class->search_by_uids = groupwise_folder_search_by_uids;
-       folder_class->search_free = groupwise_folder_search_free;
-       folder_class->set_message_flags = groupwise_set_message_flags;
-       folder_class->get_filename = groupwise_get_filename;
-       folder_class->append_message_sync = groupwise_append_message_sync;
-       folder_class->expunge_sync = groupwise_expunge_sync;
-       folder_class->get_message_sync = groupwise_folder_get_message_sync;
-       folder_class->refresh_info_sync = groupwise_refresh_info_sync;
-       folder_class->synchronize_sync = groupwise_synchronize_sync;
-       folder_class->transfer_messages_to_sync = groupwise_transfer_messages_to_sync;
-}
-
-static void
-camel_groupwise_folder_init (CamelGroupwiseFolder *gw_folder)
-{
-       CamelFolder *folder = CAMEL_FOLDER (gw_folder);
-
-       gw_folder->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               gw_folder, CAMEL_TYPE_GROUPWISE_FOLDER,
-               CamelGroupwiseFolderPrivate);
-
-       folder->permanent_flags = CAMEL_MESSAGE_ANSWERED | CAMEL_MESSAGE_DELETED |
-               CAMEL_MESSAGE_DRAFT | CAMEL_MESSAGE_FLAGGED | CAMEL_MESSAGE_SEEN;
-
-       folder->folder_flags = CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY | CAMEL_FOLDER_HAS_SEARCH_CAPABILITY;
-
-#ifdef ENABLE_THREADS
-       g_static_mutex_init (&gw_folder->priv->search_lock);
-       g_static_rec_mutex_init (&gw_folder->priv->cache_lock);
-#endif
-
-       gw_folder->need_rescan = TRUE;
-}
-
-void
-convert_to_calendar (EGwItem *item, gchar **str, gint *len)
-{
-       EGwItemOrganizer *org = NULL;
-       GSList *recp_list = NULL;
-       GSList *attach_list = NULL;
-       GString *gstr = g_string_new (NULL);
-       gint recur_key = 0;
-       gchar **tmp = NULL;
-       const gchar *temp = NULL;
-       const gchar *tmp_dt = NULL;
-
-       tmp = g_strsplit (e_gw_item_get_id (item), "@", -1);
-
-       gstr = g_string_append (gstr, "BEGIN:VCALENDAR\n");
-       gstr = g_string_append (gstr, "METHOD:REQUEST\n");
-       gstr = g_string_append (gstr, "BEGIN:VEVENT\n");
-
-       if ((recur_key = e_gw_item_get_recurrence_key (item)) != 0) {
-               gchar *recur_k = g_strdup_printf ("%d", recur_key);
-
-               g_string_append_printf (gstr, "UID:%s\n", recur_k);
-               g_string_append_printf (gstr, "X-GW-RECURRENCE-KEY:%s\n", recur_k);
-
-               g_free (recur_k);
-       } else
-               g_string_append_printf (gstr, "UID:%s\n",e_gw_item_get_icalid (item));
-
-       g_string_append_printf (gstr, "X-GWITEM-TYPE:APPOINTMENT\n");
-       tmp_dt = e_gw_item_get_start_date (item);
-       if (tmp_dt)
-               g_string_append_printf (gstr, "DTSTART:%s\n", tmp_dt);
-       g_string_append_printf (gstr, "SUMMARY:%s\n", e_gw_item_get_subject (item));
-
-       temp = e_gw_item_get_message (item);
-       if (temp) {
-               g_string_append(gstr, "DESCRIPTION:");
-               while (*temp) {
-                       if (*temp == '\n')
-                               g_string_append(gstr, "\\n");
-                       else
-                               g_string_append_c (gstr, *temp);
-                       temp++;
-               }
-               g_string_append(gstr, "\n");
-       }
-
-       tmp_dt = e_gw_item_get_creation_date (item);
-       if (tmp_dt)
-               g_string_append_printf (gstr, "DTSTAMP:%s\n", tmp_dt);
-       g_string_append_printf (gstr, "X-GWMESSAGEID:%s\n", e_gw_item_get_id (item));
-       g_string_append_printf (gstr, "X-GWSHOW-AS:BUSY\n");
-       g_string_append_printf (gstr, "X-GWRECORDID:%s\n", tmp[0]);
-
-       org = e_gw_item_get_organizer (item);
-       if (org)
-               g_string_append_printf (gstr, "ORGANIZER;CN= %s;ROLE= CHAIR;\n MAILTO:%s\n",
-                               org->display_name, org->email);
-
-       recp_list = e_gw_item_get_recipient_list (item);
-       if (recp_list) {
-               GSList *rl;
-
-               for (rl = recp_list; rl != NULL; rl = rl->next) {
-                       EGwItemRecipient *recp = (EGwItemRecipient *) rl->data;
-                       g_string_append_printf (gstr,
-                                       "ATTENDEE;CN= %s;ROLE= REQ-PARTICIPANT:\nMAILTO:%s\n",
-                                       recp->display_name, recp->email);
-               }
-       }
-
-       tmp_dt = e_gw_item_get_end_date (item);
-       if (tmp_dt)
-               g_string_append_printf (gstr, "DTEND:%s\n", tmp_dt);
-
-       temp = NULL;
-       temp = e_gw_item_get_place (item);
-       if (temp)
-               g_string_append_printf (gstr, "LOCATION:%s\n", temp);
-
-       temp = NULL;
-       temp = e_gw_item_get_task_priority (item);
-       if (temp)
-               g_string_append_printf (gstr, "PRIORITY:%s\n", temp);
-
-       temp = NULL;
-       attach_list = e_gw_item_get_attach_id_list (item);
-       if (attach_list) {
-               GSList *al;
-
-               for (al = attach_list; al != NULL; al = al->next) {
-                       EGwItemAttachment *attach = (EGwItemAttachment *)al->data;
-                       g_string_append_printf (gstr, "ATTACH:%s\n", attach->id);
-               }
-       }
-       gstr = g_string_append (gstr, "END:VEVENT\n");
-       gstr = g_string_append (gstr, "END:VCALENDAR\n");
-
-       *str = gstr->str;
-       *len = gstr->len;
-
-       g_string_free (gstr, FALSE);
-       g_strfreev (tmp);
-}
-
-static void
-convert_to_task (EGwItem *item, gchar **str, gint *len)
-{
-       EGwItemOrganizer *org = NULL;
-       GSList *recp_list = NULL;
-       GString *gstr = g_string_new (NULL);
-       gchar **tmp = NULL;
-       const gchar *temp = NULL;
-       const gchar *tmp_dt = NULL;
-
-       tmp = g_strsplit (e_gw_item_get_id (item), "@", -1);
-
-       gstr = g_string_append (gstr, "BEGIN:VCALENDAR\n");
-       gstr = g_string_append (gstr, "METHOD:REQUEST\n");
-       gstr = g_string_append (gstr, "BEGIN:VTODO\n");
-       g_string_append_printf (gstr, "UID:%s\n",e_gw_item_get_icalid (item));
-       tmp_dt = e_gw_item_get_start_date (item);
-       if (tmp_dt)
-               g_string_append_printf (gstr, "DTSTART:%s\n", tmp_dt);
-       g_string_append_printf (gstr, "SUMMARY:%s\n", e_gw_item_get_subject (item));
-
-       temp = e_gw_item_get_message (item);
-       if (temp) {
-               g_string_append(gstr, "DESCRIPTION:");
-               while (*temp) {
-                       if (*temp == '\n')
-                               g_string_append(gstr, "\\n");
-                       else
-                               g_string_append_c (gstr, *temp);
-                       temp++;
-               }
-               g_string_append(gstr, "\n");
-       }
-       temp = NULL;
-
-       tmp_dt = e_gw_item_get_creation_date (item);
-       if (tmp_dt)
-               g_string_append_printf (gstr, "DTSTAMP:%s\n", tmp_dt);
-       g_string_append_printf (gstr, "X-GWMESSAGEID:%s\n", e_gw_item_get_id (item));
-       g_string_append_printf (gstr, "X-GWSHOW-AS:BUSY\n");
-       g_string_append_printf (gstr, "X-GWRECORDID:%s\n", tmp[0]);
-
-       org = e_gw_item_get_organizer (item);
-       if (org)
-               g_string_append_printf (gstr, "ORGANIZER;CN= %s;ROLE= CHAIR;\n MAILTO:%s\n",
-                               org->display_name, org->email);
-
-       recp_list = e_gw_item_get_recipient_list (item);
-       if (recp_list) {
-               GSList *rl;
-
-               for (rl = recp_list; rl != NULL; rl = rl->next) {
-                       EGwItemRecipient *recp = (EGwItemRecipient *) rl->data;
-                       g_string_append_printf (gstr,
-                                       "ATTENDEE;CN= %s;ROLE= REQ-PARTICIPANT:\nMAILTO:%s\n",
-                                       recp->display_name, recp->email);
-               }
-       }
-
-       tmp_dt = e_gw_item_get_end_date (item);
-       if (tmp_dt)
-               g_string_append_printf (gstr, "DTEND:%s\n", tmp_dt);
-
-       temp = e_gw_item_get_place (item);
-       if (temp)
-               g_string_append_printf (gstr, "LOCATION:%s\n", temp);
-
-       temp = NULL;
-       temp = e_gw_item_get_task_priority (item);
-       if (temp)
-               g_string_append_printf (gstr, "PRIORITY:%s\n", temp);
-
-       temp = NULL;
-       temp = e_gw_item_get_due_date (item);
-       if (temp)
-               g_string_append_printf (gstr, "DUE:%s\n", temp);
-       gstr = g_string_append (gstr, "END:VTODO\n");
-       gstr = g_string_append (gstr, "END:VCALENDAR\n");
-
-       *str = g_strdup (gstr->str);
-       *len = gstr->len;
-
-       g_string_free (gstr, TRUE);
-       g_strfreev (tmp);
-}
-
-static void
-convert_to_note (EGwItem *item, gchar **str, gint *len)
-{
-       EGwItemOrganizer *org = NULL;
-       GString *gstr = g_string_new (NULL);
-       gchar **tmp = NULL;
-       const gchar *temp = NULL;
-       const gchar *tmp_dt = NULL;
-
-       tmp = g_strsplit (e_gw_item_get_id (item), "@", -1);
-
-       gstr = g_string_append (gstr, "BEGIN:VCALENDAR\n");
-       gstr = g_string_append (gstr, "METHOD:PUBLISH\n");
-       gstr = g_string_append (gstr, "BEGIN:VJOURNAL\n");
-       g_string_append_printf (gstr, "UID:%s\n",e_gw_item_get_icalid (item));
-       tmp_dt = e_gw_item_get_start_date (item);
-       if (tmp_dt)
-               g_string_append_printf (gstr, "DTSTART:%s\n", tmp_dt);
-       g_string_append_printf (gstr, "SUMMARY:%s\n", e_gw_item_get_subject (item));
-
-       temp = e_gw_item_get_message (item);
-       if (temp) {
-               g_string_append(gstr, "DESCRIPTION:");
-               while (*temp) {
-                       if (*temp == '\n')
-                               g_string_append(gstr, "\\n");
-                       else
-                               g_string_append_c (gstr, *temp);
-                       temp++;
-               }
-               g_string_append(gstr, "\n");
-       }
-       temp = NULL;
-
-       tmp_dt = e_gw_item_get_creation_date (item);
-       if (tmp_dt)
-               g_string_append_printf (gstr, "DTSTAMP:%s\n", tmp_dt);
-       g_string_append_printf (gstr, "X-GWMESSAGEID:%s\n", e_gw_item_get_id (item));
-       g_string_append_printf (gstr, "X-GWRECORDID:%s\n", tmp[0]);
-
-       org = e_gw_item_get_organizer (item);
-       if (org)
-               g_string_append_printf (gstr, "ORGANIZER;CN= %s;ROLE= CHAIR;\n MAILTO:%s\n",
-                               org->display_name, org->email);
-
-       gstr = g_string_append (gstr, "END:VJOURNAL\n");
-       gstr = g_string_append (gstr, "END:VCALENDAR\n");
-
-       *str = g_strdup (gstr->str);
-       *len = gstr->len;
-
-       g_string_free (gstr, TRUE);
-       g_strfreev (tmp);
-}
-
-/** End **/
diff --git a/camel/providers/groupwise/camel-groupwise-folder.h b/camel/providers/groupwise/camel-groupwise-folder.h
deleted file mode 100644 (file)
index c8e8b85..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-groupwise-folder.h: class for an groupwise folder */
-
-/*
- * Authors:
- *   Sivaiah Nallagatla <snallagatla@novell.com>
- *   parthasarathi susarla <sparthasarathi@novell.com>
- *
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- */
-
-#ifndef CAMEL_GROUPWISE_FOLDER_H
-#define CAMEL_GROUPWISE_FOLDER_H
-
-#include <camel/camel.h>
-
-#include "camel-groupwise-summary.h"
-
-/* Standard GObject macros */
-#define CAMEL_TYPE_GROUPWISE_FOLDER \
-       (camel_groupwise_folder_get_type ())
-#define CAMEL_GROUPWISE_FOLDER(obj) \
-       (G_TYPE_CHECK_INSTANCE_CAST \
-       ((obj), CAMEL_TYPE_GROUPWISE_FOLDER, CamelGroupwiseFolder))
-#define CAMEL_GROUPWISE_FOLDER_CLASS(cls) \
-       (G_TYPE_CHECK_CLASS_CAST \
-       ((cls), CAMEL_TYPE_GROUPWISE_FOLDER, CamelGroupwiseFolderClass))
-#define CAMEL_IS_GROUPWISE_FOLDER(obj) \
-       (G_TYPE_CHECK_INSTANCE_TYPE \
-       ((obj), CAMEL_TYPE_GROUPWISE_FOLDER))
-#define CAMEL_IS_GROUPWISE_FOLDER_CLASS(cls) \
-       (G_TYPE_CHECK_CLASS_TYPE \
-       ((cls), CAMEL_TYPE_GROUPWISE_FOLDER))
-#define CAMEL_GROUPWISE_FOLDER_GET_CLASS(obj) \
-       (G_TYPE_INSTANCE_GET_CLASS \
-       ((obj), CAMEL_TYPE_GROUPWISE_FOLDER, CamelGroupwiseFolderClass))
-
-G_BEGIN_DECLS
-
-typedef struct _CamelGroupwiseFolder CamelGroupwiseFolder;
-typedef struct _CamelGroupwiseFolderClass CamelGroupwiseFolderClass;
-typedef struct _CamelGroupwiseFolderPrivate CamelGroupwiseFolderPrivate;
-
-struct _CamelGroupwiseFolder {
-       CamelOfflineFolder parent;
-       CamelGroupwiseFolderPrivate *priv;
-
-       CamelFolderSearch *search;
-
-       CamelOfflineJournal *journal;
-       CamelDataCache *cache;
-
-       guint need_rescan:1;
-       guint need_refresh:1;
-       guint read_only:1;
-
-};
-
-struct _CamelGroupwiseFolderClass {
-       CamelOfflineFolderClass parent_class;
-};
-
-GType          camel_groupwise_folder_get_type (void);
-CamelFolder *  camel_gw_folder_new             (CamelStore *store,
-                                                const gchar *folder_dir,
-                                                const gchar *folder_name,
-                                                GCancellable *cancellable,
-                                                GError **error);
-void           gw_update_summary               (CamelFolder *folder,
-                                                GList *item_list,
-                                                GCancellable *cancellable,
-                                                GError **error);
-
-G_END_DECLS
-
-#endif /* CAMEL_GROUPWISE_FOLDER_H */
diff --git a/camel/providers/groupwise/camel-groupwise-journal.c b/camel/providers/groupwise/camel-groupwise-journal.c
deleted file mode 100644 (file)
index 81fa47c..0000000
+++ /dev/null
@@ -1,422 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- *  Authors: Jeffrey Stedfast <fejj@novell.com>
- *
- *  Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- *  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) any later version.
- *
- *  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 this program; 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 <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include <glib/gi18n-lib.h>
-
-#include "camel-groupwise-folder.h"
-#include "camel-groupwise-journal.h"
-#include "camel-groupwise-store.h"
-
-#define d(x)
-
-static void groupwise_entry_free (CamelOfflineJournal *journal, CamelDListNode *entry);
-static CamelDListNode *groupwise_entry_load (CamelOfflineJournal *journal, FILE *in);
-static gint groupwise_entry_write (CamelOfflineJournal *journal, CamelDListNode *entry, FILE *out);
-static gint groupwise_entry_play (CamelOfflineJournal *journal, CamelDListNode *entry, GCancellable *cancellable, GError **error);
-
-G_DEFINE_TYPE (CamelGroupwiseJournal, camel_groupwise_journal, CAMEL_TYPE_OFFLINE_JOURNAL)
-
-static void
-camel_groupwise_journal_class_init (CamelGroupwiseJournalClass *class)
-{
-       CamelOfflineJournalClass *offline_journal_class;
-
-       offline_journal_class = CAMEL_OFFLINE_JOURNAL_CLASS (class);
-       offline_journal_class->entry_free = groupwise_entry_free;
-       offline_journal_class->entry_load = groupwise_entry_load;
-       offline_journal_class->entry_write = groupwise_entry_write;
-       offline_journal_class->entry_play = groupwise_entry_play;
-}
-
-static void
-camel_groupwise_journal_init (CamelGroupwiseJournal *groupwise_journal)
-{
-}
-
-static void
-groupwise_entry_free (CamelOfflineJournal *journal, CamelDListNode *entry)
-{
-       CamelGroupwiseJournalEntry *groupwise_entry = (CamelGroupwiseJournalEntry *) entry;
-
-       g_free (groupwise_entry->uid);
-       g_free (groupwise_entry->original_uid);
-       g_free (groupwise_entry->source_container);
-       g_free (groupwise_entry);
-}
-
-static CamelDListNode *
-groupwise_entry_load (CamelOfflineJournal *journal, FILE *in)
-{
-       CamelGroupwiseJournalEntry *entry;
-
-       entry = g_malloc0 (sizeof (CamelGroupwiseJournalEntry));
-
-       if (camel_file_util_decode_uint32 (in, &entry->type) == -1)
-               goto exception;
-
-       switch (entry->type) {
-       case CAMEL_GROUPWISE_JOURNAL_ENTRY_APPEND:
-               if (camel_file_util_decode_string (in, &entry->uid) == -1)
-                       goto exception;
-               break;
-       case CAMEL_GROUPWISE_JOURNAL_ENTRY_TRANSFER:
-               if (camel_file_util_decode_string (in, &entry->uid) == -1)
-                       goto exception;
-               if (camel_file_util_decode_string (in, &entry->original_uid) == -1)
-                       goto exception;
-               if (camel_file_util_decode_string (in, &entry->source_container) == -1)
-                       goto exception;
-               break;
-       default:
-               goto exception;
-       }
-
-       return (CamelDListNode *) entry;
-
- exception:
-
-       if (entry->type == CAMEL_GROUPWISE_JOURNAL_ENTRY_TRANSFER)
-               g_free (entry->source_container);
-
-       g_free (entry->uid);
-       g_free (entry);
-
-       return NULL;
-}
-
-static gint
-groupwise_entry_write (CamelOfflineJournal *journal, CamelDListNode *entry, FILE *out)
-{
-       CamelGroupwiseJournalEntry *groupwise_entry = (CamelGroupwiseJournalEntry *) entry;
-
-       if (camel_file_util_encode_uint32 (out, groupwise_entry->type) == -1)
-               return -1;
-
-       switch (groupwise_entry->type) {
-       case CAMEL_GROUPWISE_JOURNAL_ENTRY_APPEND:
-               if (camel_file_util_encode_string (out, groupwise_entry->uid))
-                       return -1;
-               break;
-       case CAMEL_GROUPWISE_JOURNAL_ENTRY_TRANSFER:
-               if (camel_file_util_encode_string (out, groupwise_entry->uid))
-                       return -1;
-               if (camel_file_util_encode_string (out, groupwise_entry->original_uid))
-                       return -1;
-               if (camel_file_util_encode_string (out, groupwise_entry->source_container))
-                       return -1;
-               break;
-       default:
-               g_assert_not_reached ();
-       }
-
-       return 0;
-}
-
-static void
-gw_message_info_dup_to (CamelMessageInfoBase *dest, CamelMessageInfoBase *src)
-{
-       camel_flag_list_copy (&dest->user_flags, &src->user_flags);
-       camel_tag_list_copy (&dest->user_tags, &src->user_tags);
-       dest->date_received = src->date_received;
-       dest->date_sent = src->date_sent;
-       dest->flags = src->flags;
-       dest->size = src->size;
-}
-
-static gint
-groupwise_entry_play_append (CamelOfflineJournal *journal,
-                             CamelGroupwiseJournalEntry *entry,
-                             GCancellable *cancellable,
-                             GError **error)
-{
-       CamelGroupwiseFolder *gw_folder = (CamelGroupwiseFolder *) journal->folder;
-       CamelFolder *folder = journal->folder;
-       CamelMimeMessage *message;
-       CamelMessageInfo *info;
-       CamelStream *stream;
-       gboolean success = FALSE;
-
-       /* if the message isn't in the cache, the user went behind our backs so "not our problem" */
-       if (!gw_folder->cache || !(stream = camel_data_cache_get (gw_folder->cache, "cache", entry->uid, error))) {
-               success = TRUE;
-               goto done;
-       }
-
-       message = camel_mime_message_new ();
-       if (!camel_data_wrapper_construct_from_stream_sync ((CamelDataWrapper *) message, stream, cancellable, error)) {
-               g_object_unref (message);
-               g_object_unref (stream);
-               goto done;
-       }
-
-       g_object_unref (stream);
-
-       if (!(info = camel_folder_summary_uid (folder->summary, entry->uid))) {
-               /* Note: this should never happen, but rather than crash lets make a new info */
-               info = camel_message_info_new (NULL);
-       }
-
-       success = camel_folder_append_message_sync (
-               folder, message, info, NULL, cancellable, error);
-       camel_message_info_free (info);
-       g_object_unref (message);
-
-done:
-
-       camel_folder_summary_remove_uid (folder->summary, entry->uid);
-       camel_data_cache_remove (gw_folder->cache, "cache", entry->uid, NULL);
-
-       return (success == 0);
-}
-
-static gint
-groupwise_entry_play_transfer (CamelOfflineJournal *journal,
-                               CamelGroupwiseJournalEntry *entry,
-                               GCancellable *cancellable,
-                               GError **error)
-{
-       CamelGroupwiseFolder *gw_folder = (CamelGroupwiseFolder *) journal->folder;
-       CamelFolder *folder = journal->folder;
-       CamelGroupwiseMessageInfo *real;
-       CamelMessageInfoBase *info;
-       GPtrArray *xuids, *uids;
-       CamelFolder *src;
-       CamelStore *parent_store;
-       const gchar *name;
-
-       parent_store = camel_folder_get_parent_store (folder);
-
-       if (!(info = (CamelMessageInfoBase *) camel_folder_summary_uid (folder->summary, entry->uid))) {
-               /* Note: this should never happen, but rather than crash lets make a new info */
-               info = camel_message_info_new (NULL);
-       }
-
-       name = camel_groupwise_store_folder_lookup ((CamelGroupwiseStore *) parent_store, entry->source_container);
-       if (name && (src = camel_store_get_folder_sync (parent_store, name, 0, cancellable, error))) {
-               uids = g_ptr_array_sized_new (1);
-               g_ptr_array_add (uids, entry->original_uid);
-
-               if (camel_folder_transfer_messages_to_sync (
-                       src, uids, folder, FALSE, &xuids, cancellable, error)) {
-                       real = (CamelGroupwiseMessageInfo *) camel_folder_summary_uid (folder->summary, xuids->pdata[0]);
-
-                       /* transfer all the system flags, user flags/tags, etc */
-                       gw_message_info_dup_to ((CamelMessageInfoBase *) real, (CamelMessageInfoBase *) info);
-                       camel_message_info_free (real);
-               } else {
-                       goto exception;
-               }
-
-               g_ptr_array_free (xuids, TRUE);
-               g_ptr_array_free (uids, TRUE);
-               g_object_unref (src);
-       } else if (!name) {
-               g_set_error (
-                       error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
-                       _("Cannot get folder container %s"),
-                       entry->source_container);
-               goto exception;
-       }
-
-       /* message was successfully transferred, remove the fake item from the cache/summary */
-       camel_folder_summary_remove_uid (folder->summary, entry->uid);
-       camel_data_cache_remove (gw_folder->cache, "cache", entry->uid, NULL);
-       camel_message_info_free (info);
-
-       return 0;
-
- exception:
-
-       camel_message_info_free (info);
-
-       return -1;
-}
-
-static gint
-groupwise_entry_play (CamelOfflineJournal *journal,
-                      CamelDListNode *entry,
-                      GCancellable *cancellable,
-                      GError **error)
-{
-       CamelGroupwiseJournalEntry *groupwise_entry = (CamelGroupwiseJournalEntry *) entry;
-
-       switch (groupwise_entry->type) {
-       case CAMEL_GROUPWISE_JOURNAL_ENTRY_APPEND:
-               return groupwise_entry_play_append (journal, groupwise_entry, cancellable, error);
-       case CAMEL_GROUPWISE_JOURNAL_ENTRY_TRANSFER:
-               return groupwise_entry_play_transfer (journal, groupwise_entry, cancellable, error);
-       default:
-               g_assert_not_reached ();
-               return -1;
-       }
-}
-
-CamelOfflineJournal *
-camel_groupwise_journal_new (CamelGroupwiseFolder *folder, const gchar *filename)
-{
-       CamelOfflineJournal *journal;
-
-       g_return_val_if_fail (CAMEL_IS_GROUPWISE_FOLDER (folder), NULL);
-
-       journal = g_object_new (CAMEL_TYPE_OFFLINE_JOURNAL, NULL);
-       camel_offline_journal_construct (journal, (CamelFolder *) folder, filename);
-
-       return journal;
-}
-
-static gboolean
-update_cache (CamelGroupwiseJournal *groupwise_journal,
-              CamelMimeMessage *message,
-              const CamelMessageInfo *mi,
-              gchar **updated_uid,
-              GCancellable *cancellable,
-              GError **error)
-{
-       CamelOfflineJournal *journal = (CamelOfflineJournal *) groupwise_journal;
-       CamelGroupwiseFolder *groupwise_folder = (CamelGroupwiseFolder *) journal->folder;
-       CamelFolder *folder = (CamelFolder *) journal->folder;
-       CamelMessageInfo *info;
-       CamelStream *cache;
-       guint32 nextuid;
-       gchar *uid;
-
-       if (groupwise_folder->cache == NULL) {
-               g_set_error (
-                       error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
-                       _("Cannot append message in offline mode: cache unavailable"));
-               return FALSE;
-       }
-
-       nextuid = camel_folder_summary_next_uid (folder->summary);
-       uid = g_strdup_printf ("-%u", nextuid);
-
-       if (!(cache = camel_data_cache_add (groupwise_folder->cache, "cache", uid, error))) {
-               folder->summary->nextuid--;
-               g_free (uid);
-               return FALSE;
-       }
-
-       if (camel_data_wrapper_write_to_stream_sync (
-               (CamelDataWrapper *) message, cache, cancellable, error) == -1
-           || camel_stream_flush (cache, cancellable, error) == -1) {
-               g_prefix_error (
-                       error, _("Cannot append message in offline mode: "));
-               camel_data_cache_remove (groupwise_folder->cache, "cache", uid, NULL);
-               folder->summary->nextuid--;
-               g_object_unref (cache);
-               g_free (uid);
-               return FALSE;
-       }
-
-       g_object_unref (cache);
-
-       info = camel_folder_summary_info_new_from_message (folder->summary, message, NULL);
-       camel_pstring_free (info->uid);
-       info->uid = camel_pstring_strdup (uid);
-
-       gw_message_info_dup_to ((CamelMessageInfoBase *) info, (CamelMessageInfoBase *) mi);
-
-       camel_folder_summary_add (folder->summary, info);
-
-       if (updated_uid)
-               *updated_uid = g_strdup (uid);
-
-       g_free (uid);
-
-       return TRUE;
-}
-
-gboolean
-camel_groupwise_journal_append (CamelGroupwiseJournal *groupwise_journal,
-                                CamelMimeMessage *message,
-                                const CamelMessageInfo *mi,
-                                gchar **appended_uid,
-                                GCancellable *cancellable,
-                                GError **error)
-{
-       CamelOfflineJournal *journal = (CamelOfflineJournal *) groupwise_journal;
-       CamelGroupwiseJournalEntry *entry;
-       gchar *uid;
-
-       if (!update_cache (groupwise_journal, message, mi, &uid, cancellable, error))
-               return FALSE;
-
-       entry = g_new (CamelGroupwiseJournalEntry, 1);
-       entry->type = CAMEL_GROUPWISE_JOURNAL_ENTRY_APPEND;
-       entry->uid = uid;
-
-       camel_dlist_addtail (&journal->queue, (CamelDListNode *) entry);
-
-       if (appended_uid)
-               *appended_uid = g_strdup (uid);
-
-       return TRUE;
-}
-
-gboolean
-camel_groupwise_journal_transfer (CamelGroupwiseJournal *groupwise_journal,
-                                  CamelGroupwiseFolder *source_folder,
-                                  CamelMimeMessage *message,
-                                  const CamelMessageInfo *mi,
-                                  const gchar *original_uid,
-                                  gchar **transferred_uid,
-                                  GCancellable *cancellable,
-                                  GError **error)
-{
-       CamelOfflineJournal *journal = (CamelOfflineJournal *) groupwise_journal;
-       CamelGroupwiseStore *gw_store;
-       CamelGroupwiseJournalEntry *entry;
-       CamelStore *parent_store;
-       gchar *uid;
-
-       parent_store = camel_folder_get_parent_store (journal->folder);
-       gw_store = CAMEL_GROUPWISE_STORE (parent_store);
-
-       if (!update_cache (groupwise_journal, message, mi, &uid, cancellable, error))
-               return FALSE;
-
-       entry = g_new (CamelGroupwiseJournalEntry, 1);
-       entry->type = CAMEL_GROUPWISE_JOURNAL_ENTRY_APPEND;
-       entry->uid = uid;
-       entry->original_uid = g_strdup (original_uid);
-       entry->source_container = g_strdup (camel_groupwise_store_container_id_lookup (gw_store, camel_folder_get_name (((CamelFolder *)source_folder))));
-
-       camel_dlist_addtail (&journal->queue, (CamelDListNode *) entry);
-
-       if (transferred_uid)
-               *transferred_uid = g_strdup (uid);
-
-       return TRUE;
-}
diff --git a/camel/providers/groupwise/camel-groupwise-journal.h b/camel/providers/groupwise/camel-groupwise-journal.h
deleted file mode 100644 (file)
index b32fe5a..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- *  Authors: Jeffrey Stedfast <fejj@novell.com>
- *
- *  Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- *  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) any later version.
- *
- *  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 this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef CAMEL_GROUPWISE_JOURNAL_H
-#define CAMEL_GROUPWISE_JOURNAL_H
-
-#include <stdarg.h>
-#include <camel/camel.h>
-
-/* Standard GObject macros */
-#define CAMEL_TYPE_GROUPWISE_JOURNAL \
-       (camel_groupwise_journal_get_type ())
-#define CAMEL_GROUPWISE_JOURNAL(obj) \
-       (G_TYPE_CHECK_INSTANCE_CAST \
-       ((obj), CAMEL_TYPE_GROUPWISE_JOURNAL, CamelGroupwiseJournal))
-#define CAMEL_GROUPWISE_JOURNAL_CLASS(cls) \
-       (G_TYPE_CHECK_CLASS_CAST \
-       ((cls), CAMEL_TYPE_GROUPWISE_JOURNAL, CamelGroupwiseJournalClass))
-#define CAMEL_IS_GROUPWISE_JOURNAL(obj) \
-       (G_TYPE_CHECK_INSTANCE_TYPE \
-       ((obj), CAMEL_TYPE_GROUPWISE_JOURNAL))
-#define CAMEL_IS_GROUPWISE_JOURNAL_CLASS(cls) \
-       (G_TYPE_CHECK_CLASS_TYPE \
-       ((cls), CAMEL_TYPE_GROUPWISE_JOURNAL))
-#define CAMEL_GROUPWISE_JOURNAL_GET_CLASS(obj) \
-       (CAMEL_CHECK_GET_CLASS \
-       ((obj), CAMEL_TYPE_GROUPWISE_JOURNAL, CamelGroupwiseJournalClass))
-
-G_BEGIN_DECLS
-
-typedef struct _CamelGroupwiseJournal CamelGroupwiseJournal;
-typedef struct _CamelGroupwiseJournalClass CamelGroupwiseJournalClass;
-typedef struct _CamelGroupwiseJournalEntry CamelGroupwiseJournalEntry;
-
-struct _CamelGroupwiseFolder;
-
-enum {
-       CAMEL_GROUPWISE_JOURNAL_ENTRY_APPEND,
-       CAMEL_GROUPWISE_JOURNAL_ENTRY_TRANSFER
-};
-
-struct _CamelGroupwiseJournalEntry {
-       CamelDListNode node;
-
-       guint32 type;
-
-       gchar *uid;
-       gchar *original_uid;
-       gchar *source_container;
-};
-
-struct _CamelGroupwiseJournal {
-       CamelOfflineJournal parent;
-
-};
-
-struct _CamelGroupwiseJournalClass {
-       CamelOfflineJournalClass parent_class;
-
-};
-
-GType          camel_groupwise_journal_get_type (void);
-CamelOfflineJournal *
-               camel_groupwise_journal_new     (CamelGroupwiseFolder *folder,
-                                                const gchar *filename);
-gboolean       camel_groupwise_journal_append  (CamelGroupwiseJournal *journal,
-                                                CamelMimeMessage *message,
-                                                const CamelMessageInfo *mi,
-                                                gchar **appended_uid,
-                                                GCancellable *cancellable,
-                                                GError **error);
-gboolean       camel_groupwise_journal_transfer
-                                               (CamelGroupwiseJournal *journal,
-                                                CamelGroupwiseFolder *source_folder,
-                                                CamelMimeMessage *message,
-                                                const CamelMessageInfo *mi,
-                                                const gchar *orginal_uid,
-                                                gchar **transferred_uid,
-                                                GCancellable *cancellable,
-                                                GError **error);
-
-G_END_DECLS
-
-#endif /* CAMEL_GROUPWISE_JOURNAL_H */
diff --git a/camel/providers/groupwise/camel-groupwise-private.h b/camel/providers/groupwise/camel-groupwise-private.h
deleted file mode 100644 (file)
index 6c06de6..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Authors: Siviah Nallagatla <snallagatla@novell.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- */
-
-#ifndef CAMEL_GROUPWISE_PRIVATE_H
-#define CAMEL_GROUPWISE_PRIVATE_H
-
-/* need a way to configure and save this data, if this header is to
-   be installed.  For now, dont install it */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef ENABLE_THREADS
-#define CAMEL_GROUPWISE_FOLDER_LOCK(f, l) \
-       (g_static_mutex_lock (&((CamelGroupwiseFolder *)f)->priv->l))
-#define CAMEL_GROUPWISE_FOLDER_UNLOCK(f, l) \
-       (g_static_mutex_unlock (&((CamelGroupwiseFolder *)f)->priv->l))
-#define CAMEL_GROUPWISE_FOLDER_REC_LOCK(f, l) \
-       (g_static_rec_mutex_lock (&((CamelGroupwiseFolder *)f)->priv->l))
-#define CAMEL_GROUPWISE_FOLDER_REC_UNLOCK(f, l) \
-       (g_static_rec_mutex_unlock (&((CamelGroupwiseFolder *)f)->priv->l))
-#else
-#define GROUPWISE_FOLDER_LOCK(f, l)
-#define GROUPWISE_FOLDER_UNLOCK(f, l)
-#define GROUPWISE_FOLDER_REC_LOCK(f, l)
-#define GROUPWISE_FOLDER_REC_UNLOCK(f, l)
-#endif
-
-#endif /* CAMEL_IMAP_PRIVATE_H */
diff --git a/camel/providers/groupwise/camel-groupwise-provider.c b/camel/providers/groupwise/camel-groupwise-provider.c
deleted file mode 100644 (file)
index 681d348..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-groupwise-provider.c: GroupWise provider registration code */
-
-/*
- *  Authors: Jeffrey Stedfast <fejj@ximian.com>
- *           Sivaiah Nallagatla <snallagatla@novell.com>
- *           Rodrigo Moya <rodrigo@ximian.com>
- *
- *  Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 program; 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 <glib/gi18n-lib.h>
-#include <gmodule.h>
-
-#include "camel-groupwise-store.h"
-#include "camel-groupwise-transport.h"
-
-static void add_hash (guint *hash, gchar *s);
-static guint groupwise_url_hash (gconstpointer key);
-static gint check_equal (gchar *s1, gchar *s2);
-static gint groupwise_url_equal (gconstpointer a, gconstpointer b);
-
-static CamelProviderConfEntry groupwise_conf_entries[] = {
-       /* override the labels/defaults of the standard settings */
-
-       { 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_SECTION_END },
-
-       { CAMEL_PROVIDER_CONF_SECTION_START, "general", NULL, N_("Options") },
-       { CAMEL_PROVIDER_CONF_CHECKBOX, "filter", NULL,
-         N_("_Apply filters to new messages in Inbox on this server"), "0" },
-       { CAMEL_PROVIDER_CONF_CHECKBOX, "filter_junk", NULL,
-         N_("Check new messages for J_unk 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, "sync_offline", NULL,
-         N_("Automatically synchroni_ze account 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 groupwise_port_entries[] = {
-                                                       { 1677, N_("Default GroupWise port"), FALSE },
-                                                       { 0, NULL, 0 }
-                                                 };
-
-static CamelProvider groupwise_provider = {
-       "groupwise",
-       N_("Novell GroupWise"),
-
-       N_("For accessing Novell GroupWise servers"),
-
-       "mail",
-
-       CAMEL_PROVIDER_IS_REMOTE | CAMEL_PROVIDER_IS_SOURCE |
-       CAMEL_PROVIDER_IS_STORAGE | CAMEL_PROVIDER_SUPPORTS_SSL | CAMEL_PROVIDER_DISABLE_SENT_FOLDER,
-
-       CAMEL_URL_NEED_USER | CAMEL_URL_NEED_HOST | CAMEL_URL_ALLOW_AUTH,
-
-       groupwise_conf_entries,
-
-       groupwise_port_entries,
-
-       /* ... */
-};
-
-CamelServiceAuthType camel_groupwise_password_authtype = {
-       N_("Password"),
-
-       N_("This option will connect to the GroupWise server using a "
-          "plaintext password."),
-
-       "",
-       TRUE
-};
-
-static gint
-groupwise_auto_detect_cb (CamelURL *url, GHashTable **auto_detected,
-                        GError **error)
-{
-       *auto_detected = g_hash_table_new (g_str_hash, g_str_equal);
-
-       g_hash_table_insert (*auto_detected, g_strdup ("poa"),
-                            g_strdup (url->host));
-
-       return 0;
-}
-
-void
-camel_provider_module_init (void)
-{
-       CamelProvider *imap_provider = NULL;
-       gboolean use_imap = g_getenv ("USE_IMAP") != NULL;
-
-       if (use_imap)
-               imap_provider = camel_provider_get("imapx://", NULL);
-
-       groupwise_provider.url_hash = groupwise_url_hash;
-       groupwise_provider.url_equal = groupwise_url_equal;
-       groupwise_provider.auto_detect = groupwise_auto_detect_cb;
-       groupwise_provider.authtypes = g_list_prepend (groupwise_provider.authtypes, &camel_groupwise_password_authtype);
-       groupwise_provider.translation_domain = GETTEXT_PACKAGE;
-
-       if (use_imap)
-               groupwise_provider.object_types[CAMEL_PROVIDER_STORE] = imap_provider->object_types[CAMEL_PROVIDER_STORE];
-       else    {
-               groupwise_provider.object_types[CAMEL_PROVIDER_STORE] =  camel_groupwise_store_get_type ();
-               groupwise_provider.object_types[CAMEL_PROVIDER_TRANSPORT] = camel_groupwise_transport_get_type ();
-       }
-
-       camel_provider_register (&groupwise_provider);
-}
-
-static void
-add_hash (guint *hash, gchar *s)
-{
-       if (s)
-               *hash ^= g_str_hash(s);
-}
-
-static guint
-groupwise_url_hash (gconstpointer key)
-{
-       const CamelURL *u = (CamelURL *)key;
-       guint hash = 0;
-
-       add_hash (&hash, u->user);
-       add_hash (&hash, u->host);
-       hash ^= u->port;
-
-       return hash;
-}
-
-static gint
-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
-groupwise_url_equal (gconstpointer a, gconstpointer b)
-{
-       const CamelURL *u1 = a, *u2 = b;
-
-       return check_equal (u1->protocol, u2->protocol)
-               && check_equal (u1->user, u2->user)
-               && check_equal (u1->host, u2->host)
-               && u1->port == u2->port;
-}
diff --git a/camel/providers/groupwise/camel-groupwise-store-summary.c b/camel/providers/groupwise/camel-groupwise-store-summary.c
deleted file mode 100644 (file)
index 80c0da2..0000000
+++ /dev/null
@@ -1,538 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * Authors: Parthasarathi Susarla <sparthasarathi@novell.com>
- *
- * Description: Based on the imap implementaion of camelstoresummary
- *
- * This program 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 program; 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 <ctype.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "camel-groupwise-store-summary.h"
-
-#define CAMEL_GW_STORE_SUMMARY_VERSION (0)
-
-#define d(x)
-
-static void namespace_clear (CamelStoreSummary *s);
-
-static gint summary_header_load (CamelStoreSummary *, FILE *);
-static gint summary_header_save (CamelStoreSummary *, FILE *);
-
-static CamelStoreInfo *store_info_load (CamelStoreSummary *s, FILE *in);
-static gint store_info_save (CamelStoreSummary *s, FILE *out, CamelStoreInfo *mi);
-static void store_info_free (CamelStoreSummary *s, CamelStoreInfo *mi);
-static void store_info_set_string (CamelStoreSummary *s, CamelStoreInfo *mi, gint type, const gchar *str);
-
-static const gchar *store_info_string (CamelStoreSummary *s, const CamelStoreInfo *mi, gint type);
-CamelGroupwiseStoreNamespace *camel_groupwise_store_summary_namespace_find_full (CamelGroupwiseStoreSummary *s, const gchar *full);
-
-G_DEFINE_TYPE (CamelGroupwiseStoreSummary, camel_groupwise_store_summary, CAMEL_TYPE_STORE_SUMMARY)
-
-static void
-camel_groupwise_store_summary_class_init (CamelGroupwiseStoreSummaryClass *class)
-{
-       CamelStoreSummaryClass *store_summary_class;
-
-       store_summary_class = CAMEL_STORE_SUMMARY_CLASS (class);
-       store_summary_class->summary_header_load = summary_header_load;
-       store_summary_class->summary_header_save = summary_header_save;
-       store_summary_class->store_info_load = store_info_load;
-       store_summary_class->store_info_save = store_info_save;
-       store_summary_class->store_info_free = store_info_free;
-       store_summary_class->store_info_string = store_info_string;
-       store_summary_class->store_info_set_string = store_info_set_string;
-}
-
-static void
-camel_groupwise_store_summary_init (CamelGroupwiseStoreSummary *gw_summary)
-{
-       CamelStoreSummary *summary = CAMEL_STORE_SUMMARY (gw_summary);
-
-       summary->store_info_size = sizeof (CamelGroupwiseStoreInfo);
-       gw_summary->version = CAMEL_GW_STORE_SUMMARY_VERSION;
-}
-
-CamelGroupwiseStoreSummary *
-camel_groupwise_store_summary_new (void)
-{
-       return g_object_new (CAMEL_TYPE_GROUPWISE_STORE_SUMMARY, NULL);
-}
-
-CamelGroupwiseStoreInfo *
-camel_groupwise_store_summary_full_name (CamelGroupwiseStoreSummary *s, const gchar *full_name)
-{
-       gint count, i;
-       CamelGroupwiseStoreInfo *info;
-
-       count = camel_store_summary_count ((CamelStoreSummary *)s);
-       for (i=0;i<count;i++) {
-               info = (CamelGroupwiseStoreInfo *)camel_store_summary_index ((CamelStoreSummary *)s, i);
-               if (info) {
-                       if (strcmp (info->full_name, full_name) == 0)
-                               return info;
-                       camel_store_summary_info_free ((CamelStoreSummary *)s, (CamelStoreInfo *)info);
-               }
-       }
-
-       return NULL;
-}
-
-gchar *
-camel_groupwise_store_summary_full_to_path (CamelGroupwiseStoreSummary *s, const gchar *full_name, gchar dir_sep)
-{
-       gchar *path, *p;
-       gint c;
-       const gchar *f;
-
-       if (dir_sep != '/') {
-               p = path = alloca (strlen (full_name)*3+1);
-               f = full_name;
-               while ((c = *f++ & 0xff)) {
-                       if (c == dir_sep)
-                               *p++ = '/';
-                       else if (c == '/' || c == '%')
-                               p += sprintf(p, "%%%02X", c);
-                       else
-                               *p++ = c;
-               }
-               *p = 0;
-       } else
-               path = (gchar *)full_name;
-
-       return g_strdup (path);
-}
-static guint32 hexnib (guint32 c)
-{
-       if (c >= '0' && c <= '9')
-               return c-'0';
-       else if (c>='A' && c <= 'Z')
-               return c-'A'+10;
-       else
-               return 0;
-}
-
-static gint
-namespace_save (CamelStoreSummary *s, FILE *in, CamelGroupwiseStoreNamespace *ns)
-{
-       if (camel_file_util_encode_string (in, ns->path) == -1
-                       || camel_file_util_encode_string (in, ns->full_name) == -1
-                       || camel_file_util_encode_uint32 (in, (guint32)ns->sep) == -1)
-               return -1;
-
-       return 0;
-}
-
-static void
-namespace_free (CamelStoreSummary *s, CamelGroupwiseStoreNamespace *ns)
-{
-       g_free (ns->path);
-       g_free (ns->full_name);
-       g_free (ns);
-}
-
-static void
-namespace_clear (CamelStoreSummary *s)
-{
-       CamelGroupwiseStoreSummary *is = (CamelGroupwiseStoreSummary *)s;
-
-       if (is->namespace)
-               namespace_free (s, is->namespace);
-       is->namespace = NULL;
-}
-
-static CamelGroupwiseStoreNamespace *
-namespace_load (CamelStoreSummary *s, FILE *in)
-{
-       CamelGroupwiseStoreNamespace *ns;
-       guint32 sep = '/';
-
-       ns = g_malloc0 (sizeof (*ns));
-       if (camel_file_util_decode_string (in, &ns->path) == -1
-                       || camel_file_util_decode_string (in, &ns->full_name) == -1
-                       || camel_file_util_decode_uint32 (in, &sep) == -1) {
-               namespace_free (s, ns);
-               ns = NULL;
-       } else {
-               ns->sep = sep;
-       }
-
-       return ns;
-}
-
-gchar *
-camel_groupwise_store_summary_path_to_full (CamelGroupwiseStoreSummary *s, const gchar *path, gchar dir_sep)
-{
-       gchar *full, *f;
-       guint32 c, v = 0;
-       const gchar *p;
-       gint state=0;
-       gchar *subpath, *last = NULL;
-       CamelStoreInfo *si;
-       CamelGroupwiseStoreNamespace *ns;
-
-       /* check to see if we have a subpath of path already defined */
-       subpath = alloca (strlen (path)+1);
-       strcpy (subpath, path);
-       do {
-               si = camel_store_summary_path ((CamelStoreSummary *)s, subpath);
-               if (si == NULL) {
-                       last = strrchr (subpath, '/');
-                       if (last)
-                               *last = 0;
-               }
-       } while (si == NULL && last);
-
-       /* path is already present, use the raw version we have */
-       if (si && strlen (subpath) == strlen (path)) {
-               f = g_strdup (camel_groupwise_store_info_full_name (s, si));
-               camel_store_summary_info_free ((CamelStoreSummary *)s, si);
-               return f;
-       }
-
-       ns = camel_groupwise_store_summary_namespace_find_path (s, path);
-
-       f = full = alloca (strlen (path)*2+1);
-       if (si)
-               p = path + strlen (subpath);
-       else if (ns)
-               p = path + strlen (ns->path);
-       else
-               p = path;
-
-       while ((c = camel_utf8_getc ((const guchar **)&p))) {
-               switch (state) {
-                       case 0:
-                               if (c == '%')
-                                       state = 1;
-                               else {
-                                       if (c == '/')
-                                               c = dir_sep;
-                                       camel_utf8_putc ((guchar **) &f, c);
-                               }
-                               break;
-                       case 1:
-                               state = 2;
-                               v = hexnib (c) << 4;
-                               break;
-                       case 2:
-                               state = 0;
-                               v |= hexnib (c);
-                               camel_utf8_putc ((guchar **) &f, v);
-                               break;
-               }
-       }
-       camel_utf8_putc ((guchar **) &f, c);
-
-       /* merge old path part if required */
-       f = g_strdup (full);
-       if (si) {
-               full = g_strdup_printf("%s%s", camel_groupwise_store_info_full_name(s, si), f);
-               g_free (f);
-               camel_store_summary_info_free ((CamelStoreSummary *)s, si);
-               f = full;
-       } else if (ns) {
-               full = g_strdup_printf("%s%s", ns->full_name, f);
-               g_free (f);
-               f = full;
-       }
-       return f;
-}
-
-CamelGroupwiseStoreNamespace *
-camel_groupwise_store_summary_namespace_find_full (CamelGroupwiseStoreSummary *s, const gchar *full)
-{
-       gint len;
-       CamelGroupwiseStoreNamespace *ns;
-
-       /* NB: this currently only compares against 1 namespace, in future compare against others */
-       ns = s->namespace;
-       while (ns) {
-               len = strlen (ns->full_name);
-               d(printf("find_full: comparing namespace '%s' to name '%s'\n", ns->full_name, full));
-               if (len == 0
-                               || (strncmp (ns->full_name, full, len) == 0
-                                       && (full[len] == ns->sep || full[len] == 0)))
-                       break;
-               ns = NULL;
-       }
-
-       /* have a default? */
-       return ns;
-}
-
-CamelGroupwiseStoreInfo *
-camel_groupwise_store_summary_add_from_full (CamelGroupwiseStoreSummary *s, const gchar *full, gchar dir_sep)
-{
-       CamelGroupwiseStoreInfo *info;
-       gchar *pathu8, *prefix;
-       gint len;
-       gchar *full_name;
-       CamelGroupwiseStoreNamespace *ns;
-
-       d(printf("adding full name '%s' '%c'\n", full, dir_sep));
-
-       len = strlen (full);
-       full_name = alloca (len+1);
-       strcpy (full_name, full);
-       if (full_name[len-1] == dir_sep)
-               full_name[len-1] = 0;
-
-       info = camel_groupwise_store_summary_full_name (s, full_name);
-       if (info) {
-               camel_store_summary_info_free ((CamelStoreSummary *)s, (CamelStoreInfo *)info);
-               d(printf("  already there\n"));
-               return info;
-       }
-
-       ns = camel_groupwise_store_summary_namespace_find_full (s, full_name);
-       if (ns) {
-               d(printf("(found namespace for '%s' ns '%s') ", full_name, ns->path));
-               len = strlen (ns->full_name);
-               if (len >= strlen (full_name)) {
-                       pathu8 = g_strdup (ns->path);
-               } else {
-                       if (full_name[len] == ns->sep)
-                               len++;
-
-                       prefix = camel_groupwise_store_summary_full_to_path (s, full_name+len, ns->sep);
-                       if (*ns->path) {
-                               pathu8 = g_strdup_printf ("%s/%s", ns->path, prefix);
-                               g_free (prefix);
-                       } else {
-                               pathu8 = prefix;
-                       }
-               }
-               d(printf(" (pathu8 = '%s')", pathu8));
-       } else {
-               d(printf("(Cannot find namespace for '%s')\n", full_name));
-               pathu8 = camel_groupwise_store_summary_full_to_path (s, full_name, dir_sep);
-       }
-
-       info = (CamelGroupwiseStoreInfo *)camel_store_summary_add_from_path ((CamelStoreSummary *)s, pathu8);
-       if (info) {
-               d(printf("  '%s' -> '%s'\n", pathu8, full_name));
-               camel_store_info_set_string ((CamelStoreSummary *)s, (CamelStoreInfo *)info, CAMEL_STORE_INFO_LAST, full_name);
-       } else {
-               d(printf("  failed\n"));
-       }
-
-       return info;
-}
-
-gchar *
-camel_groupwise_store_summary_full_from_path (CamelGroupwiseStoreSummary *s, const gchar *path)
-{
-       CamelGroupwiseStoreNamespace *ns;
-       gchar *name = NULL;
-
-       ns = camel_groupwise_store_summary_namespace_find_path (s, path);
-       if (ns)
-               name = camel_groupwise_store_summary_path_to_full (s, path, ns->sep);
-
-       d(printf("looking up path %s -> %s\n", path, name?name:"not found"));
-
-       return name;
-}
-
-CamelGroupwiseStoreNamespace *
-camel_groupwise_store_summary_namespace_new (CamelGroupwiseStoreSummary *s, const gchar *full_name, gchar dir_sep)
-{
-       CamelGroupwiseStoreNamespace *ns;
-       gchar *p, *o, c;
-       gint len;
-
-       ns = g_malloc0 (sizeof (*ns));
-       ns->full_name = g_strdup (full_name);
-       len = strlen (ns->full_name)-1;
-       if (len >= 0 && ns->full_name[len] == dir_sep)
-               ns->full_name[len] = 0;
-       ns->sep = dir_sep;
-
-       o = p = ns->path = camel_groupwise_store_summary_full_to_path (s, ns->full_name, dir_sep);
-       while ((c = *p++)) {
-               if (c != '#') {
-                       if (c == '/')
-                               c = '.';
-                       *o++ = c;
-               }
-       }
-       *o = 0;
-
-       return ns;
-}
-
-void
-camel_groupwise_store_summary_namespace_set (CamelGroupwiseStoreSummary *s, CamelGroupwiseStoreNamespace *ns)
-{
-       d(printf("Setting namesapce to '%s' '%c' -> '%s'\n", ns->full_name, ns->sep, ns->path));
-       namespace_clear ((CamelStoreSummary *)s);
-       s->namespace = ns;
-       camel_store_summary_touch ((CamelStoreSummary *)s);
-}
-
-CamelGroupwiseStoreNamespace *
-camel_groupwise_store_summary_namespace_find_path (CamelGroupwiseStoreSummary *s, const gchar *path)
-{
-       gint len;
-       CamelGroupwiseStoreNamespace *ns;
-
-       /* NB: this currently only compares against 1 namespace, in future compare against others */
-       ns = s->namespace;
-       while (ns) {
-               len = strlen (ns->path);
-               if (len == 0
-                               || (strncmp (ns->path, path, len) == 0
-                                       && (path[len] == '/' || path[len] == 0)))
-                       break;
-               ns = NULL;
-       }
-
-       /* have a default? */
-       return ns;
-}
-
-static gint
-summary_header_load (CamelStoreSummary *s, FILE *in)
-{
-       CamelGroupwiseStoreSummary *summary = (CamelGroupwiseStoreSummary *)s;
-        gint32 version, capabilities, count;
-
-       namespace_clear (s);
-
-       if (CAMEL_STORE_SUMMARY_CLASS (camel_groupwise_store_summary_parent_class)->summary_header_load ((CamelStoreSummary *)s, in) == -1
-                       || camel_file_util_decode_fixed_int32 (in, &version) == -1)
-               return -1;
-
-       summary->version = version;
-
-       if (camel_file_util_decode_fixed_int32 (in, &capabilities) == -1
-                       || camel_file_util_decode_fixed_int32 (in, &count) == -1
-                       || count > 1)
-               return -1;
-
-       summary->capabilities = capabilities;
-       if (count == 1) {
-               if ((summary->namespace = namespace_load (s, in)) == NULL)
-                       return -1;
-       }
-       return 0;
-}
-
-static gint
-summary_header_save (CamelStoreSummary *s, FILE *out)
-{
-       CamelGroupwiseStoreSummary *summary = (CamelGroupwiseStoreSummary *) s;
-       guint32 count;
-
-       count = summary->namespace?1:0;
-       if (CAMEL_STORE_SUMMARY_CLASS (camel_groupwise_store_summary_parent_class)->summary_header_save ((CamelStoreSummary *)s, out) == -1
-                       || camel_file_util_encode_fixed_int32 (out, 0) == -1
-                       || camel_file_util_encode_fixed_int32 (out, summary->capabilities) == -1
-                       || camel_file_util_encode_fixed_int32 (out, count) == -1)
-               return -1;
-
-       if (summary->namespace && namespace_save (s, out, summary->namespace) == -1)
-               return -1;
-
-       return 0;
-}
-
-static CamelStoreInfo *
-store_info_load (CamelStoreSummary *s, FILE *in)
-{
-       CamelGroupwiseStoreInfo *si;
-
-       si = (CamelGroupwiseStoreInfo *)CAMEL_STORE_SUMMARY_CLASS (camel_groupwise_store_summary_parent_class)->store_info_load (s, in);
-       if (si) {
-               if (camel_file_util_decode_string (in, &si->full_name) == -1) {
-                       camel_store_summary_info_free (s, (CamelStoreInfo *)si);
-                       si = NULL;
-               }
-       }
-
-       return (CamelStoreInfo *)si;
-}
-
-static gint
-store_info_save (CamelStoreSummary *s, FILE *out, CamelStoreInfo *mi)
-{
-       CamelGroupwiseStoreInfo *summary = (CamelGroupwiseStoreInfo *)mi;
-
-       if (CAMEL_STORE_SUMMARY_CLASS (camel_groupwise_store_summary_parent_class)->store_info_save (s, out, mi) == -1
-                       || camel_file_util_encode_string (out, summary->full_name) == -1)
-               return -1;
-
-       return 0;
-}
-
-static void
-store_info_free (CamelStoreSummary *s, CamelStoreInfo *mi)
-{
-       CamelGroupwiseStoreInfo *si = (CamelGroupwiseStoreInfo *)mi;
-
-       g_free (si->full_name);
-       CAMEL_STORE_SUMMARY_CLASS (camel_groupwise_store_summary_parent_class)->store_info_free (s, mi);
-}
-
-static const gchar *
-store_info_string (CamelStoreSummary *s, const CamelStoreInfo *mi, gint type)
-{
-       CamelGroupwiseStoreInfo *isi = (CamelGroupwiseStoreInfo *)mi;
-
-       /* FIXME: Locks? */
-
-       g_assert (mi != NULL);
-
-       switch (type) {
-               case CAMEL_STORE_INFO_LAST:
-                       return isi->full_name;
-               default:
-                       return CAMEL_STORE_SUMMARY_CLASS (camel_groupwise_store_summary_parent_class)->store_info_string (s, mi, type);
-       }
-}
-
-static void
-store_info_set_string (CamelStoreSummary *s, CamelStoreInfo *mi, gint type, const gchar *str)
-{
-       CamelGroupwiseStoreInfo *isi = (CamelGroupwiseStoreInfo *)mi;
-
-       g_assert (mi != NULL);
-
-       switch (type) {
-               case CAMEL_STORE_INFO_LAST:
-                       d(printf("Set full name %s -> %s\n", isi->full_name, str));
-                       camel_store_summary_lock (s, CAMEL_STORE_SUMMARY_SUMMARY_LOCK);
-                       g_free (isi->full_name);
-                       isi->full_name = g_strdup (str);
-                       camel_store_summary_unlock (s, CAMEL_STORE_SUMMARY_SUMMARY_LOCK);
-                       break;
-               default:
-                       CAMEL_STORE_SUMMARY_CLASS (camel_groupwise_store_summary_parent_class)->store_info_set_string (s, mi, type, str);
-                       break;
-       }
-}
-
diff --git a/camel/providers/groupwise/camel-groupwise-store-summary.h b/camel/providers/groupwise/camel-groupwise-store-summary.h
deleted file mode 100644 (file)
index 0dbdb6b..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * Authors: Parthasarathi Susarla <sparthasrathi@novell.com>
- *
- * This program 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 program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef CAMEL_GROUPWISE_STORE_SUMMARY_H
-#define CAMEL_GROUPWISE_STORE_SUMMARY_H
-
-#include <camel/camel.h>
-
-/* Standard GObject macros */
-#define CAMEL_TYPE_GROUPWISE_STORE_SUMMARY \
-       (camel_groupwise_store_summary_get_type ())
-#define CAMEL_GROUPWISE_STORE_SUMMARY(obj) \
-       (G_TYPE_CHECK_INSTANCE_CAST \
-       ((obj), CAMEL_TYPE_GROUPWISE_STORE_SUMMARY, CamelGroupwiseStoreSummary))
-#define CAMEL_GROUPWISE_STORE_SUMMARY_CLASS(cls) \
-       (G_TYPE_CHECK_CLASS_CAST \
-       ((cls), CAMEL_TYPE_GROUPWISE_STORE_SUMMARY, CamelGroupwiseStoreSummaryClass))
-#define CAMEL_IS_GROUPWISE_STORE_SUMMARY(obj) \
-       (G_TYPE_CHECK_INSTANCE_TYPE \
-       ((obj), CAMEL_TYPE_GROUPWISE_STORE_SUMMARY))
-#define CAMEL_IS_GROUPWISE_STORE_SUMMARY_CLASS(cls) \
-       (G_TYPE_CHECK_CLASS_TYPE \
-       ((cls), CAMEL_TYPE_GROUPWISE_STORE_SUMMARY))
-#define CAMEL_GROUPWISE_STORE_SUMMARY_GET_CLASS(obj) \
-       (G_TYPE_INSTANCE_GET_CLASS \
-       ((obj), CAMEL_TYPE_GROUPWISE_STORE_SUMMARY, CamelGroupwiseStoreSummaryClass))
-
-G_BEGIN_DECLS
-
-typedef struct _CamelGroupwiseStoreSummary CamelGroupwiseStoreSummary;
-typedef struct _CamelGroupwiseStoreSummaryClass CamelGroupwiseStoreSummaryClass;
-typedef struct _CamelGroupwiseStoreSummaryPrivate CamelGroupwiseStoreSummaryPrivate;
-
-typedef struct _CamelGroupwiseStoreInfo CamelGroupwiseStoreInfo;
-
-enum {
-       CAMEL_GW_STORE_INFO_FULL_NAME = CAMEL_STORE_INFO_LAST,
-       CAMEL_GW_STORE_INFO_LAST
-};
-
-struct _CamelGroupwiseStoreInfo {
-       CamelStoreInfo info;
-       gchar *full_name;
-};
-
-typedef struct _CamelGroupwiseStoreNamespace CamelGroupwiseStoreNamespace;
-
-struct _CamelGroupwiseStoreNamespace {
-       gchar *path;             /* display path */
-       gchar *full_name;        /* real name */
-       gchar sep;               /* directory separator */
-};
-
-struct _CamelGroupwiseStoreSummary {
-       CamelStoreSummary summary;
-       CamelGroupwiseStoreSummaryPrivate *priv;
-
-       /* header info */
-       guint32 version;        /* version of base part of file */
-       guint32 capabilities;
-       CamelGroupwiseStoreNamespace *namespace; /* eventually to be a list */
-};
-
-struct _CamelGroupwiseStoreSummaryClass {
-       CamelStoreSummaryClass summary_class;
-};
-
-GType                        camel_groupwise_store_summary_get_type      (void);
-CamelGroupwiseStoreSummary      *camel_groupwise_store_summary_new        (void);
-CamelGroupwiseStoreInfo *camel_groupwise_store_summary_full_name (CamelGroupwiseStoreSummary *s, const gchar *full_name);
-CamelGroupwiseStoreInfo *camel_groupwise_store_summary_add_from_full (CamelGroupwiseStoreSummary *s, const gchar *full, gchar dir_sep);
-
-gchar *camel_groupwise_store_summary_full_to_path (CamelGroupwiseStoreSummary *s, const gchar *full_name, gchar dir_sep);
-gchar *camel_groupwise_store_summary_path_to_full (CamelGroupwiseStoreSummary *s, const gchar *path, gchar dir_sep);
-gchar *camel_groupwise_store_summary_full_from_path (CamelGroupwiseStoreSummary *s, const gchar *path);
-
-CamelGroupwiseStoreNamespace *camel_groupwise_store_summary_namespace_new (CamelGroupwiseStoreSummary *s, const gchar *full_name, gchar dir_sep);
-CamelGroupwiseStoreNamespace *camel_groupwise_store_summary_namespace_find_path (CamelGroupwiseStoreSummary *s, const gchar *path);
-void camel_groupwise_store_summary_namespace_set (CamelGroupwiseStoreSummary *s, CamelGroupwiseStoreNamespace *ns);
-
-#define camel_groupwise_store_info_full_name(s, i) (camel_store_info_string((CamelStoreSummary *)s, (const CamelStoreInfo *)i, CAMEL_STORE_INFO_LAST))
-
-G_END_DECLS
-
-#endif /* CAMEL_GROUPWISE_STORE_SUMMARY_H */
diff --git a/camel/providers/groupwise/camel-groupwise-store.c b/camel/providers/groupwise/camel-groupwise-store.c
deleted file mode 100644 (file)
index cd3f607..0000000
+++ /dev/null
@@ -1,1676 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-groupwise-store.c : class for an groupwise store */
-
-/*
- *  Authors:
- *  Sivaiah Nallagatla <snallagatla@novell.com>
- *  parthasarathi susarla <sparthasarathi@novell.com>
- *
- *  Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include <config.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <glib/gi18n-lib.h>
-#include <glib/gstdio.h>
-
-#include "camel-groupwise-folder.h"
-#include "camel-groupwise-store-summary.h"
-#include "camel-groupwise-store.h"
-#include "camel-groupwise-summary.h"
-#include "camel-groupwise-transport.h"
-#include "camel-groupwise-utils.h"
-
-#ifdef G_OS_WIN32
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#endif
-
-#define d(x)
-#define CURSOR_ITEM_LIMIT 100
-#define JUNK_ENABLE 1
-#define JUNK_PERSISTENCE 14
-
-const gchar * CREATE_CURSOR_VIEW = "peek id default recipient threading hasAttachment subject status priority startDate created delivered size recurrenceKey";
-
-struct _CamelGroupwiseStorePrivate {
-       gchar *server_name;
-       gchar *port;
-       gchar *user;
-       gchar *use_ssl;
-
-       gchar *base_url;
-
-       GHashTable *id_hash; /*get names from ids*/
-       GHashTable *name_hash;/*get ids from names*/
-       GHashTable *parent_hash;
-       EGwConnection *cnc;
-};
-
-extern CamelServiceAuthType camel_groupwise_password_authtype; /*for the query_auth_types function*/
-
-static GInitableIface *parent_initable_interface;
-
-static CamelFolderInfo *convert_to_folder_info (CamelGroupwiseStore *store, EGwContainer *container, const gchar *url, GCancellable *cancellable, GError **error);
-static gboolean groupwise_folders_sync (CamelGroupwiseStore *store, GCancellable *cancellable, GError **error);
-static gint match_path (const gchar *path, const gchar *name);
-static void camel_groupwise_store_initable_init (GInitableIface *interface);
-
-G_DEFINE_TYPE_WITH_CODE (
-       CamelGroupwiseStore, camel_groupwise_store, CAMEL_TYPE_OFFLINE_STORE,
-       G_IMPLEMENT_INTERFACE (
-               G_TYPE_INITABLE, camel_groupwise_store_initable_init))
-
-static guint
-groupwise_hash_folder_name (gconstpointer key)
-{
-       return g_str_hash (key);
-}
-
-static gint
-groupwise_compare_folder_name (gconstpointer a, gconstpointer b)
-{
-       gconstpointer aname = a, bname = b;
-
-       return g_str_equal (aname, bname);
-}
-
-static gboolean
-groupwise_auth_loop (CamelService *service,
-                     GCancellable *cancellable,
-                     GError **error)
-{
-       CamelSession *session = camel_service_get_session (service);
-       CamelStore *store = CAMEL_STORE (service);
-       CamelGroupwiseStore *groupwise_store = CAMEL_GROUPWISE_STORE (store);
-       CamelGroupwiseStorePrivate *priv = groupwise_store->priv;
-       CamelURL *url;
-       gboolean authenticated = FALSE;
-       gchar *uri;
-       guint32 prompt_flags = CAMEL_SESSION_PASSWORD_SECRET;
-       EGwConnectionErrors errors = {E_GW_CONNECTION_STATUS_INVALID_OBJECT, NULL};
-
-       url = camel_service_get_camel_url (service);
-
-       if (priv->use_ssl && !g_str_equal (priv->use_ssl, "never"))
-               uri = g_strconcat ("https://", priv->server_name, ":", priv->port, "/soap", NULL);
-       else
-               uri = g_strconcat ("http://", priv->server_name, ":", priv->port, "/soap", NULL);
-       url->passwd = NULL;
-
-       while (!authenticated) {
-
-               if (!url->passwd && !(store->flags & CAMEL_STORE_PROXY)) {
-                       gchar *prompt;
-
-                       prompt = camel_session_build_password_prompt (
-                               "GroupWise", url->user, url->host);
-                       url->passwd =
-                               camel_session_get_password (
-                                       session, service, "Groupwise", prompt,
-                                       "password", prompt_flags, error);
-                       g_free (prompt);
-
-                       if (!url->passwd) {
-                               g_set_error (
-                                       error, G_IO_ERROR,
-                                       G_IO_ERROR_CANCELLED,
-                                       _("You did not enter a password."));
-                               return FALSE;
-                       }
-               }
-
-               priv->cnc = e_gw_connection_new_with_error_handler (uri, priv->user, url->passwd, &errors);
-               if (!E_IS_GW_CONNECTION(priv->cnc) && priv->use_ssl && g_str_equal (priv->use_ssl, "when-possible")) {
-                       gchar *http_uri = g_strconcat ("http://", uri + 8, NULL);
-                       priv->cnc = e_gw_connection_new (http_uri, priv->user, url->passwd);
-                       g_free (http_uri);
-               }
-               if (!E_IS_GW_CONNECTION (priv->cnc)) {
-                       if (errors.status == E_GW_CONNECTION_STATUS_INVALID_PASSWORD) {
-                               /* We need to un-cache the password before prompting again */
-                               prompt_flags |= CAMEL_SESSION_PASSWORD_REPROMPT;
-                               g_free (url->passwd);
-                               url->passwd = NULL;
-                       } else {
-                               g_set_error (
-                                       error, CAMEL_SERVICE_ERROR,
-                                       CAMEL_SERVICE_ERROR_UNAVAILABLE,
-                                       "%s", errors.description ?
-                                       errors.description :
-                                       _("You must be working online to complete this operation"));
-                               return FALSE;
-                       }
-               } else
-                       authenticated = TRUE;
-
-       }
-
-       return TRUE;
-}
-
-static gboolean
-check_for_connection (CamelService *service,
-                      GCancellable *cancellable,
-                      GError **error)
-{
-       CamelGroupwiseStore *groupwise_store = CAMEL_GROUPWISE_STORE (service);
-       CamelGroupwiseStorePrivate *priv = groupwise_store->priv;
-       struct addrinfo hints, *ai;
-       GError *local_error = NULL;
-
-       memset (&hints, 0, sizeof (hints));
-       hints.ai_socktype = SOCK_STREAM;
-       hints.ai_family = PF_UNSPEC;
-       ai = camel_getaddrinfo(priv->server_name, "groupwise", &hints, cancellable, &local_error);
-       if (ai == NULL && priv->port != NULL && g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
-               g_clear_error (&local_error);
-               ai = camel_getaddrinfo (priv->server_name, priv->port, &hints, cancellable, &local_error);
-       }
-
-       if (ai == NULL) {
-               g_propagate_error (error, local_error);
-               return FALSE;
-       }
-
-       camel_freeaddrinfo (ai);
-
-       return TRUE;
-
-}
-
-/* resets the current folder. To just free current folder, pass NULL for folder */
-void
-groupwise_store_set_current_folder (CamelGroupwiseStore *groupwise_store, CamelFolder *folder)
-{
-
-       camel_service_lock (CAMEL_SERVICE (groupwise_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       if (groupwise_store->current_folder) {
-               g_object_unref (groupwise_store->current_folder);
-               groupwise_store->current_folder = NULL;
-       }
-
-       if (folder)
-               groupwise_store->current_folder = g_object_ref (folder);
-
-       camel_service_unlock (CAMEL_SERVICE (groupwise_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-}
-
-static gboolean
-groupwise_connect_sync (CamelService *service,
-                        GCancellable *cancellable,
-                        GError **error)
-{
-       CamelGroupwiseStore *store = CAMEL_GROUPWISE_STORE (service);
-       CamelGroupwiseStorePrivate *priv = store->priv;
-       CamelGroupwiseStoreNamespace *ns;
-       CamelServiceConnectionStatus status;
-       CamelProvider *provider;
-       CamelSession *session;
-       CamelURL *url;
-       const gchar *user_data_dir;
-
-       d("in groupwise store connect\n");
-
-       url = camel_service_get_camel_url (service);
-       session = camel_service_get_session (service);
-       provider = camel_service_get_provider (service);
-       status = camel_service_get_connection_status (service);
-       user_data_dir = camel_service_get_user_data_dir (service);
-
-       if (status == CAMEL_SERVICE_DISCONNECTED)
-               return FALSE;
-
-       camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       if (priv->cnc) {
-               camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-               return TRUE;
-       }
-
-       if (!check_for_connection (service, cancellable, error) || !groupwise_auth_loop (service, cancellable, error)) {
-               camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-               camel_service_disconnect_sync (service, TRUE, NULL);
-               return FALSE;
-       }
-
-       camel_offline_store_set_online_sync (
-               CAMEL_OFFLINE_STORE (store), TRUE, cancellable, NULL);
-
-       if (!e_gw_connection_get_version (priv->cnc)) {
-               camel_session_alert_user (session,
-                               CAMEL_SESSION_ALERT_WARNING,
-                               _("Some features may not work correctly with your current server version"),
-                               FALSE);
-
-       }
-
-       ns = camel_groupwise_store_summary_namespace_new (
-               store->summary, user_data_dir, '/');
-       camel_groupwise_store_summary_namespace_set (store->summary, ns);
-
-       if (camel_store_summary_count ((CamelStoreSummary *)store->summary) == 0) {
-               /*Settting the refresh stamp to the current time*/
-               store->refresh_stamp = time (NULL);
-       }
-
-       camel_store_summary_save ((CamelStoreSummary *) store->summary);
-
-       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-       if (E_IS_GW_CONNECTION (priv->cnc)) {
-               return TRUE;
-       }
-
-       return FALSE;
-
-}
-#if 0
-static void
-groupwise_disconnect_cleanup (CamelService *service, gboolean clean, GError **error)
-{
-       CamelGroupwiseStore *groupwise_store = CAMEL_GROUPWISE_STORE (service);
-       CamelGroupwiseStorePrivate *priv = groupwise_store->priv;
-
-       if (groupwise_store->summary) {
-               camel_store_summary_save ((CamelStoreSummary *)groupwise_store->summary);
-               g_object_unref (groupwise_store->summary);
-       }
-
-       if (priv) {
-               if (priv->user) {
-                       g_free (priv->user);
-                       priv->user = NULL;
-               }
-               if (priv->server_name) {
-                       g_free (priv->server_name);
-                       priv->server_name = NULL;
-               }
-               if (priv->port) {
-                       g_free (priv->port);
-                       priv->port = NULL;
-               }
-               if (priv->use_ssl) {
-                       g_free (priv->use_ssl);
-                       priv->use_ssl = NULL;
-               }
-               if (priv->base_url) {
-                       g_free (priv->base_url);
-                       priv->base_url = NULL;
-               }
-
-               if (groupwise_store->root_container)
-                       g_free (groupwise_store->root_container);
-
-               if (priv->id_hash)
-                       g_hash_table_destroy (priv->id_hash);
-
-               if (priv->name_hash)
-                       g_hash_table_destroy (priv->name_hash);
-
-               if (priv->parent_hash)
-                       g_hash_table_destroy (priv->parent_hash);
-
-               g_free (groupwise_store->priv);
-               groupwise_store->priv = NULL;
-       }
-}
-#endif
-
-static gboolean
-groupwise_disconnect_sync (CamelService *service,
-                           gboolean clean,
-                           GCancellable *cancellable,
-                           GError **error)
-{
-       CamelGroupwiseStore *groupwise_store = CAMEL_GROUPWISE_STORE (service);
-
-       if (clean) {
-               camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-               if (groupwise_store->priv && groupwise_store->priv->cnc) {
-                       g_object_unref (groupwise_store->priv->cnc);
-                       groupwise_store->priv->cnc = NULL;
-               }
-
-               groupwise_store_set_current_folder (groupwise_store, NULL);
-
-               camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-       }
-
-       /* groupwise_disconnect_cleanup (service, clean, ex); */
-       return TRUE;
-}
-
-static  GList*
-groupwise_store_query_auth_types_sync (CamelService *service,
-                                       GCancellable *cancellable,
-                                       GError **error)
-{
-       GList *auth_types = NULL;
-
-       d("in query auth types\n");
-       auth_types = g_list_prepend (auth_types,  &camel_groupwise_password_authtype);
-       return auth_types;
-}
-
-static gboolean
-groupwise_is_system_folder (const gchar *folder_name)
-{
-       if (!strcmp (folder_name, "Mailbox") ||
-           !strcmp (folder_name, "Trash") ||
-           !strcmp (folder_name, "Junk Mail") ||
-           !strcmp (folder_name, "Sent Items") ||
-           !strcmp (folder_name, "Cabinet") ||
-           !strcmp (folder_name, "Documents") )
-               return TRUE;
-       else
-               return FALSE;
-}
-
-/*Build/populate CamelFolderInfo structure based on the imap_build_folder_info function*/
-static CamelFolderInfo *
-groupwise_build_folder_info (CamelGroupwiseStore *gw_store, const gchar *parent_name, const gchar *folder_name)
-{
-       CamelURL *url;
-       const gchar *name;
-       CamelFolderInfo *fi;
-       CamelGroupwiseStorePrivate *priv = gw_store->priv;
-
-       fi = camel_folder_info_new ();
-
-       fi->unread = -1;
-       fi->total = -1;
-
-       if (parent_name) {
-               if (strlen (parent_name) > 0)
-                       fi->full_name = g_strconcat(parent_name, "/", folder_name, NULL);
-               else
-                       fi->full_name = g_strdup (folder_name);
-       } else
-               fi->full_name = g_strdup (folder_name);
-
-       url = camel_url_new (priv->base_url,NULL);
-       g_free (url->path);
-       url->path = g_strdup_printf("/%s", fi->full_name);
-       fi->uri = camel_url_to_string (url,CAMEL_URL_HIDE_ALL);
-       camel_url_free (url);
-
-       name = strrchr (fi->full_name,'/');
-       if (name == NULL)
-               name = fi->full_name;
-       else
-               name++;
-       if (!strcmp (folder_name, "Sent Items"))
-               fi->flags |= CAMEL_FOLDER_TYPE_SENT;
-       else if (!strcmp (folder_name, "Mailbox"))
-               fi->flags |= CAMEL_FOLDER_TYPE_INBOX;
-       else if (!strcmp (folder_name, "Trash"))
-               fi->flags |= CAMEL_FOLDER_TYPE_TRASH;
-       else if (!strcmp (folder_name, "Junk Mail"))
-               fi->flags |= CAMEL_FOLDER_TYPE_JUNK;
-
-       if (groupwise_is_system_folder (folder_name))
-               fi->flags |= CAMEL_FOLDER_SYSTEM;
-
-       fi->name = g_strdup (name);
-       return fi;
-}
-
-static void
-groupwise_forget_folder (CamelGroupwiseStore *gw_store, const gchar *folder_name, GError **error)
-{
-       CamelService *service;
-       const gchar *user_data_dir;
-       gchar *state_file;
-       gchar *folder_dir, *storage_path;
-       CamelFolderInfo *fi;
-
-       service = CAMEL_SERVICE (gw_store);
-       user_data_dir = camel_service_get_user_data_dir (service);
-
-       storage_path = g_strdup_printf ("%s/folders", user_data_dir);
-       folder_dir = e_path_to_physical (storage_path,folder_name);
-
-       if (g_access (folder_dir, F_OK) != 0) {
-               g_free (folder_dir);
-               return;
-       }
-
-       state_file = g_strdup_printf ("%s/cmeta", folder_dir);
-       g_unlink (state_file);
-       g_free (state_file);
-
-       g_rmdir (folder_dir);
-       g_free (folder_dir);
-
-       camel_store_summary_remove_path ( (CamelStoreSummary *)gw_store->summary, folder_name);
-       camel_store_summary_save ( (CamelStoreSummary *)gw_store->summary);
-
-       fi = groupwise_build_folder_info (gw_store, NULL, folder_name);
-       camel_store_folder_deleted (CAMEL_STORE (gw_store), fi);
-       camel_folder_info_free (fi);
-}
-
-static CamelFolder *
-groupwise_get_folder_from_disk (CamelStore *store,
-                                const gchar *folder_name,
-                                guint32 flags,
-                                GCancellable *cancellable,
-                                GError **error)
-{
-       CamelFolder *folder;
-       CamelService *service;
-       const gchar *user_data_dir;
-       gchar *folder_dir, *storage_path;
-
-       service = CAMEL_SERVICE (store);
-       user_data_dir = camel_service_get_user_data_dir (service);
-
-       storage_path = g_strdup_printf ("%s/folders", user_data_dir);
-       folder_dir = e_path_to_physical (storage_path, folder_name);
-       g_free (storage_path);
-
-       if (!folder_dir || g_access (folder_dir, F_OK) != 0) {
-               g_free (folder_dir);
-               g_set_error (
-                       error, CAMEL_STORE_ERROR,
-                       CAMEL_STORE_ERROR_NO_FOLDER,
-                       _("No such folder %s"), folder_name);
-               return NULL;
-       }
-
-       folder = camel_gw_folder_new (store, folder_name, folder_dir, cancellable, error);
-       g_free (folder_dir);
-
-       return folder;
-}
-
-static CamelFolder *
-groupwise_store_get_folder_sync (CamelStore *store,
-                                 const gchar *folder_name,
-                                 CamelStoreGetFolderFlags flags,
-                                 GCancellable *cancellable,
-                                 GError **error)
-{
-       CamelGroupwiseStore *gw_store = CAMEL_GROUPWISE_STORE (store);
-       CamelGroupwiseStorePrivate *priv = gw_store->priv;
-       CamelFolder *folder;
-       CamelService *service;
-       CamelGroupwiseSummary *summary;
-       gchar *container_id, *folder_dir, *storage_path;
-       EGwConnectionStatus status;
-       GList *list = NULL;
-       gboolean done = FALSE, all_ok = TRUE;
-       const gchar *user_data_dir;
-       const gchar *position = E_GW_CURSOR_POSITION_END;
-       gint count = 0, cursor, summary_count = 0;
-       CamelStoreInfo *si = NULL;
-       guint total = 0;
-       GError *local_error = NULL;
-
-       service = CAMEL_SERVICE (store);
-       user_data_dir = camel_service_get_user_data_dir (service);
-
-       folder = groupwise_get_folder_from_disk (
-               store, folder_name, flags, cancellable, &local_error);
-       if (folder) {
-               groupwise_store_set_current_folder (gw_store, folder);
-               return folder;
-
-       /* Ignore "no such folder" errors, fail on any other error. */
-       } else if (!g_error_matches (local_error,
-               CAMEL_STORE_ERROR, CAMEL_STORE_ERROR_NO_FOLDER)) {
-               g_propagate_error (error, local_error);
-               return NULL;
-       } else
-               g_clear_error (&local_error);
-
-       camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       groupwise_store_set_current_folder (gw_store, NULL);
-
-       if (!camel_groupwise_store_connected (gw_store, cancellable, error)) {
-               camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-               return NULL;
-       }
-
-       if (!E_IS_GW_CONNECTION ( priv->cnc)) {
-               if (!groupwise_connect_sync (service, cancellable, error)) {
-                       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-                       return NULL;
-               }
-       }
-
-       container_id =  g_strdup (g_hash_table_lookup (priv->name_hash, folder_name));
-
-       storage_path = g_strdup_printf ("%s/folders", user_data_dir);
-       folder_dir = e_path_to_physical (storage_path, folder_name);
-       g_free (storage_path);
-       folder = camel_gw_folder_new (store, folder_name, folder_dir, cancellable, NULL);
-       if (!folder) {
-               camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-               g_set_error (
-                       error, CAMEL_SERVICE_ERROR,
-                       CAMEL_SERVICE_ERROR_INVALID,
-                       _("Authentication failed"));
-               g_free (folder_dir);
-               g_free (container_id);
-               return NULL;
-       }
-       g_free (folder_dir);
-
-       si = camel_store_summary_path ((CamelStoreSummary *)gw_store->summary, folder_name);
-       if (si) {
-               total = si->total;
-               camel_store_summary_info_free ((CamelStoreSummary *)(gw_store)->summary, si);
-       }
-
-       summary = (CamelGroupwiseSummary *) folder->summary;
-
-       summary_count = camel_folder_summary_count (folder->summary);
-       if (!summary_count || !summary->time_string) {
-               d(g_print ("\n\n** %s **: No summary as yet : using get cursor request\n\n", folder->name);)
-
-               status = e_gw_connection_create_cursor (priv->cnc, container_id,
-                               CREATE_CURSOR_VIEW,
-                               NULL,
-                               &cursor);
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       status = e_gw_connection_create_cursor (priv->cnc, container_id,
-                               CREATE_CURSOR_VIEW,
-                               NULL,
-                               &cursor);
-
-               if (status != E_GW_CONNECTION_STATUS_OK) {
-                       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-                       g_free (container_id);
-                       return NULL;
-               }
-
-               camel_operation_push_message (
-                       cancellable,
-                       _("Fetching summary information for new messages in %s"),
-                       camel_folder_get_name (folder));
-               camel_folder_summary_clear (folder->summary);
-
-               while (!done) {
-                               status = e_gw_connection_read_cursor (priv->cnc, container_id,
-                                                               cursor, FALSE,
-                                                               CURSOR_ITEM_LIMIT, position, &list);
-                               if (status != E_GW_CONNECTION_STATUS_OK) {
-                                               all_ok = FALSE;
-                                               break;
-                               }
-
-                               /* This full block is repeated in the reload_folder code as well. We need
-                               better modularity */
-                               count += CURSOR_ITEM_LIMIT;
-
-                               if (total > 0) {
-                                       d(printf ("Doing readcursor : [total: %d] [count: %d]\n", total, count));
-
-                                       if (count > total)
-                                               count = total;
-
-                                       camel_operation_progress (
-                                               cancellable, (100*count)/total);
-                               }
-
-                               gw_update_summary (folder, list, cancellable, error);
-
-                               /* For shared-folders created by the user, we don't get the total number of messages,
-                               in the getFolderList call. So, we need to wait until an empty list is returned in the
-                               read cursor call. Hence, we need the !list checking in the code below */
-                               if (count == total || !list)
-                                               done = TRUE;
-
-                               g_list_foreach (list, (GFunc)g_object_unref, NULL);
-                               g_list_free (list);
-                               list = NULL;
-                               position = E_GW_CURSOR_POSITION_CURRENT;
-               }
-
-               e_gw_connection_destroy_cursor (priv->cnc, container_id, cursor);
-
-               camel_operation_pop_message (cancellable);
-       }
-       if (done && all_ok) {
-               if (summary->time_string)
-                       g_free (summary->time_string);
-               summary->time_string = g_strdup (e_gw_connection_get_server_time (priv->cnc));
-       }
-
-       camel_folder_summary_save_to_db (folder->summary, NULL);
-
-       groupwise_store_set_current_folder (gw_store, folder);
-
-       g_free (container_id);
-       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       return folder;
-}
-
-gboolean
-gw_store_reload_folder (CamelGroupwiseStore *gw_store,
-                        CamelFolder *folder,
-                        guint32 flags,
-                        GCancellable *cancellable,
-                        GError **error)
-{
-       CamelGroupwiseStorePrivate *priv = gw_store->priv;
-       CamelGroupwiseSummary *summary;
-       gchar *container_id;
-       EGwConnectionStatus status;
-       GList *list = NULL;
-       gboolean done = FALSE;
-       const gchar *position = E_GW_CURSOR_POSITION_END;
-       gint count = 0, cursor, summary_count = 0;
-       CamelStoreInfo *si = NULL;
-       const gchar *full_name;
-       const gchar *name;
-       guint total = 0;
-
-       name = camel_folder_get_name (folder);
-       full_name = camel_folder_get_full_name (folder);
-
-       camel_service_lock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       if (!camel_groupwise_store_connected (gw_store, cancellable, error)) {
-               camel_service_unlock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-               return FALSE;
-       }
-
-       if (!E_IS_GW_CONNECTION ( priv->cnc)) {
-               if (!groupwise_connect_sync (CAMEL_SERVICE ((CamelStore*)gw_store), cancellable, error)) {
-                       camel_service_unlock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-                       return FALSE;
-               }
-       }
-
-       container_id =  g_strdup (g_hash_table_lookup (priv->name_hash, full_name));
-
-       si = camel_store_summary_path ((CamelStoreSummary *)gw_store->summary, name);
-       if (si) {
-               total = si->total;
-               camel_store_summary_info_free ((CamelStoreSummary *)(gw_store)->summary, si);
-       }
-
-       summary = (CamelGroupwiseSummary *) folder->summary;
-       camel_folder_summary_clear (folder->summary);
-       camel_folder_summary_save_to_db (folder->summary, NULL);
-
-       summary_count = camel_folder_summary_count (folder->summary);
-       if (!summary_count || !summary->time_string) {
-                       d(g_print ("\n\n** %s **: Summary missing???? Reloading summary....\n\n", name);)
-
-                                       status = e_gw_connection_create_cursor (priv->cnc, container_id,
-                                                                       CREATE_CURSOR_VIEW,
-                                                                       NULL,
-                                                                       &cursor);
-                       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                                       status = e_gw_connection_create_cursor (priv->cnc, container_id,
-                                                                       CREATE_CURSOR_VIEW,
-                                                                       NULL,
-                                                                       &cursor);
-                       if (status != E_GW_CONNECTION_STATUS_OK) {
-                                       camel_service_unlock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-                                       g_free (container_id);
-                                       return FALSE;
-                       }
-
-                       camel_operation_push_message (
-                               cancellable,
-                               _("Fetching summary information for new messages in %s"),
-                               camel_folder_get_name (folder));
-
-                       while (!done) {
-                                       status = e_gw_connection_read_cursor (priv->cnc, container_id,
-                                                                       cursor, FALSE,
-                                                                       CURSOR_ITEM_LIMIT, position, &list);
-                                       if (status != E_GW_CONNECTION_STATUS_OK) {
-                                                       camel_service_unlock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-                                                       e_gw_connection_destroy_cursor (priv->cnc, container_id, cursor);
-                                                       camel_folder_summary_save_to_db (folder->summary, NULL);
-                                                       g_set_error (
-                                                               error, CAMEL_SERVICE_ERROR,
-                                                               CAMEL_SERVICE_ERROR_INVALID,
-                                                               _("Authentication failed"));
-                                                       camel_operation_pop_message (cancellable);
-                                                       g_free (container_id);
-                                                       return FALSE;
-                                       }
-                                       /* This full block is repeated in the get_folder code as well. We need
-                                          better modularity */
-                                       count += CURSOR_ITEM_LIMIT;
-
-                                       if (total > 0) {
-                                                       d(printf ("Doing readcursor : [total: %d] [count: %d]\n", total, count));
-
-                                                       if (count > total)
-                                                                       count = total;
-
-                                                       camel_operation_progress (
-                                                               cancellable, (100 * count) / total);
-                                       }
-
-                                       gw_update_summary (folder, list, cancellable, error);
-
-                                       /* For shared-folders created by the user, we don't get the total number of messages,
-                                          in the getFolderList call. So, we need to wait until an empty list is returned in the
-                                          read cursor call. Hence, we need the !list checking in the code below */
-                                       if (count == total || !list)
-                                                       done = TRUE;
-
-                                       g_list_foreach (list, (GFunc)g_object_unref, NULL);
-                                       g_list_free (list);
-                                       list = NULL;
-                                       position = E_GW_CURSOR_POSITION_CURRENT;
-                       }
-
-                       e_gw_connection_destroy_cursor (priv->cnc, container_id, cursor);
-
-                       camel_operation_pop_message (cancellable);
-       }
-
-       if (done) {
-               if (summary->time_string)
-                       g_free (summary->time_string);
-               summary->time_string = g_strdup (e_gw_connection_get_server_time (priv->cnc));
-       }
-
-       camel_folder_summary_save_to_db (folder->summary, NULL);
-
-       groupwise_store_set_current_folder (gw_store, NULL);
-
-       g_free (container_id);
-       camel_service_unlock (CAMEL_SERVICE (gw_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-       return TRUE;
-}
-
-static CamelFolderInfo *
-convert_to_folder_info (CamelGroupwiseStore *store,
-                        EGwContainer *container,
-                        const gchar *url,
-                        GCancellable *cancellable,
-                        GError **error)
-{
-       const gchar *name = NULL, *id = NULL, *parent = NULL;
-       gchar *par_name = NULL;
-       CamelFolderInfo *fi;
-       CamelGroupwiseStoreInfo *si = NULL;
-       CamelGroupwiseStorePrivate *priv = store->priv;
-       EGwContainerType type;
-
-       name = e_gw_container_get_name (container);
-       id = e_gw_container_get_id (container);
-       type = e_gw_container_get_container_type (container);
-
-       fi = camel_folder_info_new ();
-
-       if (type == E_GW_CONTAINER_TYPE_INBOX)
-               fi->flags |= CAMEL_FOLDER_TYPE_INBOX;
-       if (type == E_GW_CONTAINER_TYPE_TRASH)
-               fi->flags |= CAMEL_FOLDER_TYPE_TRASH;
-       if (type == E_GW_CONTAINER_TYPE_SENT)
-               fi->flags |= CAMEL_FOLDER_TYPE_SENT;
-
-       if ( (type == E_GW_CONTAINER_TYPE_INBOX) ||
-               (type == E_GW_CONTAINER_TYPE_SENT) ||
-               (type == E_GW_CONTAINER_TYPE_DOCUMENTS) ||
-               (type == E_GW_CONTAINER_TYPE_QUERY) ||
-               (type == E_GW_CONTAINER_TYPE_CHECKLIST) ||
-               (type == E_GW_CONTAINER_TYPE_DRAFT) ||
-               (type == E_GW_CONTAINER_TYPE_CABINET) ||
-               (type == E_GW_CONTAINER_TYPE_JUNK) ||
-               (type == E_GW_CONTAINER_TYPE_TRASH) )
-               fi->flags |= CAMEL_FOLDER_SYSTEM;
-       /*
-          parent_hash contains the "parent id <-> container id" combination. So we form
-          the path for the full name in camelfolder info by looking up the hash table until
-          NULL is found
-        */
-
-       parent = e_gw_container_get_parent_id (container);
-       par_name = g_hash_table_lookup (priv->id_hash, parent);
-
-       if (par_name != NULL) {
-               gchar *temp_parent = NULL, *temp = NULL;
-               gchar *str = g_strconcat (par_name, "/", name, NULL);
-
-               fi->name = g_strdup (name);
-
-               temp_parent = g_hash_table_lookup (priv->parent_hash, parent);
-               while (temp_parent) {
-                       temp = g_hash_table_lookup (priv->id_hash, temp_parent );
-                       if (temp == NULL) {
-                               break;
-                       }
-                       str = g_strconcat ( temp, "/", str, NULL);
-
-                       temp_parent = g_hash_table_lookup (priv->parent_hash, temp_parent);
-
-               }
-               fi->full_name = g_strdup (str);
-               fi->uri = g_strconcat (url, str, NULL);
-               g_free (str);
-       }
-       else {
-               fi->name =  g_strdup (name);
-               fi->full_name = g_strdup (name);
-               fi->uri = g_strconcat (url, "", name, NULL);
-       }
-
-       si = camel_groupwise_store_summary_add_from_full (store->summary, fi->full_name, '/');
-       if (si == NULL) {
-               camel_folder_info_free (fi);
-               return NULL;
-       }
-
-       /*name_hash returns the container id given the name */
-       g_hash_table_insert (priv->name_hash, g_strdup (fi->full_name), g_strdup (id));
-
-       if (e_gw_container_get_is_shared_to_me (container))
-               fi->flags |= CAMEL_FOLDER_SHARED_TO_ME;
-
-       if (e_gw_container_get_is_shared_by_me (container))
-               fi->flags |= CAMEL_FOLDER_SHARED_BY_ME;
-
-       if (e_gw_container_get_is_system_folder (container))
-               fi->flags |= CAMEL_FOLDER_SYSTEM;
-
-       si->info.flags = fi->flags;
-       /*refresh info*/
-       if (store->current_folder
-           && !strcmp (camel_folder_get_full_name (store->current_folder), fi->full_name)
-           && type != E_GW_CONTAINER_TYPE_INBOX) {
-               CAMEL_FOLDER_GET_CLASS (store->current_folder)->
-                       refresh_info_sync (store->current_folder, cancellable, error);
-       }
-       return fi;
-}
-
-static void
-get_folders_free (gpointer k, gpointer v, gpointer d)
-{
-       CamelFolderInfo *fi = v;
-       camel_folder_info_free (fi);
-}
-
-static gboolean
-groupwise_folders_sync (CamelGroupwiseStore *store,
-                        GCancellable *cancellable,
-                        GError **error)
-{
-       CamelGroupwiseStorePrivate  *priv = store->priv;
-       gint status;
-       GList *folder_list = NULL, *temp_list = NULL, *list = NULL;
-       gchar *url, *temp_url;
-       CamelFolderInfo *info = NULL, *hfi = NULL;
-       GHashTable *present;
-       CamelStoreInfo *si = NULL;
-       CamelURL *service_url;
-       gint count, i;
-
-       status = e_gw_connection_get_container_list (priv->cnc, "folders", &folder_list);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               status = e_gw_connection_get_container_list (priv->cnc, "folders", &folder_list);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               g_warning ("Could not get folder list..\n");
-               return TRUE;
-       }
-
-       temp_list = folder_list;
-       list = folder_list;
-
-       service_url = camel_service_get_camel_url (CAMEL_SERVICE (store));
-
-       url = camel_url_to_string (
-               service_url, CAMEL_URL_HIDE_PASSWORD |
-               CAMEL_URL_HIDE_PARAMS | CAMEL_URL_HIDE_AUTH);
-
-       if (url[strlen (url) - 1] != '/') {
-               temp_url = g_strconcat (url, "/", NULL);
-               g_free ((gchar *)url);
-               url = temp_url;
-       }
-
-       /*populate the hash table for finding the mapping from container id <-> folder name*/
-       for (;temp_list != NULL; temp_list = g_list_next (temp_list) ) {
-               const gchar *name, *id, *parent;
-               name = e_gw_container_get_name (E_GW_CONTAINER (temp_list->data));
-               id = e_gw_container_get_id (E_GW_CONTAINER (temp_list->data));
-               parent = e_gw_container_get_parent_id (E_GW_CONTAINER (temp_list->data));
-
-               if (e_gw_container_is_root (E_GW_CONTAINER (temp_list->data))) {
-                       if (store->root_container)
-                               g_free (store->root_container);
-                       store->root_container = g_strdup (id);
-                       continue;
-               }
-
-               /*id_hash returns the name for a given container id*/
-               g_hash_table_insert (priv->id_hash, g_strdup (id), g_strdup (name));
-               /*parent_hash returns the parent container id, given an id*/
-               g_hash_table_insert (priv->parent_hash, g_strdup (id), g_strdup (parent));
-       }
-
-       present = g_hash_table_new (g_str_hash, g_str_equal);
-
-       for (;folder_list != NULL; folder_list = g_list_next (folder_list)) {
-               EGwContainerType type;
-               EGwContainer *container = E_GW_CONTAINER (folder_list->data);
-
-               type = e_gw_container_get_container_type (container);
-
-               if (e_gw_container_is_root (container))
-                       continue;
-               if ((type == E_GW_CONTAINER_TYPE_CALENDAR) || (type == E_GW_CONTAINER_TYPE_CONTACTS))
-                       continue;
-
-               info = convert_to_folder_info (store, E_GW_CONTAINER (folder_list->data), (const gchar *)url, cancellable, error);
-               if (info) {
-                       hfi = g_hash_table_lookup (present, info->full_name);
-                       if (hfi == NULL)
-                               g_hash_table_insert (present, info->full_name, info);
-                       else {
-                               camel_folder_info_free (info);
-                               info = NULL;
-                       }
-               }
-       }
-
-       g_free ((gchar *)url);
-       e_gw_connection_free_container_list (list);
-       count = camel_store_summary_count ((CamelStoreSummary *)store->summary);
-
-       count = camel_store_summary_count ((CamelStoreSummary *)store->summary);
-       for (i=0;i<count;i++) {
-               si = camel_store_summary_index ((CamelStoreSummary *)store->summary, i);
-               if (si == NULL)
-                       continue;
-
-               info = g_hash_table_lookup (present, camel_store_info_path (store->summary, si));
-               if (info != NULL) {
-                       camel_store_summary_touch ((CamelStoreSummary *)store->summary);
-               } else {
-                       camel_store_summary_remove ((CamelStoreSummary *)store->summary, si);
-                       count--;
-                       i--;
-               }
-               camel_store_summary_info_free ((CamelStoreSummary *)store->summary, si);
-       }
-
-       g_hash_table_foreach (present, get_folders_free, NULL);
-       g_hash_table_destroy (present);
-
-       return TRUE;
-}
-
-static CamelFolderInfo *
-groupwise_get_folder_info_offline (CamelStore *store, const gchar *top,
-                        guint32 flags, GError **error)
-{
-       CamelGroupwiseStore *groupwise_store = CAMEL_GROUPWISE_STORE (store);
-       CamelFolderInfo *fi;
-       GPtrArray *folders;
-       gchar *path, *name;
-       gint i;
-
-       folders = g_ptr_array_new ();
-
-       if (top == NULL)
-               top = "";
-
-       /* get starting point */
-       if (top[0] == 0) {
-                       name = g_strdup("");
-       } else {
-               name = camel_groupwise_store_summary_full_from_path (groupwise_store->summary, top);
-               if (name == NULL)
-                       name = camel_groupwise_store_summary_path_to_full (groupwise_store->summary, top, '/');
-       }
-
-       path = gw_concat (name, "*");
-
-       for (i=0;i<camel_store_summary_count ((CamelStoreSummary *)groupwise_store->summary);i++) {
-               CamelStoreInfo *si = camel_store_summary_index ((CamelStoreSummary *)groupwise_store->summary, i);
-
-               if (si == NULL)
-                       continue;
-
-               if ( !strcmp (name, camel_groupwise_store_info_full_name (groupwise_store->summary, si))
-                    || match_path (path, camel_groupwise_store_info_full_name (groupwise_store->summary, si))) {
-                       fi = groupwise_build_folder_info (groupwise_store, NULL, camel_store_info_path ((CamelStoreSummary *)groupwise_store->summary, si));
-                       fi->unread = si->unread;
-                       fi->total = si->total;
-                       fi->flags = si->flags;
-                       g_ptr_array_add (folders, fi);
-               }
-               camel_store_summary_info_free ((CamelStoreSummary *)groupwise_store->summary, si);
-       }
-
-       g_free (name);
-       g_free (path);
-       fi = camel_folder_info_build (folders, top, '/', TRUE);
-       g_ptr_array_free (folders, TRUE);
-       return fi;
-}
-
-static CamelFolderInfo *
-groupwise_store_get_folder_info_sync (CamelStore *store,
-                                      const gchar *top,
-                                      CamelStoreGetFolderInfoFlags flags,
-                                      GCancellable *cancellable,
-                                      GError **error)
-{
-       CamelGroupwiseStore *groupwise_store = CAMEL_GROUPWISE_STORE (store);
-       CamelFolderInfo *info = NULL;
-
-       /* Do not call groupwise_store_connected function as it would internall call folders_sync
-          to populate the hash table which is used for mapping container id */
-       if (!(camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store))
-           && camel_service_connect_sync ((CamelService *)store, error)))
-               goto offline;
-
-       camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       if (!groupwise_folders_sync (groupwise_store, cancellable, error)) {
-               camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-               return NULL;
-       }
-
-       camel_store_summary_touch ((CamelStoreSummary *)groupwise_store->summary);
-       camel_store_summary_save ((CamelStoreSummary *)groupwise_store->summary);
-
-       camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-offline:
-       info = groupwise_get_folder_info_offline (store, top, flags, error);
-       return info;
-}
-
-/* To create a junk mail folder in case  we want it and it isn't there*/
-CamelFolderInfo *
-create_junk_folder (CamelStore *store)
-{
-       CamelGroupwiseStore *groupwise_store = CAMEL_GROUPWISE_STORE (store);
-       CamelGroupwiseStorePrivate  *priv = groupwise_store->priv;
-       CamelFolderInfo *root = NULL;
-       const gchar *parent_name, *folder_name, *child_container_id, *parent_id;
-       gint status;
-
-       parent_name = "";
-       folder_name = "Junk Mail";
-       parent_id = "";
-       /* TODO: check for offlining*/
-
-       camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-       status = e_gw_connection_modify_junk_settings (priv->cnc, JUNK_ENABLE, 0, 0,  JUNK_PERSISTENCE);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               status = e_gw_connection_modify_junk_settings (priv->cnc, JUNK_ENABLE, 0, 0,  JUNK_PERSISTENCE);
-       if (status == E_GW_CONNECTION_STATUS_OK) {
-               root = groupwise_build_folder_info (groupwise_store, parent_name, folder_name);
-               camel_store_summary_save ((CamelStoreSummary *)groupwise_store->summary);
-
-               child_container_id = e_gw_connection_get_container_id (priv->cnc, "Junk Mail");
-               if (!child_container_id)
-                       g_warning("failed to retrieve id for junk folder");
-
-               g_hash_table_insert (priv->id_hash, g_strdup (child_container_id), g_strdup (folder_name));
-               g_hash_table_insert (priv->name_hash, g_strdup (folder_name), g_strdup (child_container_id));
-               g_hash_table_insert (priv->parent_hash, g_strdup (child_container_id), g_strdup (parent_id));
-               camel_store_folder_created (store, root);
-       }
-       camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       return root;
-}
-
-static CamelFolderInfo*
-groupwise_store_create_folder_sync (CamelStore *store,
-                                    const gchar *parent_name,
-                                    const gchar *folder_name,
-                                    GCancellable *cancellable,
-                                    GError **error)
-{
-       CamelGroupwiseStore *groupwise_store = CAMEL_GROUPWISE_STORE (store);
-       CamelGroupwiseStorePrivate  *priv = groupwise_store->priv;
-       CamelFolderInfo *root = NULL;
-       const gchar *parent_id;
-       gchar *child_container_id;
-       gint status;
-
-       if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store))) {
-               g_set_error (
-                       error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
-                       _("Cannot create GroupWise folders in offline mode."));
-               return NULL;
-       }
-
-       if (parent_name == NULL) {
-               parent_name = "";
-               if (groupwise_is_system_folder (folder_name)) {
-                       g_set_error (
-                               error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
-                               _("Cannot create a special system folder"));
-                       return NULL;
-               }
-       }
-
-       if (parent_name && (strlen (parent_name) > 0) ) {
-               if (strcmp (parent_name, "Cabinet") && groupwise_is_system_folder (parent_name)) {
-                       g_set_error (
-                               error, CAMEL_FOLDER_ERROR,
-                               CAMEL_FOLDER_ERROR_INVALID_STATE,
-                               _("The parent folder is not allowed to contain subfolders"));
-                       return NULL;
-               }
-               parent_id = g_hash_table_lookup (priv->name_hash, parent_name);
-       } else
-               parent_id = "";
-
-       if (!E_IS_GW_CONNECTION ( priv->cnc)) {
-               if (!groupwise_connect_sync (CAMEL_SERVICE (store), cancellable, error)) {
-                       return NULL;
-               }
-       }
-       camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-       status = e_gw_connection_create_folder (priv->cnc,parent_id,folder_name, &child_container_id);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               status = e_gw_connection_create_folder (priv->cnc,parent_id,folder_name, &child_container_id);
-       if (status == E_GW_CONNECTION_STATUS_OK) {
-               root = groupwise_build_folder_info (groupwise_store, parent_name,folder_name);
-               camel_store_summary_save ((CamelStoreSummary *)groupwise_store->summary);
-
-               g_hash_table_insert (priv->id_hash, g_strdup (child_container_id), g_strdup (folder_name));
-               g_hash_table_insert (priv->name_hash, g_strdup (root->full_name), g_strdup (child_container_id));
-               g_hash_table_insert (priv->parent_hash, g_strdup (child_container_id), g_strdup (parent_id));
-
-               camel_store_folder_created (store, root);
-       }
-       camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-       return root;
-}
-
-static gboolean
-groupwise_store_delete_folder_sync (CamelStore *store,
-                                    const gchar *folder_name,
-                                    GCancellable *cancellable,
-                                    GError **error)
-{
-       CamelGroupwiseStore *groupwise_store = CAMEL_GROUPWISE_STORE (store);
-       CamelGroupwiseStorePrivate  *priv = groupwise_store->priv;
-       EGwConnectionStatus status;
-       const gchar * container;
-
-       camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       if (!camel_groupwise_store_connected (groupwise_store, cancellable, error)) {
-               camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-               return FALSE;
-       }
-
-       container = g_hash_table_lookup (priv->name_hash, folder_name);
-
-       status = e_gw_connection_remove_item (priv->cnc, container, container);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               status = e_gw_connection_remove_item (priv->cnc, container, container);
-
-       if (status == E_GW_CONNECTION_STATUS_OK) {
-               groupwise_store_set_current_folder (groupwise_store, NULL);
-
-               groupwise_forget_folder (groupwise_store,folder_name,NULL);
-
-               g_hash_table_remove (priv->id_hash, container);
-               g_hash_table_remove (priv->name_hash, folder_name);
-
-               g_hash_table_remove (priv->parent_hash, container);
-       }
-       camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       return TRUE;
-}
-
-static gboolean
-groupwise_store_rename_folder_sync (CamelStore *store,
-                                    const gchar *old_name,
-                                    const gchar *new_name,
-                                    GCancellable *cancellable,
-                                    GError **error)
-{
-       CamelGroupwiseStore *groupwise_store = CAMEL_GROUPWISE_STORE (store);
-       CamelGroupwiseStorePrivate  *priv = groupwise_store->priv;
-       CamelService *service;
-       const gchar *user_data_dir;
-       gchar *oldpath, *newpath, *storepath;
-       const gchar *container_id;
-       gchar *temp_new = NULL;
-
-       service = CAMEL_SERVICE (store);
-       user_data_dir = camel_service_get_user_data_dir (service);
-
-       if (groupwise_is_system_folder (old_name)) {
-               g_set_error (
-                       error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
-                       _("Cannot rename GroupWise folder '%s' to '%s'"),
-                       old_name, new_name);
-               return FALSE;
-       }
-
-       camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       if (!camel_groupwise_store_connected (groupwise_store, cancellable, error)) {
-               camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-               return FALSE;
-       }
-
-       groupwise_store_set_current_folder (groupwise_store, NULL);
-
-       container_id = camel_groupwise_store_container_id_lookup (groupwise_store, old_name);
-       temp_new = strrchr (new_name, '/');
-       if (temp_new)
-               temp_new++;
-       else
-               temp_new = (gchar *)new_name;
-
-       if (!container_id || e_gw_connection_rename_folder (priv->cnc, container_id , temp_new) != E_GW_CONNECTION_STATUS_OK)
-       {
-               g_set_error (
-                       error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
-                       _("Cannot rename GroupWise folder '%s' to '%s'"),
-                       old_name, new_name);
-               camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-               return FALSE;
-       }
-
-       g_hash_table_replace (priv->id_hash, g_strdup (container_id), g_strdup (temp_new));
-
-       g_hash_table_insert (priv->name_hash, g_strdup (new_name), g_strdup (container_id));
-       g_hash_table_remove (priv->name_hash, old_name);
-       /*FIXME:Update all the id in the parent_hash*/
-
-       storepath = g_strdup_printf ("%s/folders", user_data_dir);
-       oldpath = e_path_to_physical (storepath, old_name);
-       newpath = e_path_to_physical (storepath, new_name);
-       g_free (storepath);
-
-       /*XXX: make sure the summary is also renamed*/
-       if (g_rename (oldpath, newpath) == -1) {
-               g_warning ("Could not rename message cache '%s' to '%s': %s: cache reset",
-                               oldpath, newpath, g_strerror (errno));
-       }
-
-       g_free (oldpath);
-       g_free (newpath);
-       camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-       return TRUE;
-}
-
-gchar *
-groupwise_get_name (CamelService *service, gboolean brief)
-{
-       CamelURL *url;
-
-       url = camel_service_get_camel_url (service);
-
-       if (brief)
-               return g_strdup_printf (
-                       _("GroupWise server %s"), url->host);
-       else
-               return g_strdup_printf (
-                       _("GroupWise service for %s on %s"),
-                       url->user, url->host);
-}
-
-const gchar *
-camel_groupwise_store_container_id_lookup (CamelGroupwiseStore *gw_store, const gchar *folder_name)
-{
-       CamelGroupwiseStorePrivate *priv = gw_store->priv;
-
-       return g_hash_table_lookup (priv->name_hash, folder_name);
-}
-
-const gchar *
-camel_groupwise_store_folder_lookup (CamelGroupwiseStore *gw_store, const gchar *container_id)
-{
-       CamelGroupwiseStorePrivate *priv = gw_store->priv;
-
-       return g_hash_table_lookup (priv->id_hash, container_id);
-}
-
-EGwConnection *
-cnc_lookup (CamelGroupwiseStorePrivate *priv)
-{
-       return priv->cnc;
-}
-
-const gchar *
-groupwise_base_url_lookup (CamelGroupwiseStorePrivate *priv)
-{
-       return priv->base_url;
-}
-
-static CamelFolder *
-groupwise_store_get_trash_folder_sync (CamelStore *store,
-                                       GCancellable *cancellable,
-                                       GError **error)
-{
-       CamelFolder *folder;
-
-       folder = camel_store_get_folder_sync (
-               store, "Trash", 0, cancellable, error);
-       if (folder) {
-               CamelObject *object = CAMEL_OBJECT (folder);
-               CamelService *service;
-               const gchar *user_data_dir;
-               gchar *state;
-
-               service = CAMEL_SERVICE (store);
-               user_data_dir = camel_service_get_user_data_dir (service);
-
-               state = g_build_filename (
-                       user_data_dir, "folders", "Trash", "cmeta", NULL);
-
-               camel_object_set_state_filename (object, state);
-               g_free (state);
-               camel_object_state_read (object);
-
-               return folder;
-       } else
-               return NULL;
-}
-
-static gboolean
-groupwise_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, GError **error)
-{
-       CamelURL *url;
-       gboolean res;
-
-       url = camel_service_get_camel_url (CAMEL_SERVICE (store));
-
-       res = CAMEL_STORE_CLASS (camel_groupwise_store_parent_class)->
-               can_refresh_folder (store, info, error) ||
-               (camel_url_get_param (url, "check_all") != NULL);
-
-       return res;
-}
-
-/*
- * Function to check if we are both connected and are _actually_
- * online. Based on an equivalient function in IMAP
- */
-gboolean
-camel_groupwise_store_connected (CamelGroupwiseStore *store,
-                                 GCancellable *cancellable,
-                                 GError **error)
-{
-       if (camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store))
-           && camel_service_connect_sync ((CamelService *)store, error)) {
-               CamelGroupwiseStore *gw_store = (CamelGroupwiseStore *) store;
-               CamelGroupwiseStorePrivate *priv = gw_store->priv;
-
-               if (g_hash_table_size (priv->name_hash) == 0)
-                       return groupwise_folders_sync ((CamelGroupwiseStore *) gw_store, cancellable, error);
-
-               return TRUE;
-       }
-       /*Not online, so return FALSE*/
-       return FALSE;
-}
-
-static gint
-match_path (const gchar *path, const gchar *name)
-{
-       gchar p, n;
-
-       p = *path++;
-       n = *name++;
-       while (n && p) {
-               if (n == p) {
-                       p = *path++;
-                       n = *name++;
-               } else if (p == '%') {
-                       if (n != '/') {
-                               n = *name++;
-                       } else {
-                               p = *path++;
-                       }
-               } else if (p == '*') {
-                       return TRUE;
-               } else
-                       return FALSE;
-       }
-
-       return n == 0 && (p == '%' || p == 0);
-}
-
-static void
-groupwise_store_dispose (GObject *object)
-{
-       CamelGroupwiseStore *groupwise_store;
-
-       groupwise_store = CAMEL_GROUPWISE_STORE (object);
-
-       if (groupwise_store->summary != NULL) {
-               camel_store_summary_save (
-                       CAMEL_STORE_SUMMARY (groupwise_store->summary));
-               g_object_unref (groupwise_store->summary);
-               groupwise_store->summary = NULL;
-       }
-
-       if (groupwise_store->priv->cnc != NULL) {
-               g_object_unref (groupwise_store->priv->cnc);
-               groupwise_store->priv->cnc = NULL;
-       }
-
-       /* Chain up to parent's dispose() method. */
-       G_OBJECT_CLASS (camel_groupwise_store_parent_class)->dispose (object);
-}
-
-static void
-groupwise_store_finalize (GObject *object)
-{
-       CamelGroupwiseStore *groupwise_store;
-
-       groupwise_store = CAMEL_GROUPWISE_STORE (object);
-
-       g_free (groupwise_store->priv->user);
-       g_free (groupwise_store->priv->server_name);
-       g_free (groupwise_store->priv->port);
-       g_free (groupwise_store->priv->use_ssl);
-       g_free (groupwise_store->priv->base_url);
-       g_free (groupwise_store->root_container);
-
-       if (groupwise_store->priv->id_hash != NULL)
-               g_hash_table_destroy (groupwise_store->priv->id_hash);
-
-       if (groupwise_store->priv->name_hash != NULL)
-               g_hash_table_destroy (groupwise_store->priv->name_hash);
-
-       if (groupwise_store->priv->parent_hash != NULL)
-               g_hash_table_destroy (groupwise_store->priv->parent_hash);
-
-       /* Chain up to parent's finalize() method. */
-       G_OBJECT_CLASS (camel_groupwise_store_parent_class)->finalize (object);
-}
-
-static gboolean
-groupwise_store_initable_init (GInitable *initable,
-                               GCancellable *cancellable,
-                               GError **error)
-{
-       CamelGroupwiseStore *groupwise_store;
-       CamelService *transport;
-       CamelService *service;
-       CamelSession *session;
-       CamelURL *url;
-       const gchar *property_value;
-       const gchar *user_data_dir;
-       const gchar *store_uid;
-       gchar *transport_uid;
-       gchar *uri_string;
-       gchar *path = NULL;
-
-       groupwise_store = CAMEL_GROUPWISE_STORE (initable);
-
-       /* Chain up to parent interface's init() method. */
-       if (!parent_initable_interface->init (initable, cancellable, error))
-               return FALSE;
-
-       service = CAMEL_SERVICE (initable);
-       url = camel_service_get_camel_url (service);
-       session = camel_service_get_session (service);
-       user_data_dir = camel_service_get_user_data_dir (service);
-
-       if (!(url->host || url->user)) {
-               g_set_error (
-                       error, CAMEL_SERVICE_ERROR,
-                       CAMEL_SERVICE_ERROR_INVALID,
-                       _("Host or user not available in url"));
-       }
-
-       /*store summary*/
-       path = g_alloca (strlen (user_data_dir) + 32);
-       sprintf (path, "%s/.summary", user_data_dir);
-       groupwise_store->summary = camel_groupwise_store_summary_new ();
-       camel_store_summary_set_filename ((CamelStoreSummary *)groupwise_store->summary, path);
-       camel_store_summary_touch ((CamelStoreSummary *)groupwise_store->summary);
-       camel_store_summary_load ((CamelStoreSummary *) groupwise_store->summary);
-
-       /*host and user*/
-       groupwise_store->priv->server_name = g_strdup (url->host);
-       groupwise_store->priv->user = g_strdup (url->user);
-
-       /*base url*/
-       groupwise_store->priv->base_url = camel_url_to_string (
-               url, CAMEL_URL_HIDE_PASSWORD |
-               CAMEL_URL_HIDE_PARAMS | CAMEL_URL_HIDE_AUTH);
-
-       /*soap port*/
-       property_value =  camel_url_get_param (url, "soap_port");
-       if (property_value == NULL)
-               groupwise_store->priv->port = g_strdup ("7191");
-       else if (strlen (property_value) == 0)
-               groupwise_store->priv->port = g_strdup ("7191");
-       else
-               groupwise_store->priv->port = g_strdup (property_value);
-
-       /*filter*/
-       if (camel_url_get_param (url, "filter"))
-               CAMEL_STORE (groupwise_store)->flags |= CAMEL_STORE_FILTER_INBOX;
-
-       /*Hash Table*/
-       groupwise_store->priv->id_hash =
-               g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
-       groupwise_store->priv->name_hash =
-               g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
-       groupwise_store->priv->parent_hash =
-               g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
-
-       /*ssl*/
-       groupwise_store->priv->use_ssl =
-               g_strdup (camel_url_get_param (url, "use_ssl"));
-
-       CAMEL_STORE (groupwise_store)->flags &= ~CAMEL_STORE_VJUNK;
-       CAMEL_STORE (groupwise_store)->flags &= ~CAMEL_STORE_VTRASH;
-
-       /* Add a corresponding CamelGroupwiseTransport. */
-
-       store_uid = camel_service_get_uid (service);
-       transport_uid = g_strconcat (store_uid, "-transport", NULL);
-       uri_string = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
-
-       transport = camel_session_add_service (
-               session, transport_uid, uri_string,
-               CAMEL_PROVIDER_TRANSPORT, error);
-
-       g_free (transport_uid);
-       g_free (uri_string);
-
-       if (transport != NULL)
-               camel_groupwise_transport_set_store (
-                       CAMEL_GROUPWISE_TRANSPORT (transport),
-                       groupwise_store);
-
-       return (transport != NULL);
-}
-
-static void
-camel_groupwise_store_class_init (CamelGroupwiseStoreClass *class)
-{
-       GObjectClass *object_class;
-       CamelServiceClass *service_class;
-       CamelStoreClass *store_class;
-
-       g_type_class_add_private (class, sizeof (CamelGroupwiseStorePrivate));
-
-       object_class = G_OBJECT_CLASS (class);
-       object_class->dispose = groupwise_store_dispose;
-       object_class->finalize = groupwise_store_finalize;
-
-       service_class = CAMEL_SERVICE_CLASS (class);
-       service_class->get_name = groupwise_get_name;
-       service_class->connect_sync = groupwise_connect_sync;
-       service_class->disconnect_sync = groupwise_disconnect_sync;
-       service_class->query_auth_types_sync = groupwise_store_query_auth_types_sync;
-
-       store_class = CAMEL_STORE_CLASS (class);
-       store_class->hash_folder_name = groupwise_hash_folder_name;
-       store_class->compare_folder_name = groupwise_compare_folder_name;
-       store_class->can_refresh_folder = groupwise_can_refresh_folder;
-       store_class->free_folder_info = camel_store_free_folder_info_full;
-       store_class->get_folder_sync = groupwise_store_get_folder_sync;
-       store_class->get_folder_info_sync = groupwise_store_get_folder_info_sync;
-       store_class->get_trash_folder_sync = groupwise_store_get_trash_folder_sync;
-       store_class->create_folder_sync = groupwise_store_create_folder_sync;
-       store_class->delete_folder_sync = groupwise_store_delete_folder_sync;
-       store_class->rename_folder_sync = groupwise_store_rename_folder_sync;
-}
-
-static void
-camel_groupwise_store_initable_init (GInitableIface *interface)
-{
-       parent_initable_interface = g_type_interface_peek_parent (interface);
-
-       interface->init = groupwise_store_initable_init;
-}
-
-static void
-camel_groupwise_store_init (CamelGroupwiseStore *groupwise_store)
-{
-       groupwise_store->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               groupwise_store, CAMEL_TYPE_GROUPWISE_STORE,
-               CamelGroupwiseStorePrivate);
-
-       d("in groupwise store init\n");
-       groupwise_store->priv->server_name = NULL;
-       groupwise_store->priv->port = NULL;
-       groupwise_store->priv->use_ssl = NULL;
-       groupwise_store->priv->user = NULL;
-       groupwise_store->priv->cnc = NULL;
-       groupwise_store->current_folder = NULL;
-}
diff --git a/camel/providers/groupwise/camel-groupwise-store.h b/camel/providers/groupwise/camel-groupwise-store.h
deleted file mode 100644 (file)
index 6a72357..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-groupwise-store.h : class for an groupwise store */
-
-/*
- * Authors: Sivaiah Nallagatla <snallagatla@novell.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- */
-
-#ifndef CAMEL_GROUPWISE_STORE_H
-#define CAMEL_GROUPWISE_STORE_H
-
-#include <camel/camel.h>
-
-#include "camel-groupwise-store-summary.h"
-
-#include <e-gw-connection.h>
-#include <e-gw-container.h>
-
-/* Standard GObject macros */
-#define CAMEL_TYPE_GROUPWISE_STORE \
-       (camel_groupwise_store_get_type ())
-#define CAMEL_GROUPWISE_STORE(obj) \
-       (G_TYPE_CHECK_INSTANCE_CAST \
-       ((obj), CAMEL_TYPE_GROUPWISE_STORE, CamelGroupwiseStore))
-#define CAMEL_GROUPWISE_STORE_CLASS(cls) \
-       (G_TYPE_CHECK_CLASS_CAST \
-       ((cls), CAMEL_TYPE_GROUPWISE_STORE, CamelGroupwiseStoreClass))
-#define CAMEL_IS_GROUPWISE_STORE(obj) \
-       (G_TYPE_CHECK_INSTANCE_TYPE \
-       ((obj), CAMEL_TYPE_GROUPWISE_STORE))
-#define CAMEL_IS_GROUPWISE_STORE_CLASS(cls) \
-       (G_TYPE_CHECK_CLASS_TYPE \
-       ((cls), CAMEL_TYPE_GROUPWISE_STORE))
-#define CAMEL_GROUPWISE_STORE_GET_CLASS(obj) \
-       (G_TYPE_INSTANCE_GET_CLASS \
-       ((obj), CAMEL_TYPE_GROUPWISE_STORE, CamelGroupwiseStoreClass))
-
-#define GW_PARAM_FILTER_INBOX          (1 << 0)
-
-G_BEGIN_DECLS
-
-typedef struct _CamelGroupwiseStore CamelGroupwiseStore;
-typedef struct _CamelGroupwiseStoreClass CamelGroupwiseStoreClass;
-typedef struct _CamelGroupwiseStorePrivate CamelGroupwiseStorePrivate;
-
-struct _CamelGroupwiseStore {
-       CamelOfflineStore parent;
-
-       struct _CamelGroupwiseStoreSummary *summary;
-
-       gchar *root_container;
-       CamelGroupwiseStorePrivate *priv;
-       CamelFolder *current_folder;
-
-       /* the parameters field is not to be included not. probably for 2.6*/
-       /*guint32 parameters;*/
-       time_t refresh_stamp;
-};
-
-struct _CamelGroupwiseStoreClass {
-       CamelOfflineStoreClass parent_class;
-};
-
-GType          camel_groupwise_store_get_type  (void);
-gchar *                groupwise_get_name              (CamelService *service,
-                                                gboolean brief);
-const gchar *  camel_groupwise_store_container_id_lookup
-                                               (CamelGroupwiseStore *store,
-                                                const gchar *folder_name);
-const gchar *  camel_groupwise_store_folder_lookup
-                                               (CamelGroupwiseStore *store,
-                                                const gchar *container_id);
-EGwConnection *        cnc_lookup                      (CamelGroupwiseStorePrivate *priv);
-const gchar *  groupwise_base_url_lookup       (CamelGroupwiseStorePrivate *priv);
-CamelFolderInfo *
-               create_junk_folder              (CamelStore *store);
-gboolean       camel_groupwise_store_connected (CamelGroupwiseStore *store,
-                                                GCancellable *cancellable,
-                                                GError **error);
-gboolean       gw_store_reload_folder          (CamelGroupwiseStore *store,
-                                                CamelFolder *folder,
-                                                guint32 flags,
-                                                GCancellable *cancellable,
-                                                GError **error);
-void           groupwise_store_set_current_folder
-                                               (CamelGroupwiseStore *store,
-                                                CamelFolder *folder);
-
-G_END_DECLS
-
-#endif /* CAMEL_GROUPWISE_STORE_H */
diff --git a/camel/providers/groupwise/camel-groupwise-summary.c b/camel/providers/groupwise/camel-groupwise-summary.c
deleted file mode 100644 (file)
index ccedf9e..0000000
+++ /dev/null
@@ -1,428 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- *  Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- *  Authors:
- *     parthasrathi susarla <sparthasrathi@novell.com>
- * Based on the IMAP summary class implementation by:
- *    Michael Zucchi <notzed@ximian.com>
- *    Dan Winship <danw@ximian.com>
- *
- * This program 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 program; 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 <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/stat.h>
-
-#include "camel-groupwise-folder.h"
-#include "camel-groupwise-summary.h"
-
-#define CAMEL_GW_SUMMARY_VERSION (1)
-
-#define d(x)
-
-/*Prototypes*/
-static gint gw_summary_header_load (CamelFolderSummary *, FILE *);
-static gint gw_summary_header_save (CamelFolderSummary *, FILE *);
-
-static CamelMessageInfo *gw_message_info_migrate (CamelFolderSummary *s, FILE *in);
-
-static CamelMessageContentInfo * gw_content_info_migrate (CamelFolderSummary *s, FILE *in);
-static gboolean gw_info_set_flags (CamelMessageInfo *info, guint32 flags, guint32 set);
-
-static gint summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *mir);
-static CamelFIRecord * summary_header_to_db (CamelFolderSummary *s, GError **error);
-static CamelMIRecord * message_info_to_db (CamelFolderSummary *s, CamelMessageInfo *info);
-static CamelMessageInfo * message_info_from_db (CamelFolderSummary *s, CamelMIRecord *mir);
-static gint content_info_to_db (CamelFolderSummary *s, CamelMessageContentInfo *info, CamelMIRecord *mir);
-static CamelMessageContentInfo * content_info_from_db (CamelFolderSummary *s, CamelMIRecord *mir);
-
-/*End of Prototypes*/
-
-G_DEFINE_TYPE (CamelGroupwiseSummary, camel_groupwise_summary, CAMEL_TYPE_FOLDER_SUMMARY)
-
-static CamelMessageInfo *
-gw_message_info_clone (CamelFolderSummary *s, const CamelMessageInfo *mi)
-{
-       CamelGroupwiseMessageInfo *to;
-       const CamelGroupwiseMessageInfo *from = (const CamelGroupwiseMessageInfo *)mi;
-
-       to = (CamelGroupwiseMessageInfo *)CAMEL_FOLDER_SUMMARY_CLASS (camel_groupwise_summary_parent_class)->message_info_clone (s, mi);
-       to->server_flags = from->server_flags;
-
-       /* FIXME: parent clone should do this */
-       to->info.content = camel_folder_summary_content_info_new (s);
-
-       return (CamelMessageInfo *)to;
-}
-
-static void
-camel_groupwise_summary_class_init (CamelGroupwiseSummaryClass *class)
-{
-       CamelFolderSummaryClass *folder_summary_class;
-
-       folder_summary_class = CAMEL_FOLDER_SUMMARY_CLASS (class);
-       folder_summary_class->message_info_size = sizeof (CamelGroupwiseMessageInfo);
-       folder_summary_class->content_info_size = sizeof (CamelGroupwiseMessageContentInfo);
-       folder_summary_class->message_info_clone = gw_message_info_clone;
-       folder_summary_class->summary_header_load = gw_summary_header_load;
-       folder_summary_class->summary_header_save = gw_summary_header_save;
-       folder_summary_class->message_info_migrate = gw_message_info_migrate;
-       folder_summary_class->content_info_migrate = gw_content_info_migrate;
-       folder_summary_class->info_set_flags = gw_info_set_flags;
-       folder_summary_class->summary_header_to_db = summary_header_to_db;
-       folder_summary_class->summary_header_from_db = summary_header_from_db;
-       folder_summary_class->message_info_to_db = message_info_to_db;
-       folder_summary_class->message_info_from_db = message_info_from_db;
-       folder_summary_class->content_info_to_db = content_info_to_db;
-       folder_summary_class->content_info_from_db = content_info_from_db;
-}
-
-static void
-camel_groupwise_summary_init (CamelGroupwiseSummary *gw_summary)
-{
-       CamelFolderSummary *summary = CAMEL_FOLDER_SUMMARY (gw_summary);
-
-       /* Meta-summary - Overriding UID len */
-       summary->meta_summary->uid_len = 2048;
-}
-
-/**
- * camel_groupwise_summary_new:
- * @filename: the file to store the summary in.
- *
- * This will create a new CamelGroupwiseSummary object and read in the
- * summary data from disk, if it exists.
- *
- * Returns: A new CamelGroupwiseSummary object.
- **/
-CamelFolderSummary *
-camel_groupwise_summary_new (struct _CamelFolder *folder, const gchar *filename)
-{
-       CamelFolderSummary *summary;
-
-       summary = g_object_new (CAMEL_TYPE_GROUPWISE_SUMMARY, NULL);
-       summary->folder = folder;
-       camel_folder_summary_set_build_content (summary, TRUE);
-       camel_folder_summary_set_filename (summary, filename);
-
-       camel_folder_summary_load_from_db (summary, NULL);
-
-       return summary;
-}
-
-static gint
-summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *mir)
-{
-       CamelGroupwiseSummary *gms = CAMEL_GROUPWISE_SUMMARY (s);
-       gchar *part;
-
-       if (CAMEL_FOLDER_SUMMARY_CLASS (camel_groupwise_summary_parent_class)->summary_header_from_db (s, mir) == -1)
-               return -1;
-
-       part = mir->bdata;
-
-       gms->version = bdata_extract_digit (&part);
-       gms->validity = bdata_extract_digit (&part);
-
-       if (part && *part && part++) {
-               gms->time_string = g_strdup (part);
-       }
-
-       return 0;
-}
-
-static gint
-gw_summary_header_load (CamelFolderSummary *s, FILE *in)
-{
-       CamelGroupwiseSummary *gms = CAMEL_GROUPWISE_SUMMARY (s);
-
-       if (CAMEL_FOLDER_SUMMARY_CLASS (camel_groupwise_summary_parent_class)->summary_header_load (s, in) == -1)
-               return -1;
-
-       if (camel_file_util_decode_fixed_int32 (in, &gms->version) == -1
-                       || camel_file_util_decode_fixed_int32 (in, &gms->validity) == -1)
-               return -1;
-
-       if (camel_file_util_decode_string (in, &gms->time_string) == -1)
-               return -1;
-       return 0;
-}
-
-static CamelFIRecord *
-summary_header_to_db (CamelFolderSummary *s, GError **error)
-{
-       CamelGroupwiseSummary *ims = CAMEL_GROUPWISE_SUMMARY (s);
-       struct _CamelFIRecord *fir;
-
-       fir = CAMEL_FOLDER_SUMMARY_CLASS (camel_groupwise_summary_parent_class)->summary_header_to_db (s, error);
-       if (!fir)
-               return NULL;
-
-       fir->bdata = g_strdup_printf ("%d %d %s", CAMEL_GW_SUMMARY_VERSION, ims->validity, ims->time_string);
-
-       return fir;
-
-}
-
-static gint
-gw_summary_header_save (CamelFolderSummary *s, FILE *out)
-{
-       CamelGroupwiseSummary *gms = CAMEL_GROUPWISE_SUMMARY (s);
-
-       if (CAMEL_FOLDER_SUMMARY_CLASS (camel_groupwise_summary_parent_class)->summary_header_save (s, out) == -1)
-               return -1;
-
-       camel_file_util_encode_fixed_int32 (out, CAMEL_GW_SUMMARY_VERSION);
-       camel_file_util_encode_fixed_int32 (out, gms->validity);
-       return camel_file_util_encode_string (out, gms->time_string);
-}
-
-static CamelMessageInfo *
-message_info_from_db (CamelFolderSummary *s, CamelMIRecord *mir)
-{
-       CamelMessageInfo *info;
-       CamelGroupwiseMessageInfo *iinfo;
-
-       info = CAMEL_FOLDER_SUMMARY_CLASS (camel_groupwise_summary_parent_class)->message_info_from_db (s, mir);
-       if (info) {
-               gchar *part = mir->bdata;
-               iinfo = (CamelGroupwiseMessageInfo *)info;
-               iinfo->server_flags = bdata_extract_digit (&part);
-       }
-
-       return info;}
-
-static CamelMessageInfo *
-gw_message_info_migrate (CamelFolderSummary *s, FILE *in)
-{
-       CamelMessageInfo *info;
-       CamelGroupwiseMessageInfo *gw_info;
-
-       info = CAMEL_FOLDER_SUMMARY_CLASS (camel_groupwise_summary_parent_class)->message_info_migrate (s,in);
-       if (info) {
-               gw_info = (CamelGroupwiseMessageInfo*) info;
-               if (camel_file_util_decode_uint32 (in, &gw_info->server_flags) == -1)
-                       goto error;
-       }
-
-       return info;
-error:
-       camel_message_info_free (info);
-       return NULL;
-}
-
-static CamelMIRecord *
-message_info_to_db (CamelFolderSummary *s, CamelMessageInfo *info)
-{
-       CamelGroupwiseMessageInfo *iinfo = (CamelGroupwiseMessageInfo *)info;
-       struct _CamelMIRecord *mir;
-
-       mir = CAMEL_FOLDER_SUMMARY_CLASS (camel_groupwise_summary_parent_class)->message_info_to_db (s, info);
-       if (mir)
-               mir->bdata = g_strdup_printf ("%u", iinfo->server_flags);
-
-       return mir;
-}
-
-static CamelMessageContentInfo *
-content_info_from_db (CamelFolderSummary *s, CamelMIRecord *mir)
-{
-       gchar *part = mir->cinfo;
-       guint32 type=0;
-
-       if (part) {
-               if (*part == ' ')
-                       part++;
-               if (part) {
-                       type = bdata_extract_digit (&part);
-               }
-       }
-       mir->cinfo = part;
-       if (type)
-               return CAMEL_FOLDER_SUMMARY_CLASS (camel_groupwise_summary_parent_class)->content_info_from_db (s, mir);
-       else
-               return camel_folder_summary_content_info_new (s);
-}
-
-static CamelMessageContentInfo *
-gw_content_info_migrate (CamelFolderSummary *s, FILE *in)
-{
-       if (fgetc (in))
-               return CAMEL_FOLDER_SUMMARY_CLASS (camel_groupwise_summary_parent_class)->content_info_migrate (s, in);
-       else
-               return camel_folder_summary_content_info_new (s);
-}
-
-static gint
-content_info_to_db (CamelFolderSummary *s, CamelMessageContentInfo *info, CamelMIRecord *mir)
-{
-
-       if (info->type) {
-               mir->cinfo = g_strdup ("1");
-               return CAMEL_FOLDER_SUMMARY_CLASS (camel_groupwise_summary_parent_class)->content_info_to_db (s, info, mir);
-       } else {
-               mir->cinfo = g_strdup ("0");
-               return 0;
-       }
-}
-
-static gboolean
-gw_info_set_flags (CamelMessageInfo *info,
-                   guint32 flags,
-                   guint32 set)
-{
-               guint32 old;
-               CamelMessageInfoBase *mi = (CamelMessageInfoBase *)info;
-               gint read = 0 , deleted = 0;
-
-               gint junk_flag = 0, junk_learn_flag = 0;
-
-               /* TODO: locking? */
-
-               if (flags & CAMEL_MESSAGE_SEEN && ((set & CAMEL_MESSAGE_SEEN) != (mi->flags & CAMEL_MESSAGE_SEEN)))
-               { read = set & CAMEL_MESSAGE_SEEN ? 1 : -1; d(printf("Setting read as %d\n", set & CAMEL_MESSAGE_SEEN ? 1 : 0));}
-
-               if (flags & CAMEL_MESSAGE_DELETED && ((set & CAMEL_MESSAGE_DELETED) != (mi->flags & CAMEL_MESSAGE_DELETED)))
-               { deleted = set & CAMEL_MESSAGE_DELETED ? 1 : -1; d(printf("Setting deleted as %d\n", set & CAMEL_MESSAGE_DELETED ? 1 : 0));}
-
-               old = mi->flags;
-               mi->flags = (old & ~flags) | (set & flags);
-
-               if (old != mi->flags) {
-                               mi->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED;
-                               mi->dirty = TRUE;
-
-                               if (((old & ~CAMEL_MESSAGE_SYSTEM_MASK) == (mi->flags & ~CAMEL_MESSAGE_SYSTEM_MASK)) )
-                                               return FALSE;
-
-                               if (mi->summary) {
-                                               mi->summary->deleted_count += deleted;
-                                               mi->summary->unread_count -= read;
-                                               camel_folder_summary_touch (mi->summary);
-                               }
-               }
-
-               junk_flag = ((flags & CAMEL_MESSAGE_JUNK) && (set & CAMEL_MESSAGE_JUNK));
-               junk_learn_flag = ((flags & CAMEL_MESSAGE_JUNK_LEARN) && (set & CAMEL_MESSAGE_JUNK_LEARN));
-
-               /* This is a hack, we are using CAMEL_MESSAGE_JUNK justo to hide the item
-                * we make sure this doesn't have any side effects*/
-
-               if (junk_learn_flag && !junk_flag  && (old & CAMEL_GW_MESSAGE_JUNK)) {
-                               /*
-                                  This has ugly side-effects. Evo will never learn unjunk.
-                                  We need to create one CAMEL_MESSAGE_HIDDEN flag which must be
-                                  used for all hiding operations. We must also get rid of the seperate file
-                                  that is maintained somewhere in evolution/mail/em-folder-browser.c for hidden messages
-                                */
-                               mi->flags |= CAMEL_GW_MESSAGE_NOJUNK | CAMEL_MESSAGE_JUNK | CAMEL_MESSAGE_JUNK_LEARN;
-               } else if (junk_learn_flag && junk_flag && !(old & CAMEL_GW_MESSAGE_JUNK)) {
-                               mi->flags |= CAMEL_GW_MESSAGE_JUNK | CAMEL_MESSAGE_JUNK | CAMEL_MESSAGE_JUNK_LEARN;
-               }
-
-               if (mi->summary && mi->summary->folder && mi->uid) {
-                               CamelFolderChangeInfo *changes = camel_folder_change_info_new ();
-
-                               camel_folder_change_info_change_uid (changes, camel_message_info_uid (info));
-                               camel_folder_changed (mi->summary->folder, changes);
-                               camel_folder_change_info_free (changes);
-                               camel_folder_summary_touch (mi->summary);
-               }
-
-               return TRUE;
-}
-
-void
-camel_gw_summary_add_offline (CamelFolderSummary *summary,
-                              const gchar *uid,
-                              CamelMimeMessage *message,
-                              const CamelMessageInfo *info)
-{
-       CamelGroupwiseMessageInfo *mi;
-       const CamelFlag *flag;
-       const CamelTag *tag;
-
-       /* Create summary entry */
-       mi = (CamelGroupwiseMessageInfo *)camel_folder_summary_info_new_from_message (summary, message, NULL);
-
-       /* Copy flags 'n' tags */
-       mi->info.flags = camel_message_info_flags (info);
-
-       flag = camel_message_info_user_flags (info);
-       while (flag) {
-               camel_message_info_set_user_flag ((CamelMessageInfo *)mi, flag->name, TRUE);
-               flag = flag->next;
-       }
-       tag = camel_message_info_user_tags (info);
-       while (tag) {
-               camel_message_info_set_user_tag ((CamelMessageInfo *)mi, tag->name, tag->value);
-               tag = tag->next;
-       }
-
-       mi->info.size = camel_message_info_size (info);
-       mi->info.uid = camel_pstring_strdup (uid);
-
-       camel_folder_summary_add (summary, (CamelMessageInfo *)mi);
-
-}
-
-void
-camel_gw_summary_add_offline_uncached (CamelFolderSummary *summary,
-                                       const gchar *uid,
-                                       const CamelMessageInfo *info)
-{
-       CamelGroupwiseMessageInfo *mi;
-
-       mi = camel_message_info_clone (info);
-       mi->info.uid = camel_pstring_strdup (uid);
-       camel_folder_summary_add (summary, (CamelMessageInfo *)mi);
-}
-
-void
-groupwise_summary_clear (CamelFolderSummary *summary, gboolean uncache)
-{
-       CamelFolderChangeInfo *changes;
-       CamelMessageInfo *info;
-       gint i, count;
-       const gchar *uid;
-
-       changes = camel_folder_change_info_new ();
-       count = camel_folder_summary_count (summary);
-       for (i = 0; i < count; i++) {
-               if (!(info = camel_folder_summary_index (summary, i)))
-                       continue;
-
-               uid = camel_message_info_uid (info);
-               camel_folder_change_info_remove_uid (changes, uid);
-               camel_folder_summary_remove_uid (summary, uid);
-               camel_message_info_free (info);
-       }
-
-       camel_folder_summary_clear_db (summary);
-       /*camel_folder_summary_save (summary);*/
-
-       if (camel_folder_change_info_changed (changes))
-               camel_folder_changed (summary->folder, changes);
-       camel_folder_change_info_free (changes);
-}
-
diff --git a/camel/providers/groupwise/camel-groupwise-summary.h b/camel/providers/groupwise/camel-groupwise-summary.h
deleted file mode 100644 (file)
index 4ea56b7..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- *  Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- *  Authors:
- *     parthasarathi susarla <sparthasarathi@novell.com>
- *
- * This program 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 program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef CAMEL_GW_SUMMARY_H
-#define CAMEL_GW_SUMMARY_H
-
-#include <camel/camel.h>
-
-/* Standard GObject macros */
-#define CAMEL_TYPE_GROUPWISE_SUMMARY \
-       (camel_groupwise_summary_get_type ())
-#define CAMEL_GROUPWISE_SUMMARY(obj) \
-       (G_TYPE_CHECK_INSTANCE_CAST \
-       ((obj), CAMEL_TYPE_GROUPWISE_SUMMARY, CamelGroupwiseSummary))
-#define CAMEL_GROUPWISE_SUMMARY_CLASS(cls) \
-       (G_TYPE_CHECK_CLASS_CAST \
-       ((cls), CAMEL_TYPE_GROUPWISE_SUMMARY, CamelGroupwiseSummaryClass))
-#define CAMEL_IS_GROUPWISE_SUMMARY(obj) \
-       (G_TYPE_CHECK_INSTANCE_TYPE \
-       ((obj), CAMEL_TYPE_GROUPWISE_SUMMARY))
-#define CAMEL_IS_GROUPWISE_SUMMARY_CLASS(cls) \
-       (G_TYPE_CHECK_CLASS_TYPE \
-       ((cls), CAMEL_TYPE_GROUPWISE_SUMMARY))
-#define CAMEL_GROUPWISE_SUMMARY_GET_CLASS(obj) \
-       (G_TYPE_INSTANCE_GET_CLASS \
-       ((obj), CAMEL_TYPE_GROUPWISE_SUMMARY, CamelGroupwiseSummaryClass))
-
-G_BEGIN_DECLS
-
-typedef struct _CamelGroupwiseSummary CamelGroupwiseSummary;
-typedef struct _CamelGroupwiseSummaryClass CamelGroupwiseSummaryClass;
-typedef struct _CamelGroupwiseMessageInfo CamelGroupwiseMessageInfo;
-typedef struct _CamelGroupwiseMessageContentInfo CamelGroupwiseMessageContentInfo;
-
-/* extra summary flags*/
-enum {
-       CAMEL_GW_MESSAGE_JUNK = 1 << 17,
-       CAMEL_GW_MESSAGE_NOJUNK = 1 << 18
-};
-
-struct _CamelGroupwiseMessageInfo {
-       CamelMessageInfoBase info;
-
-       guint32 server_flags;
-} ;
-
-struct _CamelGroupwiseMessageContentInfo {
-       CamelMessageContentInfo info;
-} ;
-
-struct _CamelGroupwiseSummary {
-       CamelFolderSummary parent;
-
-       gchar *time_string;
-       gint32 version;
-       gint32 validity;
-} ;
-
-struct _CamelGroupwiseSummaryClass {
-       CamelFolderSummaryClass parent_class;
-};
-
-GType          camel_groupwise_summary_get_type (void);
-CamelFolderSummary *
-               camel_groupwise_summary_new     (CamelFolder *folder,
-                                                const gchar *filename);
-void           camel_gw_summary_add_offline    (CamelFolderSummary *summary,
-                                                const gchar *uid,
-                                                CamelMimeMessage *messgae,
-                                                const CamelMessageInfo *info);
-void           camel_gw_summary_add_offline_uncached
-                                               (CamelFolderSummary *summary,
-                                                const gchar *uid,
-                                                const CamelMessageInfo *info);
-void           groupwise_summary_clear         (CamelFolderSummary *summary,
-                                                gboolean uncache);
-
-G_END_DECLS
-
-#endif /* CAMEL_GW_SUMMARY_H */
diff --git a/camel/providers/groupwise/camel-groupwise-transport.c b/camel/providers/groupwise/camel-groupwise-transport.c
deleted file mode 100644 (file)
index 54b3af9..0000000
+++ /dev/null
@@ -1,227 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-groupwise-transport.c : class for an groupwise transport */
-
-/*
- * Authors: Sivaiah Nallagatla <snallagatla@novell.com>
- *         Parthasarathi Susarla <sparthasarathi@novell.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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 <glib/gi18n-lib.h>
-
-#include "camel-groupwise-store.h"
-#include "camel-groupwise-transport.h"
-#include "camel-groupwise-utils.h"
-
-#define REPLY_VIEW "default message attachments threading"
-
-#define CAMEL_GROUPWISE_TRANSPORT_GET_PRIVATE(obj) \
-       (G_TYPE_INSTANCE_GET_PRIVATE \
-       ((obj), CAMEL_TYPE_GROUPWISE_TRANSPORT, CamelGroupwiseTransportPrivate))
-
-G_DEFINE_TYPE (CamelGroupwiseTransport, camel_groupwise_transport, CAMEL_TYPE_TRANSPORT)
-
-struct _CamelGroupwiseTransportPrivate {
-       CamelGroupwiseStore *store;
-};
-
-static void
-groupwise_transport_dispose (GObject *object)
-{
-       CamelGroupwiseTransportPrivate *priv;
-
-       priv = CAMEL_GROUPWISE_TRANSPORT_GET_PRIVATE (object);
-
-       if (priv->store != NULL) {
-               g_object_unref (priv->store);
-               priv->store = NULL;
-       }
-
-       /* Chain up to parent's dispose() method. */
-       G_OBJECT_CLASS (camel_groupwise_transport_parent_class)->
-               dispose (object);
-}
-
-static gchar *
-groupwise_transport_get_name (CamelService *service,
-                              gboolean brief)
-{
-       CamelURL *url;
-
-       url = camel_service_get_camel_url (service);
-
-       if (brief)
-               return g_strdup_printf (
-                       _("GroupWise server %s"),
-                       url->host);
-       else
-               return g_strdup_printf (
-                       _("GroupWise mail delivery via %s"),
-                       url->host);
-}
-
-static gboolean
-groupwise_transport_connect_sync (CamelService *service,
-                                  GCancellable *cancellable,
-                                  GError **error)
-{
-       return TRUE;
-}
-
-static gboolean
-groupwise_send_to_sync (CamelTransport *transport,
-                        CamelMimeMessage *message,
-                        CamelAddress *from,
-                        CamelAddress *recipients,
-                        GCancellable *cancellable,
-                        GError **error)
-{
-       CamelGroupwiseTransportPrivate *priv;
-       CamelService *service;
-       CamelSession *session;
-       CamelURL *service_url;
-       EGwItem *item ,*temp_item=NULL;
-       EGwConnection *cnc = NULL;
-       EGwConnectionStatus status = 0;
-       GSList *sent_item_list = NULL;
-       gchar *reply_request = NULL;
-       EGwItemLinkInfo *info = NULL;
-
-       if (!transport) {
-               g_set_error (
-                       error, CAMEL_SERVICE_ERROR,
-                       CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
-                       _("Authentication failed"));
-               return FALSE;
-       }
-
-       priv = CAMEL_GROUPWISE_TRANSPORT_GET_PRIVATE (transport);
-
-       service = CAMEL_SERVICE (transport);
-       session = camel_service_get_session (service);
-       service_url = camel_service_get_camel_url (service);
-
-       camel_operation_push_message (cancellable, _("Sending Message") );
-
-       /*camel groupwise store and cnc*/
-       cnc = cnc_lookup (priv->store->priv);
-       if (!cnc) {
-               g_warning ("||| Eh!!! Failure |||\n");
-               camel_operation_pop_message (cancellable);
-               g_set_error (
-                       error, CAMEL_SERVICE_ERROR,
-                       CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
-                       _("Authentication failed"));
-               return FALSE;
-       }
-
-       item = camel_groupwise_util_item_from_message (cnc, message, from);
-
-       reply_request = g_strdup (camel_medium_get_header (CAMEL_MEDIUM (message), "X-GW-ORIG-ITEM-ID"));
-       if (reply_request) {
-               g_strstrip (reply_request);
-               status = e_gw_connection_reply_item (cnc, reply_request, REPLY_VIEW, &temp_item);
-               if (status != E_GW_CONNECTION_STATUS_OK)
-                       g_warning ("Could not send a replyRequest...continuing without!!\n");
-               else {
-                       info = e_gw_item_get_link_info (temp_item);
-                       e_gw_item_set_link_info (item, info);
-               }
-               g_free (reply_request);
-       }
-
-       /*Send item*/
-       status = e_gw_connection_send_item (cnc, item, &sent_item_list);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               g_warning (" Error Sending mail");
-               camel_operation_pop_message (cancellable);
-               e_gw_item_set_link_info (item, NULL);
-               g_object_unref (item);
-               if (temp_item)
-                       g_object_unref (temp_item);
-
-               /* FIXME: 58652 should be changed with an enum.*/
-               if (status == 58652)
-                       g_set_error (
-                               error, CAMEL_SERVICE_ERROR,
-                               CAMEL_SERVICE_ERROR_UNAVAILABLE,
-                               _("You have exceeded this account's storage limit. Your messages are queued in your Outbox. Resend by pressing Send/Receive after deleting/archiving some of your mail.\n"));
-               else
-                       g_set_error (
-                               error, CAMEL_SERVICE_ERROR,
-                               CAMEL_SERVICE_ERROR_UNAVAILABLE,
-                               _("Could not send message: %s"),
-                               _("Unknown error"));
-               status = 0;
-               return FALSE;
-       }
-       e_gw_item_set_link_info (item, NULL);
-
-       e_gw_item_set_recipient_list (item, NULL);
-
-       if (temp_item)
-               g_object_unref (temp_item);
-       g_object_unref (item);
-
-       camel_operation_pop_message (cancellable);
-
-       return TRUE;
-}
-
-static void
-camel_groupwise_transport_class_init (CamelGroupwiseTransportClass *class)
-{
-       GObjectClass *object_class;
-       CamelServiceClass *service_class;
-       CamelTransportClass *transport_class;
-
-       g_type_class_add_private (
-               class, sizeof (CamelGroupwiseTransportPrivate));
-
-       object_class = G_OBJECT_CLASS (class);
-       object_class->dispose = groupwise_transport_dispose;
-
-       service_class = CAMEL_SERVICE_CLASS (class);
-       service_class->get_name = groupwise_transport_get_name;
-       service_class->connect_sync = groupwise_transport_connect_sync;
-
-       transport_class = CAMEL_TRANSPORT_CLASS (class);
-       transport_class->send_to_sync = groupwise_send_to_sync;
-}
-
-static void
-camel_groupwise_transport_init (CamelGroupwiseTransport *transport)
-{
-       transport->priv = CAMEL_GROUPWISE_TRANSPORT_GET_PRIVATE (transport);
-}
-
-void
-camel_groupwise_transport_set_store (CamelGroupwiseTransport *transport,
-                                     CamelGroupwiseStore *store)
-{
-       g_return_if_fail (CAMEL_IS_GROUPWISE_TRANSPORT (transport));
-       g_return_if_fail (CAMEL_IS_GROUPWISE_STORE (store));
-
-       transport->priv->store = g_object_ref (store);
-}
diff --git a/camel/providers/groupwise/camel-groupwise-transport.h b/camel/providers/groupwise/camel-groupwise-transport.h
deleted file mode 100644 (file)
index ee9d21c..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-groupwise-transport.h : class for an groupwise transport */
-
-/*
- * Authors: Sivaiah Nallagatla <snallagatla@novell.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- */
-
-#ifndef CAMEL_GROUPWISE_TRANSPORT_H
-#define CAMEL_GROUPWISE_TRANSPORT_H
-
-#include "camel-groupwise-store.h"
-
-/* Standard GObject macros */
-#define CAMEL_TYPE_GROUPWISE_TRANSPORT \
-       (camel_groupwise_transport_get_type ())
-#define CAMEL_GROUPWISE_TRANSPORT(obj) \
-       (G_TYPE_CHECK_INSTANCE_CAST \
-       ((obj), CAMEL_TYPE_GROUPWISE_TRANSPORT, CamelGroupwiseTransport))
-#define CAMEL_GROUPWISE_TRANSPORT_CLASS(cls) \
-       (G_TYPE_CHECK_CLASS_CAST \
-       ((cls), CAMEL_TYPE_GROUPWISE_TRANSPORT, CamelGroupwiseTransportClass))
-#define CAMEL_IS_GROUPWISE_TRANSPORT(obj) \
-       (G_TYPE_CHECK_INSTANCE_TYPE \
-       ((obj), CAMEL_TYPE_GROUPWISE_TRANSPORT))
-#define CAMEL_IS_GROUPWISE_TRANSPORT_CLASS(cls) \
-       (G_TYPE_CHECK_CLASS_TYPE \
-       ((cls), CAMEL_TYPE_GROUPWISE_TRANSPORT))
-#define CAMEL_GROUPWISE_TRANSPORT_GET_CLASS(obj) \
-       (G_TYPE_INSTANCE_GET_CLASS \
-       ((obj), CAMEL_TYPE_GROUPWISE_TRANSPORT, CamelGroupwiseTransportClass))
-
-G_BEGIN_DECLS
-
-typedef struct _CamelGroupwiseTransport CamelGroupwiseTransport;
-typedef struct _CamelGroupwiseTransportClass CamelGroupwiseTransportClass;
-typedef struct _CamelGroupwiseTransportPrivate CamelGroupwiseTransportPrivate;
-
-struct _CamelGroupwiseTransport {
-       CamelTransport parent;
-       CamelGroupwiseTransportPrivate *priv;
-};
-
-struct _CamelGroupwiseTransportClass {
-       CamelTransportClass parent_class;
-};
-
-GType          camel_groupwise_transport_get_type (void);
-void           camel_groupwise_transport_set_store
-                                       (CamelGroupwiseTransport *transport,
-                                        CamelGroupwiseStore *store);
-
-G_END_DECLS
-
-#endif /* CAMEL_GROUPWISE_TRANSPORT_H */
diff --git a/camel/providers/groupwise/camel-groupwise-utils.c b/camel/providers/groupwise/camel-groupwise-utils.c
deleted file mode 100644 (file)
index 0c8f11b..0000000
+++ /dev/null
@@ -1,715 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* camel-groupwise-utils.c
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 program; 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 <unistd.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include <glib/gstdio.h>
-
-#include "camel-groupwise-utils.h"
-
-#define SUBFOLDER_DIR_NAME     "subfolders"
-#define SUBFOLDER_DIR_NAME_LEN 10
-#define RFC_822        "message/rfc822"
-
-static void do_multipart (EGwConnection *cnc, EGwItem *item, CamelMultipart *mp, GSList **attach_list);
-/**
- * e_path_to_physical:
- * @prefix: a prefix to prepend to the path, or %NULL
- * @path: the virtual path to convert to a filesystem path.
- *
- * This converts the "virtual" path @path into an expanded form that
- * allows a given name to refer to both a file and a directory. The
- * expanded path will have a "subfolders" directory inserted between
- * each path component. If the path ends with "/", the returned
- * physical path will end with "/subfolders"
- *
- * If @prefix is non-%NULL, it will be prepended to the returned path.
- *
- * Returns: the expanded path
- **/
-gchar *
-e_path_to_physical (const gchar *prefix, const gchar *vpath)
-{
-       const gchar *p, *newp;
-       gchar *dp;
-       gchar *ppath;
-       gint ppath_len;
-       gint prefix_len;
-
-       while (*vpath == '/')
-               vpath++;
-       if (!prefix)
-               prefix = "";
-
-       /* Calculate the length of the real path. */
-       ppath_len = strlen (vpath);
-       ppath_len++;    /* For the ending zero.  */
-
-       prefix_len = strlen (prefix);
-       ppath_len += prefix_len;
-       ppath_len++;    /* For the separating slash.  */
-
-       /* Take account of the fact that we need to translate every
-        * separator into 'subfolders/'.
-        */
-       p = vpath;
-       while (1) {
-               newp = strchr (p, '/');
-               if (newp == NULL)
-                       break;
-
-               ppath_len += SUBFOLDER_DIR_NAME_LEN;
-               ppath_len++; /* For the separating slash.  */
-
-               /* Skip consecutive slashes.  */
-               while (*newp == '/')
-                       newp++;
-
-               p = newp;
-       };
-
-       ppath = g_malloc (ppath_len);
-       dp = ppath;
-
-       memcpy (dp, prefix, prefix_len);
-       dp += prefix_len;
-       *(dp++) = '/';
-
-       /* Copy the mangled path.  */
-       p = vpath;
-       while (1) {
-               newp = strchr (p, '/');
-               if (newp == NULL) {
-                       strcpy (dp, p);
-                       break;
-               }
-
-               memcpy (dp, p, newp - p + 1); /* '+ 1' to copy the slash too.  */
-               dp += newp - p + 1;
-
-               memcpy (dp, SUBFOLDER_DIR_NAME, SUBFOLDER_DIR_NAME_LEN);
-               dp += SUBFOLDER_DIR_NAME_LEN;
-
-               *(dp++) = '/';
-
-               /* Skip consecutive slashes.  */
-               while (*newp == '/')
-                       newp++;
-
-               p = newp;
-       }
-
-       return ppath;
-}
-
-static gboolean
-find_folders_recursive (const gchar *physical_path, const gchar *path,
-                       EPathFindFoldersCallback callback, gpointer data)
-{
-       GDir *dir;
-       gchar *subfolder_directory_path;
-       gboolean ok;
-
-       if (*path) {
-               if (!callback (physical_path, path, data))
-                       return FALSE;
-
-               subfolder_directory_path = g_strdup_printf ("%s/%s", physical_path, SUBFOLDER_DIR_NAME);
-       } else {
-               /* On the top level, we have no folders and,
-                * consequently, no subfolder directory.
-                */
-
-               subfolder_directory_path = g_strdup (physical_path);
-       }
-
-       /* Now scan the subfolders and load them. */
-       dir = g_dir_open (subfolder_directory_path, 0, NULL);
-       if (dir == NULL) {
-               g_free (subfolder_directory_path);
-               return TRUE;
-       }
-
-       ok = TRUE;
-       while (ok) {
-               struct stat file_stat;
-               const gchar *dirent;
-               gchar *file_path;
-               gchar *new_path;
-
-               dirent = g_dir_read_name (dir);
-               if (dirent == NULL)
-                       break;
-
-               file_path = g_strdup_printf ("%s/%s", subfolder_directory_path, dirent);
-
-               if (g_stat (file_path, &file_stat) < 0 ||
-                   !S_ISDIR (file_stat.st_mode)) {
-                       g_free (file_path);
-                       continue;
-               }
-
-               new_path = g_strdup_printf ("%s/%s", path, dirent);
-
-               ok = find_folders_recursive (file_path, new_path, callback, data);
-
-               g_free (file_path);
-               g_free (new_path);
-       }
-
-       g_dir_close (dir);
-       g_free (subfolder_directory_path);
-
-       return ok;
-}
-
-/**
- * e_path_find_folders:
- * @prefix: directory to start from
- * @callback: Callback to invoke on each folder
- * @data: Data for @callback
- *
- * Walks the folder tree starting at @prefix and calls @callback
- * on each folder.
- *
- * Returns: %TRUE on success, %FALSE if an error occurs at any point
- **/
-gboolean
-e_path_find_folders (const gchar *prefix,
-                    EPathFindFoldersCallback callback,
-                    gpointer data)
-{
-       return find_folders_recursive (prefix, "", callback, data);
-}
-
-/**
- * e_path_rmdir:
- * @prefix: a prefix to prepend to the path, or %NULL
- * @path: the virtual path to convert to a filesystem path.
- *
- * This removes the directory pointed to by @prefix and @path
- * and attempts to remove its parent "subfolders" directory too
- * if it's empty.
- *
- * Returns: -1 (with errno set) if it failed to rmdir the
- * specified directory. 0 otherwise, whether or not it removed
- * the parent directory.
- **/
-gint
-e_path_rmdir (const gchar *prefix, const gchar *vpath)
-{
-       gchar *physical_path, *p;
-
-       /* Remove the directory itself */
-       physical_path = e_path_to_physical (prefix, vpath);
-       if (g_rmdir (physical_path) == -1) {
-               g_free (physical_path);
-               return -1;
-       }
-
-       /* Attempt to remove its parent "subfolders" directory,
-        * ignoring errors since it might not be empty.
-        */
-
-       p = strrchr (physical_path, '/');
-       if (p[1] == '\0') {
-               g_free (physical_path);
-               return 0;
-       }
-       *p = '\0';
-       p = strrchr (physical_path, '/');
-       if (!p || strcmp (p + 1, SUBFOLDER_DIR_NAME) != 0) {
-               g_free (physical_path);
-               return 0;
-       }
-
-       g_rmdir (physical_path);
-       g_free (physical_path);
-       return 0;
-}
-
-static GSList *
-add_recipients (GSList *recipient_list, CamelAddress *recipients, gint recipient_type)
-{
-       gint total_add,i;
-       EGwItemRecipient *recipient;
-
-       total_add = camel_address_length (recipients);
-       for (i=0; i<total_add; i++) {
-               const gchar *name = NULL, *addr = NULL;
-               if (camel_internet_address_get ((CamelInternetAddress *)recipients, i , &name, &addr )) {
-
-                       recipient = g_new0 (EGwItemRecipient, 1);
-
-                       recipient->email = g_strdup (addr);
-                       recipient->display_name = g_strdup (name);
-                       recipient->type = recipient_type;
-                       recipient->status = E_GW_ITEM_STAT_NONE;
-                       recipient_list = g_slist_prepend (recipient_list, recipient);
-               }
-       }
-       return recipient_list;
-}
-
-static void
-send_as_attachment (EGwConnection *cnc, EGwItem *item, CamelStream *content, CamelContentType *type, CamelDataWrapper *dw, const gchar *filename, const gchar *cid, GSList **attach_list)
-{
-       EGwItemLinkInfo *info = NULL;
-       EGwConnectionStatus status;
-       EGwItemAttachment *attachment;
-       EGwItem *temp_item;
-       GByteArray *byte_array;
-
-       attachment = g_new0 (EGwItemAttachment, 1);
-       attachment->contentType = camel_content_type_simple (type);
-
-       if (cid)
-               attachment->contentid = camel_header_contentid_decode (cid);
-
-       byte_array = camel_stream_mem_get_byte_array (CAMEL_STREAM_MEM (content));
-
-       if (filename && byte_array->data) {
-               if (camel_content_type_is (type, "application", "pgp-signature")) {
-                       gchar *temp_str;
-                       gint temp_len;
-                       temp_str = g_base64_encode (byte_array->data, byte_array->len);
-                       temp_len = strlen (temp_str);
-                       attachment->data = g_strdup (temp_str);
-                       attachment->size = temp_len;
-                       g_free (temp_str);
-                       temp_str = NULL;
-               } else {
-                       attachment->data = g_base64_encode (byte_array->data, byte_array->len);
-                       attachment->size = strlen (attachment->data);
-               }
-       } else if (byte_array->data) {
-               gchar *temp_str;
-               gint temp_len;
-               if (!strcmp (attachment->contentType, "multipart/digest")) {
-                       /* FIXME? */
-               } else {
-                       temp_str = g_base64_encode (byte_array->data, byte_array->len);
-                       temp_len = strlen (temp_str);
-                       attachment->data = g_strdup (temp_str);
-                       attachment->size = temp_len;
-                       g_free (temp_str);
-                       temp_str = NULL;
-               }
-       }
-
-       if (camel_content_type_is (type, "text", "html") || camel_content_type_is (type, "multipart", "alternative")) {
-               if (!filename)
-                       filename = "text.htm";
-               if (camel_content_type_is (type, "multipart", "alternative")) {
-                       /* FIXME: this just feels so wrong... */
-                       g_free (attachment->contentType);
-                       attachment->contentType = g_strdup ("text/html");
-               }
-       }
-
-       attachment->name = g_strdup (filename ? filename : "");
-       if (camel_content_type_is (type, "message", "rfc822")) {
-               gchar *item_id;
-
-               item_id = g_strdup (camel_medium_get_header (CAMEL_MEDIUM (dw), "X-GW-ITEM-ID"));
-               /*
-                * XXX: The following code piece is a screwed up way of doing stuff.
-                * But we dont have much choice. Do not use 'camel_header_msgid_decode'
-                * since it removes the container id portion from the id and which the
-                * groupwise server needs.
-                */
-               g_strstrip (item_id);
-               status = e_gw_connection_forward_item (cnc, item_id, NULL, TRUE, &temp_item);
-               g_free (item_id);
-
-               if (status != E_GW_CONNECTION_STATUS_OK) {
-                       g_warning ("Could not send a forwardRequest...continuing without!!\n");
-
-                       g_free (attachment->name);
-                       attachment->name = g_strdup ("Mime.822");
-
-                       g_free (attachment->contentType);
-                       attachment->contentType = g_strdup ("Mail");
-               } else {
-                       GSList *attach_list = e_gw_item_get_attach_id_list (temp_item);
-                       EGwItemAttachment *temp_attach = (EGwItemAttachment *)attach_list->data;
-                       attachment->id = g_strdup (temp_attach->id);
-                       attachment->item_reference = g_strdup (temp_attach->item_reference);
-                       g_free (attachment->name);
-                       attachment->name = g_strdup (temp_attach->name);
-                       g_free (attachment->contentType);
-                       attachment->contentType = g_strdup ("Mail");
-                       g_free (attachment->data);
-                       attachment->data = NULL;
-                       attachment->size = 0;
-                       info = e_gw_item_get_link_info (temp_item);
-                       e_gw_item_set_link_info (item, info);
-               }
-       }
-
-       *attach_list = g_slist_append (*attach_list, attachment);
-}
-
-static GSList *
-populate_recipients (CamelMimeMessage *message, EGwItem *item, gboolean redirect)
-{
-       GSList *recipient_list = NULL;
-       CamelAddress *recipients;
-
-       if (redirect)
-               recipients = CAMEL_ADDRESS (camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_RESENT_TO));
-       else
-               recipients = CAMEL_ADDRESS (camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO));
-       recipient_list=add_recipients (recipient_list,recipients,E_GW_ITEM_RECIPIENT_TO);
-
-       if (redirect)
-               recipients = CAMEL_ADDRESS (camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_RESENT_CC));
-       else
-               recipients = CAMEL_ADDRESS (camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC));
-       recipient_list=add_recipients (recipient_list,recipients,E_GW_ITEM_RECIPIENT_CC);
-
-       if (redirect)
-               recipients = CAMEL_ADDRESS (camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_RESENT_BCC));
-       else
-               recipients = CAMEL_ADDRESS (camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_BCC));
-       recipient_list=add_recipients (recipient_list,recipients,E_GW_ITEM_RECIPIENT_BC);
-       recipient_list = g_slist_reverse (recipient_list);
-
-       return recipient_list;
-}
-
-EGwItem *
-camel_groupwise_util_item_from_message (EGwConnection *cnc, CamelMimeMessage *message, CamelAddress *from)
-{
-       EGwItem *item;
-       EGwItemOrganizer *org = g_new0 (EGwItemOrganizer, 1);
-       const gchar *display_name = NULL, *email = NULL;
-       gchar *send_options = NULL;
-       CamelMultipart *mp;
-       GSList *recipient_list = NULL, *attach_list = NULL;
-
-       /*Egroupwise item*/
-       item = e_gw_item_new_empty ();
-
-       /*populate recipient list*/
-       recipient_list = populate_recipients (message, item, TRUE);
-       if (recipient_list == NULL)
-               recipient_list = populate_recipients (message, item, FALSE);
-
-       /** Get the mime parts from CamelMimemessge **/
-       mp = (CamelMultipart *)camel_medium_get_content (CAMEL_MEDIUM (message));
-       if (!mp) {
-               g_warning ("ERROR: Could not get content object");
-               return NULL;
-       }
-
-       if (CAMEL_IS_MULTIPART (mp)) {
-               /*contains multiple parts*/
-               do_multipart (cnc, item, mp, &attach_list);
-       } else {
-               /*only message*/
-               CamelStream *content;
-               CamelDataWrapper *dw = NULL;
-               CamelContentType *type;
-               GByteArray *byte_array;
-
-               byte_array = g_byte_array_new ();
-               content = camel_stream_mem_new_with_byte_array (byte_array);
-
-               dw = camel_medium_get_content (CAMEL_MEDIUM (message));
-               type = camel_mime_part_get_content_type ((CamelMimePart *)message);
-
-               if (camel_content_type_is (type, "text", "plain")) {
-                       CamelStream *filtered_stream;
-                       CamelMimeFilter *filter;
-                       const gchar *charset;
-                       gchar *content_type;
-
-                       content_type = camel_content_type_simple (type);
-                       e_gw_item_set_content_type (item, content_type);
-                       g_free (content_type);
-
-                       charset = camel_content_type_param (type, "charset");
-                       if (charset && g_ascii_strcasecmp (charset, "US-ASCII") && g_ascii_strcasecmp (charset, "UTF-8")) {
-                               filter = camel_mime_filter_charset_new (charset, "UTF-8");
-                               filtered_stream = camel_stream_filter_new (content);
-                               camel_stream_filter_add ((CamelStreamFilter *) filtered_stream, filter);
-                               g_object_unref (filter);
-                       } else {
-                               /* US-ASCII or UTF-8 */
-                               filtered_stream = g_object_ref (content);
-                       }
-
-                       camel_data_wrapper_decode_to_stream_sync (dw, filtered_stream, NULL, NULL);
-                       camel_stream_flush (filtered_stream, NULL, NULL);
-                       g_object_unref (filtered_stream);
-
-                       camel_stream_write (content, "", 1, NULL, NULL);
-                       e_gw_item_set_message (item, (const gchar *)byte_array->data);
-               } else {
-                       camel_data_wrapper_decode_to_stream_sync (dw, content, NULL, NULL);
-                       send_as_attachment (cnc, item, content, type, dw, NULL, NULL, &attach_list);
-               }
-
-               g_object_unref (content);
-       }
-       /*Populate EGwItem*/
-       /*From Address*/
-       camel_internet_address_get ((CamelInternetAddress *)from, 0 , &display_name, &email);
-       org->display_name = g_strdup (display_name);
-       org->email = g_strdup (email);
-       e_gw_item_set_organizer (item, org);
-       /*recipient list*/
-       e_gw_item_set_recipient_list (item, recipient_list);
-       /*Item type is mail*/
-       e_gw_item_set_item_type (item, E_GW_ITEM_TYPE_MAIL);
-       /*subject*/
-       e_gw_item_set_subject (item, camel_mime_message_get_subject (message));
-       /*attachmets*/
-       e_gw_item_set_attach_id_list (item, attach_list);
-
-       /*send options*/
-       e_gw_item_set_sendoptions (item, TRUE);
-
-       if ((gchar *)camel_medium_get_header (CAMEL_MEDIUM (message), X_REPLY_CONVENIENT))
-               e_gw_item_set_reply_request (item, TRUE);
-
-       send_options = (gchar *)camel_medium_get_header (CAMEL_MEDIUM (message), X_REPLY_WITHIN);
-       if (send_options) {
-               e_gw_item_set_reply_request (item, TRUE);
-               e_gw_item_set_reply_within (item, send_options);
-       }
-       send_options = (gchar *)camel_medium_get_header (CAMEL_MEDIUM (message),X_EXPIRE_AFTER);
-       if (send_options)
-               e_gw_item_set_expires (item, send_options);
-
-       send_options = (gchar *)camel_medium_get_header (CAMEL_MEDIUM (message), X_DELAY_UNTIL);
-       if (send_options)
-               e_gw_item_set_delay_until (item, send_options);
-
-       send_options = (gchar *)camel_medium_get_header (CAMEL_MEDIUM (message), X_TRACK_WHEN);
-
-       /*we check if user has modified the status tracking options, if no then we anyway
-        * set status tracking all*/
-       if (send_options) {
-               switch (atoi (send_options)) {
-                       case 1: e_gw_item_set_track_info (item, E_GW_ITEM_DELIVERED);
-                               break;
-                       case 2: e_gw_item_set_track_info (item, E_GW_ITEM_DELIVERED_OPENED);
-                               break;
-                       case 3: e_gw_item_set_track_info (item, E_GW_ITEM_ALL);
-                               break;
-                       default: e_gw_item_set_track_info (item, E_GW_ITEM_NONE);
-                                break;
-               }
-       } else
-               e_gw_item_set_track_info (item, E_GW_ITEM_ALL);
-
-       if ((gchar *)camel_medium_get_header (CAMEL_MEDIUM (message), X_AUTODELETE))
-               e_gw_item_set_autodelete (item, TRUE);
-
-       send_options = (gchar *)camel_medium_get_header (CAMEL_MEDIUM (message), X_RETURN_NOTIFY_OPEN);
-       if (send_options) {
-               switch (atoi (send_options)) {
-                       case 0: e_gw_item_set_notify_opened (item, E_GW_ITEM_NOTIFY_NONE);
-                               break;
-                       case 1: e_gw_item_set_notify_opened (item, E_GW_ITEM_NOTIFY_MAIL);
-               }
-       }
-       send_options = (gchar *)camel_medium_get_header (CAMEL_MEDIUM (message), X_RETURN_NOTIFY_DELETE);
-       if (send_options) {
-               switch (atoi (send_options)) {
-                       case 0: e_gw_item_set_notify_deleted (item, E_GW_ITEM_NOTIFY_NONE);
-                               break;
-                       case 1: e_gw_item_set_notify_deleted (item, E_GW_ITEM_NOTIFY_MAIL);
-               }
-       }
-
-       send_options = (gchar *)camel_medium_get_header (CAMEL_MEDIUM (message), X_SEND_OPT_PRIORITY);
-       if (send_options) {
-               switch (atoi (send_options)) {
-                       case E_GW_PRIORITY_HIGH: e_gw_item_set_priority(item, "High");
-                                                break;
-                       case E_GW_PRIORITY_LOW:  e_gw_item_set_priority(item, "Low");
-                                                break;
-                       case E_GW_PRIORITY_STANDARD: e_gw_item_set_priority(item, "Standard");
-                                                    break;
-               }
-       }
-
-       send_options = (gchar *)camel_medium_get_header (CAMEL_MEDIUM (message), X_SEND_OPT_SECURITY);
-       if (send_options) {
-               switch (atoi (send_options)) {
-                       case E_GW_SECURITY_NORMAL : e_gw_item_set_security(item, "Normal");
-                                                   break;
-                       case E_GW_SECURITY_PROPRIETARY : e_gw_item_set_security(item, "Proprietary");
-                                                        break;
-                       case E_GW_SECURITY_CONFIDENTIAL : e_gw_item_set_security(item, "Confidential");
-                                                         break;
-                       case E_GW_SECURITY_SECRET : e_gw_item_set_security(item, "Secret");
-                                                   break;
-                       case E_GW_SECURITY_TOP_SECRET : e_gw_item_set_security(item, "TopSecret");
-                                                       break;
-                       case E_GW_SECURITY_FOR_YOUR_EYES_ONLY : e_gw_item_set_security(item, "ForYourEyesOnly");
-                                                               break;
-               }
-       }
-       return item;
-}
-
-void
-do_flags_diff (flags_diff_t *diff, guint32 old, guint32 _new)
-{
-       diff->changed = old ^ _new;
-       diff->bits = _new & diff->changed;
-}
-
-gchar *
-gw_concat ( const gchar *prefix, const gchar *suffix)
-{
-       gsize len;
-
-       len = strlen (prefix);
-       if (len == 0 || prefix[len - 1] == '/')
-               return g_strdup_printf ("%s%s", prefix, suffix);
-       else
-               return g_strdup_printf ("%s%c%s", prefix, '/', suffix);
-}
-
-void
-strip_lt_gt (gchar **string, gint s_offset, gint e_offset)
-{
-       gchar *temp = NULL;
-       gint len;
-
-       temp = g_strdup (*string);
-       len = strlen (*string);
-
-       *string = (gchar *)g_malloc0 (len-1);
-       *string = memcpy(*string, temp+s_offset, len-e_offset);
-       g_free (temp);
-}
-
-static void
-do_multipart (EGwConnection *cnc, EGwItem *item, CamelMultipart *mp, GSList **attach_list)
-{
-       /*contains multiple parts*/
-       guint part_count;
-       gint i;
-
-       part_count = camel_multipart_get_number (mp);
-       for ( i=0; i<part_count; i++) {
-               CamelContentType *type;
-               CamelMimePart *part;
-               CamelStream *content;
-               CamelDataWrapper *dw = NULL;
-               GByteArray *buffer;
-               const gchar *filename;
-               const gchar *content_id = NULL;
-
-               buffer = g_byte_array_new ();
-               content = camel_stream_mem_new_with_byte_array (buffer);
-
-               /*
-                * XXX:
-                * Assuming the first part always is the actual message
-                * and an attachment otherwise.....
-                */
-               part = camel_multipart_get_part (mp, i);
-
-               if (!part)
-                       continue;
-
-               type = camel_mime_part_get_content_type (part);
-               dw = camel_medium_get_content (CAMEL_MEDIUM (part));
-
-               if (CAMEL_IS_MULTIPART (dw)) {
-                       do_multipart (cnc, item, (CamelMultipart *) camel_medium_get_content ((CamelMedium *) part), attach_list);
-                       continue;
-               }
-
-               if (type->subtype && !strcmp (type->subtype, "alternative")) {
-                       /* eh... I don't think this code will ever get hit? */
-                       CamelMimePart *temp_part;
-                       const gchar *cid = NULL;
-                       CamelStream *temp_content;
-                       CamelDataWrapper *temp_dw = NULL;
-                       GByteArray *temp_buffer;
-
-                       temp_buffer = g_byte_array_new ();
-                       temp_content = camel_stream_mem_new_with_byte_array (temp_buffer);
-
-                       temp_part = camel_multipart_get_part ((CamelMultipart *)dw, 1);
-                       if (temp_part) {
-                               temp_dw = camel_medium_get_content (CAMEL_MEDIUM (temp_part));
-                               camel_data_wrapper_write_to_stream_sync (temp_dw, temp_content, NULL, NULL);
-                               filename = camel_mime_part_get_filename (temp_part);
-                               cid = camel_mime_part_get_content_id (temp_part);
-                               send_as_attachment (cnc, item, temp_content, type, temp_dw, filename, cid, attach_list);
-                       }
-                       g_object_unref (temp_content);
-                       continue;
-               }
-
-               if (i == 0 && camel_content_type_is (type, "text", "plain")) {
-                       CamelStream *filtered_stream;
-                       CamelMimeFilter *filter;
-                       const gchar *charset;
-                       gchar *content_type;
-
-                       content_type = camel_content_type_simple (type);
-                       e_gw_item_set_content_type (item, content_type);
-                       g_free (content_type);
-
-                       charset = camel_content_type_param (type, "charset");
-                       if (charset && g_ascii_strcasecmp (charset, "US-ASCII") && g_ascii_strcasecmp (charset, "UTF-8")) {
-                               filter = camel_mime_filter_charset_new (charset, "UTF-8");
-                               filtered_stream = camel_stream_filter_new (content);
-                               camel_stream_filter_add ((CamelStreamFilter *) filtered_stream, filter);
-                               g_object_unref (filter);
-                       } else {
-                               /* US-ASCII or UTF-8 */
-                               filtered_stream = g_object_ref (content);
-                       }
-
-                       camel_data_wrapper_decode_to_stream_sync (dw, filtered_stream, NULL, NULL);
-                       camel_stream_flush (filtered_stream, NULL, NULL);
-                       g_object_unref (filtered_stream);
-
-                       camel_stream_write (content, "", 1, NULL, NULL);
-                       e_gw_item_set_message (item, (const gchar *) buffer->data);
-               } else {
-                       filename = camel_mime_part_get_filename (part);
-                       content_id = camel_mime_part_get_content_id (part);
-
-                       camel_data_wrapper_decode_to_stream_sync (dw, content, NULL, NULL);
-                       send_as_attachment (cnc, item, content, type, dw, filename, content_id, attach_list);
-               }
-
-               g_object_unref (content);
-       } /*end of for*/
-}
diff --git a/camel/providers/groupwise/camel-groupwise-utils.h b/camel/providers/groupwise/camel-groupwise-utils.h
deleted file mode 100644 (file)
index f6f30fc..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * 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_GROUPWISE_UTILS_H
-#define CAMEL_GROUPWISE_UTILS_H
-
-#include <camel/camel.h>
-#include <e-gw-connection.h>
-#include <e-gw-container.h>
-#include <e-gw-item.h>
-
-/*Headers for send options*/
-#define X_SEND_OPTIONS        "X-gw-send-options"
-/*General Options*/
-#define X_SEND_OPT_PRIORITY   "X-gw-send-opt-priority"
-#define X_SEND_OPT_SECURITY   "X-gw-send-opt-security"
-#define X_REPLY_CONVENIENT    "X-reply-convenient"
-#define X_REPLY_WITHIN        "X-reply-within"
-#define X_EXPIRE_AFTER        "X-expire-after"
-#define X_DELAY_UNTIL         "X-delay-until"
-
-/*Status Tracking Options*/
-#define X_TRACK_WHEN            "X-track-when"
-#define X_AUTODELETE            "X-auto-delete"
-#define X_RETURN_NOTIFY_OPEN    "X-return-notify-open"
-#define X_RETURN_NOTIFY_DELETE  "X-return-notify-delete"
-
-/* Folder types for source */
-#define RECEIVED  "Mailbox"
-#define SENT     "Sent Items"
-#define DRAFT    ""
-#define PERSONAL  "Cabinet"
-
-G_BEGIN_DECLS
-
-/*for syncing flags back to server*/
-typedef struct {
-       guint32 changed;
-       guint32 bits;
-} flags_diff_t;
-
-/* FIXME: deprecated
-   This is used exclusively for the legacy imap cache code.  DO NOT use this in any new code */
-
-typedef gboolean (*EPathFindFoldersCallback) (const gchar *physical_path,
-                                             const gchar *path,
-                                             gpointer user_data);
-
-gchar *   e_path_to_physical  (const gchar *prefix, const gchar *vpath);
-
-gboolean e_path_find_folders (const gchar *prefix,
-                             EPathFindFoldersCallback callback,
-                             gpointer data);
-
-gint      e_path_rmdir        (const gchar *prefix, const gchar *vpath);
-
-EGwItem *camel_groupwise_util_item_from_message (EGwConnection *cnc, CamelMimeMessage *message, CamelAddress *from);
-
-void do_flags_diff (flags_diff_t *diff, guint32 old, guint32 _new);
-gchar *gw_concat ( const gchar *prefix, const gchar *suffix);
-void strip_lt_gt (gchar **string, gint s_offset, gint e_offset);
-
-G_END_DECLS
-
-#endif
diff --git a/camel/providers/groupwise/libcamelgroupwise.urls b/camel/providers/groupwise/libcamelgroupwise.urls
deleted file mode 100644 (file)
index fb62422..0000000
+++ /dev/null
@@ -1 +0,0 @@
-groupwise
index 3c4fbfe..aef754f 100644 (file)
@@ -1431,7 +1431,6 @@ addressbook/backends/file/Makefile
 addressbook/backends/vcf/Makefile
 addressbook/backends/ldap/Makefile
 addressbook/backends/google/Makefile
-addressbook/backends/groupwise/Makefile
 addressbook/backends/webdav/Makefile
 art/Makefile
 calendar/Makefile
@@ -1443,13 +1442,11 @@ calendar/libegdbus/Makefile
 calendar/backends/Makefile
 calendar/backends/caldav/Makefile
 calendar/backends/file/Makefile
-calendar/backends/groupwise/Makefile
 calendar/backends/http/Makefile
 calendar/backends/contacts/Makefile
 calendar/backends/weather/Makefile
 camel/Makefile
 camel/providers/Makefile
-camel/providers/groupwise/Makefile
 camel/providers/imap/Makefile
 camel/providers/imapx/Makefile
 camel/providers/local/Makefile
@@ -1473,9 +1470,6 @@ libedataserver/eds-version.h
 libedataserver/libedataserver.pc
 libedataserverui/Makefile
 libedataserverui/libedataserverui.pc
-servers/Makefile
-servers/groupwise/Makefile
-servers/groupwise/libegroupwise.pc
 tests/Makefile
 tests/libebook/Makefile
 tests/libebook/vcard/Makefile
diff --git a/servers/Makefile.am b/servers/Makefile.am
deleted file mode 100644 (file)
index ae2e183..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-SUBDIRS = groupwise
-
--include $(top_srcdir)/git.mk
diff --git a/servers/groupwise/Makefile.am b/servers/groupwise/Makefile.am
deleted file mode 100644 (file)
index b815620..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-noinst_PROGRAMS = create-account soap-test
-
-SERVERS_GROUPWISE_CPPFLAGS= \
-       -DG_LOG_DOMAIN=\"libegroupwise\"                \
-       -I$(top_srcdir)                                 \
-       -I$(top_builddir)                               \
-       $(SOUP_CFLAGS)                                  \
-       $(E_DATA_SERVER_CFLAGS)
-
-create_account_CPPFLAGS = $(SERVERS_GROUPWISE_CPPFLAGS)
-create_account_SOURCES = create-account.c
-create_account_LDADD =                                                 \
-       $(top_builddir)/libedataserver/libedataserver-1.2.la    \
-       $(SOUP_LIBS)                                            \
-       $(E_DATA_SERVER_LIBS)
-
-soap_test_CPPFLAGS = $(SERVERS_GROUPWISE_CPPFLAGS)
-soap_test_SOURCES = soap-test.c
-soap_test_LDADD =                                              \
-       $(top_builddir)/libedataserver/libedataserver-1.2.la    \
-       $(SOUP_LIBS)                                            \
-       libegroupwise-1.2.la                                    \
-       $(E_DATA_SERVER_LIBS)
-
-build-timestamp.h : $(top_builddir)/config.h
-       echo "const char *build_timestamp = \"Evolution-Data-Server-@BASE_VERSION@-`date +%F`\";" > $@
-
-BUILT_SOURCES = build-timestamp.h
-NODIST_FILES = build-timestamp.h
-CLEANFILES = build-timestamp.h
-
-lib_LTLIBRARIES = libegroupwise-1.2.la
-
-libegroupwise_1_2_la_CPPFLAGS = \
-       $(AM_CPPFLAGS)                                  \
-       -DG_LOG_DOMAIN=\"libegroupwise\"                \
-       -I$(top_srcdir)                                 \
-       -I$(top_builddir)                               \
-       $(SOUP_CFLAGS)                                  \
-       $(E_DATA_SERVER_CFLAGS)
-
-libegroupwise_1_2_la_SOURCES =                 \
-       e-gw-connection.c                       \
-       e-gw-connection.h                       \
-       e-gw-container.c                        \
-       e-gw-container.h                        \
-       e-gw-item.c                             \
-       e-gw-item.h                             \
-       e-gw-sendoptions.h                      \
-       e-gw-sendoptions.c                      \
-       e-gw-message.c                          \
-       e-gw-message.h                          \
-       e-gw-filter.c                           \
-       e-gw-filter.h                           \
-       e-gw-recur-utils.c                      \
-       e-gw-recur-utils.h                      \
-       e-gw-proxy.h                            \
-       e-gw-proxy.c                            \
-       soup-soap-message.c                     \
-       soup-soap-response.c                    \
-       build-timestamp.h
-
-libegroupwise_1_2_la_LIBADD =                                          \
-       ../../libedataserver/libedataserver-1.2.la                      \
-       $(E_DATA_SERVER_LIBS)                                           \
-       $(SOUP_LIBS)
-
-libegroupwise_1_2_la_LDFLAGS =                                               \
-        -version-info $(LIBEGROUPWISE_CURRENT):$(LIBEGROUPWISE_REVISION):$(LIBEGROUPWISE_AGE) $(NO_UNDEFINED)
-
-libegroupwiseincludedir = $(privincludedir)/groupwise
-
-libegroupwiseinclude_HEADERS =                  \
-        e-gw-connection.h                       \
-       e-gw-container.h                        \
-       e-gw-message.h                          \
-       e-gw-item.h                             \
-       e-gw-sendoptions.h                      \
-       e-gw-filter.h                           \
-       e-gw-recur-utils.h                      \
-       e-gw-proxy.h                            \
-       soup-soap-message.h                     \
-       soup-soap-response.h
-
-%-$(API_VERSION).pc: %.pc
-        cp $< $@
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = libegroupwise-$(API_VERSION).pc
-
-EXTRA_DIST = $(pkgconfig_DATA:-$(API_VERSION).pc=.pc.in)
-
-DISTCLEANFILES = $(pkgconfig_DATA)
-
-
--include $(top_srcdir)/git.mk
diff --git a/servers/groupwise/create-account.c b/servers/groupwise/create-account.c
deleted file mode 100644 (file)
index b308c87..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-
-#include <config.h>
-#include <gconf/gconf-client.h>
-#include <glib.h>
-#include <libedataserver/e-source-list.h>
-
-static GConfClient *conf_client;
-static GMainLoop *main_loop;
-static gchar *arg_hostname, *arg_username, *arg_password;
-
-static void
-add_account (const gchar *conf_key, const gchar *hostname, const gchar *username)
-{
-       ESourceList *source_list;
-       ESourceGroup *group;
-       ESource *source;
-       gchar *group_name;
-
-       source_list = e_source_list_new_for_gconf (conf_client, conf_key);
-
-       group_name = g_strdup (hostname);
-       group = e_source_group_new (group_name, "groupwise://");
-       e_source_list_add_group (source_list, group, -1);
-
-       g_free (group_name);
-       group_name = g_strdup_printf ("%s:7181/soap/", hostname);
-       source = e_source_new ("Calendar", group_name);
-       e_source_set_property (source, "auth", "1");
-       e_source_set_property (source, "username", username);
-       e_source_group_add_source (group, source, -1);
-
-       e_source_list_sync (source_list, NULL);
-
-       g_free (group_name);
-       g_object_unref (source);
-       g_object_unref (group);
-       g_object_unref (source_list);
-}
-
-static gboolean
-idle_cb (gpointer data)
-{
-       add_account ("/apps/evolution/calendar/sources", arg_hostname, arg_username);
-       add_account ("/apps/evolution/tasks/sources", arg_hostname, arg_username);
-
-       g_main_loop_quit (main_loop);
-
-       return FALSE;
-}
-
-gint
-main (gint argc, gchar *argv[])
-{
-       g_type_init ();
-       if (argc != 3 && argc != 4) {
-               g_print ("Usage: %s hostname username [password]\n", argv[0]);
-               return -1;
-       }
-
-       arg_hostname = argv[1];
-       arg_username = argv[2];
-       if (argc == 4)
-               arg_password = argv[3];
-       else
-               arg_password = NULL;
-
-       conf_client = gconf_client_get_default ();
-
-       main_loop = g_main_loop_new (NULL, TRUE);
-       g_idle_add ((GSourceFunc) idle_cb, NULL);
-       g_main_loop_run (main_loop);
-
-       /* terminate */
-       g_object_unref (conf_client);
-       g_main_loop_unref (main_loop);
-
-       return 0;
-}
diff --git a/servers/groupwise/doc/GW_SABdeltas.txt b/servers/groupwise/doc/GW_SABdeltas.txt
deleted file mode 100644 (file)
index f97b8db..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-   <xs:element name="getDeltasRequest">
-      <xs:complexType>
-         <xs:sequence>
-            <xs:annotation>
-               <xs:documentation>
-               container:  The only valid container at this time is the GroupWise System Address book uid.
-               view:       This is the view for the items that are returned.
-               </xs:documentation>
-            </xs:annotation>
-            <xs:element name="container" type="types:uid" />
-            <xs:element name="view" type="types:View" nillable="1" />
-            <xs:element name="deltaInfo" type="types:DeltaInfo" />
-         </xs:sequence>
-      </xs:complexType>
-   </xs:element>
-   <xs:element name="getDeltasResponse">
-      <xs:complexType>
-         <xs:sequence>
-            <xs:element name="items" type="types:Items" minOccurs="0" />
-            <xs:element name="deltaInfo" type="types:DeltaInfo" />
-            <xs:element name="status" type="types:Status" />
-         </xs:sequence>
-      </xs:complexType>
-   </xs:element>
-   <xs:element name="getDeltaInfoRequest">
-      <xs:complexType>
-         <xs:sequence>
-            <xs:annotation>
-               <xs:documentation>
-               The only valid container at this time is the GroupWise System Address book uid.
-               </xs:documentation>
-            </xs:annotation>
-            <xs:element name="container" type="types:uid" />
-         </xs:sequence>
-      </xs:complexType>
-   </xs:element>
-   <xs:element name="getDeltaInfoResponse">
-      <xs:complexType>
-         <xs:sequence>
-            <xs:element name="deltaInfo" type="types:DeltaInfo" />
-            <xs:element name="status" type="types:Status" />
-         </xs:sequence>
-      </xs:complexType>
-   </xs:element>
diff --git a/servers/groupwise/doc/gw-soap-enums.xsd b/servers/groupwise/doc/gw-soap-enums.xsd
deleted file mode 100644 (file)
index a9bcc81..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?> \r
-<xs:schema targetNamespace="http://schemas.novell.com/2003/10/NCSP/enums.xsd"\r
-                  elementFormDefault="qualified"\r
-                  xmlns:xs="http://www.w3.org/2001/XMLSchema"\r
-                  xmlns:tns="http://schemas.novell.com/2003/10/NCSP/enums.xsd">\r
-                  \r
-<xs:simpleType name="FolderType">\r
-       <xs:restriction base="xs:string">\r
-               <xs:enumeration value="Mailbox" />\r
-               <xs:enumeration value="SentItems" />\r
-               <xs:enumeration value="WorkInProgress" />\r
-               <xs:enumeration value="Trash" />\r
-               <xs:enumeration value="Calendar" />\r
-               <xs:enumeration value="Contacts" />\r
-               <xs:enumeration value="Documents" />\r
-               <xs:enumeration value="Checklist" />\r
-               <xs:enumeration value="Cabinet" />\r
-               <xs:enumeration value="Normal" />\r
-               <xs:enumeration value="NNTP" />\r
-               <xs:enumeration value="IMAP" />\r
-               <xs:enumeration value="Query" />\r
-               <xs:enumeration value="JunkMail" />\r
-       </xs:restriction>\r
-</xs:simpleType>\r
-\r
-<!-- Indicates the "Box Type" of the message -->\r
-<xs:simpleType name="ItemSource">\r
-       <xs:restriction base="xs:string">\r
-               <xs:enumeration value="received"/>\r
-               <xs:enumeration value="sent"/>\r
-               <xs:enumeration value="draft"/>\r
-               <xs:enumeration value="personal"/>\r
-       </xs:restriction>\r
-</xs:simpleType>\r
-\r
-</xs:schema>\r
diff --git a/servers/groupwise/doc/gw-soap-methods.xsd b/servers/groupwise/doc/gw-soap-methods.xsd
deleted file mode 100644 (file)
index 2107433..0000000
+++ /dev/null
@@ -1,1104 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?> \r
-<xs:schema targetNamespace="http://schemas.novell.com/2003/10/NCSP/methods.xsd" elementFormDefault="qualified"\r
-       xmlns="http://schemas.novell.com/2003/10/NCSP/methods.xsd" \r
-       xmlns:tns="http://schemas.novell.com/2003/10/NCSP/methods.xsd"\r
-       xmlns:types="http://schemas.novell.com/2003/10/NCSP/types.xsd"\r
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
-       xmlns:xs="http://www.w3.org/2001/XMLSchema">\r
-\r
-       <xs:element name="acceptRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="items" type="types:ItemRefList"/>\r
-                               <xs:element name="comment" type="xs:string"/>\r
-                               <xs:element name="acceptLevel" type="types:AcceptLevel"/>\r
-                               <xs:element name="recurrenceAllInstances" type="types:recurrenceKey" />\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="acceptResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="acceptShareRequest">\r
-               <xs:annotation>\r
-                       <xs:documentation>\r
-                               container is requied for accepting a shared folder notification.\r
-                               It is the container id of the folder where the new folder will be\r
-                               placed.\r
-                               If name or container are not sent, the original values from the\r
-                               notification message will be used.\r
-                       </xs:documentation>\r
-               </xs:annotation>\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="id" type="types:uid"/>\r
-                               <xs:element name="name" type="xs:string" minOccurs="0"/>\r
-                               <xs:element name="container" type="types:uid" minOccurs="0"/>\r
-                               <xs:element ref="types:description" minOccurs="0"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="acceptShareResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="addItemRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="container" type="types:uid"/>\r
-                               <xs:element name="id" type="types:uid"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="addItemResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="addItemsRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="container" type="types:uid"/>\r
-                               <xs:element name="items" type="types:ItemRefList"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="addItemsResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="addMembersRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="container" type="types:uid"/>\r
-                               <xs:element name="members" type="types:GroupMemberList"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="addMembersResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="closeFreeBusySessionRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="freeBusySessionId" type="xs:int"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="closeFreeBusySessionResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="completeRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="items" type="types:ItemRefList"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="completeResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="createCursorRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="container" type="types:uid"/>\r
-                               <xs:element name="view" type="types:View" minOccurs="0" />\r
-                               <xs:element name="filter" type="types:Filter" minOccurs="0" />\r
-<!--                           <xs:element name="sort" type="types:Sort" minOccurs="0" /> -->\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="createCursorResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="cursor" type="xs:int"/>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="createItemRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="item" type="types:Item"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="createItemResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="id" type="types:uid"/>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="createProxyAccessRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="entry" type="types:AccessRightEntry"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="createProxyAccessResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="id" type="types:uid"/>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="createSignatureRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="signature" type="tns:Signature" />\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="createSignatureResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="declineRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="items" type="types:ItemRefList"/>\r
-                               <xs:element name="comment" type="xs:string"/>\r
-                               <xs:element name="recurrenceAllInstances" type="types:recurrenceKey" />\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="declineResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="delegateRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="items" type="types:ItemRefList"/>\r
-                               <xs:element name="commentToOrganizer" type="xs:string"/>\r
-                               <xs:element name="commentToDelegatee" type="xs:string"/>\r
-                               <xs:element name="distribution" type="types:Distribution"/>\r
-                               <xs:element name="recurrenceAllInstances" type="types:recurrenceKey" />\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="delegateResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="destroyCursorRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="container" type="types:uid"/>\r
-                               <xs:element name="cursor" type="xs:int"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="destroyCursorResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="forwardRequest">\r
-               <xs:annotation>\r
-                       <xs:documentation>\r
-                               Forwarding a message is a two step process.\r
-                               First you call the method with the id of the original item.\r
-                               A new mail item is returned.\r
-                               It has the orignal subject.\r
-                               The caller is responsible to prepend "Fwd:" or what ever they\r
-                               want to modify the original subject.\r
-                               If the caller wants the original message body returned, they need\r
-                               to supply message or message/RTF in the view.\r
-                               It is up to the caller to modify the message body in any way.\r
-                               When all of the changes to the returned mail item are complete,\r
-                               the caller would then call sendRequest with the new mail item.\r
-                               A linkInfo element is return in the mail item. That element needs\r
-                               to be passed unchanged in the sendRequest.\r
-                               If the caller wants to send the original item as an attachment to\r
-                               the new mail item, the caller would pass <embed>1</embed> in the\r
-                               forwardRequest.\r
-                       </xs:documentation>\r
-               </xs:annotation>\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="id" type="types:uid"/>\r
-                               <xs:element name="view" type="types:View" nillable="true"/>\r
-                               <xs:element name="embed" type="xs:boolean" default="0"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="forwardResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="item" type="types:Item"/>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="getAddressBookListRequest">\r
-       </xs:element>\r
-\r
-       <xs:element name="getAddressBookListResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="books" type="types:AddressBookList"/>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="getAttachmentRequest">\r
-               <xs:annotation>\r
-                       <xs:documentation>\r
-                               This work only for file attachments.\r
-                               If you try to specify an embedded item, you will get an error.\r
-                               If you specify offset = 0 and length = -1,\r
-                                       you will receive the whole attachment.\r
-                               You can supply other values for offset and length to receive\r
-                                       a part of the attachment.\r
-                       </xs:documentation>\r
-               </xs:annotation>\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="id" type="types:uid"/>\r
-                               <xs:element name="offset" type="xs:int"/>\r
-                               <xs:element name="length" type="xs:int"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="getAttachmentResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="part" type="types:MessagePart"/>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="getCategoryListRequest">\r
-       </xs:element>\r
-\r
-       <xs:element name="getCategoryListResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="categories" type="types:CategoryList"/>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="getCustomListRequest">\r
-       </xs:element>\r
-\r
-       <xs:element name="getCustomListResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="customs" type="types:CustomList"/>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="getFolderListRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="parent" type="types:uid"/>\r
-                               <xs:element name="view" type="types:View"/>\r
-                               <xs:element name="recurse" type="xs:boolean"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="getFolderListResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="folders" type="types:FolderList"/>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="getFreeBusyRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="freeBusySessionId" type="xs:string"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="getFreeBusyResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="freeBusyStats" type="types:FreeBusyStats"/>\r
-                               <xs:element name="freeBusyInfo" type="types:FreeBusyInfoList"/>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="getItemRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="id" type="types:uid"/>\r
-                               <xs:element name="view" type="types:View" nillable="true"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="getItemResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="item" type="types:Item"/>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="getItemsRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="container" type="types:uid"/>\r
-                               <xs:element name="view" type="types:View"/>\r
-                               <xs:element name="filter" type="types:Filter"/>\r
-                               <xs:element name="items" type="types:ItemRefList" minOccurs="0" maxOccurs="1"/>\r
-<!--                           <xs:element name="sort" type="types:Sort"/> -->\r
-                               <xs:element name="count" type="xs:int" default="-1"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="getItemsResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="items" type="types:Items"/>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="getQuickMessagesRequest">\r
-               <xs:annotation>\r
-                       <xs:documentation>\r
-                               This method provides a quicker access to mail items.\r
-                               It does this by only access fields that are stored in the\r
-                               database index. The fields in the index are: id, status, modified,\r
-                               container, message type, categories, subject, orignalSubject, and\r
-                               source.\r
-                               The New list is the fastest access.\r
-                               The Modified list is slower.\r
-                               The All list is the slowest.\r
-                               If you pass a startDate, the test is for any item that is newer\r
-                               than that date. (The list does not include that date.)\r
-                               If you don't pass a container string. The query will be across\r
-                               all folders.\r
-                               If you don't pass a types list, the query will be for all message\r
-                               types unless the container is the Calendar folder. In that case\r
-                               the default will be "CalendarItem. "CalendarItem" is a special\r
-                               case it represents Appointment, Note and Task.\r
-                               You can select the source types you want to see. If you don't\r
-                               specify a source, you will get received, draft and personal.\r
-                               If you don't specify a view, the above fields will be returned.\r
-                               If you specify other fields than the above fields, they will not\r
-                               be returned.\r
-                               You can restrict the number of items return by specifying a count.\r
-                               All items will be returned if no count is given.\r
-                               \r
-                       </xs:documentation>\r
-               </xs:annotation>\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="list" type="types:MessageList"/>\r
-                               <xs:element ref="types:startDate" minOccurs="0"/>\r
-                               <xs:element name="container" type="types:uid" minOccurs="0"/>\r
-                               <xs:element name="types" type="types:MessageTypeList" minOccurs="0"/>\r
-                               <xs:element name="source" type="types:ItemSourceList" minOccurs="0"/>\r
-                               <xs:element name="view" type="types:View" minOccurs="0"/>\r
-                               <xs:element name="count" type="xs:int" default="-1"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="getQuickMessagesResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="items" type="types:Items"/>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="getProxyAccessListRequest">\r
-       </xs:element>\r
-\r
-       <xs:element name="getProxyAccessListResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="accessRights" type="types:AccessRightList"/>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="getProxyListRequest">\r
-       </xs:element>\r
-\r
-       <xs:element name="getProxyListResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="proxies" type="types:ProxyList"/>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="getSettingsRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="id" type="xs:string" minOccurs="0" nillable="true"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="getSettingsResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="settings" type="types:Settings"/>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="getSignaturesRequest" />\r
-\r
-       <xs:element name="getSignaturesResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="signatures" type="types:Signatures"/>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="getTimezoneListRequest">\r
-       </xs:element>\r
-\r
-       <xs:element name="getTimezoneListResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="timezones" type="types:TimezoneList"/>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="loginRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="auth" type="types:Authentication"/>\r
-                               <xs:element name="language" type="xs:language"/>\r
-                               <xs:element name="version" type="xs:decimal"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="loginResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="session" type="xs:string"/>\r
-                               <xs:element name="userinfo" type="types:UserInfo"/>\r
-                               <xs:element name="gwVersion" type="xs:string"/>\r
-                               <xs:element name="redirectToHost" type="types:Host" minOccurs="0" maxOccurs="1"/>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="logoutRequest">\r
-       </xs:element>\r
-\r
-       <xs:element name="logoutResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="markPrivateRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="items" type="types:ItemRefList"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="markPrivateResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="markReadRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="items" type="types:ItemRefList"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="markReadResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="markUnPrivateRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="items" type="types:ItemRefList"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="markUnPrivateResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="markUnReadRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="items" type="types:ItemRefList"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="markUnReadResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="modifyItemRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="id" type="types:uid"/>\r
-                               <xs:element name="notification" type="types:SharedFolderNotification" minOccurs="0"/>\r
-                               <xs:element name="updates" type="types:ItemChanges"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="modifyItemResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element ref="types:modified" minOccurs="0"/>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="modifyItemsRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="item" type="types:ModifyItem" maxOccurs="unbounded"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="modifyItemsResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element ref="types:modified" minOccurs="0" maxOccurs="unbounded"/>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="modifyPasswordRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="old" type="xs:string" minOccurs="0"/>\r
-                               <xs:element name="new" type="xs:string" minOccurs="0"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="modifyPasswordResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="modifyProxyAccessRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="id" type="types:uid"/>\r
-                               <xs:element name="updates" type="types:AccessRightChanges"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="modifyProxyAccessResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="modifySettingsRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="settings" type="types:SettingsList"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="modifySettingsResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="modifySignaturesRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="updates" type="types:Signatures"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="modifySignaturesResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="moveItemRequest">\r
-               <xs:annotation>\r
-                       <xs:documentation>\r
-                               This method will link (copy) or move items into the container.\r
-                               To do a link (copy) do not supply a from container.\r
-                               To move item(s) from one container to another supply the from\r
-                               container id.\r
-                       </xs:documentation>\r
-               </xs:annotation>\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="id" type="types:uid"/>\r
-                               <xs:element name="container" type="types:uid"/>\r
-                               <xs:element name="from" type="types:uid" minOccurs="0"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="moveItemResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="positionCursorRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="container" type="types:uid"/>\r
-                               <xs:element name="cursor" type="xs:int"/>\r
-                               <xs:element name="seek" type="types:CursorSeek"/>\r
-                               <xs:element name="offset" type="xs:int"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="positionCursorResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="purgeDeletedItemsRequest">\r
-               <xs:annotation>\r
-                       <xs:documentation>\r
-                               This method permanently deletes all items that were previously\r
-                                  marked for deletion (i.e. stored in the "Trash").\r
-                       </xs:documentation>\r
-               </xs:annotation>\r
-               <xs:complexType>\r
-                       <xs:sequence/>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="purgeDeletedItemsResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="purgeRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="items" type="types:ItemRefList"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="purgeResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="readCursorRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="container" type="types:uid"/>\r
-                               <xs:element name="cursor" type="xs:int"/>\r
-                               <xs:element name="forward" type="xs:boolean" default="1"/>\r
-                               <xs:element name="count" type="xs:int"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="readCursorResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="items" type="types:ItemList"/>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="removeItemRequest">\r
-               <xs:annotation>\r
-                       <xs:documentation>\r
-                               If the container is not specified then the item is \r
-                                  removed from all of the containers that it is linked\r
-                                  to and is stored in the "Trash".\r
-                               If the container is specified then the item is only\r
-                                  removed from that specific container and it's link\r
-                                  is stored in the "Trash".\r
-                       </xs:documentation>\r
-               </xs:annotation>\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="container" type="types:uid" nillable="true"/>\r
-                               <xs:element name="id" type="types:uid"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="removeItemResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="removeItemsRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="container" type="types:uid"/>\r
-                               <xs:element name="items" type="types:ItemRefList"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="removeItemsResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="removeMembersRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="container" type="types:uid"/>\r
-                               <xs:element name="members" type="types:GroupMemberList"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="removeMembersResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="removeProxyAccessRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="id" type="types:uid"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="removeProxyAccessResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="removeSignatureRequest">\r
-               <xs:annotation>\r
-                       <xs:documentation>\r
-                               The signature will be purged when remove\r
-                               request completed. The missing id node or id\r
-                               length when it is not delete all signatures\r
-                               indicates the removing of plain text signature\r
-                               which resides in user's settings record.\r
-                       </xs:documentation>\r
-               </xs:annotation>\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="id" type="tns:uid" minOccurs="0"/>\r
-                               <xs:element name="all" type="xs:boolean" minOccurs="0"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="removeSignatureResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="replyRequest">\r
-               <xs:annotation>\r
-                       <xs:documentation>\r
-                               Replying to a message is a two step process.\r
-                               First you call the method with the id of the original item.\r
-                               A new mail item is returned.\r
-                               It has the orignal subject.\r
-                               The caller is responsible to prepend "Re:" or what ever they\r
-                               want to modify the original subject.\r
-                               If the caller wants the original message body returned, they need\r
-                               to supply message or message/RTF in the view.\r
-                               It is up to the caller to modify the message body in any way.\r
-                               When all of the changes to the returned mail item are complete,\r
-                               the caller would then call sendRequest with the new mail item.\r
-                               If the caller wants to reply to all recipeints of the original\r
-                               item, the caller needs to pass recipients in the view.\r
-                               If recipients is not in the view, the response will be addressed\r
-                               to the original sender.\r
-                               A linkInfo element is return in the mail item. That element needs\r
-                               to be passed unchanged in the sendRequest.\r
-                       </xs:documentation>\r
-               </xs:annotation>\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="id" type="types:uid"/>\r
-                               <xs:element name="view" type="types:View" nillable="true"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="replyResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="item" type="types:Item"/>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="retractRequest">\r
-               <xs:annotation>\r
-                       <xs:documentation>\r
-                               If a recipient has opened or accepted a Calendar item, a notice\r
-                               will be placed in the recipient's in-box when the item is\r
-                               retracted.  The notice can be affected by the following options:\r
-                               \r
-                               "comment":  The comment will be included in the notice.\r
-                               "retractCausedByResend": When TRUE, the notice will be suppressed\r
-                               in lieu of the 'new' calendar item that will be delivered to \r
-                               the recipient.\r
-                               "retractingAllInstances": When TRUE, a single notice will be \r
-                               placed in the recipient's in-box (instead of a notice for each\r
-                               instance).  \r
-                       </xs:documentation>\r
-               </xs:annotation>\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="items" type="types:ItemRefList"/>\r
-                               <xs:element name="comment" type="xs:string" minOccurs="0"/>\r
-                               <xs:element name="retractingAllInstances" type="xs:bool" minOccurs="0"/>\r
-                               <xs:element name="retractCausedByResend" type="xs:bool" minOccurs="0"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="retractResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="sendItemRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="item" type="types:Item"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="sendItemResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="id" type="types:ItemRefList"/>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="startFreeBusySessionRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="users" type="types:FreeBusyUserList"/>\r
-                               <xs:element name="startDate" type="xs:dateTime"/>\r
-                               <xs:element name="endDate" type="xs:dateTime"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="startFreeBusySessionResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="freeBusySessionId" type="xs:int"/>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="unacceptRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="items" type="types:ItemRefList"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="unacceptResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="uncompleteRequest">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="items" type="types:ItemRefList"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-       <xs:element name="uncompleteResponse">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="status" type="types:Status"/>\r
-                       </xs:sequence>\r
-               </xs:complexType>\r
-       </xs:element>\r
-\r
-</xs:schema>\r
diff --git a/servers/groupwise/doc/gw-soap-types.xsd b/servers/groupwise/doc/gw-soap-types.xsd
deleted file mode 100644 (file)
index 2903b44..0000000
+++ /dev/null
@@ -1,1591 +0,0 @@
-<?xml version="1.0" ?>\r
-<xs:schema\r
-       targetNamespace="http://schemas.novell.com/2003/10/NCSP/types.xsd"\r
-       xmlns:xs="http://www.w3.org/2001/XMLSchema"\r
-       xmlns:tns="http://schemas.novell.com/2003/10/NCSP/types.xsd">\r
-\r
-       <xs:element name="acceptLevel" type="tns:AcceptLevel"/>\r
-       <xs:element name="code" type="xs:int"/>\r
-       <xs:element name="description" type="xs:string"/>\r
-       <xs:element name="displayName" type="xs:string"/>\r
-       <xs:element name="email" type="xs:string"/>\r
-       <xs:element name="endDate" type="xs:dateTime"/>\r
-       <xs:element name="id" type="tns:uid"/>\r
-       <xs:element name="modified" type="xs:dateTime"/>\r
-       <xs:element name="name" type="xs:string"/>\r
-       <xs:element name="recurrenceKey" type="xs:unsignedInt"/>\r
-       <xs:element name="rights" type="tns:Rights"/>\r
-       <xs:element name="sequence" type="xs:unsignedInt"/>\r
-       <xs:element name="startDate" type="xs:dateTime"/>\r
-       <xs:element name="subject" type="xs:string"/>\r
-       <xs:element name="uuid" type="tns:UUID"/>\r
-       <xs:element name="version" type="xs:unsignedInt"/>\r
-\r
-       <xs:simpleType name="AcceptLevel">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="Free"/>\r
-                       <xs:enumeration value="Tentative"/>\r
-                       <xs:enumeration value="Busy"/>\r
-                       <xs:enumeration value="OutOfOffice"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="AccessControlListEntry">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:NameAndEmail">\r
-                               <xs:sequence>\r
-                                       <xs:element ref="tns:rights"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="AccessControlList">\r
-               <xs:sequence>\r
-                       <xs:element name="entry" type="tns:AccessControlListEntry" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="AccessMiscRight">\r
-               <xs:sequence>\r
-                       <xs:element name="alarms" type="xs:boolean" minOccurs="0"/>\r
-                       <xs:element name="notify" type="xs:boolean" minOccurs="0"/>\r
-                       <xs:element name="readHidden" type="xs:boolean" minOccurs="0"/>\r
-                       <xs:element name="setup" type="xs:boolean" minOccurs="0"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="AccessRight">\r
-               <xs:sequence>\r
-                       <xs:element name="read" type="xs:boolean" minOccurs="0"/>\r
-                       <xs:element name="write" type="xs:boolean" minOccurs="0"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="AccessRightChanges">\r
-               <xs:sequence>\r
-                       <xs:element name="add" type="tns:AccessRightEntry" minOccurs="0" maxOccurs="1"/>\r
-                       <xs:element name="delete" type="tns:AccessRightEntry" minOccurs="0" maxOccurs="1"/>\r
-                       <xs:element name="update" type="tns:AccessRightEntry" minOccurs="0" maxOccurs="1"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="AccessRightEntry">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:NameAndEmail">\r
-                               <xs:sequence>\r
-                                       <xs:element ref="tns:id" minOccurs="0"/>\r
-                                       <xs:element name="appointment" type="tns:AccessRight" minOccurs="0"/>\r
-                                       <xs:element name="mail" type="tns:AccessRight" minOccurs="0"/>\r
-                                       <xs:element name="misc" type="tns:AccessMiscRight" minOccurs="0"/>\r
-                                       <xs:element name="note" type="tns:AccessRight" minOccurs="0"/>\r
-                                       <xs:element name="task" type="tns:AccessRight" minOccurs="0"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="AccessRightList">\r
-               <xs:sequence>\r
-                       <xs:element name="entry" type="tns:AccessRightEntry" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="AddressBook">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:Item">\r
-                               <xs:sequence>\r
-                                       <xs:element ref="tns:description" minOccurs="0"/>\r
-                                       <xs:element name="isPersonal" type="xs:boolean" minOccurs="0"/>\r
-                                       <xs:element name="isFrequentContacts" type="xs:boolean" minOccurs="0"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="AddressBookItem">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:ContainerItem">\r
-                               <xs:sequence>\r
-                                       <xs:element ref="tns:uuid" minOccurs="0"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="AddressBookList">\r
-               <xs:sequence>\r
-                       <xs:element name="book" type="tns:AddressBook" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="Alarm">\r
-               <xs:simpleContent>\r
-                       <xs:extension base = "xs:int">\r
-                               <xs:attribute name="enabled" type="xs:boolean"/>\r
-                       </xs:extension>\r
-               </xs:simpleContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="Appointment">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:CalendarItem">\r
-                               <xs:sequence>\r
-                                       <xs:element ref="tns:endDate"/>\r
-                                       <xs:element ref="tns:acceptLevel"/>\r
-                                       <xs:element name="alarm" type="tns:Alarm" minOccurs="0"/>\r
-                                       <xs:element name="allDayEvent" type="xs:boolean" minOccurs="0"/>\r
-                                       <xs:element name="place" type="xs:string" minOccurs="0"/>\r
-                                       <xs:element name="timezone" type="tns:Timezone" minOccurs="0"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:simpleType name="AppointmentConflict">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="Yes"/>\r
-                       <xs:enumeration value="No"/>\r
-                       <xs:enumeration value="Ignore"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="AttachmentID">\r
-               <xs:simpleContent>\r
-                       <xs:extension base="tns:uid">\r
-                               <xs:attribute name="itemReference" type="xs:boolean"/>\r
-                       </xs:extension>\r
-               </xs:simpleContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="AttachmentInfo">\r
-               <xs:sequence>\r
-                       <xs:element name="attachment" type="tns:AttachmentItemInfo" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="AttachmentItemInfo">\r
-               <xs:sequence>\r
-                       <xs:element name="id" type="tns:AttachmentID" minOccurs="0"/>\r
-                       <xs:element ref="tns:name" minOccurs="0"/>\r
-                       <xs:element name="contentId" type="xs:string" minOccurs="0"/>\r
-                       <xs:element name="contentType" type="xs:string" minOccurs="0"/>\r
-                       <xs:element name="size" type="xs:unsignedInt" minOccurs="0"/>\r
-                       <xs:element name="date" type="xs:dateTime" minOccurs="0"/>\r
-                       <xs:element name="data" type="xs:base64Binary" minOccurs="0"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="Authentication">\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="BoxEntry">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:ContainerItem">\r
-                               <xs:sequence>\r
-                                       <xs:element name="status" type="tns:ItemStatus" minOccurs="0"/>\r
-                                       <xs:element name="thread" type="xs:string" minOccurs="0"/>\r
-                                       <xs:element name="msgid" type="xs:string" minOccurs="0"/>\r
-                                       <xs:element name="source" type="tns:ItemSource" minOccurs="0"/>\r
-               <xs:documentation>\r
-                  Return the sent items id if this returnSentItemsId is true.  The returnSentItemsId will be the first\r
-                  id returned in the list.  This is the id of the item that is created in the sent items \r
-                  (a.k.a. outbox, itemSource=sent) folder.\r
-               </xs:documentation>\r
-                                       <xs:element name="returnSentItemsId" type="xs:boolean" minOccurs="0"/>\r
-                                       <xs:element name="delivered" type="xs:dateTime"/>\r
-                                       <xs:element name="class" type="tns:ItemClass" minOccurs="0"/>\r
-                                       <xs:element name="security" type="tns:ItemSecurity" minOccurs="0"/>\r
-                                       <xs:element name="comment" type="xs:string" minOccurs="0"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="CalendarItem">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:Mail">\r
-                               <xs:sequence>\r
-                                       <xs:element ref="tns:startDate" minOccurs="0"/>\r
-                                       <xs:element name="rdate" type="tns:RecurrenceDateType" minOccurs="0"/>\r
-                                       <xs:element name="rrule" type="tns:RecurrenceRule" minOccurs="0"/>\r
-                                       <xs:element name="exdate" type="tns:RecurrenceDateType" minOccurs="0"/>\r
-                                       <xs:element ref="tns:recurrenceKey" minOccurs="0"/>\r
-                                       <xs:element name="iCalId" type="xs:string" minOccurs="0"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="Category">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:Item">\r
-                               <xs:sequence>\r
-                               <xs:element name="type" type="tns:CategoryType" minOccurs="0"/>\r
-                               <xs:element name="color" type="xs:unsignedInt" minOccurs="0"/>\r
-                       </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="CategoryList">\r
-               <xs:sequence>\r
-                       <xs:element name="category" type="tns:Category" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="CategoryRefList">\r
-               <xs:sequence>\r
-                       <xs:element name="category" type="tns:uid" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-               <xs:attribute name="primary" type="tns:uid"/>\r
-       </xs:complexType>\r
-\r
-       <xs:simpleType name="CategoryType">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="Normal"/>\r
-                       <xs:enumeration value="Personal"/>\r
-                       <xs:enumeration value="Follow-up"/>\r
-                       <xs:enumeration value="Urgent"/>\r
-                       <xs:enumeration value="LowPriority"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="CommentStatus">\r
-               <xs:simpleContent>\r
-                       <xs:extension base="xs:dateTime">\r
-                               <xs:attribute name="comment" type="xs:string"/>\r
-                       </xs:extension>\r
-               </xs:simpleContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="Contact">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:AddressBookItem">\r
-                               <xs:sequence>\r
-                                       <xs:element name="fullName" type="tns:FullName" minOccurs="0"/>\r
-                                       <xs:element name="emailList" type="tns:EmailAddressList" minOccurs="0"/>\r
-                                       <xs:element name="imList" type="tns:ImAddressList" minOccurs="0"/>\r
-                                       <xs:element name="phoneList" type="tns:PhoneList" minOccurs="0"/>\r
-                                       <xs:element name="addressList" type="tns:PostalAddressList" minOccurs="0"/>\r
-                                       <xs:element name="officeInfo" type="tns:OfficeInfo" minOccurs="0"/>\r
-                                       <xs:element name="personalInfo" type="tns:PersonalInfo" minOccurs="0"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="ContainerItem">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:Item">\r
-                               <xs:sequence>\r
-                                       <xs:element name="container" type="tns:ContainerRef" minOccurs="1" maxOccurs="unbounded"/>\r
-                                       <xs:element name="categories" type="tns:CategoryRefList" minOccurs="0"/>\r
-                                       <xs:element name="created" type="xs:dateTime" minOccurs="0"/>\r
-                                       <xs:element name="customs" type="tns:CustomList" minOccurs="0"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="ContainerRef">\r
-               <xs:simpleContent>\r
-                       <xs:extension base="xs:string">\r
-                               <xs:attribute name="deleted" type="xs:dateTime"/>\r
-                       </xs:extension>\r
-               </xs:simpleContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="ContactFolder">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:SystemFolder">\r
-                               <xs:sequence>\r
-                                       <xs:element name="addressBook" type="tns:uid" minOccurs="0"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:simpleType name="ContactType">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="Contact"/>\r
-                       <xs:enumeration value="Group"/>\r
-                       <xs:enumeration value="Resource"/>\r
-                       <xs:enumeration value="Organization"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:simpleType name="CursorSeek">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="current"/>\r
-                       <xs:enumeration value="start"/>\r
-                       <xs:enumeration value="end"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="Custom">\r
-               <xs:sequence>\r
-                       <xs:element name="field" type="xs:string"/>\r
-                       <xs:element name="value" type="xs:anyType" minOccurs="0"/>\r
-                       <xs:element name="locked" type="xs:boolean" minOccurs="0"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="CustomList">\r
-               <xs:sequence>\r
-                       <xs:element name="custom" type="tns:Custom" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:simpleType name="Day">\r
-               <xs:restriction base="xs:unsignedByte">\r
-                       <xs:maxInclusive value="30"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:simpleType name="DayOfMonth">\r
-               <xs:restriction base="xs:Byte">\r
-                       <xs:minInclusive value="-30"/>\r
-                       <xs:maxInclusive value="30"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="DayOfMonthList">\r
-               <xs:sequence>\r
-                       <xs:element name="day" type="tns:DayOfMonth" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="DayOfWeek">\r
-               <xs:simpleContent>\r
-                       <xs:extension base="tns:WeekDay">\r
-                               <xs:attribute name="occurrence" type="tns:OccurrenceType"/>\r
-                       </xs:extension>\r
-               </xs:simpleContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="DayOfWeekList">\r
-               <xs:sequence>\r
-                       <xs:element name="day" type="tns:DayOfWeek" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:simpleType name="DayOfYear">\r
-               <xs:restriction base="xs:integer">\r
-                       <xs:minInclusive value="-365"/>\r
-                       <xs:maxInclusive value="365"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="DayOfYearList">\r
-               <xs:sequence>\r
-                       <xs:element name="day" type="tns:DayOfYear" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="DelegatedStatus">\r
-               <xs:simpleContent>\r
-                       <xs:extension base="tns:CommentStatus">\r
-                               <xs:attribute name="userid" type="xs:string"/>\r
-                       </xs:extension>\r
-               </xs:simpleContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="DelegateeStatus">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:RecipientStatus">\r
-                               <xs:attribute name="userid" type="xs:string"/>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="Distribution">\r
-               <xs:sequence>\r
-                       <xs:element name="from" type="tns:From" minOccurs="0"/>\r
-                       <xs:element name="to" type="xs:string" minOccurs="0"/>\r
-                       <xs:element name="cc" type="xs:string" minOccurs="0"/>\r
-                       <xs:element name="recipients" type="tns:RecipientList"/>\r
-                       <xs:element name="sendoptions" type="tns:SendOptions" minOccurs="0"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:simpleType name="DistributionType">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="TO"/>\r
-                       <xs:enumeration value="CC"/>\r
-                       <xs:enumeration value="BC"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="DocumentRef">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:Mail">\r
-                               <xs:sequence>\r
-                                       <xs:element name="library" type="tns:NameAndEmail"/>\r
-                                       <xs:element name="number" type="xs:unsignedInt"/>\r
-                                       <xs:element name="filename" type="xs:string" minOccurs="0"/>\r
-                                       <xs:element name="docType" type="xs:string"/>\r
-                                       <xs:element name="author" type="tns:NameAndEmail"/>\r
-                                       <xs:element name="creator" type="tns:NameAndEmail"/>\r
-                                       <xs:element name="officialVersion" type="xs:unsignedInt"/>\r
-                                       <xs:element name="currentVersion" type="xs:unsignedInt"/>\r
-                                       <xs:element name="version" type="xs:unsignedInt"/>\r
-                                       <xs:element name="versionDescription" type="xs:string"/>\r
-                                       <xs:element name="fileSize" type="xs:unsignedInt" minOccurs="0"/>\r
-                                       <xs:element name="acl" type="tns:AccessControlList" minOccurs="0"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="EmailAddressList">\r
-               <xs:sequence>\r
-                       <xs:element ref="tns:email" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-               <xs:attribute name="primary" type="xs:string"/>\r
-       </xs:complexType>\r
-\r
-\r
-       <xs:simpleType name="Execution">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="Startup"/>\r
-                       <xs:enumeration value="Exit"/>\r
-                       <xs:enumeration value="New"/>\r
-                       <xs:enumeration value="FolderOpen"/>\r
-                       <xs:enumeration value="FolderClose"/>\r
-                       <xs:enumeration value="FolderNew"/>\r
-                       <xs:enumeration value="User"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="Filter">\r
-               <xs:sequence>\r
-                       <xs:element name="element" type="tns:FilterElement" minOccurs="0" maxOccurs="1"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="FilterElement">\r
-               <xs:sequence>\r
-                       <xs:element name="op" type="tns:FilterOp"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="FilterEntry">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:FilterElement">\r
-                               <xs:sequence>\r
-                                       <xs:element name="field" type="xs:string"/>\r
-                                       <xs:element name="value" type="xs:anyType"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="FilterGroup">\r
-               <xs:annotation>\r
-                       <xs:documentation>\r
-                               FilterGroup comprises FilterOp "and", "or" or "not"\r
-                       </xs:documentation>\r
-               </xs:annotation>\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:FilterElement">\r
-                               <xs:sequence>\r
-                                       <xs:element name="element" type="tns:FilterElement" minOccurs="1" maxOccurs="unbounded"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:simpleType name="FilterOp">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="and"/>\r
-                       <xs:enumeration value="or"/>\r
-                       <xs:enumeration value="not"/>\r
-                       <xs:enumeration value="eq"/>\r
-                       <xs:enumeration value="ne"/>\r
-                       <xs:enumeration value="gt"/>\r
-                       <xs:enumeration value="lt"/>\r
-                       <xs:enumeration value="gte"/>\r
-                       <xs:enumeration value="lte"/>\r
-                       <xs:enumeration value="contains"/>\r
-                       <xs:enumeration value="containsWord"/>\r
-                       <xs:enumeration value="begins"/>\r
-                       <xs:enumeration value="exists"/>\r
-                       <xs:enumeration value="notExist"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="Folder">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:Item">\r
-                               <xs:sequence>\r
-                                       <xs:element name="parent" type="tns:uid"/>\r
-                                       <xs:element ref="tns:description" minOccurs="0"/>\r
-                                       <xs:element name="count" type="xs:int" minOccurs="0"/>\r
-                                       <xs:element name="hasUnread" type="xs:boolean" minOccurs="0"/>\r
-                                       <xs:element name="unreadCount" type="xs:int" minOccurs="0"/>\r
-                                       <xs:element ref="tns:sequence" minOccurs="0"/>\r
-                                       <xs:element name="settings" type="tns:uid" minOccurs="0"/>\r
-                                       <xs:element name="hasSubfolders" type="xs:boolean" minOccurs="0"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="FolderACL">\r
-               <xs:sequence>\r
-                       <xs:element name="entry" type="tns:FolderACLEntry" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="FolderACLEntry">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:AccessControlListEntry">\r
-                               <xs:sequence>\r
-                                       <xs:element name="status" type="tns:FolderACLStatus"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:simpleType name="FolderACLStatus">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="pending"/>\r
-                       <xs:enumeration value="accepted"/>\r
-                       <xs:enumeration value="deleted"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="FolderList">\r
-               <xs:sequence>\r
-                       <xs:element name="folder" type="tns:Folder" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:simpleType name="FolderType">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="Mailbox"/>\r
-                       <xs:enumeration value="SentItems"/>\r
-                       <xs:enumeration value="WorkInProgress"/>\r
-                       <xs:enumeration value="Trash"/>\r
-                       <xs:enumeration value="Calendar"/>\r
-                       <xs:enumeration value="Contacts"/>\r
-                       <xs:enumeration value="Documents"/>\r
-                       <xs:enumeration value="Checklist"/>\r
-                       <xs:enumeration value="Cabinet"/>\r
-                       <xs:enumeration value="Normal"/>\r
-                       <xs:enumeration value="NNTP"/>\r
-                       <xs:enumeration value="IMAP"/>\r
-                       <xs:enumeration value="Query"/>\r
-                       <xs:enumeration value="JunkMail"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="FreeBusyBlockList">\r
-               <xs:sequence>\r
-                       <xs:element name="block" type="tns:FreeBusyBlock" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-       \r
-       <xs:complexType name="FreeBusyBlock">\r
-               <xs:sequence>\r
-                       <xs:element ref="tns:startDate"/>\r
-                       <xs:element ref="tns:endDate"/>\r
-                       <xs:element ref="tns:acceptLevel"/>\r
-                       <xs:element ref="tns:subject"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="FreeBusyInfo">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:FreeBusyUser">\r
-                               <xs:sequence>\r
-                                       <xs:element name="blocks" type="tns:FreeBusyBlockList"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="FreeBusyUserList">\r
-               <xs:sequence>\r
-                       <xs:element name="user" type="tns:FreeBusyUser" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="FreeBusyInfoList">\r
-               <xs:sequence>\r
-                       <xs:element name="user" type="tns:FreeBusyInfo" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="FreeBusyStats">\r
-               <xs:sequence>\r
-                       <xs:element name="responded" type="xs:int"/>\r
-                       <xs:element name="outstanding" type="xs:int"/>\r
-                       <xs:element name="total" type="xs:int"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="FreeBusyUser">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:NameAndEmail"/>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:simpleType name="Frequency">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="Daily"/>\r
-                       <xs:enumeration value="Weekly"/>\r
-                       <xs:enumeration value="Monthy"/>\r
-                       <xs:enumeration value="Yearly"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="From">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:NameAndEmail">\r
-                               <xs:sequence>\r
-                                       <xs:element name="replyTo" type="xs:string" minOccurs="0"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="FullName">\r
-               <xs:sequence>\r
-                       <xs:element ref="tns:displayName" minOccurs="0"/>\r
-                       <xs:element name="namePrefix" type="xs:string" minOccurs="0"/>\r
-                       <xs:element name="firstName" type="xs:string" minOccurs="0"/>\r
-                       <xs:element name="middleName" type="xs:string" minOccurs="0"/>\r
-                       <xs:element name="lastName" type="xs:string" minOccurs="0"/>\r
-                       <xs:element name="nameSuffix" type="xs:string" minOccurs="0"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:simpleType name="GMTOffset">\r
-               <xs:annotation>\r
-                       <xs:documentation>\r
-                               The number of seconds from GMT (UTC)\r
-                       </xs:documentation>\r
-               </xs:annotation>\r
-               <xs:restriction base="xs:int">\r
-                       <xs:minExclusive value="-86400"/>\r
-                       <xs:maxExclusive value="86400"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="Group">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:AddressBookItem">\r
-                               <xs:sequence>\r
-                                       <xs:element name="members" type="tns:GroupMemberList"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="GroupMember">\r
-               <xs:sequence>\r
-                       <xs:element ref="tns:id"/>\r
-                       <xs:element ref="tns:name" minOccurs="0"/>\r
-                       <xs:element ref="tns:email"/>\r
-                       <xs:element name="distType" type="tns:DistributionType" default="TO"/>\r
-                       <xs:element name="itemType" type="tns:ContactType" default="Contact"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="GroupMemberList">\r
-               <xs:sequence>\r
-                       <xs:element name="member" type="tns:GroupMember" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="Host">\r
-               <xs:sequence>\r
-                       <xs:element name="ipAddress" type="xs:string" minOccurs="0" maxOccurs="1"/>\r
-                       <xs:element name="port" type="xs:unsignedInt" minOccurs="0" maxOccurs="1"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:simpleType name="Hour">\r
-               <xs:restriction base="xs:unsignedByte">\r
-                       <xs:maxInclusive value="23"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="ImAddress">\r
-               <xs:sequence>\r
-                       <xs:element name="service" type="xs:string"/>\r
-                       <xs:element name="address" type="xs:string"/>\r
-                       <!-- type = work, home, etc. -->\r
-                       <xs:element name="type" type="xs:string"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="ImAddressList">\r
-               <xs:sequence>\r
-                       <xs:element name="im" type="tns:ImAddress" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="Item">\r
-               <xs:sequence>\r
-                       <xs:element ref="tns:id" minOccurs="0"/>\r
-                       <xs:element ref="tns:name" minOccurs="0"/>\r
-                       <xs:element ref="tns:version" minOccurs="0"/>\r
-                       <xs:element ref="tns:modified" minOccurs="0"/>\r
-                       <xs:element name="changes" type="tns:ItemChanges" minOccurs="0" maxOccurs="1"/>\r
-               </xs:sequence>\r
-               <xs:attribute name="type" type="xs:string"/>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="ItemChanges">\r
-               <xs:sequence>\r
-                       <xs:element name="add" type="tns:Item" minOccurs="0" maxOccurs="1"/>\r
-                       <xs:element name="delete" type="tns:Item" minOccurs="0" maxOccurs="1"/>\r
-                       <xs:element name="update" type="tns:Item" minOccurs="0" maxOccurs="1"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:simpleType name="ItemClass">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="Public"/>\r
-                       <xs:enumeration value="Private"/>\r
-                       <xs:enumeration value="Confidential"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="ItemList">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:Items">\r
-                               <xs:attribute name="offset" type="xs:int"/>\r
-                               <xs:attribute name="count" type="xs:int"/>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="ItemOptions">\r
-               <xs:sequence>\r
-                       <xs:element name="priority" type="tns:ItemOptionsPriority" minOccurs="0" default="Standard"/>\r
-                       <xs:element name="expires" type="xs:dateTime" minOccurs="0"/>\r
-                       <xs:element name="delayDeliveryUntil" type="xs:dateTime" minOccurs="0"/>\r
-                       <xs:element name="concealSubject" type="xs:boolean" minOccurs="0"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:simpleType name="ItemOptionsPriority">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="High"/>\r
-                       <xs:enumeration value="Standard"/>\r
-                       <xs:enumeration value="Low"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="ItemRef">\r
-               <xs:simpleContent>\r
-                       <xs:extension base="xs:string">\r
-                               <xs:attribute name="uid" type="tns:uid" use="optional"/>\r
-                       </xs:extension>\r
-               </xs:simpleContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="ItemRefList">\r
-               <xs:sequence>\r
-                       <xs:element name="item" type="tns:uid" minOccurs="1" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="Items">\r
-               <xs:sequence>\r
-                       <xs:element name="item" type="tns:Item" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:simpleType name="ItemSecurity">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="Normal"/>\r
-                       <xs:enumeration value="Proprietary"/>\r
-                       <xs:enumeration value="Confidential"/>\r
-                       <xs:enumeration value="Secret"/>\r
-                       <xs:enumeration value="TopSecret"/>\r
-                       <xs:enumeration value="ForYourEyesOnly"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:simpleType name="ItemSource">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="received"/>\r
-                       <xs:enumeration value="sent"/>\r
-                       <xs:enumeration value="draft"/>\r
-                       <xs:enumeration value="personal"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:simpleType name="ItemSourceList">\r
-         <xs:list itemType="ItemSource"/>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="ItemStatus">\r
-               <xs:sequence>\r
-                       <xs:element name="accepted" type="xs:boolean" minOccurs="0"/>\r
-                       <xs:element name="completed" type="xs:boolean" minOccurs="0"/>\r
-                       <xs:element name="delegated" type="xs:boolean" minOccurs="0"/>\r
-                       <xs:element name="deleted" type="xs:boolean" minOccurs="0"/>\r
-                       <xs:element name="forwarded" type="xs:boolean" minOccurs="0"/>\r
-                       <xs:element name="opened" type="xs:boolean" minOccurs="0"/>\r
-                       <xs:element name="read" type="xs:boolean" minOccurs="0"/>\r
-                       <xs:element name="replied" type="xs:boolean" minOccurs="0"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="LinkInfo">\r
-               <xs:sequence>\r
-                       <xs:element name="id" type="xs:string"/>\r
-                       <xs:element name="type" type="tns:LinkType"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:simpleType name="LinkType">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="forward"/>\r
-                       <xs:enumeration value="reply"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="Mail">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:BoxEntry">\r
-                               <xs:sequence>\r
-                                       <xs:element ref="tns:subject"/>\r
-                                       <xs:element name="originalSubject" type="xs:string" minOccurs="0"/>\r
-                                       <xs:element name="subjectPrefix" type="xs:string" minOccurs="0"/>\r
-                                       <xs:element name="distribution" type="tns:Distribution"/>\r
-                                       <xs:element name="message" type="tns:MessageBody" minOccurs="0"/>\r
-                                       <xs:element name="attachments" type="tns:AttachmentInfo" minOccurs="0"/>\r
-                                       <xs:element name="options" type="tns:ItemOptions" minOccurs="0"/>\r
-                                       <xs:element name="link" type="tns:LinkInfo" minOccurs="0"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:annotation>\r
-               <xs:documentation>\r
-                       Currently there is only one MessageBody part. The MessageBody part is\r
-                       the text plain message body. The HTML message body will be an\r
-                       attachment with a name "text.htm". The HTML message body can have\r
-                       related part attachments. They are related if they come immediatelly\r
-                       after the "text.htm" attachment and they have a "contentId" element.\r
-               </xs:documentation>\r
-       </xs:annotation>\r
-       <xs:complexType name="MessageBody">\r
-               <xs:sequence>\r
-                       <xs:element name="part" type="tns:MessagePart" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-        <xs:simpleType name="MessageList">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="All"/>\r
-                       <xs:enumeration value="Modified"/>\r
-                       <xs:enumeration value="New"/>\r
-               </xs:restriction>\r
-        </xs:simpleType>\r
-\r
-       <xs:complexType name="MessagePart">\r
-               <xs:simpleContent>\r
-                       <xs:extension base="xs:base64Binary">\r
-                               <xs:attribute name="contentId" type="xs:string" minOccurs="0"/>\r
-                               <xs:attribute name="contentType" type="xs:string"/>\r
-                               <xs:attribute name="length" type="xs:int"/>\r
-                       </xs:extension>\r
-               </xs:simpleContent>\r
-       </xs:complexType>\r
-\r
-        <xs:simpleType name="MessageType">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="Appointment"/>\r
-                       <xs:enumeration value="CalendarItem"/>\r
-                       <xs:enumeration value="DocumentReference"/>\r
-                       <xs:enumeration value="Mail"/>\r
-                       <xs:enumeration value="Note"/>\r
-                       <xs:enumeration value="PhoneMessage"/>\r
-                       <xs:enumeration value="Task"/>\r
-               </xs:restriction>\r
-        </xs:simpleType>\r
-\r
-       <xs:simpleType name="MessageTypeList">\r
-         <xs:list itemType="MessageType"/>\r
-       </xs:simpleType>\r
-\r
-       <xs:simpleType name="Minute">\r
-               <xs:restriction base="xs:unsignedByte">\r
-                       <xs:maxInclusive value="59"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="ModifyItem">\r
-               <xs:sequence>\r
-                       <xs:element name="id" type="types:uid"/>\r
-                       <xs:element name="notification" type="types:SharedFolderNotification" minOccurs="0"/>\r
-                       <xs:element name="updates" type="types:ItemChanges"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:simpleType name="Month">\r
-               <xs:restriction base="xs:unsignedByte">\r
-                       <xs:maxInclusive value="11"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="MonthList">\r
-               <xs:sequence>\r
-                       <xs:element name="month" type="tns:Month" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="NameAndEmail">\r
-               <xs:sequence>\r
-                       <xs:element ref="tns:displayName" minOccurs="0"/>\r
-                       <xs:element ref="tns:email" minOccurs="0"/>\r
-                       <xs:element ref="tns:uuid" minOccurs="0"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="Note">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:CalendarItem"/>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:simpleType name="NotificationType">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="SharedAddressBook"/>\r
-                       <xs:enumeration value="SharedFolder"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:simpleType name="OccurrenceType">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="First"/>\r
-                       <xs:enumeration value="Second"/>\r
-                       <xs:enumeration value="Third"/>\r
-                       <xs:enumeration value="Fourth"/>\r
-                       <xs:enumeration value="Fifth"/>\r
-                       <xs:enumeration value="Last"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="OfficeInfo">\r
-               <xs:sequence>\r
-                       <xs:element name="organization" type="tns:ItemRef" minOccurs="0"/>\r
-                       <xs:element name="department" type="xs:string" minOccurs="0"/>\r
-                       <xs:element name="title" type="xs:string" minOccurs="0"/>\r
-                       <xs:element name="website" type="xs:anyURI" minOccurs="0"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="Organization">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:AddressBookItem">\r
-                               <xs:sequence>\r
-                                       <xs:element name="contact" type="tns:ItemRef" minOccurs="0"/>\r
-                                       <xs:element name="phone" type="xs:string" minOccurs="0"/>\r
-                                       <xs:element name="fax" type="xs:string" minOccurs="0"/>\r
-                                       <xs:element name="address" type="tns:PostalAddress" minOccurs="0"/>\r
-                                       <xs:element name="website" type="xs:anyURI" minOccurs="0"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="PersonalInfo">\r
-               <xs:sequence>\r
-                       <xs:element name="birthday" type="xs:date" nillable="true" minOccurs="0"/>\r
-                       <xs:element name="website" type="xs:anyURI" minOccurs="0"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="PhoneFlags">\r
-               <xs:sequence>\r
-                       <xs:element name="called" type="xs:boolean" minOccurs="0"/>\r
-                       <xs:element name="pleaseCall" type="xs:boolean" minOccurs="0"/>\r
-                       <xs:element name="willCall" type="xs:boolean" minOccurs="0"/>\r
-                       <xs:element name="returnedYourCall" type="xs:boolean" minOccurs="0"/>\r
-                       <xs:element name="wantsToSeeYou" type="xs:boolean" minOccurs="0"/>\r
-                       <xs:element name="cameToSeeYou" type="xs:boolean" minOccurs="0"/>\r
-                       <xs:element name="urgent" type="xs:boolean" minOccurs="0"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="PhoneList">\r
-               <xs:sequence>\r
-                       <xs:element name="phone" type="tns:PhoneNumber" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-               <xs:attribute name="default" type="xs:string"/>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="PhoneMessage">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:Mail">\r
-                               <xs:sequence>\r
-                                       <xs:element name="caller" type="xs:string" minOccurs="0"/>\r
-                                       <xs:element name="company" type="xs:string" minOccurs="0"/>\r
-                                       <xs:element name="phone" type="xs:string" minOccurs="0"/>\r
-                                       <xs:element name="flags" type="tns:PhoneFlags" minOccurs="0"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="PhoneNumber">\r
-               <xs:simpleContent>\r
-                       <xs:extension base="xs:string">\r
-                               <xs:attribute name="type" type="tns:PhoneNumberType" use="required"/>\r
-                       </xs:extension>\r
-               </xs:simpleContent>\r
-       </xs:complexType>\r
-\r
-       <xs:simpleType name="PhoneNumberType">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="Fax" /> \r
-                       <xs:enumeration value="Home" /> \r
-                       <xs:enumeration value="Mobile" /> \r
-                       <xs:enumeration value="Office" /> \r
-                       <xs:enumeration value="Pager" /> \r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="PlainText">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:Authentication">\r
-                               <xs:sequence>\r
-                                       <xs:element name="username" type="xs:string"/>\r
-                                       <xs:element name="password" type="xs:string" minOccurs="0"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="PostalAddress">\r
-               <xs:sequence>\r
-                       <xs:element ref="tns:description" minOccurs="0"/>\r
-                       <xs:element name="streetAddress" type="xs:string" minOccurs="0"/>\r
-                       <xs:element name="location" type="xs:string" minOccurs="0"/>\r
-                       <xs:element name="city" type="xs:string" minOccurs="0"/>\r
-                       <xs:element name="state" type="xs:string" minOccurs="0"/>\r
-                       <xs:element name="postalCode" type="xs:string" minOccurs="0"/>\r
-                       <xs:element name="country" type="xs:string" minOccurs="0"/>\r
-               </xs:sequence>\r
-               <xs:attribute name="type" type="tns:PostalAddressType" use="required"/>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="PostalAddressList">\r
-               <xs:sequence>\r
-                       <xs:element name="address" type="tns:PostalAddress" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:simpleType name="PostalAddressType">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="Home"/>\r
-                       <xs:enumeration value="Office"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="ProblemEntry">\r
-               <xs:sequence>\r
-                       <xs:element name="element" type="xs:string" minOccurs="0"/>\r
-                       <xs:element ref="tns:code" minOccurs="0"/>\r
-                       <xs:element ref="tns:description" minOccurs="0"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="ProblemList">\r
-               <xs:sequence>\r
-                       <xs:element name="entry" type="tns:ProblemEntry" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="Proxy">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:Authentication">\r
-                               <xs:sequence>\r
-                                       <xs:element name="username" type="xs:string"/>\r
-                                       <xs:element name="proxy" type="xs:string"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="ProxyList">\r
-               <xs:sequence>\r
-                       <xs:element name="proxy" type="tns:NameAndEmail" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="Query">\r
-               <xs:sequence>\r
-                       <xs:element name="target" type="tns:QueryTarget"/>\r
-                       <xs:element name="filter" type="tns:Filter"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="QueryFolder">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:Folder">\r
-                               <xs:sequence>\r
-                                       <xs:element name="query" type="tns:Query" minOccurs="0"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="QueryTarget">\r
-               <xs:sequence>\r
-                       <xs:element name="source" type="tns:uid" minOccurs="0" maxOccurs="1"/>\r
-                       <xs:element name="container" type="tns:uid" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="Recipient">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:NameAndEmail">\r
-                               <xs:sequence>\r
-                                       <xs:element name="distType" type="tns:DistributionType"/>\r
-                                       <xs:element name="recipType" type="tns:RecipientType"/>\r
-                                       <xs:element name="recipientStatus" type="tns:RecipientStatus" minOccurs="0" maxOccurs="1"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="RecipientList">\r
-               <xs:sequence>\r
-                       <xs:element name="recipient" type="tns:Recipient" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="RecipientStatus">\r
-               <xs:sequence>\r
-                       <xs:element name="delivered" type="xs:dateTime" minOccurs="0"/>\r
-                       <xs:element name="undeliverable" type="xs:dateTime" minOccurs="0"/>\r
-                       <xs:element name="transferred" type="xs:dateTime" minOccurs="0"/>\r
-                       <xs:element name="transferDelayed" type="xs:dateTime" minOccurs="0"/>\r
-                       <xs:element name="downloaded" type="xs:dateTime" minOccurs="0"/>\r
-                       <xs:element name="downloadedByThirdParty" type="xs:dateTime" minOccurs="0"/>\r
-                       <xs:element name="retractRequested" type="xs:dateTime" minOccurs="0"/>\r
-                       <xs:element name="retracted" type="xs:dateTime" minOccurs="0"/>\r
-                       <xs:element name="opened" type="xs:dateTime" minOccurs="0"/>\r
-                       <xs:element name="deleted" type="xs:dateTime" minOccurs="0"/>\r
-                       <xs:element name="undeleted" type="xs:dateTime" minOccurs="0"/>\r
-                       <xs:element name="purged" type="xs:dateTime" minOccurs="0"/>\r
-                       <xs:element name="accepted" type="tns:CommentStatus" minOccurs="0"/>\r
-                       <xs:element name="declined" type="tns:CommentStatus" minOccurs="0"/>\r
-                       <xs:element name="replied" type="xs:dateTime" minOccurs="0"/>\r
-                       <xs:element name="forwarded" type="xs:dateTime" minOccurs="0"/>\r
-                       <xs:element name="shared" type="xs:dateTime" minOccurs="0"/>\r
-                       <xs:element name="started" type="xs:dateTime" minOccurs="0"/>\r
-                       <xs:element name="completed" type="xs:dateTime" minOccurs="0"/>\r
-                       <xs:element name="incomplete" type="xs:dateTime" minOccurs="0"/>\r
-                       <xs:element name="delegated" type="tns:DelegatedStatus" minOccurs="0"/>\r
-                       <xs:element name="delegateeStatus" type="tns:DelegateeStatus" minOccurs="0"/> <!-- USERID property specifies delegatee -->\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:simpleType name="RecipientType">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="User"/>\r
-                       <xs:enumeration value="Resource"/>\r
-                       <xs:enumeration value="PersonalGroup"/>\r
-                       <xs:enumeration value="SystemGroup"/>\r
-                       <xs:enumeration value="PersonalGroupMember"/>\r
-                       <xs:enumeration value="SystemGroupMember"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="RecurrenceDateType">\r
-        <xs:sequence>\r
-         <xs:element name="date" type="xs:date" maxOccurs="unbounded"/>\r
-        </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="RecurrenceRule">\r
-               <xs:annotation>\r
-                       <xs:documentation>\r
-                               This is the same logic as iCalander (RFC 2445).\r
-                       </xs:documentation>\r
-               </xs:annotation>\r
-               <xs:complexContent>\r
-                       <xs:sequence>\r
-                               <xs:element name="frequency" type="tns:Frequency"/>\r
-                               <xs:choice>\r
-                                       <xs:element name="count" type="xs:unsignedInt" minOccurs="0"/>\r
-                                       <xs:element name="until" type="xs:date" minOccurs="0"/>\r
-                               </xs:choice>\r
-                               <xs:element name="interval" type="xs:unsignedInt" minOccurs="0"/>\r
-                               <xs:element name="byDay" type="tns:DayOfWeekList" minOccurs="0"/>\r
-                               <xs:element name="byMonthDay" type="tns:DayOfMonthList" minOccurs="0"/>\r
-                               <xs:element name="byYearDay" type="tns:DayOfYearList" minOccurs="0"/>\r
-                               <xs:element name="byMonth" type="tns:MonthList" minOccurs="0"/>\r
-                </xs:sequence>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="Resource">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:AddressBookItem">\r
-                               <xs:sequence>\r
-                                       <xs:element name="phone" type="xs:string" minOccurs="0"/>\r
-                                       <xs:element name="resourceType" type="xs:string" minOccurs="0"/>\r
-                                       <xs:element ref="tns:email" minOccurs="0"/>\r
-                                       <xs:element name="owner" type="tns:ItemRef" minOccurs="0"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="ReturnNotification">\r
-               <xs:annotation>\r
-                       <xs:documentation>\r
-                               A calendar item will have opened, accepted and decliened (not deleted)\r
-                               A box entry item will have opened and deleted\r
-                       </xs:documentation>\r
-               </xs:annotation>\r
-               <xs:sequence>\r
-                       <xs:element name="opened" type="tns:ReturnNotificationOptions" minOccurs="0"/>\r
-                       <xs:element name="deleted" type="tns:ReturnNotificationOptions" minOccurs="0"/>\r
-                       <xs:element name="accepted" type="tns:ReturnNotificationOptions" minOccurs="0"/>\r
-                       <xs:element name="declined" type="tns:ReturnNotificationOptions" minOccurs="0"/>\r
-                       <xs:element name="completed" type="tns:ReturnNotificationOptions" minOccurs="0"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="ReturnNotificationOptions">\r
-               <xs:sequence>\r
-                       <xs:element name="mail" type="xs:boolean" default="false"/>\r
-                       <xs:element name="notify" type="xs:boolean" default="false"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="Rights">\r
-               <xs:all>\r
-                       <xs:element name="read" type="xs:boolean" minOccurs="0"/>\r
-                       <xs:element name="add" type="xs:boolean" minOccurs="0"/>\r
-                       <xs:element name="edit" type="xs:boolean" minOccurs="0"/>\r
-                       <xs:element name="delete" type="xs:boolean" minOccurs="0"/>\r
-                       <xs:element name="share" type="xs:boolean" minOccurs="0"/>\r
-                       <xs:element name="manage" type="xs:boolean" minOccurs="0"/>\r
-               </xs:all>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="SendOptionsRequestReply">\r
-      <xs:element name="whenConvenient" type="xs:boolean" minOccurs="0"/>\r
-      <xs:element name="byDate" type="xs:dateTime" minOccurs="0"/>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="SendOptions">\r
-               <xs:sequence>\r
-                       <xs:element name="requestReply" type="tns:SendOptionsRequestReply" minOccurs="0"/>\r
-                       <xs:element name="mimeEncoding" type="xs:string" minOccurs="0"/>\r
-                       <xs:element name="statusTracking" type="tns:StatusTracking" minOccurs="0"/>\r
-                       <xs:element name="notification" type="tns:ReturnNotification" minOccurs="0"/>\r
-                       <xs:element name="updateFrequentContacts" type="xs:boolean" minOccurs="0" default="true"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="Rule">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:ContainerItem">\r
-                               <xs:sequence>\r
-                                       <xs:element name="execution" type="tns:Execution" minOccurs="0"/>\r
-                                       <xs:element ref="tns:sequence"/>\r
-                                       <xs:element name="types" type="tns:MessageTypeList" minOccurs="0"/>\r
-                                       <xs:element name="source" type="tns:ItemSourceList" minOccurs="0"/>\r
-                                       <xs:element name="conflict" type="tns:AppointmentConflict" minOccurs="0" default="Ignore"/>\r
-                                       <xs:element name="filter" type="tns:Filter" minOccurs="0"/>\r
-                                       <xs:element name="actions" type="tns:RuleActionList" minOccurs="0"/>\r
-                               </xs:sequence>\r
-                               <xs:attribute name="enabled" type="xs:boolean" default="false"/>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="RuleAction">\r
-               <xs:sequence>\r
-                       <xs:element name="type" type="tns:RuleActionType"/>\r
-                       <xs:element name="container" type="tns:uid" minOccurs="0"/>\r
-                       <xs:element name="item" type="tns:Mail" minOccurs="0"/>\r
-                       <xs:element name="message" type="xs:string" minOccurs="0"/>\r
-                       <xs:element ref="tns:acceptLevel" minOccurs="0"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="RuleActionList">\r
-               <xs:sequence>\r
-                       <xs:element name="action" type="tns:RuleAction" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:simpleType name="RuleActionType">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="Accept"/>\r
-                       <xs:enumeration value="Delegate"/>\r
-                       <xs:enumeration value="Delete"/>\r
-                       <xs:enumeration value="Forward"/>\r
-                       <xs:enumeration value="Link"/>\r
-                       <xs:enumeration value="MarkPrivate"/>\r
-                       <xs:enumeration value="MarkRead"/>\r
-                       <xs:enumeration value="MarkUnread"/>\r
-                       <xs:enumeration value="Move"/>\r
-                       <xs:enumeration value="Purge"/>\r
-                       <xs:enumeration value="Reply"/>\r
-                       <xs:enumeration value="Send"/>\r
-                       <xs:enumeration value="StopRules"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="Settings">\r
-               <xs:sequence>\r
-                       <xs:element name="group" type="tns:SettingsGroup" minOccurs="0" maxOccurs="unbounded"/>\r
-                       <xs:element name="setting" type="tns:Custom" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="SettingsGroup">\r
-               <xs:sequence>\r
-                       <xs:element name="setting" type="tns:Custom" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-               <xs:attribute name="type" type="xs:string"/>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="SettingsList">\r
-               <xs:sequence>\r
-                       <xs:element name="setting" type="tns:Custom" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="SharedFolder">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:Folder">\r
-                               <xs:sequence>\r
-                                       <xs:element ref="tns:rights" minOccurs="0"/>\r
-                                       <xs:element name="acl" type="tns:FolderACL" minOccurs="0"/>\r
-                                       <xs:element name="owner" type="tns:UUID" minOccurs="0"/>\r
-                                       <xs:element name="isSharedByMe" type="xs:boolean" minOccurs="0"/>\r
-                                       <xs:element name="isSharedToMe" type="xs:boolean" minOccurs="0"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="SharedFolderNotification">\r
-               <xs:sequence>\r
-                       <xs:element ref="tns:subject" minOccurs="0"/>\r
-                       <xs:element name="message" type="xs:string" minOccurs="0"/>\r
-                       <xs:element ref="tns:description" minOccurs="0"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="SharedNotification">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:Mail">\r
-                               <xs:sequence>\r
-                                       <xs:element name="notification" type ="tns:NotificationType" minOccurs="1"/>\r
-                                       <xs:element ref="tns:description" minOccurs="0"/>\r
-                                       <xs:element ref="tns:rights" minOccurs="0"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="Signature">\r
-               <xs:sequence>\r
-                       <xs:element name="id" type="tns:uid" minOccurs="0"/>\r
-                       <xs:element ref="tns:name" minOccurs="0"/>\r
-                       <xs:element name="type" type="tns:SignatureType" minOccurs="0"/>\r
-                       <xs:element name="default" type="tns:SignatureDefault" minOccurs="0"/>\r
-                       <xs:element name="part" type="tns:SignatureData" minOccurs="0"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="Signatures">\r
-               <xs:sequence>\r
-                       <xs:element name="signature" type="tns:Signature" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:simpleType name="SignatureDefault">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="system"/>\r
-                       <xs:enumeration value="HTML"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="SignatureData">\r
-               <xs:sequence>\r
-                       <xs:element name="size" type="xs:unsignedInt" minOccurs="0"/>\r
-                       <xs:element name="data" type="xs:base64Binary" minOccurs="0"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:simpleType name="SignatureType">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="PlainText"/>\r
-                       <xs:enumeration value="HTML"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="Status">\r
-               <xs:sequence>\r
-                       <xs:element ref="tns:code"/>\r
-                       <xs:element ref="tns:description" minOccurs="0"/>\r
-                       <xs:element name="info" type="xs:string" minOccurs="0"/>\r
-                       <xs:element name="problems" type="tns:ProblemList" minOccurs="0"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="StatusTracking">\r
-               <xs:simpleContent>\r
-                       <xs:extension base="tns:StatusTrackingOptions">\r
-                               <xs:attribute name="autoDelete" type="xs:boolean" default="false"/>\r
-                       </xs:extension>\r
-               </xs:simpleContent>\r
-       </xs:complexType>\r
-\r
-       <xs:simpleType name="StatusTrackingOptions">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="None"/>\r
-                       <xs:enumeration value="Delivered"/>\r
-                       <xs:enumeration value="DeliveredAndOpened"/>\r
-                       <xs:enumeration value="All"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="SystemFolder">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:Folder">\r
-                               <xs:sequence>\r
-                                       <xs:element name="isSystemFolder" type="xs:boolean" minOccurs="0"/>\r
-                                       <xs:element name="type" type="tns:FolderType"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="Task">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:CalendarItem">\r
-                               <xs:sequence>\r
-                                       <xs:element name="dueDate" type="xs:date"/>\r
-                                       <xs:element name="taskPriority" type="xs:string" minOccurs="0"/>\r
-                                       <xs:element name="completed" type="xs:boolean" minOccurs="0"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="Timezone">\r
-               <xs:sequence>\r
-                       <xs:element name="id" type="xs:string"/>\r
-                       <xs:element ref="tns:description"/>\r
-                       <xs:element name="daylight" type="tns:TimezoneComponent" minOccurs="0" maxOccurs="1"/>\r
-                       <xs:element name="standard" type="tns:TimezoneComponent"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="TimezoneComponent">\r
-               <xs:sequence>\r
-                       <xs:element name="name" type="xs:string"/>\r
-                       <xs:element name="month" type="tns:Month" minOccurs="0"/>\r
-                       <xs:choice>\r
-                               <xs:element name="day" type="tns:Day" minOccurs="0"/>\r
-                               <xs:element name="dayOfWeek" type="tns:DayOfWeek" minOccurs="0"/>\r
-                       </xs:choice>\r
-                       <xs:element name="hour" type="tns:Hour" minOccurs="0"/>\r
-                       <xs:element name="minute" type="tns:Minute" minOccurs="0"/>\r
-                       <xs:element name="offset" type="tns:GMTOffset"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="TimezoneList">\r
-               <xs:sequence>\r
-                       <xs:element name="timezone" type="tns:Timezone" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:complexType name="TrustedApplication">\r
-               <xs:complexContent>\r
-                       <xs:extension base="tns:Authentication">\r
-                               <xs:sequence>\r
-                                       <xs:element name="username" type="xs:string"/>\r
-                                       <xs:element name="name" type="xs:string"/>\r
-                                       <xs:element name="key" type="xs:string"/>\r
-                               </xs:sequence>\r
-                       </xs:extension>\r
-               </xs:complexContent>\r
-       </xs:complexType>\r
-\r
-       <xs:simpleType name="uid">\r
-               <xs:annotation>\r
-                       <xs:documentation>\r
-                               The unique identifier is a application defined\r
-                               string to uniquely identify an item. The string\r
-                               can optionally consist of two parts. The first\r
-                               part identifies a unique existence of an item. \r
-                               The second part of the string optionally specifies\r
-                               instance information. The first and second part of \r
-                               the ID are separated by an '@'. For this reason \r
-                               neither the first nor second part can contain an \r
-                               '@' symbol.\r
-                               \r
-                               To determine whether or not two items are the \r
-                               same item, the consumer of this API should \r
-                               compare the first part of the ids of the two\r
-                               items (i.e. all of the id up to the @ symbol).\r
-                       </xs:documentation>\r
-               </xs:annotation>\r
-               <xs:restriction base="xs:string">\r
-                       <xs:pattern value="[^@]+(@*)?"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-\r
-       <xs:complexType name="UserInfo">\r
-               <xs:sequence>\r
-                       <xs:element ref="tns:name"/>\r
-                       <xs:element ref="tns:email" minOccurs="0"/>\r
-                       <xs:element ref="tns:uuid" minOccurs="0"/>\r
-                       <xs:any/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-\r
-       <xs:simpleType name="UUID">\r
-               <xs:annotation>\r
-                       <xs:documentation>\r
-                               The UUID is the unique user ID on a given \r
-                               email system. This is used in various \r
-                               places to indicate that a sender or recipient\r
-                               is an user internal to the collaboration\r
-                               system instead of an external user (i.e. \r
-                               internet address).\r
-                       </xs:documentation>\r
-               </xs:annotation>\r
-               <xs:restriction base="xs:string"/>\r
-       </xs:simpleType>\r
-\r
-       <xs:simpleType name="View">\r
-               <xs:list itemType="xs:string"/>\r
-       </xs:simpleType>\r
-\r
-       <xs:simpleType name="WeekDay">\r
-               <xs:restriction base="xs:string">\r
-                       <xs:enumeration value="Sunday"/>\r
-                       <xs:enumeration value="Monday"/>\r
-                       <xs:enumeration value="Tuesday"/>\r
-                       <xs:enumeration value="Wednesday"/>\r
-                       <xs:enumeration value="Thursday"/>\r
-                       <xs:enumeration value="Friday"/>\r
-                       <xs:enumeration value="Saturday"/>\r
-               </xs:restriction>\r
-       </xs:simpleType>\r
-</xs:schema>\r
diff --git a/servers/groupwise/e-gw-connection.c b/servers/groupwise/e-gw-connection.c
deleted file mode 100644 (file)
index a4e281e..0000000
+++ /dev/null
@@ -1,4174 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors :
- *  JP Rosevear <jpr@ximian.com>
- *  Rodrigo Moya <rodrigo@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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 <ctype.h>
-#include <glib/gi18n-lib.h>
-#include <libedataserver/e-proxy.h>
-#include <libsoup/soup.h>
-#include "soup-soap-message.h"
-#include "e-gw-connection.h"
-#include "e-gw-message.h"
-#include "e-gw-filter.h"
-#include "build-timestamp.h"
-
-/* For soup sync session timeout */
-#define GW_SOUP_SESSION_TIMEOUT 30
-
-/* Soup session proxy-uri property */
-#define SOUP_SESSION_PROXY_URI "proxy-uri"
-
-G_DEFINE_TYPE (EGwConnection, e_gw_connection, G_TYPE_OBJECT)
-
-static GObjectClass *parent_class = NULL;
-static GHashTable *loaded_connections_permissions = NULL;
-
-struct _EGwConnectionPrivate {
-       SoupSession *soup_session;
-
-       gchar *uri;
-       gchar *username;
-       gchar *password;
-       gchar *session_id;
-       gchar *user_name;
-       gchar *user_email;
-       gchar *user_uuid;
-       gchar *version;
-       gchar *server_time;
-       GHashTable *categories_by_name;
-       GHashTable *categories_by_id;
-       GList *book_list;
-       EGwSendOptions *opts;
-       GMutex *reauth_mutex;
-       GMutex *msg_lock;
-       EProxy *proxy;
-};
-
-static void
-update_soup_session_proxy_settings (EProxy *proxy, SoupSession* session,
-                                   const gchar * uri)
-{
-       SoupURI *proxy_uri = NULL;
-
-       if (!session || !uri || !proxy)
-               return;
-
-       if (e_proxy_require_proxy_for_uri (proxy, uri))
-               proxy_uri = e_proxy_peek_uri_for (proxy, uri);
-
-       g_object_set (session, SOUP_SESSION_PROXY_URI,
-                     proxy_uri, NULL);
-}
-
-static void
-proxy_settings_changed (EProxy *proxy, gpointer user_data)
-{
-       EGwConnection* conn = (EGwConnection *)user_data;
-       if (!conn || !conn->priv || !conn->priv->soup_session)
-               return;
-
-       update_soup_session_proxy_settings (proxy,
-                                           conn->priv->soup_session,
-                                           conn->priv->uri);
-}
-
-static EGwConnectionStatus
-reauthenticate (EGwConnection *cnc)
-{
-       EGwConnectionPrivate  *priv;
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       SoupSoapParameter *param;
-       EGwConnectionStatus status = -1;
-       gchar *session = NULL;
-
-       priv = cnc->priv;
-       if (!priv)
-               return E_GW_CONNECTION_STATUS_INVALID_CONNECTION;
-
-       g_mutex_lock (priv->reauth_mutex);
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "getCategoryListRequest");
-       e_gw_message_write_footer (msg);
-
-        /* just to make sure we still have invlaid session
-          when multiple e_gw_connection apis see inavlid connection error
-          at the sma time this prevents this function sending login requests multiple times */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               g_mutex_unlock (priv->reauth_mutex);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-       status = e_gw_connection_parse_response_status (response);
-       g_object_unref (response);
-
-       if (status == E_GW_CONNECTION_STATUS_OK) {
-               g_mutex_unlock (priv->reauth_mutex);
-               return status;
-       }
-       /* build the SOAP message */
-       msg = e_gw_message_new_with_header (priv->uri, NULL, "loginRequest");
-       soup_soap_message_start_element (msg, "auth", "types", NULL);
-       soup_soap_message_add_attribute (msg, "type", "types:PlainText", "xsi",
-                                        "http://www.w3.org/2001/XMLSchema-instance");
-       e_gw_message_write_string_parameter (msg, "username", "types", priv->username);
-       e_gw_message_write_string_parameter (msg, "password", "types", priv->password);
-       soup_soap_message_end_element (msg);
-       e_gw_message_write_footer (msg);
-
-       /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (response)
-               status = e_gw_connection_parse_response_status (response);
-
-       if (status == E_GW_CONNECTION_STATUS_OK) {
-               param = soup_soap_response_get_first_parameter_by_name (response, "session");
-               if (param)
-                       session = soup_soap_parameter_get_string_value (param);
-
-       }
-
-       if (session) {
-               g_free (priv->session_id);
-               priv->session_id = session;
-       }
-       g_object_unref (msg);
-       if (response)
-               g_object_unref (response);
-       g_mutex_unlock (priv->reauth_mutex);
-       return status;
-
-}
-
-static gboolean
-e_gw_connection_response_parse_status_and_description (SoupSoapResponse *response, gint *status, gchar **description)
-{
-       SoupSoapParameter *param, *subparam;
-
-       param = soup_soap_response_get_first_parameter_by_name (response, "status");
-       if (!param)
-               return FALSE;
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "code");
-       if (!subparam)
-               return FALSE;
-
-       *status = soup_soap_parameter_get_int_value (subparam);
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "description");
-       if (!subparam)
-               return FALSE;
-
-       *description =  soup_soap_parameter_get_string_value (subparam);
-
-       return TRUE;
-}
-
-EGwConnectionStatus
-e_gw_connection_parse_response_status (SoupSoapResponse *response)
-{
-       SoupSoapParameter *param, *subparam;
-
-       param = soup_soap_response_get_first_parameter_by_name (response, "status");
-       if (!param)
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "code");
-       if (!subparam)
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-
-       switch (soup_soap_parameter_get_int_value (subparam)) {
-       case 0 : return E_GW_CONNECTION_STATUS_OK;
-       case 59905 : return E_GW_CONNECTION_STATUS_BAD_PARAMETER;
-       case 53505 : return E_GW_CONNECTION_STATUS_UNKNOWN_USER;
-       case 59914: return E_GW_CONNECTION_STATUS_ITEM_ALREADY_ACCEPTED;
-       case 59910: return E_GW_CONNECTION_STATUS_INVALID_CONNECTION;
-       case 59923: return E_GW_CONNECTION_STATUS_REDIRECT;
-       case 53530: return E_GW_CONNECTION_STATUS_OTHER;
-       /* FIXME: 58652 should be changed with an enum.*/
-       case 58652: return E_GW_CONNECTION_STATUS_OVER_QUOTA;
-       case 59922: return 59922; /*Very big attachment, get in chunks*/
-               /* FIXME: map all error codes */
-       }
-
-       return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-}
-
-const gchar *
-e_gw_connection_get_error_message (EGwConnectionStatus status)
-{
-       switch (status) {
-       case E_GW_CONNECTION_STATUS_OK :
-               break;
-       case E_GW_CONNECTION_STATUS_INVALID_CONNECTION :
-               return _("Invalid connection");
-       case E_GW_CONNECTION_STATUS_INVALID_OBJECT :
-               return _("Invalid object");
-       case E_GW_CONNECTION_STATUS_INVALID_RESPONSE :
-               return _("Invalid response from server");
-       case E_GW_CONNECTION_STATUS_NO_RESPONSE:
-               return _("No response from the server");
-       case E_GW_CONNECTION_STATUS_OBJECT_NOT_FOUND :
-               return _("Object not found");
-       case E_GW_CONNECTION_STATUS_UNKNOWN_USER :
-               return _("Unknown User");
-       case E_GW_CONNECTION_STATUS_BAD_PARAMETER :
-               return _("Bad parameter");
-       case E_GW_CONNECTION_STATUS_OTHER :
-       case E_GW_CONNECTION_STATUS_UNKNOWN :
-       default :
-               return _("Unknown error");
-       }
-
-       return NULL;
-}
-
-static EGwConnectionStatus
-logout (EGwConnection *cnc)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       /* build the SOAP message */
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "logoutRequest");
-       e_gw_message_write_string_parameter (msg, "session", "types", cnc->priv->session_id);
-       e_gw_message_write_footer (msg);
-
-       /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       return status;
-}
-
-static void
-e_gw_connection_dispose (GObject *object)
-{
-       EGwConnection *cnc = (EGwConnection *) object;
-       EGwConnectionPrivate *priv;
-       gchar *hash_key;
-
-       g_return_if_fail (E_IS_GW_CONNECTION (cnc));
-
-       priv = cnc->priv;
-       printf ("gw connection dispose \n");
-
-       /* removed the connection from the hash table */
-       if (loaded_connections_permissions != NULL) {
-               hash_key = g_strdup_printf ("%s:%s@%s",
-                                           priv->username ? priv->username : "",
-                                           priv->password ? priv->password : "",
-                                           priv->uri ? priv->uri : "");
-               g_hash_table_remove (loaded_connections_permissions, hash_key);
-               if (g_hash_table_size (loaded_connections_permissions) == 0) {
-                       g_hash_table_destroy (loaded_connections_permissions);
-                       loaded_connections_permissions = NULL;
-               }
-               g_free (hash_key);
-       }
-
-       if (priv) {
-               if (priv->session_id) {
-                       logout (cnc);
-                       priv->session_id = NULL;
-               }
-
-               if (priv->soup_session) {
-                       g_object_unref (priv->soup_session);
-                       priv->soup_session = NULL;
-               }
-
-               if (priv->uri) {
-                       g_free (priv->uri);
-                       priv->uri = NULL;
-               }
-
-               if (priv->username) {
-                       g_free (priv->username);
-                       priv->username = NULL;
-               }
-
-               if (priv->password) {
-                       g_free (priv->password);
-                       priv->password = NULL;
-               }
-
-               if (priv->user_name) {
-                       g_free (priv->user_name);
-                       priv->user_name = NULL;
-               }
-
-               if (priv->user_email) {
-                       g_free (priv->user_email);
-                       priv->user_email = NULL;
-               }
-
-               if (priv->user_uuid) {
-                       g_free (priv->user_uuid);
-                       priv->user_uuid = NULL;
-               }
-
-               if (priv->reauth_mutex) {
-                       g_mutex_free (priv->reauth_mutex);
-                       priv->reauth_mutex = NULL;
-               }
-
-               if (priv->msg_lock) {
-                       g_mutex_free (priv->msg_lock);
-                       priv->msg_lock = NULL;
-               }
-
-               if (priv->categories_by_id) {
-                       g_hash_table_destroy (priv->categories_by_id);
-                       priv->categories_by_id = NULL;
-               }
-
-               if (priv->categories_by_name) {
-                       g_hash_table_destroy (priv->categories_by_name);
-                       priv->categories_by_name = NULL;
-               }
-
-               if (priv->book_list) {
-                       g_list_foreach (priv->book_list, (GFunc) g_object_unref, NULL);
-                       g_list_free (priv->book_list);
-                       priv->book_list = NULL;
-               }
-
-               if (priv->opts) {
-                       g_object_unref (priv->opts);
-                       priv->opts = NULL;
-               }
-
-               if (priv->version) {
-                       g_free (priv->version);
-                       priv->opts = NULL;
-               }
-
-               if (priv->server_time) {
-                       g_free (priv->server_time);
-                       priv->server_time = NULL;
-               }
-
-               if (priv->proxy) {
-                       g_object_unref (priv->proxy);
-                       priv->proxy = NULL;
-               }
-       }
-
-       if (parent_class->dispose)
-               (* parent_class->dispose) (object);
-}
-
-static void
-e_gw_connection_finalize (GObject *object)
-{
-       EGwConnection *cnc = (EGwConnection *) object;
-       EGwConnectionPrivate *priv;
-
-       g_return_if_fail (E_IS_GW_CONNECTION (cnc));
-
-       priv = cnc->priv;
-       printf ("gw connection finalize\n");
-       /* clean up */
-       g_free (priv);
-       cnc->priv = NULL;
-
-       if (parent_class->finalize)
-               (* parent_class->finalize) (object);
-}
-
-static void
-e_gw_connection_class_init (EGwConnectionClass *klass)
-{
-       GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-       parent_class = g_type_class_peek_parent (klass);
-
-       object_class->dispose = e_gw_connection_dispose;
-       object_class->finalize = e_gw_connection_finalize;
-}
-
-static void
-e_gw_connection_init (EGwConnection *cnc)
-{
-       EGwConnectionPrivate *priv;
-       guint timeout = GW_SOUP_SESSION_TIMEOUT;
-
-       /* allocate internal structure */
-       priv = g_new0 (EGwConnectionPrivate, 1);
-       cnc->priv = priv;
-
-       /* Set a default timeout value of 30 seconds.
-          FIXME: Make timeout configurable
-       */
-       if (g_getenv ("SOUP_SESSION_TIMEOUT"))
-               timeout = atoi (g_getenv ("SOUP_SESSION_TIMEOUT"));
-
-        /* Initialize proxy settings */
-       priv->proxy = e_proxy_new ();
-       e_proxy_setup_proxy (priv->proxy);
-        g_signal_connect (priv->proxy, "changed", G_CALLBACK (proxy_settings_changed), cnc);
-
-       /* create the SoupSession for this connection */
-       priv->soup_session = soup_session_sync_new_with_options (SOUP_SESSION_TIMEOUT, timeout, NULL);
-       priv->reauth_mutex = g_mutex_new ();
-       priv->msg_lock = g_mutex_new ();
-       priv->categories_by_id = NULL;
-       priv->categories_by_name = NULL;
-       priv->book_list = NULL;
-       priv->opts = NULL;
-
-       /* README: We do not use libsoup logger and use our own as we need formatted output etc. */
-       /*
-          if (g_getenv ("GROUPWISE_DEBUG")) {
-               if (atoi (g_getenv ("GROUPWISE_DEBUG")) == 1) {
-                       SoupLogger *logger;
-
-                       logger = soup_logger_new (SOUP_LOGGER_LOG_BODY, -1);
-                       soup_logger_attach (logger, priv->soup_session);
-                       g_object_unref (logger);
-               }
-       }
-       */
-}
-
-static SoupSoapMessage*
-form_login_request (const gchar *uri, const gchar * username, const gchar * password)
-{
-       SoupSoapMessage *msg;
-       /* build the SOAP message */
-       msg = e_gw_message_new_with_header (uri, NULL, "loginRequest");
-       e_gw_message_write_string_parameter (msg, "application", "types", build_timestamp);
-       e_gw_message_write_string_parameter (msg, "version", NULL, "1.02");
-       soup_soap_message_start_element (msg, "auth", "types", NULL);
-       soup_soap_message_add_attribute (msg, "type", "types:PlainText", "xsi",
-                                        "http://www.w3.org/2001/XMLSchema-instance");
-       e_gw_message_write_string_parameter (msg, "username", "types", username);
-       if (password && *password)
-               e_gw_message_write_string_parameter (msg, "password", "types", password);
-       soup_soap_message_end_element (msg);
-       e_gw_message_write_footer (msg);
-       return msg;
-}
-
-EGwConnection *
-e_gw_connection_new_with_error_handler (const gchar *uri, const gchar *username, const gchar *password, EGwConnectionErrors *errors)
-{
-       EGwConnection *cnc;
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       SoupSoapParameter *param;
-       EGwConnectionStatus status;
-       gchar *hash_key;
-       gchar *redirected_uri = NULL;
-       gint code;
-       gchar *description = NULL;
-
-       static GStaticMutex connecting = G_STATIC_MUTEX_INIT;
-
-       g_static_mutex_lock (&connecting);
-
-       /* search the connection in our hash table */
-       if (loaded_connections_permissions != NULL) {
-               hash_key = g_strdup_printf ("%s:%s@%s",
-                               username ? username : "",
-                               password ? password : "",
-                               uri);
-               cnc = g_hash_table_lookup (loaded_connections_permissions, hash_key);
-               g_free (hash_key);
-
-               if (E_IS_GW_CONNECTION (cnc)) {
-                       g_object_ref (cnc);
-                       g_static_mutex_unlock (&connecting);
-                       return cnc;
-               }
-       }
-
-       /* not found, so create a new connection */
-       cnc = g_object_new (E_TYPE_GW_CONNECTION, NULL);
-
-       /* Set proxy details for the Soup session before any
-          communication. */
-       update_soup_session_proxy_settings (cnc->priv->proxy,
-                                           cnc->priv->soup_session,
-                                           uri);
-
-       msg = form_login_request (uri, username, password);
-
-       /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-
-       if (!response) {
-               if (errors)
-                       errors->status = E_GW_CONNECTION_STATUS_UNKNOWN;
-               g_object_unref (cnc);
-               g_static_mutex_unlock (&connecting);
-               g_object_unref (msg);
-               return NULL;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_REDIRECT) {
-               gchar *host, *port;
-               gchar **tokens;
-               SoupSoapParameter *subparam;
-
-               param = soup_soap_response_get_first_parameter_by_name (response, "redirectToHost");
-               subparam = soup_soap_parameter_get_first_child_by_name (param, "ipAddress");
-               host = soup_soap_parameter_get_string_value (subparam);
-               subparam = soup_soap_parameter_get_first_child_by_name (param, "port");
-               port = soup_soap_parameter_get_string_value (subparam);
-               if (host && port) {
-                       tokens = g_strsplit (uri, "://", 2);
-                       redirected_uri = g_strconcat (tokens[0], "://", host, ":", port, "/soap", NULL);
-                       g_object_unref (msg);
-                       g_object_unref (response);
-                       msg = form_login_request (redirected_uri, username, password);
-                       uri = redirected_uri;
-                       response = e_gw_connection_send_message (cnc, msg);
-                       status = e_gw_connection_parse_response_status (response);
-                       g_strfreev (tokens);
-               }
-
-               g_free (host);
-               g_free (port);
-       }
-       param = soup_soap_response_get_first_parameter_by_name (response, "session");
-       if (!param) {
-               if (errors && e_gw_connection_response_parse_status_and_description (response, &code, &description) ) {
-                       errors->status = code;
-                       errors->description = description;
-               }
-               g_object_unref (response);
-               g_object_unref (msg);
-               g_object_unref (cnc);
-               g_static_mutex_unlock (&connecting);
-
-               return NULL;
-       }
-
-       cnc->priv->uri = g_strdup (uri);
-       cnc->priv->username = g_strdup (username);
-       cnc->priv->password = g_strdup (password);
-       cnc->priv->session_id = soup_soap_parameter_get_string_value (param);
-
-       /* retrieve user information */
-       param = soup_soap_response_get_first_parameter_by_name (response, "userinfo");
-
-       if (param) {
-               SoupSoapParameter *subparam;
-               gchar *param_value;
-
-               subparam = soup_soap_parameter_get_first_child_by_name (param, "email");
-               if (subparam) {
-                       param_value = soup_soap_parameter_get_string_value (subparam);
-                       cnc->priv->user_email  = param_value;
-               }
-
-               subparam = soup_soap_parameter_get_first_child_by_name (param, "name");
-               if (subparam) {
-                       param_value = soup_soap_parameter_get_string_value (subparam);
-                       cnc->priv->user_name = param_value;
-               }
-
-               subparam = soup_soap_parameter_get_first_child_by_name (param, "uuid");
-               if (subparam) {
-                       param_value = soup_soap_parameter_get_string_value (subparam);
-                       cnc->priv->user_uuid = param_value;
-               }
-       }
-
-       param = soup_soap_response_get_first_parameter_by_name (response, "gwVersion");
-       if (param) {
-               gchar *param_value;
-               param_value = soup_soap_parameter_get_string_value (param);
-               cnc->priv->version = param_value;
-       } else
-               cnc->priv->version = NULL;
-
-       param = soup_soap_response_get_first_parameter_by_name (response, "serverUTCTime");
-       if (param)
-               cnc->priv->server_time = soup_soap_parameter_get_string_value (param);
-
-       /* add the connection to the loaded_connections_permissions hash table */
-       hash_key = g_strdup_printf ("%s:%s@%s",
-                       cnc->priv->username ? cnc->priv->username : "",
-                       cnc->priv->password ? cnc->priv->password : "",
-                       cnc->priv->uri);
-       if (loaded_connections_permissions == NULL)
-               loaded_connections_permissions = g_hash_table_new_full (g_str_hash, g_str_equal,
-                               g_free, NULL);
-       g_hash_table_insert (loaded_connections_permissions, hash_key, cnc);
-
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-       g_static_mutex_unlock (&connecting);
-       g_free (redirected_uri);
-       return cnc;
-
-}
-
-EGwConnection *
-e_gw_connection_new (const gchar *uri, const gchar *username, const gchar *password)
-{
-       /* This is where I miss function-overloading and default-parameters */
-
-       return e_gw_connection_new_with_error_handler (uri, username, password, NULL);
-}
-
-SoupSoapResponse *
-e_gw_connection_send_message (EGwConnection *cnc, SoupSoapMessage *msg)
-{
-       SoupSoapResponse *response;
-       guint status;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), NULL);
-       g_return_val_if_fail (SOUP_IS_SOAP_MESSAGE (msg), NULL);
-
-       g_mutex_lock (cnc->priv->msg_lock);
-       status = soup_session_send_message (cnc->priv->soup_session, SOUP_MESSAGE (msg));
-       g_mutex_unlock (cnc->priv->msg_lock);
-
-       if (!SOUP_STATUS_IS_SUCCESSFUL (status)) {
-               if (g_getenv ("GROUPWISE_DEBUG")) {
-                       const gchar *error = soup_status_get_phrase (status);
-
-                       if (!error)
-                               error = "Unknown error";
-
-                       g_debug ("%s: Failed to send message with error %d (%s)", G_STRFUNC, status, error);
-               }
-               return NULL;
-       }
-
-       /* process response */
-       response = soup_soap_message_parse_response (msg);
-
-       if (response && g_getenv ("GROUPWISE_DEBUG")) {
-
-               /* README: The stdout can be replaced with Evolution's
-               Logging framework also */
-
-               soup_soap_response_dump_response (response, stdout);
-               g_print ("\n------\n");
-       }
-
-       return response;
-}
-
-EGwConnectionStatus
-e_gw_connection_logout (EGwConnection *cnc)
-{
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       g_object_unref (cnc);
-
-       return E_GW_CONNECTION_STATUS_OK;
-}
-
-EGwConnectionStatus
-e_gw_connection_get_container_list (EGwConnection *cnc, const gchar *top, GList **container_list)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-       SoupSoapParameter *param;
-
-       /* when user cancels password dialog, then the cnc is NULL */
-       if (!cnc)
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-
-       g_return_val_if_fail (container_list != NULL, E_GW_CONNECTION_STATUS_UNKNOWN);
-
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "getFolderListRequest");
-       if (!msg) {
-                g_warning (G_STRLOC ": Could not build SOAP message");
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-       }
-
-       e_gw_message_write_string_parameter (msg, "parent", NULL, top);
-       e_gw_message_write_string_parameter (msg, "recurse", NULL, "true");
-       e_gw_message_write_footer (msg);
-
-        /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       g_object_unref (msg);
-
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       reauthenticate (cnc);
-               g_object_unref (response);
-               return status;
-       }
-
-       /* if status is OK - parse result. return the list */
-       param = soup_soap_response_get_first_parameter_by_name (response, "folders");
-       if (param) {
-               SoupSoapParameter *subparam;
-               for (subparam = soup_soap_parameter_get_first_child_by_name (param, "folder");
-                    subparam != NULL;
-                    subparam = soup_soap_parameter_get_next_child_by_name (subparam, "folder")) {
-                       EGwContainer *container;
-
-                       container = e_gw_container_new_from_soap_parameter (subparam);
-                       if (container)
-                               *container_list = g_list_append (*container_list, container);
-               }
-       }
-
-       g_object_unref (response);
-
-       return status;
-}
-
-void
-e_gw_connection_free_container_list (GList *container_list)
-{
-       g_return_if_fail (container_list != NULL);
-
-       g_list_foreach (container_list, (GFunc) g_object_unref, NULL);
-       g_list_free (container_list);
-}
-
-gchar *
-e_gw_connection_get_container_id (EGwConnection *cnc, const gchar *name)
-{
-       EGwConnectionStatus status;
-       GList *container_list = NULL, *l;
-       gchar *container_id = NULL;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), NULL);
-       g_return_val_if_fail (name != NULL, NULL);
-
-        status = e_gw_connection_get_container_list (cnc, "folders", &container_list);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               status = e_gw_connection_get_container_list (cnc, "folders", &container_list);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               e_gw_connection_free_container_list (container_list);
-               return NULL;
-       }
-
-       /* search the container in the list */
-       for (l = container_list; l != NULL; l = l->next) {
-               EGwContainer *container = E_GW_CONTAINER (l->data);
-
-               if (strcmp (e_gw_container_get_name (container), name) == 0) {
-                       container_id = g_strdup (e_gw_container_get_id (container));
-                       break;
-               }
-       }
-
-       e_gw_connection_free_container_list (container_list);
-
-       return container_id;
-}
-
-EGwContainer *
-e_gw_connection_get_container (EGwConnection *cnc, const gchar * uid)
-{
-               SoupSoapMessage *msg;
-               SoupSoapResponse *response;
-               EGwConnectionStatus status;
-
-               g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), NULL);
-               g_return_val_if_fail (uid!= NULL, NULL);
-
-               msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "getFolderRequest");
-               if (!msg) {
-                               g_warning (G_STRLOC ": Could not build SOAP message");
-                               return NULL;
-               }
-
-               e_gw_message_write_string_parameter (msg, "id", NULL, uid);
-               /* The server does not feel good if the name, id view elements are not passed */
-               e_gw_message_write_string_parameter (msg, "view", NULL, "name id uid count unreadCount");
-               e_gw_message_write_footer (msg);
-
-               /* send message to server */
-               response = e_gw_connection_send_message (cnc, msg);
-               if (!response) {
-                               g_object_unref (msg);
-                               return NULL;
-               }
-
-               status = e_gw_connection_parse_response_status (response);
-               g_object_unref (msg);
-
-               if (status == E_GW_CONNECTION_STATUS_OK) {
-                               EGwContainer *container;
-                               SoupSoapParameter *subparam;
-
-                               subparam = soup_soap_response_get_first_parameter_by_name (response, "folder");
-                               container = e_gw_container_new_from_soap_parameter (subparam);
-                               g_object_unref (response);
-
-                               return container;
-               }
-               g_object_unref (response);
-
-               return NULL;
-}
-
-EGwConnectionStatus
-e_gw_connection_get_items_delta_info (EGwConnection *cnc, const gchar *container, gdouble *first_sequence,
-                                       gdouble *last_sequence, gdouble *last_po_rebuild_time )
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-       SoupSoapParameter *param, *subparam;
-       gchar *tmp = NULL;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       /* build the SOAP message */
-        msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "getDeltaInfoRequest");
-       if (!msg) {
-                g_warning (G_STRLOC ": Could not build SOAP message");
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-       }
-
-       e_gw_message_write_string_parameter (msg, "container", NULL, container);
-
-       e_gw_message_write_footer (msg);
-
-        /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       reauthenticate (cnc);
-               g_object_unref (response);
-               g_object_unref (msg);
-               return status;
-       }
-
-       param = soup_soap_response_get_first_parameter_by_name (response, "deltaInfo");
-       if (!param) {
-               g_object_unref (response);
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-       }
-
-        /* parse these parameters */
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "firstSequence");
-
-       if (subparam) {
-               tmp = soup_soap_parameter_get_string_value (subparam);
-               *first_sequence = strtod (tmp, NULL);
-               g_free (tmp);
-       } else
-               *first_sequence = -1;
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "lastSequence");
-
-       if (subparam) {
-               tmp = soup_soap_parameter_get_string_value (subparam);
-               *last_sequence = strtod (tmp, NULL);
-               g_free (tmp);
-       }
-       else
-               *last_sequence = -1;
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "lastTimePORebuild");
-
-       if (subparam) {
-               tmp = soup_soap_parameter_get_string_value (subparam);
-               *last_po_rebuild_time = strtod (tmp, NULL);
-               g_free (tmp);
-       } else
-               *last_po_rebuild_time = -1;
-
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       return status;
-}
-
-EGwConnectionStatus
-e_gw_connection_get_items_delta (EGwConnection *cnc, const gchar *container, const gchar *view, const gchar *count, const gchar * start_sequence, GList **add_list, GList **delete_list)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-       SoupSoapParameter *param, *subparam, *subsubparam;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       /* build the SOAP message */
-        msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "getDeltasRequest");
-       if (!msg) {
-                g_warning (G_STRLOC ": Could not build SOAP message");
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-       }
-
-       e_gw_message_write_string_parameter (msg, "container", NULL, container);
-       if (view)
-               e_gw_message_write_string_parameter (msg, "view", NULL, view);
-
-       soup_soap_message_start_element (msg, "deltaInfo", NULL, NULL);
-       e_gw_message_write_string_parameter (msg, "firstSequence", NULL, start_sequence);
-       e_gw_message_write_string_parameter (msg, "count", NULL, count);
-       soup_soap_message_end_element (msg);
-
-        /* send message to server */
-
-       e_gw_message_write_footer (msg);
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       reauthenticate (cnc);
-               g_object_unref (response);
-               g_object_unref (msg);
-               return status;
-       }
-
-       /* if status is OK - parse result. return the list */
-       param = soup_soap_response_get_first_parameter_by_name (response, "items");
-       if (!param) {
-               g_object_unref (response);
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-       }
-
-        /* parse these parameters */
-        for (subparam = soup_soap_parameter_get_first_child_by_name (param, "item");
-            subparam != NULL;
-            subparam = soup_soap_parameter_get_next_child_by_name (subparam, "item")) {
-               EGwItem *item;
-
-               item = e_gw_item_new_from_soap_parameter (cnc->priv->user_email, container, subparam);
-
-               subsubparam =  soup_soap_parameter_get_first_child_by_name(subparam, "sync");
-               if (subsubparam) {
-                       gchar *value;
-
-                       value = soup_soap_parameter_get_string_value (subsubparam);
-                       if (!strcmp (value, "add") || !strcmp (value, "update")) {
-                               *add_list = g_list_append (*add_list, item);
-                       } else if (!strcmp (value, "delete")) {
-                               *delete_list = g_list_append (*delete_list, item);
-                       }
-                       g_free (value);
-               }
-       }
-
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       return E_GW_CONNECTION_STATUS_OK;
-
-}
-
-EGwConnectionStatus
-e_gw_connection_get_items (EGwConnection *cnc, const gchar *container, const gchar *view, EGwFilter *filter, GList **list)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-       SoupSoapParameter *param, *subparam;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       /* build the SOAP message */
-        msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "getItemsRequest");
-       if (!msg) {
-                g_warning (G_STRLOC ": Could not build SOAP message");
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-       }
-
-       e_gw_message_write_string_parameter (msg, "container", NULL, container);
-       if (view)
-               e_gw_message_write_string_parameter (msg, "view", NULL, view);
-
-       if (filter)
-               e_gw_filter_append_to_soap_message (filter, msg);
-       e_gw_message_write_footer (msg);
-
-        /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       reauthenticate (cnc);
-               g_object_unref (response);
-               g_object_unref (msg);
-               return status;
-       }
-
-       /* if status is OK - parse result. return the list */
-       param = soup_soap_response_get_first_parameter_by_name (response, "items");
-       if (!param) {
-               g_object_unref (response);
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-       }
-
-        /* parse these parameters into ecalcomponents*/
-        for (subparam = soup_soap_parameter_get_first_child_by_name (param, "item");
-            subparam != NULL;
-            subparam = soup_soap_parameter_get_next_child_by_name (subparam, "item")) {
-               EGwItem *item;
-
-               item = e_gw_item_new_from_soap_parameter (cnc->priv->user_email, container, subparam);
-               if (item)
-                       *list = g_list_append (*list, item);
-       }
-
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       return E_GW_CONNECTION_STATUS_OK;
-}
-
-EGwConnectionStatus
-e_gw_connection_get_items_from_ids (EGwConnection *cnc, const gchar *container, const gchar *view, GPtrArray *item_ids, GList **list)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-       SoupSoapParameter *param, *subparam;
-       gint i;
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       /* build the SOAP message */
-        msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "getItemsRequest");
-       if (!msg) {
-                g_warning (G_STRLOC ": Could not build SOAP message");
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-       }
-
-       e_gw_message_write_string_parameter (msg, "container", NULL, container);
-       if (view)
-               e_gw_message_write_string_parameter (msg, "view", NULL, view);
-       soup_soap_message_start_element (msg, "items", NULL, NULL);
-       for (i = 0; i < item_ids->len; i++) {
-               gchar *id = g_ptr_array_index (item_ids, i);
-               e_gw_message_write_string_parameter (msg, "item", NULL, id);
-       }
-       soup_soap_message_end_element (msg);
-
-       e_gw_message_write_footer (msg);
-
-        /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       reauthenticate (cnc);
-               g_object_unref (response);
-               g_object_unref (msg);
-               return status;
-       }
-
-       /* if status is OK - parse result. return the list */
-       param = soup_soap_response_get_first_parameter_by_name (response, "items");
-       if (!param) {
-               g_object_unref (response);
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-       }
-
-        /* parse these parameters into ecalcomponents*/
-        for (subparam = soup_soap_parameter_get_first_child_by_name (param, "item");
-            subparam != NULL;
-            subparam = soup_soap_parameter_get_next_child_by_name (subparam, "item")) {
-               EGwItem *item;
-
-               item = e_gw_item_new_from_soap_parameter (cnc->priv->user_email, container, subparam);
-               if (item)
-                       *list = g_list_append (*list, item);
-       }
-
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       return E_GW_CONNECTION_STATUS_OK;
-}
-
-EGwConnectionStatus
-e_gw_connection_get_deltas ( EGwConnection *cnc, GSList **adds, GSList **deletes, GSList **updates)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-       SoupSoapParameter *param, *subparam;
-       gchar *tmp;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       /* build the SOAP message */
-         msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "getDeltaRequest");
-        if (!msg) {
-                 g_warning (G_STRLOC ": Could not build SOAP message");
-                /* g_object_unref (cnc); */
-                return E_GW_CONNECTION_STATUS_UNKNOWN;
-        }
-
-        /*FIXME  make this generic */
-         soup_soap_message_start_element (msg, "CalendarItem", NULL, NULL);
-        soup_soap_message_end_element (msg);
-        e_gw_message_write_footer (msg);
-
-         /* send message to server */
-        response = e_gw_connection_send_message (cnc, msg);
-        if (!response) {
-                g_object_unref (msg);
-                /* g_object_unref (cnc); */
-                return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-        }
-
-        status = e_gw_connection_parse_response_status (response);
-        if (status != E_GW_CONNECTION_STATUS_OK) {
-               g_object_unref (response);
-               g_object_unref (msg);
-               /* g_object_unref (cnc); */
-               return status;
-       }
-
-       /* if status is OK - parse result. return the list */
-       param = soup_soap_response_get_first_parameter_by_name (response, "changed");
-        if (!param) {
-                g_object_unref (response);
-                g_object_unref (msg);
-                /* g_object_unref (cnc); */
-                return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-        }
-
-       tmp = soup_soap_parameter_get_string_value (param);
-       if (!g_ascii_strcasecmp (tmp, "0")) {
-               g_free (tmp);
-                 g_message ("No deltas");
-                /* g_object_unref (cnc); */
-                return E_GW_CONNECTION_STATUS_OK;
-       }
-
-       g_free (tmp);
-
-         param = soup_soap_response_get_first_parameter_by_name (response, "deltas");
-        if (!param) {
-                g_object_unref (response);
-                g_object_unref (msg);
-               /* g_object_unref (cnc); */
-               /* return E_GW_CONNECTION_STATUS_INVALID_RESPONSE; */
-               /* getting around the server behavior that deltas can be null
-                * though changes is true */
-                return E_GW_CONNECTION_STATUS_OK;
-        }
-
-         /* process all deletes first*/
-         param = soup_soap_parameter_get_first_child_by_name (param, "delete");
-        if (param) {
-                 for (subparam = soup_soap_parameter_get_first_child_by_name (param, "item");
-                        subparam != NULL;
-                         subparam = soup_soap_parameter_get_next_child_by_name (subparam, "item")) {
-                                 /*process each item */
-                                gchar *uid;
-                                SoupSoapParameter *param_id;
-
-                                 param_id = soup_soap_parameter_get_first_child_by_name (subparam, "id");
-                                if (!param_id) {
-                                        g_object_unref (response);
-                                        g_object_unref (msg);
-                                       /* g_object_unref (cnc); */
-                                }
-                                uid = (gchar *)soup_soap_parameter_get_string_value (param_id);
-                                 /*if (!e_cal_backend_cache_remove_component (cache, uid, NULL))
-                                         g_message ("Could not remove %s", uid); */
-                                *deletes = g_slist_append (*deletes, uid);
-                }
-        }
-
-         /* process adds*/
-         param = soup_soap_parameter_get_first_child_by_name (param, "add");
-        if (param) {
-                 for (subparam = soup_soap_parameter_get_first_child_by_name (param, "item");
-                        subparam != NULL;
-                         subparam = soup_soap_parameter_get_next_child_by_name (subparam, "item")) {
-                               /*process each item */
-                               EGwItem *item;
-                               /*FIXME  pass the container id */
-                               item = e_gw_item_new_from_soap_parameter (cnc->priv->user_email, "Calendar", subparam);
-                               if (!item) {
-                                        g_object_unref (response);
-                                        g_object_unref (msg);
-                                       /* g_object_unref (cnc); */
-                                       return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-                                }
-                                 /*if (!e_cal_backend_cache_put_component (cache, comp))
-                                         g_message ("Could not add the component"); */
-                                *adds = g_slist_append (*adds, item);
-                }
-        }
-
-         /* process updates*/
-         param = soup_soap_parameter_get_first_child_by_name (param, "update");
-        if (param) {
-                 for (subparam = soup_soap_parameter_get_first_child_by_name(param, "item");
-                    subparam != NULL;
-                    subparam = soup_soap_parameter_get_next_child (subparam)) {
-                        EGwItem *item;
-                        /*process each item */
-                        /*item = get_item_from_updates (subparam);*/
-                        item = e_gw_item_new_from_soap_parameter (cnc->priv->user_email, "Calendar", subparam);
-                        if (item)
-                                *updates = g_slist_append (*updates, item);
-                }
-        }
-
-        /* free memory */
-        g_object_unref (response);
-        g_object_unref (msg);
-
-       return E_GW_CONNECTION_STATUS_OK;
-}
-
-EGwConnectionStatus
-e_gw_connection_send_item (EGwConnection *cnc, EGwItem *item, GSList **id_list)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status = E_GW_CONNECTION_STATUS_UNKNOWN;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_CONNECTION);
-       g_return_val_if_fail (E_IS_GW_ITEM (item), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       if (id_list)
-               *id_list = NULL;
-
-       /* compose SOAP message */
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "sendItemRequest");
-       if (!msg) {
-               g_warning (G_STRLOC ": Could not build SOAP message");
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-       }
-
-       if (!e_gw_item_append_to_soap_message (item, msg)) {
-               g_warning (G_STRLOC ": Could not append item to SOAP message");
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_INVALID_OBJECT;
-       }
-
-       e_gw_message_write_footer (msg);
-
-       /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_OK && id_list != NULL) {
-               SoupSoapParameter *param;
-
-               /* get the generated ID from the SOAP response */
-               /* for loop here to populate the list_ids. */
-               for (param = soup_soap_response_get_first_parameter_by_name (response, "id");
-                       param; param = soup_soap_response_get_next_parameter_by_name (response, param, "id")) {
-
-                       *id_list = g_slist_append (*id_list, soup_soap_parameter_get_string_value (param));
-               }
-       }
-       else if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-       g_object_unref (msg);
-       g_object_unref (response);
-
-       return status;
-}
-
-EGwConnectionStatus
-e_gw_connection_create_item (EGwConnection *cnc, EGwItem *item, gchar ** id)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       SoupSoapParameter *param;
-       EGwConnectionStatus status = E_GW_CONNECTION_STATUS_UNKNOWN;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_CONNECTION);
-       g_return_val_if_fail (E_IS_GW_ITEM (item), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       /* compose SOAP message */
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "createItemRequest");
-       if (!msg) {
-               g_warning (G_STRLOC ": Could not build SOAP message");
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-       }
-
-       if (!e_gw_item_append_to_soap_message (item, msg)) {
-               g_warning (G_STRLOC ": Could not append item to SOAP message");
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_INVALID_OBJECT;
-       }
-
-       e_gw_message_write_footer (msg);
-
-       /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_OK) {
-               param = soup_soap_response_get_first_parameter_by_name (response, "id");
-               if (param != NULL)
-                       *id = soup_soap_parameter_get_string_value (param);
-       } else if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-
-       g_object_unref (msg);
-       g_object_unref (response);
-
-       return status;
-}
-
-EGwConnectionStatus
-e_gw_connection_modify_item (EGwConnection *cnc, const gchar *id , EGwItem *item)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       /* build the SOAP message */
-        msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "modifyItemRequest");
-       if (!msg) {
-                g_warning (G_STRLOC ": Could not build SOAP message");
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-       }
-
-       e_gw_message_write_string_parameter (msg, "id", NULL, id);
-
-       if (!e_gw_item_append_changes_to_soap_message (item, msg)) {
-               g_warning (G_STRLOC ": Could not append item to SOAP message");
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_INVALID_OBJECT;
-       }
-
-       e_gw_message_write_footer (msg);
-
-       /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-       g_object_unref (msg);
-       g_object_unref (response);
-
-       return status;
-
-}
-
-EGwConnectionStatus
-e_gw_connection_get_item (EGwConnection *cnc, const gchar *container, const gchar *id, const gchar *view, EGwItem **item)
-{
-
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-       SoupSoapParameter *param;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       /* build the SOAP message */
-        msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "getItemRequest");
-       if (!msg) {
-                g_warning (G_STRLOC ": Could not build SOAP message");
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-       }
-
-       e_gw_message_write_string_parameter (msg, "id", NULL, id);
-
-       if (view)
-               e_gw_message_write_string_parameter (msg, "view", NULL, view);
-       e_gw_message_write_footer (msg);
-
-        /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       reauthenticate (cnc);
-               g_object_unref (response);
-               g_object_unref (msg);
-               return status;
-       }
-
-       /* if status is OK - parse result. return the list */
-       param = soup_soap_response_get_first_parameter_by_name (response, "item");
-       if (!param) {
-               g_object_unref (response);
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-       }
-
-       *item = e_gw_item_new_from_soap_parameter (cnc->priv->user_email, container, param);
-
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       if (!*item)
-               return E_GW_CONNECTION_STATUS_INVALID_OBJECT;
-
-       return E_GW_CONNECTION_STATUS_OK;
-}
-
-EGwConnectionStatus
-e_gw_connection_remove_item (EGwConnection *cnc, const gchar *container, const gchar *id)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_CONNECTION);
-       g_return_val_if_fail (id != NULL, E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       /* build the SOAP message */
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "removeItemRequest");
-
-       if (container && *container)
-               e_gw_message_write_string_parameter (msg, "container", NULL, container);
-       e_gw_message_write_string_parameter (msg, "id", NULL, id);
-       e_gw_message_write_footer (msg);
-
-       /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       return status;
-}
-
-EGwConnectionStatus
-e_gw_connection_remove_items (EGwConnection *cnc, const gchar *container, GList *item_ids)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_CONNECTION);
-
-       /* build the SOAP message */
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "removeItemsRequest");
-       if (container && *container)
-               e_gw_message_write_string_parameter (msg, "container", NULL, container);
-
-       soup_soap_message_start_element (msg, "items", NULL, NULL);
-       for (; item_ids != NULL; item_ids = g_list_next (item_ids))
-               e_gw_message_write_string_parameter (msg, "item", NULL, item_ids->data);
-       soup_soap_message_end_element (msg);
-       e_gw_message_write_footer (msg);
-
-       /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       return status;
-}
-
-EGwConnectionStatus
-e_gw_connection_accept_request (EGwConnection *cnc, const gchar *id, const gchar *accept_level, const gchar *accept_comment, const gchar *recurrence_key)
-{
-       SoupSoapMessage *msg;
-       gint status;
-       SoupSoapResponse *response;
-
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "acceptRequest");
-       soup_soap_message_start_element (msg, "items", NULL, NULL);
-       e_gw_message_write_string_parameter (msg, "item", NULL, id);
-       soup_soap_message_end_element (msg);
-       e_gw_message_write_string_parameter (msg, "acceptLevel", NULL, accept_level);
-
-       if (recurrence_key)
-               e_gw_message_write_string_parameter (msg, "recurrenceAllInstances", NULL, recurrence_key);
-
-       if (accept_comment)
-               e_gw_message_write_string_parameter (msg, "comment", NULL, accept_comment);
-
-       e_gw_message_write_footer (msg);
-
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-       g_object_unref (response);
-       g_object_unref (msg);
-       return status;
-}
-
-EGwConnectionStatus
-e_gw_connection_decline_request (EGwConnection *cnc, const gchar *id, const gchar *decline_comment, const gchar *recurrence_key)
-{
-       SoupSoapMessage *msg;
-       gint status;
-       SoupSoapResponse *response;
-
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "declineRequest");
-       soup_soap_message_start_element (msg, "items", NULL, NULL);
-       e_gw_message_write_string_parameter (msg, "item", NULL, id);
-       soup_soap_message_end_element (msg);
-
-       if (decline_comment)
-               e_gw_message_write_string_parameter (msg, "comment", NULL, decline_comment);
-
-       if (recurrence_key)
-               e_gw_message_write_string_parameter (msg, "recurrenceAllInstances", NULL, recurrence_key);
-
-       e_gw_message_write_footer (msg);
-
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-       g_object_unref (response);
-       g_object_unref (msg);
-       return status;
-}
-
-EGwConnectionStatus
-e_gw_connection_retract_request (EGwConnection *cnc, const gchar *id, const gchar *comment, gboolean retract_all, gboolean resend)
-{
-       SoupSoapMessage *msg;
-       gint status;
-       SoupSoapResponse *response;
-
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "retractRequest");
-       soup_soap_message_start_element (msg, "items", NULL, NULL);
-       e_gw_message_write_string_parameter (msg, "item", NULL, id);
-       soup_soap_message_end_element (msg);
-       /* comment, FALSE, FALSE to be filled in later. */
-       e_gw_message_write_footer (msg);
-
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-       g_object_unref (response);
-       g_object_unref (msg);
-       return status;
-}
-
-EGwConnectionStatus
-e_gw_connection_complete_request (EGwConnection *cnc, const gchar *id)
-{
-       SoupSoapMessage *msg;
-       gint status;
-       SoupSoapResponse *response;
-
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "completeRequest");
-       soup_soap_message_start_element (msg, "items", NULL, NULL);
-       e_gw_message_write_string_parameter (msg, "item", NULL, id);
-       soup_soap_message_end_element (msg);
-       e_gw_message_write_footer (msg);
-
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-       g_object_unref (response);
-       g_object_unref (msg);
-       return status;
-}
-
-EGwConnectionStatus
-e_gw_connection_delegate_request (EGwConnection *cnc, EGwItem *item, const gchar *id, const gchar *comments_org, const gchar *comments_del, const gchar *recur_key)
-{
-       SoupSoapMessage *msg;
-       gint status;
-       SoupSoapResponse *response;
-
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "delegateRequest");
-
-       if (id)
-               e_gw_message_write_string_parameter (msg, "id", NULL, id);
-
-       e_gw_item_add_distribution_to_soap_message (item, msg);
-       if (comments_org)
-               e_gw_message_write_string_parameter (msg, "commentToOrganizer", NULL, comments_org);
-       if (comments_del)
-               e_gw_message_write_string_parameter (msg, "commentToDelegatee", NULL, comments_del);
-       if (recur_key)
-               e_gw_message_write_string_parameter (msg, "recurrenceAllInstances", NULL, recur_key);
-
-       e_gw_message_write_footer (msg);
-
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       return status;
-}
-
-const gchar *
-e_gw_connection_get_version (EGwConnection *cnc)
-{
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), NULL);
-
-       return (const gchar *) cnc->priv->version;
-}
-
-const gchar *
-e_gw_connection_get_uri (EGwConnection *cnc)
-{
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), NULL);
-
-       return (const gchar *) cnc->priv->uri;
-}
-
-const gchar *
-e_gw_connection_get_session_id (EGwConnection *cnc)
-{
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), NULL);
-
-       return (const gchar *) cnc->priv->session_id;
-}
-
-const gchar *
-e_gw_connection_get_user_name (EGwConnection *cnc)
-{
-       g_return_val_if_fail (cnc != NULL, NULL);
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), NULL);
-
-       return (const gchar *) cnc->priv->user_name;
-}
-
-const gchar *
-e_gw_connection_get_user_email (EGwConnection *cnc)
-{
-       g_return_val_if_fail (cnc != NULL, NULL);
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), NULL);
-
-       return (const gchar *) cnc->priv->user_email;
-
-}
-
-const gchar *
-e_gw_connection_get_user_uuid (EGwConnection *cnc)
-{
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), NULL);
-
-       return (const gchar *) cnc->priv->user_uuid;
-}
-
-const gchar *
-e_gw_connection_get_server_time (EGwConnection *cnc)
-{
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), NULL);
-
-       return (const gchar *) cnc->priv->server_time;
-}
-
-gchar *
-e_gw_connection_format_date_string (const gchar *dtstring)
-{
-       gchar *str2;
-       gint i, j, len = strlen (dtstring);
-
-       str2 = g_malloc0 (len);
-       if (len <= 0)
-               return str2;
-
-       for (i = 0,j = 0; i < len; i++) {
-               if ((dtstring[i] != '-') && (dtstring[i] != ':')) {
-                       str2[j] = dtstring[i];
-                       j++;
-               }
-       }
-
-       str2[j] = '\0';
-       return str2;
-}
-
-time_t
-e_gw_connection_get_date_from_string (const gchar *dtstring)
-{
-       time_t t = 0;
-       GTimeVal t_val;
-
-       g_return_val_if_fail (dtstring != NULL, 0);
-
-       if (g_time_val_from_iso8601 (dtstring, &t_val)) {
-               t = (time_t) t_val.tv_sec;
-       } else if (strlen (dtstring) == 8) {
-               /* It might be a date value */
-               GDate date;
-               struct tm tt;
-               guint16 year;
-               guint month;
-               guint8 day;
-
-               g_date_clear (&date, 1);
-#define digit_at(x,y) (x[y] - '0')
-               year = digit_at (dtstring, 0) * 1000
-                       + digit_at (dtstring, 1) * 100
-                       + digit_at (dtstring, 2) * 10
-                       + digit_at (dtstring, 3);
-               month = digit_at (dtstring, 4) * 10 + digit_at (dtstring, 5);
-               day = digit_at (dtstring, 6) * 10 + digit_at (dtstring, 7);
-
-               g_date_set_year (&date, year);
-               g_date_set_month (&date, month);
-               g_date_set_day (&date, day);
-
-               g_date_to_struct_tm (&date, &tt);
-               t = mktime (&tt);
-
-       } else
-               g_warning ("Could not parse the string \n");
-
-       return t;
-}
-
-EGwConnectionStatus
-e_gw_connection_create_book (EGwConnection *cnc, gchar *book_name, gchar **id)
-{
-       SoupSoapMessage *msg;
-       gint status;
-       SoupSoapResponse *response;
-       SoupSoapParameter *param;
-       gchar *value;
-
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "createItemRequest");
-       soup_soap_message_start_element (msg, "item", NULL, NULL);
-       soup_soap_message_add_attribute (msg, "type", "AddressBook", "xsi", NULL);
-       e_gw_message_write_string_parameter (msg, "name", NULL, book_name);
-       soup_soap_message_end_element (msg);
-       e_gw_message_write_footer (msg);
-
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       reauthenticate (cnc);
-               g_object_unref (response);
-               g_object_unref (msg);
-               return status;
-       }
-       value = NULL;
-       param = soup_soap_response_get_first_parameter_by_name (response, "id");
-       if (param)
-               value = soup_soap_parameter_get_string_value (param);
-       if (value)
-               *id = value;
-
-       status = E_GW_CONNECTION_STATUS_OK;
-       return status;
-}
-
-EGwConnectionStatus
-e_gw_connection_get_address_book_list (EGwConnection *cnc, GList **container_list)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-       EGwConnectionPrivate *priv;
-       SoupSoapParameter *param;
-       SoupSoapParameter *type_param;
-       gchar *value;
-       static GStaticMutex connecting = G_STATIC_MUTEX_INIT;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_UNKNOWN);
-       g_return_val_if_fail (container_list != NULL, E_GW_CONNECTION_STATUS_UNKNOWN);
-
-       priv = cnc->priv;
-       g_static_mutex_lock (&connecting);
-
-       if (priv->book_list) {
-               *container_list = priv->book_list;
-               g_static_mutex_unlock (&connecting);
-               return E_GW_CONNECTION_STATUS_OK;
-       }
-
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "getAddressBookListRequest");
-       if (!msg) {
-                g_warning (G_STRLOC ": Could not build SOAP message");
-               g_static_mutex_unlock (&connecting);
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-       }
-
-       e_gw_message_write_footer (msg);
-
-        /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               g_static_mutex_unlock (&connecting);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       g_object_unref (msg);
-
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       reauthenticate (cnc);
-               g_object_unref (response);
-               g_static_mutex_unlock (&connecting);
-               return status;
-       }
-
-       /* if status is OK - parse result. return the list */
-       param = soup_soap_response_get_first_parameter_by_name (response, "books");
-       if (!param) {
-               g_object_unref (response);
-               g_static_mutex_unlock (&connecting);
-               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-       } else {
-               SoupSoapParameter *subparam;
-               for (subparam = soup_soap_parameter_get_first_child_by_name (param, "book");
-                    subparam != NULL;
-                    subparam = soup_soap_parameter_get_next_child_by_name (subparam, "book")) {
-                       EGwContainer *container;
-
-                       container = e_gw_container_new_from_soap_parameter (subparam);
-                       if (container) {
-                               priv->book_list = g_list_append (priv->book_list, container);
-                               type_param = soup_soap_parameter_get_first_child_by_name (subparam, "isPersonal");
-                               value = NULL;
-                               if (type_param)
-                                       value = soup_soap_parameter_get_string_value (type_param);
-                               if (value && g_str_equal(value , "1"))
-                                       e_gw_container_set_is_writable (container, TRUE);
-                               else
-                                       e_gw_container_set_is_writable (container, FALSE);
-                               g_free (value);
-                               value = NULL;
-                               type_param = soup_soap_parameter_get_first_child_by_name (subparam, "isFrequentContacts");
-                               if (type_param)
-                                       value = soup_soap_parameter_get_string_value (type_param);
-                                if (value && g_str_equal(value , "1"))
-                                       e_gw_container_set_is_frequent_contacts (container, TRUE);
-
-                               g_free (value);
-
-                       }
-
-               }
-       }
-
-       g_object_unref (response);
-       *container_list = priv->book_list;
-       g_static_mutex_unlock (&connecting);
-
-       return status;
-}
-
-EGwConnectionStatus
-e_gw_connection_get_address_book_id ( EGwConnection *cnc, gchar *book_name, gchar **id , gboolean *is_writable)
-{
-       EGwConnectionStatus status;
-       GList *container_list = NULL, *l;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-       g_return_val_if_fail (book_name != NULL, E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       status = e_gw_connection_get_address_book_list (cnc, &container_list);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               return status;
-       }
-
-       /* search the container in the list */
-       for (l = container_list; l != NULL; l = l->next) {
-               EGwContainer *container = E_GW_CONTAINER (l->data);
-               if (strcmp (e_gw_container_get_name (container), book_name) == 0) {
-
-                       *id = g_strdup (e_gw_container_get_id (container));
-                       *is_writable = e_gw_container_get_is_writable (container);
-                       break;
-               }
-       }
-
-       return status;
-
-}
-
-EGwConnectionStatus
-e_gw_connection_modify_settings (EGwConnection *cnc, EGwSendOptions *opts)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-       EGwConnectionPrivate *priv;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-       g_return_val_if_fail (opts != NULL, E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       priv = cnc->priv;
-
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "modifySettingsRequest");
-       if (!msg) {
-                g_warning (G_STRLOC ": Could not build SOAP message");
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-       }
-
-       if (!e_gw_sendoptions_form_message_to_modify (msg, opts, priv->opts)) {
-               g_warning (G_STRLOC ": Could not append changes to SOAP message");
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_INVALID_OBJECT;
-       }
-
-       e_gw_message_write_footer (msg);
-
-        /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       reauthenticate (cnc);
-               g_object_unref (response);
-               g_object_unref (msg);
-               return status;
-       } else {
-               g_object_unref (priv->opts);
-               priv->opts = NULL;
-               priv->opts = opts;
-       }
-
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       return status;
-}
-
-EGwConnectionStatus
-e_gw_connection_get_settings (EGwConnection *cnc, EGwSendOptions **opts)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-       SoupSoapParameter *param;
-       EGwConnectionPrivate *priv;
-       static GStaticMutex connecting = G_STATIC_MUTEX_INIT;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       priv = cnc->priv;
-
-       g_static_mutex_lock (&connecting);
-
-       if (priv->opts) {
-               g_object_ref (priv->opts);
-               *opts = priv->opts;
-               g_static_mutex_unlock (&connecting);
-
-               return E_GW_CONNECTION_STATUS_OK;
-       }
-
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "getSettingsRequest");
-       if (!msg) {
-                g_warning (G_STRLOC ": Could not build SOAP message");
-               g_static_mutex_unlock (&connecting);
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-       }
-       e_gw_message_write_footer (msg);
-
-        /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               g_static_mutex_unlock (&connecting);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       reauthenticate (cnc);
-               g_object_unref (response);
-               g_object_unref (msg);
-               g_static_mutex_unlock (&connecting);
-               return status;
-       }
-
-       param = soup_soap_response_get_first_parameter_by_name (response, "settings");
-       if (!param) {
-               g_object_unref (response);
-               g_object_unref (msg);
-               g_static_mutex_unlock (&connecting);
-               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-       } else
-               priv->opts = e_gw_sendoptions_new_from_soap_parameter (param);
-
-       g_object_ref (priv->opts);
-       *opts = priv->opts;
-       g_object_unref (response);
-       g_object_unref (msg);
-       g_static_mutex_unlock (&connecting);
-
-       return E_GW_CONNECTION_STATUS_OK;
-}
-
-EGwConnectionStatus
-e_gw_connection_get_categories (EGwConnection *cnc, GHashTable **categories_by_id, GHashTable **categories_by_name)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-       EGwConnectionPrivate *priv;
-       SoupSoapParameter *param, *subparam, *second_level_child;
-       gchar *id, *name;
-       static GStaticMutex connecting = G_STATIC_MUTEX_INIT;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       priv = cnc->priv;
-       g_static_mutex_lock (&connecting);
-
-       if (priv->categories_by_id && priv->categories_by_name) {
-               *categories_by_id = priv->categories_by_id;
-               *categories_by_name = priv->categories_by_name;
-               g_static_mutex_unlock (&connecting);
-               return E_GW_CONNECTION_STATUS_OK;
-       }
-
-       /* build the SOAP message */
-        msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "getCategoryListRequest");
-       if (!msg) {
-                g_warning (G_STRLOC ": Could not build SOAP message");
-               g_static_mutex_unlock (&connecting);
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-       }
-       e_gw_message_write_footer (msg);
-
-        /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               g_static_mutex_unlock (&connecting);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       reauthenticate (cnc);
-               g_object_unref (response);
-               g_object_unref (msg);
-               g_static_mutex_unlock (&connecting);
-               return status;
-       }
-
-       /* if status is OK - parse result. return the list */
-       param = soup_soap_response_get_first_parameter_by_name (response, "categories");
-       if (!param) {
-               g_object_unref (response);
-               g_object_unref (msg);
-               g_static_mutex_unlock (&connecting);
-               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-       }
-
-       priv->categories_by_id = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
-       priv->categories_by_name = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
-
-       for (subparam = soup_soap_parameter_get_first_child_by_name (param, "category");
-            subparam != NULL;
-            subparam = soup_soap_parameter_get_next_child_by_name (subparam, "category")) {
-               id = name = NULL;
-               second_level_child = soup_soap_parameter_get_first_child_by_name (subparam, "id");
-               if (second_level_child)
-                       id = soup_soap_parameter_get_string_value (second_level_child);
-               second_level_child = soup_soap_parameter_get_first_child_by_name (subparam, "name");
-               if (second_level_child)
-                       name = soup_soap_parameter_get_string_value (second_level_child);
-               if (id && name) {
-                       gchar **components = g_strsplit (id, "@", -1);
-                       g_free (id);
-                       id = components[0];
-                       if (categories_by_id)
-                               g_hash_table_insert (priv->categories_by_id, g_strdup (id), g_strdup (name));
-                       if (categories_by_name)
-                               g_hash_table_insert (priv->categories_by_name, g_strdup (name), g_strdup (id));
-                       g_strfreev (components);
-                       id = NULL;
-               }
-               g_free (id);
-               g_free (name);
-       }
-
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-       *categories_by_id = priv->categories_by_id;
-       *categories_by_name = priv->categories_by_name;
-       g_static_mutex_unlock (&connecting);
-
-       return E_GW_CONNECTION_STATUS_OK;
-}
-
-EGwConnectionStatus
-e_gw_connection_add_members (EGwConnection *cnc, const gchar *group_id, GList *member_ids)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_UNKNOWN);
-       g_return_val_if_fail (member_ids != NULL, E_GW_CONNECTION_STATUS_UNKNOWN);
-       g_return_val_if_fail (group_id != NULL, E_GW_CONNECTION_STATUS_UNKNOWN);
-
-        msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "addMembersRequest");
-       if (!msg) {
-                g_warning (G_STRLOC ": Could not build SOAP message");
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-       }
-       e_gw_message_write_string_parameter (msg, "container", NULL, group_id);
-       soup_soap_message_start_element (msg, "members", NULL, NULL);
-
-       for (; member_ids != NULL; member_ids = g_list_next (member_ids)) {
-               soup_soap_message_start_element (msg, "member", NULL, NULL);
-               e_gw_message_write_string_parameter (msg, "id", NULL, member_ids->data);
-               soup_soap_message_end_element (msg);
-       }
-
-       soup_soap_message_end_element (msg);
-       e_gw_message_write_footer (msg);
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-       g_object_unref (response);
-       g_object_unref (msg);
-       return status;
-
-}
-
-EGwConnectionStatus
-e_gw_connection_remove_members (EGwConnection *cnc, const gchar *group_id, GList *member_ids)
-{
-
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_UNKNOWN);
-       g_return_val_if_fail (member_ids != NULL, E_GW_CONNECTION_STATUS_UNKNOWN);
-       g_return_val_if_fail (group_id != NULL, E_GW_CONNECTION_STATUS_UNKNOWN);
-
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "removeMembersRequest");
-       if (!msg) {
-                g_warning (G_STRLOC ": Could not build SOAP message");
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-       }
-       e_gw_message_write_string_parameter (msg, "container", NULL, group_id);
-       soup_soap_message_start_element (msg, "members", NULL, NULL);
-
-       for (; member_ids != NULL; member_ids = g_list_next (member_ids)) {
-               soup_soap_message_start_element (msg, "member", NULL, NULL);
-               e_gw_message_write_string_parameter (msg, "id", NULL, member_ids->data);
-               soup_soap_message_end_element (msg);
-       }
-
-       soup_soap_message_end_element (msg);
-       e_gw_message_write_footer (msg);
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-       g_object_unref (response);
-       g_object_unref (msg);
-       return status;
-
-}
-
-EGwConnectionStatus
-e_gw_connection_create_cursor (EGwConnection *cnc, const gchar *container, const gchar *view, EGwFilter *filter, gint *cursor)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-       SoupSoapParameter *param;
-       gchar *value;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_UNKNOWN);
-       g_return_val_if_fail ((container != NULL), E_GW_CONNECTION_STATUS_UNKNOWN);
-
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "createCursorRequest");
-       e_gw_message_write_string_parameter (msg, "container", NULL, container);
-       if (view)
-               e_gw_message_write_string_parameter (msg, "view", NULL, view);
-       if (E_IS_GW_FILTER (filter))
-               e_gw_filter_append_to_soap_message (filter, msg);
-
-       e_gw_message_write_footer (msg);
-
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       reauthenticate (cnc);
-               g_object_unref (response);
-               g_object_unref (msg);
-               return status;
-       }
-       param = soup_soap_response_get_first_parameter_by_name (response, "cursor");
-       if (!param) {
-               g_object_unref (response);
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-       }
-       value = soup_soap_parameter_get_string_value (param);
-
-       if (!value) {
-                g_object_unref (response);
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-       }
-
-       *cursor =(gint) g_ascii_strtod (value, NULL);
-
-       g_free (value);
-       g_object_unref (response);
-       g_object_unref (msg);
-       return E_GW_CONNECTION_STATUS_OK;
-}
-
-EGwConnectionStatus
-e_gw_connection_destroy_cursor (EGwConnection *cnc, const gchar *container,  gint cursor)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_UNKNOWN);
-       g_return_val_if_fail ((container != NULL), E_GW_CONNECTION_STATUS_UNKNOWN);
-
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "destroyCursorRequest");
-       e_gw_message_write_string_parameter (msg, "container", NULL, container);
-
-       e_gw_message_write_int_parameter (msg, "cursor", NULL, cursor);
-       e_gw_message_write_footer (msg);
-
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-       g_object_unref (response);
-       g_object_unref (msg);
-       return status;
-
-}
-
-EGwConnectionStatus
-e_gw_connection_position_cursor (EGwConnection *cnc, const gchar *container, gint cursor, const gchar *seek, gint offset)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_UNKNOWN);
-       g_return_val_if_fail ((container != NULL), E_GW_CONNECTION_STATUS_UNKNOWN);
-
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "positionCursorRequest");
-       e_gw_message_write_int_parameter (msg, "cursor", NULL, cursor);
-       e_gw_message_write_string_parameter (msg, "container", NULL, container);
-       e_gw_message_write_string_parameter (msg, "seek", NULL, seek);
-       e_gw_message_write_int_parameter (msg, "offset", NULL, offset);
-
-       e_gw_message_write_footer (msg);
-
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       g_object_unref (response);
-       g_object_unref (msg);
-       return status;
-}
-
-EGwConnectionStatus
-e_gw_connection_read_cursor (EGwConnection *cnc, const gchar *container, gint cursor, gboolean forward, gint count, const gchar *cursor_seek, GList **item_list)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-       SoupSoapParameter *param, *subparam;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_UNKNOWN);
-       g_return_val_if_fail ((container != NULL), E_GW_CONNECTION_STATUS_UNKNOWN);
-
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "readCursorRequest");
-       e_gw_message_write_int_parameter (msg, "cursor", NULL, cursor);
-       /* there is problem in read curosr if you set this, uncomment after the problem
-          is fixed in server */
-       e_gw_message_write_string_parameter (msg, "position", NULL, cursor_seek);
-       e_gw_message_write_string_parameter (msg, "forward", NULL, forward ? "true": "false");
-       e_gw_message_write_string_parameter (msg, "container", NULL, container);
-       e_gw_message_write_int_parameter (msg, "count", NULL, count);
-
-       e_gw_message_write_footer (msg);
-
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       reauthenticate (cnc);
-               g_object_unref (response);
-               g_object_unref (msg);
-               return status;
-       }
-
-       /* if status is OK - parse result. return the list */
-       param = soup_soap_response_get_first_parameter_by_name (response, "items");
-       if (!param) {
-               g_object_unref (response);
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-       }
-
-       for (subparam = soup_soap_parameter_get_first_child_by_name (param, "item");
-            subparam != NULL;
-            subparam = soup_soap_parameter_get_next_child_by_name (subparam, "item")) {
-               EGwItem *item;
-
-               item = e_gw_item_new_from_soap_parameter (cnc->priv->user_email, container, subparam);
-               if (item)
-                       *item_list = g_list_append (*item_list, item);
-       }
-
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-       return E_GW_CONNECTION_STATUS_OK;
-}
-
-EGwConnectionStatus e_gw_connection_get_quick_messages (EGwConnection *cnc, const gchar *container, const gchar *view, gchar **start_date, const gchar *message_list, const gchar *item_types, const gchar *item_sources, gint count, GSList **item_list)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-       SoupSoapParameter *param, *subparam;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_UNKNOWN);
-       g_return_val_if_fail (message_list != NULL, E_GW_CONNECTION_STATUS_UNKNOWN);
-
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "getQuickMessagesRequest");
-       e_gw_message_write_string_parameter (msg, "list", NULL, message_list);
-       if (start_date && *start_date)
-               e_gw_message_write_string_parameter (msg, "startDate", NULL, *start_date);
-       if (container)
-               e_gw_message_write_string_parameter (msg, "container", NULL, container);
-       if (item_types)
-               e_gw_message_write_string_parameter (msg, "types", NULL, item_types);
-       if (item_sources)
-               e_gw_message_write_string_parameter (msg, "source", NULL, item_sources);
-       if (view)
-               e_gw_message_write_string_parameter (msg, "view", NULL, view);
-       if (count > 0)
-               e_gw_message_write_int_parameter (msg, "count", NULL, count);
-
-       e_gw_message_write_footer (msg);
-
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       reauthenticate (cnc);
-               g_object_unref (response);
-               g_object_unref (msg);
-               return status;
-       }
-
-       /* if status is OK - parse result. return the list */
-       *item_list = NULL;
-       param = soup_soap_response_get_first_parameter_by_name (response, "items");
-       if (!param) {
-               g_object_unref (response);
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-       }
-       if (start_date && *start_date && (((!strcmp (message_list, "New")) || (!strcmp (message_list, "Modified"))))) {
-               subparam = soup_soap_response_get_first_parameter_by_name (response, "startDate");
-               if (subparam) {
-                       gchar *date;
-
-                       date = soup_soap_parameter_get_string_value (subparam);
-                       if (date)
-                               g_free (*start_date), *start_date = NULL, *start_date = date;
-                       else
-                               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-               } else
-                       return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-       }
-
-       if (!strcmp (message_list, "All")) {
-               gboolean view_is_id = FALSE;
-
-               if (!strcmp (view, "id"))
-                       view_is_id = TRUE;
-               /* We are  interested only in getting the ids */
-               for (subparam = soup_soap_parameter_get_first_child_by_name (param, "item");
-                    subparam != NULL;
-                    subparam = soup_soap_parameter_get_next_child_by_name (subparam, "item")) {
-                       SoupSoapParameter *param_id;
-                       gchar *id;
-
-                       if (view_is_id) {
-                               param_id = soup_soap_parameter_get_first_child_by_name (subparam, "id");
-                               if (!param_id) {
-                                       g_object_unref (response);
-                                       g_object_unref (msg);
-                                       return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-                               }
-                       } else {
-                               param_id = soup_soap_parameter_get_first_child_by_name (subparam, "iCalId");
-                               if (!param_id) {
-                                       g_object_unref (response);
-                                       g_object_unref (msg);
-                                       return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-                               }
-                       }
-
-                       id = g_strdup (soup_soap_parameter_get_string_value (param_id));
-                       if (id)
-                               *item_list = g_slist_append (*item_list, id);
-               }
-
-               g_object_unref (response);
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_OK;
-
-       }
-
-       for (subparam = soup_soap_parameter_get_first_child_by_name (param, "item");
-            subparam != NULL;
-            subparam = soup_soap_parameter_get_next_child_by_name (subparam, "item")) {
-               EGwItem *item;
-
-               item = e_gw_item_new_from_soap_parameter (cnc->priv->user_email, container, subparam);
-               if (item)
-                       *item_list = g_slist_append (*item_list, item);
-       }
-
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-       return E_GW_CONNECTION_STATUS_OK;
-
-}
-
-EGwConnectionStatus
-e_gw_connection_create_folder (EGwConnection *cnc, const gchar *parent_name,const gchar *folder_name, gchar **container_id)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       SoupSoapParameter *param;
-       EGwConnectionStatus status = E_GW_CONNECTION_STATUS_UNKNOWN;
-
-       msg = e_gw_message_new_with_header (e_gw_connection_get_uri (cnc), e_gw_connection_get_session_id(cnc), "createItemRequest");
-
-       soup_soap_message_start_element (msg, "item", NULL, NULL);
-       soup_soap_message_add_attribute (msg, "type", "Folder", "xsi", NULL);
-
-       e_gw_message_write_string_parameter (msg, "name", NULL, folder_name);
-       e_gw_message_write_string_parameter (msg, "parent", NULL,parent_name );
-
-       soup_soap_message_end_element (msg);
-
-       e_gw_message_write_footer (msg);
-
-       response =  e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-       status = e_gw_connection_parse_response_status (response);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       reauthenticate (cnc);
-               g_object_unref (response);
-               g_object_unref (msg);
-               return status;
-       } else {
-               param = soup_soap_response_get_first_parameter_by_name (response, "id");
-               *container_id = soup_soap_parameter_get_string_value(param);
-               printf ("CONTAINER ID %s \n", *container_id);
-       }
-
-       return status;
-
-}
-
-/*
- *
- */
-EGwConnectionStatus
-e_gw_connection_get_attachment (EGwConnection *cnc, const gchar *id, gint offset, gint length, const gchar **attachment, gint *attach_length)
-{
-
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-       SoupSoapParameter *param;
-       gchar *buffer = NULL, *buf_length = NULL;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       /* build the SOAP message */
-        msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "getAttachmentRequest");
-       if (!msg) {
-                g_warning (G_STRLOC ": Could not build SOAP message");
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-       }
-
-       e_gw_message_write_string_parameter (msg, "id", NULL, id);
-       e_gw_message_write_int_parameter (msg, "offset", NULL, offset);
-       e_gw_message_write_int_parameter (msg, "length", NULL, length);
-
-       e_gw_message_write_footer (msg);
-
-        /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       reauthenticate (cnc);
-               g_object_unref (response);
-               g_object_unref (msg);
-               return status;
-       }
-
-       param = soup_soap_response_get_first_parameter_by_name (response, "part");
-       if (param) {
-               buf_length =  soup_soap_parameter_get_property (param, "length");
-               buffer = soup_soap_parameter_get_string_value (param);
-       }
-
-       if (buffer && buf_length && atoi (buf_length) > 0) {
-               gsize len = atoi (buf_length);
-               *attachment = (gchar *) g_base64_decode (buffer,&len);
-               *attach_length = len;
-       } else {
-               *attachment = NULL;
-               *attach_length = 0;
-       }
-
-       /* free memory */
-       g_free (buffer);
-       g_free (buf_length);
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       return E_GW_CONNECTION_STATUS_OK;
-}
-
-/*
- *
- */
-EGwConnectionStatus
-e_gw_connection_get_attachment_base64 (EGwConnection *cnc, const gchar *id, gint offset, gint length, const gchar **attachment, gint *attach_length, gint *offset_r)
-{
-
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-       SoupSoapParameter *param;
-       gchar *buffer = NULL, *buf_length = NULL, *o_return = NULL;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       /* build the SOAP message */
-        msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "getAttachmentRequest");
-       if (!msg) {
-                g_warning (G_STRLOC ": Could not build SOAP message");
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-       }
-
-       e_gw_message_write_string_parameter (msg, "id", NULL, id);
-       e_gw_message_write_int_parameter (msg, "offset", NULL, offset);
-       e_gw_message_write_int_parameter (msg, "length", NULL, length);
-
-       e_gw_message_write_footer (msg);
-
-        /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       reauthenticate (cnc);
-               g_object_unref (response);
-               g_object_unref (msg);
-               return status;
-       }
-
-       param = soup_soap_response_get_first_parameter_by_name (response, "part");
-       if (param) {
-               buf_length =  soup_soap_parameter_get_property (param, "length");
-               o_return =  soup_soap_parameter_get_property (param, "offset");
-               buffer = soup_soap_parameter_get_string_value (param);
-       }
-
-       if (buffer && buf_length && atoi (buf_length) > 0) {
-               gint len = atoi (buf_length);
-               *attachment = g_strdup (buffer);
-               *attach_length = len;
-               if (len && o_return)
-                       *offset_r = atoi (o_return);
-               else
-                       *offset_r = 0;
-       } else {
-               *attachment = NULL;
-               *attach_length = 0;
-               *offset_r = 0;
-       }
-
-       /* free memory */
-       g_free (buffer);
-       g_free (buf_length);
-       g_free (o_return);
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       return E_GW_CONNECTION_STATUS_OK;
-}
-
-EGwConnectionStatus
-e_gw_connection_add_item (EGwConnection *cnc, const gchar *container, const gchar *id)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_CONNECTION);
-       g_return_val_if_fail (id != NULL, E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       /* build the SOAP message */
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "addItemRequest");
-
-       if (container && *container)
-               e_gw_message_write_string_parameter (msg, "container", NULL, container);
-       e_gw_message_write_string_parameter (msg, "id", NULL, id);
-       e_gw_message_write_footer (msg);
-
-       /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       return status;
-}
-
-EGwConnectionStatus
-e_gw_connection_add_items (EGwConnection *cnc, const gchar *container, GList *item_ids)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_CONNECTION);
-       g_return_val_if_fail (item_ids != NULL, E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       /* build the SOAP message */
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "addItemsRequest");
-
-       if (container && *container)
-               e_gw_message_write_string_parameter (msg, "container", NULL, container);
-
-       soup_soap_message_start_element (msg, "items", NULL, NULL);
-       for (; item_ids != NULL; item_ids = g_list_next (item_ids))
-               e_gw_message_write_string_parameter (msg, "item", NULL, item_ids->data);
-       soup_soap_message_end_element (msg);
-
-       e_gw_message_write_footer (msg);
-
-       /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       return status;
-}
-
-EGwConnectionStatus
-e_gw_connection_rename_folder (EGwConnection *cnc, const gchar *id ,const gchar *new_name)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       /* build the SOAP message */
-        msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "modifyItemRequest");
-       if (!msg) {
-                g_warning (G_STRLOC ": Could not build SOAP message");
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-       }
-
-       e_gw_message_write_string_parameter (msg, "id", NULL, id);
-
-       soup_soap_message_start_element (msg, "updates", NULL, NULL);
-       soup_soap_message_start_element (msg, "update", NULL, NULL);
-       e_gw_message_write_string_parameter (msg, "name", NULL, new_name);
-       soup_soap_message_end_element (msg);
-       soup_soap_message_end_element (msg);
-
-       e_gw_message_write_footer (msg);
-
-       /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-       g_object_unref (msg);
-       g_object_unref (response);
-
-       return status;
-
-}
-
-EGwConnectionStatus
-e_gw_connection_share_folder (EGwConnection *cnc, gchar *id, GList *new_list, const gchar *sub, const gchar *mesg ,int flag)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status = E_GW_CONNECTION_STATUS_UNKNOWN;
-
-       msg = e_gw_message_new_with_header (e_gw_connection_get_uri (cnc), e_gw_connection_get_session_id (cnc), "modifyItemRequest");
-       e_gw_container_form_message (msg, id, new_list, sub, mesg, flag);
-       e_gw_message_write_footer (msg);
-       response =  e_gw_connection_send_message (cnc, msg);
-
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       return status;
-}
-
-EGwConnectionStatus
-e_gw_connection_move_item (EGwConnection *cnc, const gchar *id, const gchar *dest_container_id, const gchar *from_container_id)
-
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_CONNECTION);
-       g_return_val_if_fail (id != NULL, E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-       g_return_val_if_fail (dest_container_id != NULL, E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       /* build the SOAP message */
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "moveItemRequest");
-       e_gw_message_write_string_parameter (msg, "id", NULL, id);
-       e_gw_message_write_string_parameter (msg, "container", NULL,dest_container_id);
-       if (from_container_id)
-               e_gw_message_write_string_parameter (msg, "from", NULL,from_container_id);
-       e_gw_message_write_footer (msg);
-
-       /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-       return status;
-
-}
-
-EGwConnectionStatus
-e_gw_connection_accept_shared_folder (EGwConnection *cnc, gchar *name, gchar *container_id, gchar *item_id, gchar *desc)
-{
-
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status = E_GW_CONNECTION_STATUS_UNKNOWN;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_CONNECTION);
-       g_return_val_if_fail (container_id != NULL, E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-       g_return_val_if_fail (item_id != NULL, E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-       g_return_val_if_fail (name != NULL, E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "acceptShareRequest");
-       e_gw_message_write_string_parameter (msg, "id", NULL, item_id);
-       e_gw_message_write_string_parameter (msg, "name", NULL, name);
-       e_gw_message_write_string_parameter (msg, "container", NULL, container_id);
-       e_gw_message_write_string_parameter (msg, "description", NULL, desc);
-       e_gw_message_write_footer (msg);
-       response =  e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       return status;
-
-}
-
-EGwConnectionStatus
-e_gw_connection_purge_deleted_items (EGwConnection *cnc)
-{
-
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status = E_GW_CONNECTION_STATUS_UNKNOWN;
-
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "purgeDeletedItemsRequest");
-       e_gw_message_write_footer (msg);
-       response =  e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       return status;
-
-}
-
-EGwConnectionStatus
-e_gw_connection_purge_selected_items (EGwConnection *cnc, GList *item_ids)
-{
-
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status = E_GW_CONNECTION_STATUS_UNKNOWN;
-
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "purgeRequest");
-       /* Now write the elements that need to be deleted */
-       soup_soap_message_start_element (msg, "items", NULL, NULL);
-       for (; item_ids != NULL; item_ids = g_list_next (item_ids))
-               e_gw_message_write_string_parameter (msg, "item", NULL, item_ids->data);
-       soup_soap_message_end_element (msg);
-       /*End message*/
-       e_gw_message_write_footer (msg);
-       /* Send to server */
-       response =  e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       return status;
-
-}
-
-EGwConnectionStatus
-e_gw_connection_mark_read (EGwConnection *cnc, GList *item_ids)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_CONNECTION);
-
-       /* build the SOAP message */
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "markReadRequest");
-
-       soup_soap_message_start_element (msg, "items", NULL, NULL);
-       for (; item_ids != NULL; item_ids = g_list_next (item_ids))
-               e_gw_message_write_string_parameter (msg, "item", NULL, item_ids->data);
-       soup_soap_message_end_element (msg);
-       e_gw_message_write_footer (msg);
-
-       /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       return status;
-}
-
-EGwConnectionStatus
-e_gw_connection_mark_unread (EGwConnection *cnc, GList *item_ids)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_CONNECTION);
-
-       /* build the SOAP message */
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "markUnReadRequest");
-
-       soup_soap_message_start_element (msg, "items", NULL, NULL);
-       for (; item_ids != NULL; item_ids = g_list_next (item_ids))
-               e_gw_message_write_string_parameter (msg, "item", NULL, item_ids->data);
-       soup_soap_message_end_element (msg);
-       e_gw_message_write_footer (msg);
-
-       /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       return status;
-}
-
-EGwConnectionStatus
-e_gw_connection_reply_item (EGwConnection *cnc, const gchar *id, const gchar *view, EGwItem **item)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-       SoupSoapParameter *param;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       /* build the SOAP message */
-        msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "replyRequest");
-       if (!msg) {
-                g_warning (G_STRLOC ": Could not build SOAP message");
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-       }
-
-       e_gw_message_write_string_parameter (msg, "id", NULL, id);
-
-       if (view)
-               e_gw_message_write_string_parameter (msg, "view", NULL, view);
-       e_gw_message_write_footer (msg);
-
-       /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       reauthenticate (cnc);
-               g_object_unref (response);
-               g_object_unref (msg);
-               return status;
-       }
-
-       /* if status is OK - parse result. return the list */
-       param = soup_soap_response_get_first_parameter_by_name (response, "item");
-       if (!param) {
-               g_object_unref (response);
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-       }
-
-       *item = e_gw_item_new_from_soap_parameter (cnc->priv->user_email, "", param);
-
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       if (!*item)
-               return E_GW_CONNECTION_STATUS_INVALID_OBJECT;
-
-       return E_GW_CONNECTION_STATUS_OK;
-}
-
-EGwConnectionStatus
-e_gw_connection_forward_item (EGwConnection *cnc, const gchar *id, const gchar *view, gboolean embed, EGwItem **item)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-       SoupSoapParameter *param;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       /* build the SOAP message */
-        msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "forwardRequest");
-       if (!msg) {
-                g_warning (G_STRLOC ": Could not build SOAP message");
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-       }
-
-       e_gw_message_write_string_parameter (msg, "id", NULL, id);
-
-       if (view)
-               e_gw_message_write_string_parameter (msg, "view", NULL, view);
-
-       if (embed)
-               e_gw_message_write_int_parameter (msg, "embed", NULL,1);
-
-       e_gw_message_write_footer (msg);
-       /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       reauthenticate (cnc);
-               g_object_unref (response);
-               g_object_unref (msg);
-               return status;
-       }
-
-       /* if status is OK - parse result. return the list */
-       param = soup_soap_response_get_first_parameter_by_name (response, "item");
-       if (!param) {
-               g_object_unref (response);
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-       }
-
-       *item = e_gw_item_new_from_soap_parameter (cnc->priv->user_email, "", param);
-
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       if (!*item)
-               return E_GW_CONNECTION_STATUS_INVALID_OBJECT;
-
-       return E_GW_CONNECTION_STATUS_OK;
-}
-
-/* e_gw_connection_create_junk_entry :creates a junk entry in the list
- * @cnc
- * @value : to be added in the list
- * @match_type : "email"/"domain" default: email
- * @list_type : "junk"/"trust"/"block" default: junk
- * */
-
-EGwConnectionStatus
-e_gw_connection_create_junk_entry (EGwConnection *cnc, const gchar *value, const gchar *match_type, const gchar *list_type)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-       g_return_val_if_fail (value != NULL, E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       /* build the SOAP message */
-        msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "createJunkEntryRequest");
-       if (!msg) {
-                g_warning (G_STRLOC ": Could not build SOAP message");
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-       }
-       soup_soap_message_start_element (msg, "entry", NULL, NULL);
-       e_gw_message_write_string_parameter (msg, "match", NULL, value);
-       e_gw_message_write_string_parameter (msg, "matchType", NULL, match_type);
-       e_gw_message_write_string_parameter (msg, "listType", NULL, list_type);
-       soup_soap_message_end_element (msg);
-       e_gw_message_write_footer (msg);
-       response =  e_gw_connection_send_message (cnc, msg);
-
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       return status;
-}
-
-/*TODO: move to different file*/
-static void
-parse_junk_settings (SoupSoapParameter *param, gint *use_junk, gint *use_block, gint *use_pab, gint *persistence)
-{
-       SoupSoapParameter *subparam, *field_param, *val_param;
-
-       if (param == NULL)
-               return;
-       else    {
-               /* parse these parameters into junk settings*/
-               for (subparam = soup_soap_parameter_get_first_child_by_name (param, "setting");
-                               subparam != NULL;
-                               subparam = soup_soap_parameter_get_next_child_by_name (subparam, "setting")) {
-                       gchar *field = NULL;
-                       gint val = 0;
-
-                       field_param = soup_soap_parameter_get_first_child_by_name (subparam, "field");
-                       val_param = soup_soap_parameter_get_first_child_by_name (subparam, "value");
-
-                       if (field_param) {
-                               field = soup_soap_parameter_get_string_value (field_param);
-                               if (!field)
-                                       continue;
-                       } else
-                               continue;
-
-                       if (!g_ascii_strcasecmp (field, "useJunkList")) {
-                               if (val_param)
-                                       val = soup_soap_parameter_get_int_value (val_param);
-                               *use_junk = val;
-                       } else  if (!g_ascii_strcasecmp (field, "useBlockList")) {
-                               if (val_param)
-                                       val = soup_soap_parameter_get_int_value (val_param);
-                               *use_block = val;
-                       } else if (!g_ascii_strcasecmp (field, "usePAB")) {
-                               if (val_param)
-                                       val = soup_soap_parameter_get_int_value (val_param);
-                               *use_pab = val;
-                       } else if (!g_ascii_strcasecmp (field, "persistence")) {
-                               if (val_param)
-                                       val = soup_soap_parameter_get_int_value (val_param);
-                               *persistence = val;
-                       }
-                       g_free (field);
-               }
-       }
-}
-
-/*
- * e_gw_connection_get_junk_settings: gets the junk settings
- * use_junk : returned value, whether junk list is being used
- * use_block: use block list
- * use_pab: returned value, whether personal addresbook is used
- * persistence:
- * */
-EGwConnectionStatus
-e_gw_connection_get_junk_settings (EGwConnection *cnc, gint *use_junk, gint *use_block, gint *use_pab, gint *persistence)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       SoupSoapParameter *param;
-       EGwConnectionStatus status;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       /* build the SOAP message */
-        msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "getJunkMailSettingsRequest");
-
-       if (!msg) {
-                g_warning (G_STRLOC ": Could not build SOAP message");
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-       }
-       e_gw_message_write_footer (msg);
-       response =  e_gw_connection_send_message (cnc, msg);
-
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-
-       /* if status is OK - parse result. return the list */
-       if (status == E_GW_CONNECTION_STATUS_OK) {
-               param = soup_soap_response_get_first_parameter_by_name (response, "settings");
-               parse_junk_settings (param, use_junk, use_block, use_pab, persistence);
-       }
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       return status;
-
-}
-
-static void
-msg_add_settings (SoupSoapMessage *msg, const gchar *field, gint value)
-{
-       soup_soap_message_start_element (msg, "setting", NULL, NULL);
-       e_gw_message_write_string_parameter (msg, "field", NULL, field);
-       e_gw_message_write_int_parameter (msg, "value", NULL, value);
-       soup_soap_message_end_element (msg);
-}
-
-/* e_gw_connection_modify_junk_settings: creates/removes junk mail settings
- * @cnc
- * @use_junk 0 : disable spam learning from junk list 1: enable
- * @use_block: same for block list
- * use_pab 1: put messages except from personal add book in junk, 0 disable
- * @persistence :delete after
- * */
-
-EGwConnectionStatus
-e_gw_connection_modify_junk_settings (EGwConnection *cnc, gint use_junk, gint use_pab, gint use_block, gint persistence)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       /* build the SOAP message */
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "modifyJunkMailSettingsRequest");
-       if (!msg) {
-               g_warning (G_STRLOC ": Could not build SOAP message");
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-       }
-
-       soup_soap_message_start_element (msg, "settings", NULL, NULL);
-
-       msg_add_settings (msg, "useJunkList", use_junk);
-       msg_add_settings (msg, "usePAB", use_pab);
-       msg_add_settings (msg, "useBlockList", use_block);
-       msg_add_settings (msg, "persistence", persistence);
-
-       soup_soap_message_end_element (msg);
-       e_gw_message_write_footer (msg);
-       response =  e_gw_connection_send_message (cnc, msg);
-
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       return status;
-
-}
-
-/*TODO:Move this code to some other file and make this function public*/
-static EGwJunkEntry *
-e_gw_junkentry_new_from_soap_parameter (SoupSoapParameter *param)
-{
-       EGwJunkEntry *junk_entry;
-       SoupSoapParameter *subparam;
-
-       g_return_val_if_fail (param != NULL, NULL);
-
-       junk_entry = g_new0 (EGwJunkEntry, 1);
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "id");
-       if (!subparam) {
-               g_warning (G_STRLOC ": found junk entry with no name");
-               return NULL;
-       }
-       junk_entry->id = soup_soap_parameter_get_string_value (subparam);
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "match");
-       if (!subparam) {
-               g_warning (G_STRLOC ": found junk entry with no Match");
-               return NULL;
-       }
-       junk_entry->match = soup_soap_parameter_get_string_value (subparam);
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "matchType");
-       if (!subparam) {
-               g_warning (G_STRLOC ": found junk entry with no MatchType");
-               return NULL;
-       }
-       junk_entry->matchType = soup_soap_parameter_get_string_value (subparam);
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "lastUsed");
-       if (subparam)
-               junk_entry->lastUsed = soup_soap_parameter_get_string_value (subparam);
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "version");
-       if (subparam)
-               junk_entry->version = soup_soap_parameter_get_int_value (subparam);
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "modified");
-       if (subparam)
-               junk_entry->modified = soup_soap_parameter_get_string_value (subparam);
-
-       return junk_entry;
-
-}
-
-/*TODO:Move this code to some other file and make this function public*/
-static void
-get_junk_list_from_soap_response (SoupSoapResponse *response, GList **entries)
-{
-       SoupSoapParameter *param, *subparam;
-
-       param = soup_soap_response_get_first_parameter_by_name (response, "junk");
-       if (param) {
-               /* parse these parameters into junk entries*/
-               for (subparam = soup_soap_parameter_get_first_child_by_name (param, "entry");
-                               subparam != NULL;
-                               subparam = soup_soap_parameter_get_next_child_by_name (subparam, "entry")) {
-                       EGwJunkEntry *junk_entry;
-
-                       junk_entry = e_gw_junkentry_new_from_soap_parameter (subparam);
-                       if (junk_entry)
-                               *entries = g_list_append (*entries, junk_entry);
-               }
-       }
-       param = soup_soap_response_get_first_parameter_by_name (response, "block");
-       if (param) {
-               for (subparam = soup_soap_parameter_get_first_child_by_name (param, "entry");
-                               subparam != NULL;
-                               subparam = soup_soap_parameter_get_next_child_by_name (subparam, "entry")) {
-                       EGwJunkEntry *junk_entry;
-                       junk_entry = e_gw_junkentry_new_from_soap_parameter (subparam);
-                       if (junk_entry)
-                               *entries = g_list_append (*entries, junk_entry);
-               }
-       }
-       param = soup_soap_response_get_first_parameter_by_name (response, "trust");
-       if (param) {
-               for (subparam = soup_soap_parameter_get_first_child_by_name (param, "entry");
-                               subparam != NULL;
-                               subparam = soup_soap_parameter_get_next_child_by_name (subparam, "entry")) {
-                       EGwJunkEntry *junk_entry;
-                       junk_entry = e_gw_junkentry_new_from_soap_parameter (subparam);
-                       if (junk_entry)
-                               *entries = g_list_append (*entries, junk_entry);
-               }
-       }
- }
-
-/* Caller must free the entries*** TODO: have a function in the generic file to free these*/
-EGwConnectionStatus
-e_gw_connection_get_junk_entries (EGwConnection *cnc, GList **entries)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       /* build the SOAP message */
-        msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "getJunkEntriesRequest");
-
-       if (!msg) {
-                g_warning (G_STRLOC ": Could not build SOAP message");
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-       }
-       e_gw_message_write_footer (msg);
-       response =  e_gw_connection_send_message (cnc, msg);
-
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-
-       /* if status is OK - parse result. return the list */
-       if (status == E_GW_CONNECTION_STATUS_OK)
-               get_junk_list_from_soap_response (response, entries);
-
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       return status;
-}
-
-EGwConnectionStatus
-e_gw_connection_remove_junk_entry (EGwConnection *cnc, const gchar *id)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_CONNECTION);
-       g_return_val_if_fail (id != NULL, E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-
-       /* build the SOAP message */
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "removeJunkEntryRequest");
-
-       e_gw_message_write_string_parameter (msg, "id", NULL, id);
-       e_gw_message_write_footer (msg);
-
-       /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       return status;
-
-}
-
-EGwConnectionStatus
-e_gw_connection_read_cal_ids (EGwConnection *cnc, const gchar *container, gint cursor, gboolean forward, gint count, const gchar *cursor_seek, GList **list)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-       SoupSoapParameter *param, *subparam;
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_UNKNOWN);
-       g_return_val_if_fail ((container != NULL), E_GW_CONNECTION_STATUS_UNKNOWN);
-
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "readCursorRequest");
-       e_gw_message_write_int_parameter (msg, "cursor", NULL, cursor);
-       *list = NULL;
-       /* there is problem in read curosr if you set this, uncomment after the problem
-          is fixed in server */
-       e_gw_message_write_string_parameter (msg, "position", NULL, cursor_seek);
-       e_gw_message_write_string_parameter (msg, "forward", NULL, forward ? "true": "false");
-       e_gw_message_write_string_parameter (msg, "container", NULL, container);
-       e_gw_message_write_int_parameter (msg, "count", NULL, count);
-
-       e_gw_message_write_footer (msg);
-
-       /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       reauthenticate (cnc);
-               g_object_unref (response);
-               g_object_unref (msg);
-               return status;
-       }
-
-       /* if status is OK - parse result. return the list */
-       param = soup_soap_response_get_first_parameter_by_name (response, "items");
-       if (!param) {
-               g_object_unref (response);
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-       }
-
-       /* parse these parameters into ecalcomponents*/
-       for (subparam = soup_soap_parameter_get_first_child_by_name (param, "item");
-                       subparam != NULL;
-                       subparam = soup_soap_parameter_get_next_child_by_name (subparam, "item")) {
-               SoupSoapParameter *param_id;
-               EGwItemCalId *calid = g_new0 (EGwItemCalId, 1);
-               gchar *id = NULL;
-
-               param_id = soup_soap_parameter_get_first_child_by_name (subparam, "id");
-               if (param_id) {
-                       id = soup_soap_parameter_get_string_value (param_id);
-                       if (!id) {
-                               e_gw_item_free_cal_id (calid);
-                               g_object_unref (response);
-                               g_object_unref (msg);
-                               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-                       }
-
-                       calid->item_id = id;
-               } else {
-                       e_gw_item_free_cal_id (calid);
-                       g_object_unref (response);
-                       g_object_unref (msg);
-                       return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-               }
-
-               id = NULL;
-
-               param_id = soup_soap_parameter_get_first_child_by_name (subparam, "recurrenceKey");
-               if (param_id) {
-                       id = soup_soap_parameter_get_string_value (param_id);
-               }
-
-               if (id && !g_str_equal (id, "0")) {
-                       calid->recur_key = id;
-
-                       /* startDate is returned for both all-day and ordinary events */
-                       param_id = soup_soap_parameter_get_first_child_by_name (subparam, "startDate");
-                       if (!param_id)
-                               param_id = soup_soap_parameter_get_first_child_by_name (subparam, "startDay");
-
-                       if (param_id) {
-                               gchar *formatted_date;
-                               id = soup_soap_parameter_get_string_value (param_id);
-                               formatted_date = e_gw_connection_format_date_string (id);
-                                /* store the date in calid for recurring events */
-                               calid->start_date = formatted_date;
-                               g_free (id);
-                       }
-
-               } else {
-                       g_free (id);
-                       id = NULL;
-
-                       param_id = soup_soap_parameter_get_first_child_by_name (subparam, "iCalId");
-                       if (!param_id) {
-                               if (*list) {
-                                       g_list_foreach (*list, (GFunc) e_gw_item_free_cal_id, NULL);
-                                       g_list_free (*list);
-                                       *list = NULL;
-                               }
-
-                               e_gw_item_free_cal_id (calid);
-                               g_object_unref (response);
-                               g_object_unref (msg);
-                               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-                       }
-
-                       id = soup_soap_parameter_get_string_value (param_id);
-                       calid->ical_id = id;
-               }
-
-               *list = g_list_append (*list, calid);
-       }
-
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-       return E_GW_CONNECTION_STATUS_OK;
-}
-
-EGwConnectionStatus
-e_gw_connection_get_all_mail_uids (EGwConnection *cnc, const gchar *container, gint cursor, gboolean forward, gint count, const gchar *cursor_seek, GList **list)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-       SoupSoapParameter *param, *subparam;
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_UNKNOWN);
-       g_return_val_if_fail ((container != NULL), E_GW_CONNECTION_STATUS_UNKNOWN);
-
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "readCursorRequest");
-       e_gw_message_write_int_parameter (msg, "cursor", NULL, cursor);
-       *list = NULL;
-       /* there is problem in read curosr if you set this, uncomment after the problem
-          is fixed in server */
-       e_gw_message_write_string_parameter (msg, "position", NULL, cursor_seek);
-       e_gw_message_write_string_parameter (msg, "forward", NULL, forward ? "true": "false");
-       e_gw_message_write_string_parameter (msg, "container", NULL, container);
-       e_gw_message_write_int_parameter (msg, "count", NULL, count);
-
-       e_gw_message_write_footer (msg);
-
-       /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       reauthenticate (cnc);
-               g_object_unref (response);
-               g_object_unref (msg);
-               return status;
-       }
-
-       /* if status is OK - parse result. return the list */
-       param = soup_soap_response_get_first_parameter_by_name (response, "items");
-       if (!param) {
-               g_object_unref (response);
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-       }
-
-       /* parse these parameters into ecalcomponents*/
-       for (subparam = soup_soap_parameter_get_first_child_by_name (param, "item");
-                       subparam != NULL;
-                       subparam = soup_soap_parameter_get_next_child_by_name (subparam, "item")) {
-               SoupSoapParameter *param_id;
-               gchar *id = NULL;
-
-               param_id = soup_soap_parameter_get_first_child_by_name (subparam, "id");
-               if (!param_id) {
-                       if (*list) {
-                               g_list_foreach (*list, (GFunc) g_free, NULL);
-                               g_list_free (*list);
-                               *list = NULL;
-                       }
-                       g_object_unref (response);
-                       g_object_unref (msg);
-                       return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-               }
-
-               id = soup_soap_parameter_get_string_value (param_id);
-               if (id)
-                       *list = g_list_prepend (*list, id);
-               else {
-                       if (*list) {
-                               g_list_foreach (*list, (GFunc) g_free, NULL);
-                               g_list_free (*list);
-                               *list = NULL;
-                       }
-                       g_object_unref (response);
-                       g_object_unref (msg);
-                       return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-               }
-       }
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-       return E_GW_CONNECTION_STATUS_OK;
-}
-
-EGwConnectionStatus
-e_gw_connection_get_proxy_access_list (EGwConnection *cnc, GList **proxy_list)
-{
-       SoupSoapMessage *msg = NULL;
-       SoupSoapResponse *response = NULL;
-       EGwConnectionStatus status;
-       SoupSoapParameter *param;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_CONNECTION);
-
-       /* build the SOAP message */
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "getProxyAccessListRequest");
-
-       e_gw_message_write_footer (msg);
-
-       /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-
-       status = e_gw_connection_parse_response_status (response);
-       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-               reauthenticate (cnc);
-
-       param = soup_soap_response_get_first_parameter_by_name (response, "accessRights");
-       if (!param) {
-               g_object_unref (response);
-               return status;
-       } else  {
-               e_gw_proxy_construct_proxy_access_list (param, proxy_list);
-       }
-       /* free memory */
-       if (response)
-               g_object_unref (response);
-       if (msg)
-               g_object_unref (msg);
-       return status;
-}
-
-EGwConnectionStatus
-e_gw_connection_add_proxy (EGwConnection *cnc, proxyHandler *new_proxy)
-{
-       SoupSoapMessage *msg = NULL;
-       SoupSoapResponse *response = NULL;
-       EGwConnectionStatus status;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_UNKNOWN);
-       msg = e_gw_message_new_with_header (e_gw_connection_get_uri (cnc), e_gw_connection_get_session_id (cnc), "createProxyAccessRequest");
-
-       e_gw_proxy_form_proxy_add_msg (msg, new_proxy);
-
-       e_gw_message_write_footer (msg);
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-       }
-       status = e_gw_connection_parse_response_status (response);
-
-       if (response)
-       g_object_unref (response);
-
-       if (msg)
-       g_object_unref (msg);
-       return status;
-}
-
-EGwConnectionStatus
-e_gw_connection_remove_proxy (EGwConnection *cnc, proxyHandler *removeProxy)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_UNKNOWN);
-
-       msg = e_gw_message_new_with_header (e_gw_connection_get_uri(cnc), e_gw_connection_get_session_id(cnc), "removeProxyAccessRequest");
-
-       e_gw_proxy_form_proxy_remove_msg (msg, removeProxy);
-
-       e_gw_message_write_footer (msg);
-
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-       }
-       e_gw_connection_parse_response_status (response);
-       g_object_unref (response);
-       g_object_unref (msg);
-       return E_GW_CONNECTION_STATUS_OK;
-
-}
-
-EGwConnectionStatus
-e_gw_connection_modify_proxy (EGwConnection *cnc, proxyHandler *new_proxy)
-{
-       SoupSoapMessage *msg = NULL;
-       SoupSoapResponse *response = NULL;
-       EGwConnectionStatus status;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_UNKNOWN);
-       msg = e_gw_message_new_with_header (e_gw_connection_get_uri (cnc), e_gw_connection_get_session_id (cnc), "modifyProxyAccessRequest");
-       e_gw_message_write_string_parameter (msg, "id", NULL, new_proxy->uniqueid);
-
-       e_gw_proxy_form_modify_proxy_msg (msg, new_proxy);
-
-       e_gw_message_write_footer (msg);
-       response = e_gw_connection_send_message (cnc, msg);
-
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-       }
-       status = e_gw_connection_parse_response_status (response);
-
-       if (response)
-       g_object_unref (response);
-
-       if (msg)
-       g_object_unref (msg);
-       return status;
-}
-
-EGwConnectionStatus
-e_gw_connection_get_proxy_list (EGwConnection *cnc, GList **proxy_info)
-{
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       EGwConnectionStatus status;
-       SoupSoapParameter *param;
-
-       g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
-       /* build the SOAP message */
-        msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "getProxyListRequest");
-       if (!msg) {
-                g_warning (G_STRLOC ": Could not build SOAP message");
-               return E_GW_CONNECTION_STATUS_UNKNOWN;
-       }
-
-       e_gw_message_write_footer (msg);
-
-       /* send message to server */
-       response = e_gw_connection_send_message (cnc, msg);
-       if (!response) {
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_NO_RESPONSE;
-       }
-       status = e_gw_connection_parse_response_status (response);
-       if (status != E_GW_CONNECTION_STATUS_OK) {
-               if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-                       reauthenticate (cnc);
-               g_object_unref (response);
-               g_object_unref (msg);
-               return status;
-       }
-       /* if status is OK - parse result. return the list */
-       param = soup_soap_response_get_first_parameter_by_name (response, "proxies");
-       e_gw_proxy_construct_proxy_list (param, proxy_info);
-       if (!param) {
-               g_object_unref (response);
-               g_object_unref (msg);
-               return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
-       }
-
-       g_object_unref (response);
-       g_object_unref (msg);
-
-       return E_GW_CONNECTION_STATUS_OK;
-}
-
-static SoupSoapMessage*
-form_proxy_login_request (EGwConnection *cnc, const gchar * username, const gchar * password, const gchar *proxy)
-{
-       SoupSoapMessage *msg;
-       /* build the SOAP message */
-       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "loginRequest");
-       soup_soap_message_start_element (msg, "auth", "types", NULL);
-       soup_soap_message_add_attribute (msg, "type", "types:Proxy", "xsi",
-                                        "http://www.w3.org/2001/XMLSchema-instance");
-       e_gw_message_write_string_parameter (msg, "username", "types", username);
-       e_gw_message_write_string_parameter (msg, "password", "types", password);
-       e_gw_message_write_string_parameter (msg, "proxy", "types", proxy);
-       soup_soap_message_end_element (msg);
-       e_gw_message_write_footer (msg);
-       return msg;
-}
-
-EGwConnection *
-e_gw_connection_get_proxy_connection (EGwConnection *parent_cnc, gchar *username, const gchar *password, const gchar *proxy, gint  *permissions)
-{
-       EGwConnection *cnc;
-       SoupSoapMessage *msg;
-       SoupSoapResponse *response;
-       SoupSoapParameter *param;
-       SoupSoapParameter *subparam;
-       gchar *hash_key;
-       gchar *name = NULL;
-       gint i;
-       gchar *permissions_key = NULL;
-
-       static GStaticMutex connecting = G_STATIC_MUTEX_INIT;
-
-       g_static_mutex_lock (&connecting);
-
-       for (i=0; proxy[i]!='\0' && proxy[i]!='@'; i++);
-       if (proxy[i]=='@')
-               name = g_strndup (proxy, i);
-       else
-               name = g_strdup (proxy);
-       /* search the connection in our hash table */
-       if (loaded_connections_permissions != NULL) {
-               hash_key = g_strdup_printf ( "%s:%s@%s",
-                               name,
-                               "",
-                               parent_cnc->priv->uri);
-               cnc = g_hash_table_lookup (loaded_connections_permissions, hash_key);
-               permissions_key = g_strdup_printf ("%s:permissions", hash_key);
-
-               if (E_IS_GW_CONNECTION (cnc)) {
-                       *permissions = GPOINTER_TO_INT (g_hash_table_lookup (loaded_connections_permissions, permissions_key));
-                       g_free (permissions_key);
-                       g_free (name);
-                       g_free (hash_key);
-                       g_object_ref (cnc);
-                       g_static_mutex_unlock (&connecting);
-                       return cnc;
-               }
-               g_free (permissions_key);
-       }
-
-       /* not found, so create a new connection */
-       cnc = g_object_new (E_TYPE_GW_CONNECTION, NULL);
-
-       msg = form_proxy_login_request (parent_cnc, username, password, proxy);
-
-       /* send message to server */
-       response = e_gw_connection_send_message (parent_cnc, msg);
-
-       if (!response) {
-               g_object_unref (cnc);
-               g_static_mutex_unlock (&connecting);
-               g_object_unref (msg);
-               return NULL;
-       }
-
-       e_gw_connection_parse_response_status (response);
-
-       param = soup_soap_response_get_first_parameter_by_name (response, "session");
-       if (!param) {
-               g_object_unref (response);
-               g_object_unref (msg);
-               g_object_unref (cnc);
-               g_static_mutex_unlock (&connecting);
-               return NULL;
-       }
-
-       cnc->priv->uri = g_strdup (parent_cnc->priv->uri);
-       cnc->priv->username = g_strdup (proxy);
-       cnc->priv->password = NULL;
-       cnc->priv->session_id = soup_soap_parameter_get_string_value (param);
-
-       /* retrieve user information */
-       param = soup_soap_response_get_first_parameter_by_name (response, "entry");
-
-       if (param) {
-               gchar *param_value;
-
-               subparam = soup_soap_parameter_get_first_child_by_name (param, "email");
-               if (subparam) {
-                       param_value = soup_soap_parameter_get_string_value (subparam);
-                       cnc->priv->user_email  = param_value;
-               }
-
-               subparam = soup_soap_parameter_get_first_child_by_name (param, "name");
-               if (subparam) {
-                       param_value = soup_soap_parameter_get_string_value (subparam);
-                       cnc->priv->user_name = param_value;
-               }
-
-               subparam = soup_soap_parameter_get_first_child_by_name (param, "uuid");
-               if (subparam) {
-                       param_value = soup_soap_parameter_get_string_value (subparam);
-                       cnc->priv->user_uuid = param_value;
-               }
-
-               e_gw_proxy_parse_proxy_login_response (param, permissions);
-       }
-
-       param = soup_soap_response_get_first_parameter_by_name (response, "gwVersion");
-       if (param) {
-               gchar *param_value;
-               param_value = soup_soap_parameter_get_string_value (param);
-               cnc->priv->version = param_value;
-       } else
-               cnc->priv->version = NULL;
-
-       param = soup_soap_response_get_first_parameter_by_name (response, "serverUTCTime");
-       if (param)
-               cnc->priv->server_time = soup_soap_parameter_get_string_value (param);
-
-       /* add the connection to the loaded_connections_permissions hash table */
-       hash_key = g_strdup_printf ("%s:%s@%s",
-                       name,
-                       "",
-                       cnc->priv->uri);
-
-       g_hash_table_insert (loaded_connections_permissions, hash_key, cnc);
-       permissions_key = g_strdup_printf ("%s:permissions", hash_key);
-       g_hash_table_insert (loaded_connections_permissions, permissions_key, GINT_TO_POINTER (*permissions));
-
-       /* free memory */
-       g_object_unref (response);
-       g_object_unref (msg);
-       g_free (name);
-       g_static_mutex_unlock (&connecting);
-       return cnc;
-}
diff --git a/servers/groupwise/e-gw-connection.h b/servers/groupwise/e-gw-connection.h
deleted file mode 100644 (file)
index d66bfab..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors :
- *  JP Rosevear <jpr@ximian.com>
- *  Rodrigo Moya <rodrigo@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- */
-
-#ifndef E_GW_CONNECTION_H
-#define E_GW_CONNECTION_H
-
-#include <glib-object.h>
-#include "soup-soap-message.h"
-#include "e-gw-proxy.h"
-#include "e-gw-container.h"
-#include "e-gw-item.h"
-#include "e-gw-filter.h"
-#include "e-gw-sendoptions.h"
-#include "e-gw-recur-utils.h"
-
-G_BEGIN_DECLS
-
-#define E_TYPE_GW_CONNECTION            (e_gw_connection_get_type ())
-#define E_GW_CONNECTION(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_GW_CONNECTION, EGwConnection))
-#define E_GW_CONNECTION_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_GW_CONNECTION, EGwConnectionClass))
-#define E_IS_GW_CONNECTION(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_GW_CONNECTION))
-#define E_IS_GW_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_GW_CONNECTION))
-
-typedef struct _EGwConnection        EGwConnection;
-typedef struct _EGwConnectionClass   EGwConnectionClass;
-typedef struct _EGwConnectionPrivate EGwConnectionPrivate;
-
-typedef struct {
-       gint status;
-       gchar *description;
-}EGwConnectionErrors;
-
-struct _EGwConnection {
-       GObject parent;
-       EGwConnectionPrivate *priv;
-};
-
-struct _EGwConnectionClass {
-       GObjectClass parent_class;
-};
-
-/* TODO:This has to go either in a generic file or specific to junk*/
-typedef struct {
-       gchar *id;
-       gchar *match;
-       gchar *matchType;
-       gchar *lastUsed;
-       gint version;
-       gchar *modified;
-} EGwJunkEntry;
-
-GType          e_gw_connection_get_type (void);
-EGwConnection *e_gw_connection_new (const gchar *uri, const gchar *username, const gchar *password);
-
-EGwConnection * e_gw_connection_new_with_error_handler (const gchar *uri, const gchar *username, const gchar *password, EGwConnectionErrors *errors);
-
-typedef enum {
-       E_GW_CONNECTION_STATUS_OK,
-       E_GW_CONNECTION_STATUS_INVALID_CONNECTION,
-       E_GW_CONNECTION_STATUS_INVALID_OBJECT,
-       E_GW_CONNECTION_STATUS_INVALID_RESPONSE,
-       E_GW_CONNECTION_STATUS_NO_RESPONSE,
-       E_GW_CONNECTION_STATUS_OBJECT_NOT_FOUND,
-       E_GW_CONNECTION_STATUS_UNKNOWN_USER,
-       E_GW_CONNECTION_STATUS_BAD_PARAMETER,
-       E_GW_CONNECTION_STATUS_ITEM_ALREADY_ACCEPTED,
-       E_GW_CONNECTION_STATUS_REDIRECT,
-       E_GW_CONNECTION_STATUS_OTHER,
-       E_GW_CONNECTION_STATUS_UNKNOWN,
-       E_GW_CONNECTION_STATUS_INVALID_PASSWORD = 53273,
-       E_GW_CONNECTION_STATUS_OVER_QUOTA = 58652
-} EGwConnectionStatus;
-
-#define E_GW_CURSOR_POSITION_CURRENT "current"
-#define E_GW_CURSOR_POSITION_START "start"
-#define E_GW_CURSOR_POSITION_END "end"
-
-SoupSoapResponse   *e_gw_connection_send_message (EGwConnection *cnc, SoupSoapMessage *msg);
-EGwConnectionStatus e_gw_connection_parse_response_status (SoupSoapResponse *response);
-const gchar         *e_gw_connection_get_error_message (EGwConnectionStatus status);
-
-EGwConnectionStatus e_gw_connection_logout (EGwConnection *cnc);
-
-EGwConnectionStatus e_gw_connection_get_container_list (EGwConnection *cnc, const gchar *top, GList **container_list);
-void                e_gw_connection_free_container_list (GList *container_list);
-gchar               *e_gw_connection_get_container_id (EGwConnection *cnc, const gchar *name);
-EGwContainer * e_gw_connection_get_container (EGwConnection *cnc, const gchar * uid);
-
-EGwConnectionStatus e_gw_connection_get_items (EGwConnection *cnc, const gchar *container,
-                                              const gchar *view, EGwFilter *filter, GList **list);
-EGwConnectionStatus e_gw_connection_get_deltas ( EGwConnection *cnc, GSList **adds, GSList **deletes, GSList **updates);
-EGwConnectionStatus e_gw_connection_send_item (EGwConnection *cnc, EGwItem *item, GSList **id_list);
-EGwConnectionStatus e_gw_connection_remove_item (EGwConnection *cnc, const gchar *container, const gchar *id);
-EGwConnectionStatus e_gw_connection_remove_items (EGwConnection *cnc, const gchar *container, GList *item_ids);
-EGwConnectionStatus e_gw_connection_get_items_delta_info (EGwConnection *cnc, const gchar *container, gdouble *first_sequence, gdouble *last_sequence, gdouble *last_po_rebuild_time);
-EGwConnectionStatus e_gw_connection_get_items_delta (EGwConnection *cnc, const gchar *container, const gchar *view, const gchar *count, const gchar * start_sequence, GList **add_list, GList **delete_list);
-
-const gchar         *e_gw_connection_get_uri (EGwConnection *cnc);
-const gchar         *e_gw_connection_get_session_id (EGwConnection *cnc);
-const gchar         *e_gw_connection_get_user_name (EGwConnection *cnc);
-const gchar         *e_gw_connection_get_user_email (EGwConnection *cnc);
-const gchar         *e_gw_connection_get_user_uuid (EGwConnection *cnc);
-const gchar       *e_gw_connection_get_version (EGwConnection *cnc);
-const gchar       *e_gw_connection_get_server_time (EGwConnection *cnc);
-
-time_t              e_gw_connection_get_date_from_string (const gchar *dtstring);
-gchar               *e_gw_connection_format_date_string (const gchar *dtstring);
-
-EGwConnectionStatus e_gw_connection_create_item (EGwConnection *cnc, EGwItem *item, gchar ** id);
-EGwConnectionStatus e_gw_connection_get_item (EGwConnection *cnc, const gchar *container, const gchar *id, const gchar *view, EGwItem **item);
-EGwConnectionStatus e_gw_connection_modify_item (EGwConnection *cnc, const gchar *id, EGwItem *item);
-EGwConnectionStatus e_gw_connection_accept_request (EGwConnection *cnc, const gchar *id, const gchar *accept_level, const gchar *accept_comment, const gchar *recurrence_key);
-EGwConnectionStatus e_gw_connection_decline_request (EGwConnection *cnc, const gchar *id, const gchar *decline_comment, const gchar *recurrence_key);
-EGwConnectionStatus e_gw_connection_retract_request (EGwConnection *cnc, const gchar *id, const gchar *comment, gboolean retract_all, gboolean resend);
-EGwConnectionStatus e_gw_connection_complete_request (EGwConnection *cnc, const gchar *id);
-EGwConnectionStatus e_gw_connection_delegate_request (EGwConnection *cnc, EGwItem *item, const gchar *id, const gchar *comments_org, const gchar *comments_del, const gchar *recur_key);
-EGwConnectionStatus e_gw_connection_create_book (EGwConnection *cnc, gchar *book_name, gchar **id);
-EGwConnectionStatus e_gw_connection_remove_book (EGwConnection *cnc, gchar *book_uid);
-EGwConnectionStatus e_gw_connection_get_address_book_list (EGwConnection *cnc, GList **container_list);
-EGwConnectionStatus e_gw_connection_get_address_book_id ( EGwConnection *cnc, gchar *book_name, gchar **id , gboolean *is_writable);
-EGwConnectionStatus e_gw_connection_get_categories  (EGwConnection *cnc, GHashTable **categories_by_id, GHashTable **categoreis_by_name);
-EGwConnectionStatus e_gw_connection_add_members (EGwConnection *cnc, const gchar *group_id, GList *member_ids);
-EGwConnectionStatus e_gw_connection_remove_members (EGwConnection *cnc, const gchar *group_id, GList *member_ids);
-EGwConnectionStatus e_gw_connection_get_items_from_ids (EGwConnection *cnc, const gchar *container, const gchar *view, GPtrArray *item_ids, GList **list);
-
-EGwConnectionStatus e_gw_connection_create_cursor (EGwConnection *cnc, const gchar *container, const gchar *view, EGwFilter *filter, gint *cursor);
-EGwConnectionStatus e_gw_connection_destroy_cursor (EGwConnection *cnc, const gchar *container,  gint cursor);
-EGwConnectionStatus e_gw_connection_read_cursor (EGwConnection *cnc, const gchar *container, gint cursor, gboolean forward, gint count, const gchar *cursor_seek, GList **item_list);
-EGwConnectionStatus e_gw_connection_position_cursor (EGwConnection *cnc, const gchar *container, gint cursor, const gchar *seek, gint offset);
-
-EGwConnectionStatus e_gw_connection_get_quick_messages (EGwConnection *cnc, const gchar *container, const gchar *view, gchar **start_date, const gchar *message_list, const gchar *item_types, const gchar *item_sources, gint count, GSList **item_list);
-
-EGwConnectionStatus e_gw_connection_create_folder (EGwConnection *cnc, const gchar *parent_name,const gchar *folder_name, gchar **container_id);
-EGwConnectionStatus
-e_gw_connection_get_attachment (EGwConnection *cnc, const gchar *id, gint offset, gint length, const gchar **attachment, gint *attach_length);
-EGwConnectionStatus e_gw_connection_get_attachment_base64 (EGwConnection *cnc, const gchar *id, gint offset, gint length, const gchar **attachment, gint *attach_length, gint *offset_r);
-EGwConnectionStatus e_gw_connection_add_item (EGwConnection *cnc, const gchar *container, const gchar *id);
-EGwConnectionStatus e_gw_connection_add_items (EGwConnection *cnc, const gchar *container, GList *item_ids);
-EGwConnectionStatus e_gw_connection_move_item (EGwConnection *cnc, const gchar *id, const gchar *dest_container_id, const gchar *from_container_id);
-EGwConnectionStatus e_gw_connection_rename_folder (EGwConnection *cnc, const gchar *id ,const gchar *new_name);
-EGwConnectionStatus e_gw_connection_get_settings (EGwConnection *cnc, EGwSendOptions **opts);
-EGwConnectionStatus e_gw_connection_modify_settings (EGwConnection *cnc, EGwSendOptions *opts);
-EGwConnectionStatus e_gw_connection_share_folder (EGwConnection *cnc, gchar *id, GList *new_list, const gchar *sub, const gchar *mesg ,int flag);
-EGwConnectionStatus e_gw_connection_accept_shared_folder (EGwConnection *cnc, gchar *folder_name, gchar *container_id, gchar *item_id, gchar *desc);
-EGwConnectionStatus e_gw_connection_purge_deleted_items (EGwConnection *cnc);
-EGwConnectionStatus e_gw_connection_purge_selected_items (EGwConnection *cnc, GList *item_ids);
-
-EGwConnectionStatus e_gw_connection_mark_read (EGwConnection *cnc, GList *item_ids);
-EGwConnectionStatus e_gw_connection_mark_unread (EGwConnection *cnc, GList *item_ids);
-EGwConnectionStatus e_gw_connection_reply_item (EGwConnection *cnc, const gchar *id, const gchar *view, EGwItem **item);
-EGwConnectionStatus e_gw_connection_forward_item (EGwConnection *cnc, const gchar *id, const gchar *view, gboolean embed, EGwItem **item);
-EGwConnectionStatus e_gw_connection_create_junk_entry (EGwConnection *cnc, const gchar *value, const gchar *match_type , const gchar *list_type);
-EGwConnectionStatus e_gw_connection_get_junk_settings (EGwConnection *cnc, gint *use_junk, gint *use_block, gint *use_pab,  gint *persistence);
-EGwConnectionStatus e_gw_connection_modify_junk_settings (EGwConnection *cnc, gint use_junk, gint use_block, gint use_pab , gint persistence);
-EGwConnectionStatus e_gw_connection_get_junk_entries (EGwConnection *cnc, GList **entries);
-EGwConnectionStatus  e_gw_connection_remove_junk_entry (EGwConnection *cnc, const gchar *id);
-EGwConnectionStatus e_gw_connection_read_cal_ids (EGwConnection *cnc, const gchar *container, gint cursor, gboolean forward, gint count, const gchar *cursor_seek, GList **list);
-EGwConnectionStatus e_gw_connection_get_proxy_access_list (EGwConnection *cnc, GList **proxy_list);
-EGwConnectionStatus e_gw_connection_add_proxy (EGwConnection *cnc, proxyHandler *new_proxy);
-EGwConnectionStatus e_gw_connection_remove_proxy (EGwConnection *cnc, proxyHandler *newProxy);
-EGwConnectionStatus e_gw_connection_modify_proxy (EGwConnection *cnc, proxyHandler *newProxy);
-EGwConnectionStatus e_gw_connection_get_proxy_list (EGwConnection *cnc, GList **proxy_info);
-EGwConnection *e_gw_connection_get_proxy_connection (EGwConnection *cnc1, gchar *username, const gchar *password, const gchar *proxy, int* permissions);
-EGwConnectionStatus e_gw_connection_get_all_mail_uids (EGwConnection *cnc, const gchar *container, gint cursor, gboolean forward, gint count, const gchar *cursor_seek, GList **list);
-
-G_END_DECLS
-
-#endif
diff --git a/servers/groupwise/e-gw-container.c b/servers/groupwise/e-gw-container.c
deleted file mode 100644 (file)
index 2d433be..0000000
+++ /dev/null
@@ -1,783 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors :
- *  JP Rosevear <jpr@ximian.com>
- *  Rodrigo Moya <rodrigo@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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 "e-gw-container.h"
-#include "e-gw-message.h"
-
-G_DEFINE_TYPE (EGwContainer, e_gw_container, G_TYPE_OBJECT)
-
-struct _EGwContainerPrivate {
-       gchar *name;
-       gchar *id;
-       gchar *parent;
-       guint32 unread;
-       guint32 total;
-       gint sequence;
-       gchar *owner;
-       GList *user_list;
-       gchar *modified;
-       EGwContainerType type;
-       gboolean is_root;
-       gboolean is_writable;
-       gboolean is_frequent_contacts; /*indicates  whether this folder is frequent contacts or not */
-       gboolean is_shared_by_me;
-       gboolean is_shared_to_me;
-       gboolean is_system_folder;
-};
-
-static GObjectClass *parent_class = NULL;
-
-static void e_gw_container_set_sequence (EGwContainer *container, gint sequence);
-static void e_gw_container_set_modified (EGwContainer *container, const gchar *modified);
-static void e_gw_container_set_owner (EGwContainer *container, const gchar *owner);
-static void e_gw_container_set_is_shared_by_me (EGwContainer *container, gboolean is_shared_by_me);
-static void e_gw_container_set_is_shared_to_me (EGwContainer *container, gboolean is_shared_to_me);
-
-static void
-free_node (EShUsers *user)
-{
-       if (user) {
-               g_free (user->email);
-               g_free (user);
-       }
-       return;
-}
-
-static void
-e_gw_container_dispose (GObject *object)
-{
-       EGwContainer *container = (EGwContainer *) object;
-
-       g_return_if_fail (E_IS_GW_CONTAINER (container));
-
-       if (parent_class->dispose)
-               (* parent_class->dispose) (object);
-}
-
-static void
-e_gw_container_finalize (GObject *object)
-{
-       EGwContainer *container = (EGwContainer *) object;
-       EGwContainerPrivate *priv;
-
-       g_return_if_fail (E_IS_GW_CONTAINER (container));
-
-       priv = container->priv;
-       if (priv) {
-               if (priv->name) {
-                       g_free (priv->name);
-                       priv->name = NULL;
-               }
-
-               if (priv->id) {
-                       g_free (priv->id);
-                       priv->id = NULL;
-               }
-
-               if (priv->parent) {
-                       g_free (priv->parent);
-                       priv->parent = NULL;
-               }
-
-               if (priv->owner) {
-                       g_free (priv->owner);
-                       priv->owner = NULL;
-               }
-
-               if (priv->modified) {
-                       g_free (priv->modified);
-                       priv->modified = NULL;
-               }
-
-               if (priv->user_list) {
-                       g_list_foreach (priv->user_list,(GFunc) free_node, NULL);
-                       g_list_free (priv->user_list);
-                       priv->user_list = NULL;
-               }
-
-               g_free (priv);
-               container->priv = NULL;
-       }
-
-       if (parent_class->finalize)
-               (* parent_class->finalize) (object);
-}
-
-static void
-e_gw_container_class_init (EGwContainerClass *klass)
-{
-       GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-       parent_class = g_type_class_peek_parent (klass);
-
-       object_class->dispose = e_gw_container_dispose;
-       object_class->finalize = e_gw_container_finalize;
-}
-
-static void
-e_gw_container_init (EGwContainer *container)
-{
-       EGwContainerPrivate *priv;
-
-       /* allocate internal structure */
-       priv = g_new0 (EGwContainerPrivate, 1);
-       priv->is_writable = TRUE;
-       priv->is_frequent_contacts = FALSE;
-       container->priv = priv;
-}
-
-EGwContainer *
-e_gw_container_new_from_soap_parameter (SoupSoapParameter *param)
-{
-       EGwContainer *container;
-
-       g_return_val_if_fail (param != NULL, NULL);
-
-       container = g_object_new (E_TYPE_GW_CONTAINER, NULL);
-       if (!e_gw_container_set_from_soap_parameter (container, param)) {
-               g_object_unref (container);
-               return NULL;
-       }
-
-       return container;
-}
-
-gboolean
-e_gw_container_set_from_soap_parameter (EGwContainer *container, SoupSoapParameter *param)
-{
-       gchar *value;
-       gint int_value;
-       gint rights = 0;
-       gboolean byme = FALSE;
-       gboolean tome = FALSE;
-       SoupSoapParameter *subparam;
-       SoupSoapParameter *entry_subparam;
-       SoupSoapParameter *email_rt_subparam;
-       SoupSoapParameter *rights_subparam;
-
-       g_return_val_if_fail (E_IS_GW_CONTAINER (container), FALSE);
-       g_return_val_if_fail (param != NULL, FALSE);
-
-       /* retrieve the name */
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "name");
-       if (!subparam) {
-                       /* GroupWise 7.X servers does not return the name field.
-                       This is not an issue with Bonsai 8.X . So, keep this code for
-                       working well with the broken GW 7.X series */
-                       e_gw_container_set_name (container, "");
-       } else {
-                       value = soup_soap_parameter_get_string_value (subparam);
-                       e_gw_container_set_name (container, (const gchar *) value);
-                       g_free (value);
-       }
-
-       /* retrieve the ID */
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "id");
-       if (!subparam) {
-                       e_gw_container_set_id (container, "");
-       } else {
-                       value = soup_soap_parameter_get_string_value (subparam);
-                       e_gw_container_set_id (container, (const gchar *) value);
-                       g_free (value);
-       }
-
-       /* retrieve the parent container id */
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "parent");
-       if (!subparam) {
-               e_gw_container_set_parent_id (container, "");
-               container->priv->is_root = TRUE;
-       } else {
-
-               value = soup_soap_parameter_get_string_value (subparam);
-               e_gw_container_set_parent_id (container, (const gchar *) value);
-               g_free (value);
-       }
-
-       /*retrieve the folder type*/
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "folderType");
-       if (!subparam)
-               container->priv->type = E_GW_CONTAINER_TYPE_FOLDER;
-       else {
-               value = soup_soap_parameter_get_string_value (subparam);
-               if (!strcmp (value, "Root"))
-                       container->priv->type = E_GW_CONTAINER_TYPE_ROOT;
-               else if (!strcmp (value, "Mailbox"))
-                       container->priv->type = E_GW_CONTAINER_TYPE_INBOX;
-               else if (!strcmp (value, "SentItems"))
-                       container->priv->type = E_GW_CONTAINER_TYPE_SENT;
-               else if (!strcmp (value, "Calendar"))
-                       container->priv->type = E_GW_CONTAINER_TYPE_CALENDAR;
-               else if (!strcmp (value, "Contacts"))
-                       container->priv->type = E_GW_CONTAINER_TYPE_CONTACTS;
-               else if (!strcmp (value, "Draft"))
-                       container->priv->type = E_GW_CONTAINER_TYPE_DRAFT;
-               else if (!strcmp (value, "Trash"))
-                       container->priv->type = E_GW_CONTAINER_TYPE_TRASH;
-               else if (!strcmp (value, "JunkMail"))
-                       container->priv->type = E_GW_CONTAINER_TYPE_JUNK;
-               g_free (value);
-       }
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "isSystemFolder");
-       if (subparam) {
-               value = soup_soap_parameter_get_string_value (subparam);
-               if (!strcmp (value, "1"))
-                       container->priv->is_system_folder = TRUE;
-               g_free (value);
-       }
-
-       /* retrive the unread and total count */
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "hasUnread");
-       if (!subparam) {
-               container->priv->unread = 0;
-       } else {
-               subparam = soup_soap_parameter_get_first_child_by_name (param, "unreadCount");
-               if (subparam) {
-                       value = soup_soap_parameter_get_string_value (subparam);
-                       if (value)
-                               container->priv->unread = atoi (value);
-                       else
-                               container->priv->unread = 0; /*XXX:should it be 0?*/
-
-                       g_free (value);
-               }
-       }
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "count");
-       if (subparam) {
-               value = soup_soap_parameter_get_string_value (subparam);
-               if (value)
-                       container->priv->total = atoi (value);
-               g_free (value);
-       }
-       /* Is shared by me*/
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "isSharedByMe");
-       if (!subparam) {
-               e_gw_container_set_is_shared_by_me (container, FALSE);
-
-       } else {
-               value = soup_soap_parameter_get_string_value (subparam);
-               if (value) {
-                       e_gw_container_set_is_shared_by_me (container, TRUE);
-                       byme = TRUE;
-               } else {
-                       e_gw_container_set_is_shared_by_me (container, FALSE);
-                       byme = FALSE;
-               }
-
-               g_free (value);
-       }
-       /* is shared to me*/
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "isSharedToMe");
-
-       if (!subparam) {
-               e_gw_container_set_is_shared_to_me (container, FALSE);
-
-       } else {
-               value = soup_soap_parameter_get_string_value (subparam);
-               if (value) {
-                       e_gw_container_set_is_shared_to_me (container, TRUE);
-                       tome = TRUE;
-               } else {
-                       e_gw_container_set_is_shared_to_me (container, FALSE);
-                       tome = FALSE;
-               }
-
-               g_free (value);
-       }
-       /*Retrieve email add of the sharing person*/
-       if (tome || byme) {
-               subparam = soup_soap_parameter_get_first_child_by_name (param, "acl");
-               if (!subparam)
-                       g_warning (G_STRLOC ": No ACL");
-
-               else {
-                       for (entry_subparam = soup_soap_parameter_get_first_child_by_name (subparam, "entry");
-                                       entry_subparam != NULL;
-                                       entry_subparam = soup_soap_parameter_get_next_child_by_name (entry_subparam, "entry")) {
-
-                               EShUsers *user = g_new0 (EShUsers , 1);
-                               email_rt_subparam = soup_soap_parameter_get_first_child_by_name (entry_subparam, "email");
-
-                               if (!email_rt_subparam) {
-                                       g_warning (G_STRLOC ":Email Tag Not Available");
-                               } else {
-                                       value = soup_soap_parameter_get_string_value (email_rt_subparam);
-                                       if (value) {
-                                               user->email = value;
-                                       }
-                                       /* Retrieve Rights*/
-                                       email_rt_subparam = soup_soap_parameter_get_first_child_by_name (entry_subparam, "rights");
-
-                                       if (!email_rt_subparam)
-                                               g_warning (G_STRLOC ": User without any Rights");
-                                       else {
-                                               rights = 0;
-                                               rights_subparam = soup_soap_parameter_get_first_child_by_name (email_rt_subparam, "add");
-                                               if (rights_subparam)
-                                                       rights = rights | 0x1;
-
-                                               rights_subparam = soup_soap_parameter_get_first_child_by_name (email_rt_subparam, "edit");
-                                               if (rights_subparam)
-                                                       rights = rights | 0x2;
-
-                                               rights_subparam = soup_soap_parameter_get_first_child_by_name (email_rt_subparam, "delete");
-                                               if (rights_subparam)
-                                                       rights = rights | 0x4;
-
-                                               user->rights = rights;
-                                       }
-
-                                       container->priv->user_list = g_list_append (container->priv->user_list, user);
-
-                               }
-
-                       }
-
-               }
-
-               /*Retrieve owner*/
-               subparam = soup_soap_parameter_get_first_child_by_name (param, "owner");
-               if (subparam) {
-                       value = soup_soap_parameter_get_string_value (subparam);
-                       e_gw_container_set_owner (container, value);
-                       g_free (value);
-               }
-       }
-
-               /* shared folder*/
-               /*Retrieve When Modified last*/
-               subparam = soup_soap_parameter_get_first_child_by_name (param, "modified");
-
-               if (subparam) {
-                       value = soup_soap_parameter_get_string_value (subparam);
-                       e_gw_container_set_modified (container, (const gchar *) value);
-                       g_free (value);
-               }
-
-               /*retrieve sequence*/
-               subparam = soup_soap_parameter_get_first_child_by_name (param, "sequence");
-
-               if (subparam) {
-                       int_value = soup_soap_parameter_get_int_value (subparam);
-                       e_gw_container_set_sequence (container, int_value);
-               }
-
-               return TRUE;
-}
-
-void
-e_gw_container_get_user_list (EGwContainer *container, GList **user_list)
-{
-       g_return_if_fail (E_GW_CONTAINER (container));
-
-       *user_list = container->priv->user_list;
-
-}
-
-gint
-e_gw_container_get_sequence (EGwContainer *container)
-{
-       g_return_val_if_fail (E_IS_GW_CONTAINER (container), 0);
-
-       return (gint)container->priv->sequence;
-}
-
-static  void
-e_gw_container_set_sequence (EGwContainer *container, gint sequence)
-{
-       g_return_if_fail (E_IS_GW_CONTAINER (container));
-       container->priv->sequence = sequence;
-}
-
-const gchar *
-e_gw_container_get_modified (EGwContainer *container)
-{
-       g_return_val_if_fail (E_IS_GW_CONTAINER (container), NULL);
-
-       return (const gchar *) container->priv->modified;
-}
-
-static void
-e_gw_container_set_modified (EGwContainer *container, const gchar *modified)
-{
-       EGwContainerPrivate *priv;
-
-       g_return_if_fail (E_IS_GW_CONTAINER (container));
-       g_return_if_fail (modified != NULL);
-
-       priv = container->priv;
-
-       if (priv->modified)
-               g_free (priv->modified);
-       priv->modified = g_strdup (modified);
-}
-
-static void
-e_gw_container_set_owner (EGwContainer *container, const gchar *owner)
-{
-       EGwContainerPrivate *priv;
-
-       g_return_if_fail (E_IS_GW_CONTAINER (container));
-       g_return_if_fail (owner!=NULL);
-
-       priv = container->priv;
-       if (priv->owner)
-               g_free (container->priv->owner);
-       container->priv->owner = g_strdup (owner);
-}
-
-const gchar *
-e_gw_container_get_owner (EGwContainer *container)
-{
-       g_return_val_if_fail (E_GW_CONTAINER (container), NULL);
-
-       return (const gchar *) container->priv->owner;
-}
-
-gint
-e_gw_container_get_rights (EGwContainer *container, gchar *email)
-{
-       GList *user_list = NULL;
-       GList *node = NULL;
-       EShUsers *user = NULL;
-
-       g_return_val_if_fail (E_IS_GW_CONTAINER (container), 0);
-
-       user_list = container->priv->user_list;
-
-       for (node = user_list; node != NULL; node = node->next) {
-               user = node->data;
-               if ( !strcmp (user->email, email))
-                       return user->rights;
-       }
-
-       return 0;
-}
-
-gboolean
-e_gw_container_get_is_shared_by_me (EGwContainer *container)
-{
-       g_return_val_if_fail (E_IS_GW_CONTAINER (container), FALSE);
-
-       return (gboolean) container->priv->is_shared_by_me;
-}
-
-static void
-e_gw_container_set_is_shared_by_me (EGwContainer *container, gboolean is_shared_by_me)
-{
-       g_return_if_fail (E_IS_GW_CONTAINER (container));
-
-       container->priv->is_shared_by_me = is_shared_by_me;
-}
-
-gboolean
-e_gw_container_get_is_shared_to_me (EGwContainer *container)
-{
-       g_return_val_if_fail (E_IS_GW_CONTAINER (container), FALSE);
-
-       return (gboolean) container->priv->is_shared_to_me;
-}
-
-static void
-e_gw_container_set_is_shared_to_me (EGwContainer *container, gboolean is_shared_to_me)
-{
-       g_return_if_fail (E_IS_GW_CONTAINER (container));
-
-       container->priv->is_shared_to_me = is_shared_to_me;
-}
-
-gboolean
-e_gw_container_get_is_system_folder (EGwContainer *container)
-{
-       g_return_val_if_fail (E_IS_GW_CONTAINER (container), FALSE);
-
-       return container->priv->is_system_folder;
-}
-
-void
-e_gw_container_set_is_system_folder (EGwContainer *container, gboolean is_system_folder)
-{
-       g_return_if_fail (E_IS_GW_CONTAINER (container));
-
-       container->priv->is_system_folder = is_system_folder;
-}
-
-const gchar *
-e_gw_container_get_name (EGwContainer *container)
-{
-       g_return_val_if_fail (E_IS_GW_CONTAINER (container), NULL);
-
-       return (const gchar *) container->priv->name;
-}
-
-void
-e_gw_container_set_name (EGwContainer *container, const gchar *new_name)
-{
-       EGwContainerPrivate *priv;
-
-       g_return_if_fail (E_IS_GW_CONTAINER (container));
-       g_return_if_fail (new_name != NULL);
-
-       priv = container->priv;
-
-       if (priv->name)
-               g_free (priv->name);
-       priv->name = g_strdup (new_name);
-}
-
-const gchar *
-e_gw_container_get_id (EGwContainer *container)
-{
-       g_return_val_if_fail (E_IS_GW_CONTAINER (container), NULL);
-
-       return (const gchar *) container->priv->id;
-}
-
-void
-e_gw_container_set_id (EGwContainer *container, const gchar *new_id)
-{
-       EGwContainerPrivate *priv;
-
-       g_return_if_fail (E_IS_GW_CONTAINER (container));
-       g_return_if_fail (new_id != NULL);
-
-       priv = container->priv;
-
-       if (priv->id)
-               g_free (priv->id);
-       priv->id = g_strdup (new_id);
-}
-
-const gchar *
-e_gw_container_get_parent_id (EGwContainer *container)
-{
-       g_return_val_if_fail (E_IS_GW_CONTAINER (container), NULL);
-
-       return (const gchar *) container->priv->parent;
-}
-
-void
-e_gw_container_set_parent_id (EGwContainer *container, const gchar *parent_id)
-{
-       EGwContainerPrivate *priv;
-
-       g_return_if_fail (E_IS_GW_CONTAINER (container));
-       g_return_if_fail (parent_id != NULL);
-
-       priv = container->priv;
-
-       if (priv->parent)
-               g_free (priv->parent);
-
-       priv->parent = g_strdup (parent_id);
-}
-
-guint32
-e_gw_container_get_total_count (EGwContainer *container)
-{
-       g_return_val_if_fail (E_IS_GW_CONTAINER (container), -1);
-
-       return container->priv->total;
-}
-
-guint32
-e_gw_container_get_unread_count (EGwContainer *container)
-{
-       g_return_val_if_fail (E_IS_GW_CONTAINER (container), -1);
-
-       return container->priv->unread;
-
-}
-
-gboolean
-e_gw_container_get_is_writable (EGwContainer *container)
-{
-       g_return_val_if_fail (E_IS_GW_CONTAINER (container), FALSE);
-
-       return container->priv->is_writable;
-
-}
-
-void
-e_gw_container_set_is_writable (EGwContainer *container, gboolean is_writable)
-{
-       g_return_if_fail (E_IS_GW_CONTAINER (container));
-
-       container->priv->is_writable = is_writable;
-}
-
-gboolean
-e_gw_container_get_is_frequent_contacts (EGwContainer *container)
-{
-       g_return_val_if_fail (E_IS_GW_CONTAINER (container), FALSE);
-
-       return container->priv->is_frequent_contacts;
-
-}
-
-void
-e_gw_container_set_is_frequent_contacts (EGwContainer *container, gboolean is_frequent_contacts)
-{
-       g_return_if_fail (E_IS_GW_CONTAINER (container));
-
-       container->priv->is_frequent_contacts = is_frequent_contacts;
-}
-
-gboolean
-e_gw_container_is_root (EGwContainer *container)
-{
-       g_return_val_if_fail (E_IS_GW_CONTAINER (container), FALSE);
-
-       return container->priv->is_root;
-}
-
-EGwContainerType
-e_gw_container_get_container_type (EGwContainer *container)
-{
-       g_return_val_if_fail (E_IS_GW_CONTAINER (container), FALSE);
-       return container->priv->type;
-}
-
-/* flag specifies whether we are adding to acl or deleting one or more entries*/
-/* flag = 1 :delete entry
- * flag = 2 :update entry
- * flag = 0 :add to acl
- */
-void
-e_gw_container_form_message (SoupSoapMessage *msg, gchar *id, GList *new_list, const gchar *sub, const gchar *mesg, gint flag)
-{
-       gboolean add, edit, del;
-       gchar *email = NULL;
-       GList *node = NULL;
-       EShUsers *user = NULL;
-
-       e_gw_message_write_string_parameter (msg, "id", NULL, id);
-       soup_soap_message_start_element (msg, "notification", NULL, NULL);
-       e_gw_message_write_string_parameter (msg, "subject", NULL, sub);
-       e_gw_message_write_string_parameter (msg, "message", NULL, mesg);
-       soup_soap_message_end_element (msg);
-       soup_soap_message_start_element (msg, "updates", NULL, NULL);
-
-       if (flag == 0) {
-               soup_soap_message_start_element (msg, "add", NULL, NULL);
-               soup_soap_message_start_element (msg, "acl", NULL, NULL);
-
-               for (node = new_list; node != NULL; node = node->next) {
-                       user = node->data;
-                       add=edit=del=FALSE;
-                       soup_soap_message_start_element (msg, "entry", NULL, NULL);
-                       e_gw_message_write_string_parameter (msg, "displayName", NULL,"");
-                       email = g_strdup (user->email);
-                       if (user->rights & 0x1)
-                               add = TRUE;
-                       if (user->rights & 0x2)
-                               edit = TRUE;
-                       if (user->rights & 0x4)
-                               del = TRUE;
-
-                       e_gw_message_write_string_parameter (msg, "email", NULL, email);
-                       soup_soap_message_start_element (msg, "rights", NULL, NULL);
-                       e_gw_message_write_int_parameter (msg, "read", NULL, 1);
-                       e_gw_message_write_int_parameter (msg, "add", NULL, add);
-                       e_gw_message_write_int_parameter (msg, "edit", NULL, edit);
-                       e_gw_message_write_int_parameter (msg, "delete", NULL, del);
-
-                       soup_soap_message_end_element (msg);
-                       soup_soap_message_end_element (msg);
-               }
-
-               soup_soap_message_end_element (msg);
-               soup_soap_message_end_element (msg);
-
-       } else  if (flag == 1) {
-               soup_soap_message_start_element (msg, "delete", NULL, NULL);
-               soup_soap_message_start_element (msg, "acl", NULL, NULL);
-
-               for (node = new_list; node != NULL; node = node->next) {
-                       user = node->data;
-                       add = edit = del = FALSE;
-                       soup_soap_message_start_element (msg, "entry", NULL, NULL);
-                       e_gw_message_write_string_parameter (msg, "displayName", NULL, "name");
-                       email = g_strdup (user->email);
-
-                       if (user->rights & 0x1)
-                               add = TRUE;
-                       if (user->rights & 0x2)
-                               edit = TRUE;
-                       if (user->rights & 0x4)
-                               del = TRUE;
-
-                       e_gw_message_write_string_parameter (msg, "email", NULL, email);
-                       soup_soap_message_start_element(msg, "rights", NULL, NULL);
-                       e_gw_message_write_int_parameter (msg, "read", NULL, 1);
-                       e_gw_message_write_int_parameter (msg, "add", NULL, add);
-                       e_gw_message_write_int_parameter (msg, "edit", NULL, edit);
-                       e_gw_message_write_int_parameter (msg, "delete", NULL, del);
-
-                       soup_soap_message_end_element (msg);
-                       soup_soap_message_end_element (msg);
-
-               }
-               soup_soap_message_end_element (msg);
-               soup_soap_message_end_element (msg);
-
-       } else if (flag == 2) {
-               soup_soap_message_start_element (msg, "update", NULL, NULL);
-               soup_soap_message_start_element (msg, "acl", NULL, NULL);
-
-               for (node = new_list; node != NULL; node = node->next) {
-                       user = node->data;
-                       add = edit = del = FALSE;
-                       soup_soap_message_start_element (msg, "entry", NULL, NULL);
-                       e_gw_message_write_string_parameter (msg, "displayName",NULL,"");
-                       email = g_strdup (user->email);
-                       if (user->rights & 0x1)
-                               add = TRUE;
-                       if (user->rights & 0x2)
-                               edit = TRUE;
-                       if (user->rights & 0x4)
-                               del =TRUE;
-
-                       e_gw_message_write_string_parameter (msg, "email", NULL, email);
-                       soup_soap_message_start_element (msg, "rights", NULL, NULL);
-                       e_gw_message_write_int_parameter (msg, "read", NULL, 1);
-                       e_gw_message_write_int_parameter (msg, "add", NULL, add);
-                       e_gw_message_write_int_parameter (msg, "edit", NULL, edit);
-                       e_gw_message_write_int_parameter (msg, "delete", NULL, del);
-
-                       soup_soap_message_end_element (msg);
-                       soup_soap_message_end_element (msg);
-               }
-
-               soup_soap_message_end_element (msg);
-               soup_soap_message_end_element (msg);
-
-       }
-
-       soup_soap_message_end_element (msg);
-}
diff --git a/servers/groupwise/e-gw-container.h b/servers/groupwise/e-gw-container.h
deleted file mode 100644 (file)
index 4a34953..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors :
- *  JP Rosevear <jpr@ximian.com>
- *  Rodrigo Moya <rodrigo@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- */
-
-#ifndef E_GW_CONTAINER_H
-#define E_GW_CONTAINER_H
-
-#include "soup-soap-response.h"
-#include "soup-soap-message.h"
-
-G_BEGIN_DECLS
-
-#define E_TYPE_GW_CONTAINER            (e_gw_container_get_type ())
-#define E_GW_CONTAINER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_GW_CONTAINER, EGwContainer))
-#define E_GW_CONTAINER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_GW_CONTAINER, EGwContainerClass))
-#define E_IS_GW_CONTAINER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_GW_CONTAINER))
-#define E_IS_GW_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_GW_CONTAINER))
-
-typedef struct _EShUsers            EShUsers;
-typedef struct _EGwContainer        EGwContainer;
-typedef struct _EGwContainerClass   EGwContainerClass;
-typedef struct _EGwContainerPrivate EGwContainerPrivate;
-
-struct _EGwContainer {
-       GObject parent;
-       EGwContainerPrivate *priv;
-};
-
-struct _EGwContainerClass {
-       GObjectClass parent_class;
-};
-
-struct _EShUsers {
-       gchar *email;
-       gint rights;
-};
-
-typedef enum {
-       E_GW_CONTAINER_TYPE_ROOT,
-       E_GW_CONTAINER_TYPE_INBOX,
-       E_GW_CONTAINER_TYPE_SENT,
-       E_GW_CONTAINER_TYPE_CALENDAR,
-       E_GW_CONTAINER_TYPE_CONTACTS,
-       E_GW_CONTAINER_TYPE_DOCUMENTS,
-       E_GW_CONTAINER_TYPE_QUERY,
-       E_GW_CONTAINER_TYPE_CHECKLIST,
-       E_GW_CONTAINER_TYPE_DRAFT,
-       E_GW_CONTAINER_TYPE_CABINET,
-       E_GW_CONTAINER_TYPE_TRASH,
-       E_GW_CONTAINER_TYPE_JUNK,
-       E_GW_CONTAINER_TYPE_FOLDER
-
-} EGwContainerType;
-
-GType         e_gw_container_get_type (void);
-EGwContainer *e_gw_container_new_from_soap_parameter (SoupSoapParameter *param);
-gboolean      e_gw_container_set_from_soap_parameter (EGwContainer *container,
-                                                     SoupSoapParameter *param);
-const gchar   *e_gw_container_get_name (EGwContainer *container);
-void          e_gw_container_set_name (EGwContainer *container, const gchar *new_name);
-const gchar   *e_gw_container_get_id (EGwContainer *container);
-void          e_gw_container_set_id (EGwContainer *container, const gchar *new_id);
-const gchar   *e_gw_container_get_parent_id (EGwContainer *container);
-void         e_gw_container_set_parent_id (EGwContainer *container, const gchar *parent_id);
-guint32       e_gw_container_get_total_count (EGwContainer *container);
-guint32       e_gw_container_get_unread_count (EGwContainer *container);
-gboolean      e_gw_container_get_is_writable (EGwContainer *container);
-void          e_gw_container_set_is_writable (EGwContainer *container, gboolean writable);
-gboolean     e_gw_container_get_is_frequent_contacts (EGwContainer *container);
-void         e_gw_container_set_is_frequent_contacts (EGwContainer *container, gboolean is_frequent_contacts);
-gboolean    e_gw_container_is_root (EGwContainer *container);
-const gchar *  e_gw_container_get_owner (EGwContainer *container);
-const gchar *  e_gw_container_get_modified (EGwContainer *container);
-gint           e_gw_container_get_sequence (EGwContainer *container);
-gboolean      e_gw_container_get_is_shared_by_me (EGwContainer *container);
-gboolean      e_gw_container_get_is_shared_to_me (EGwContainer *container);
-gint         e_gw_container_get_rights (EGwContainer *container, gchar *email);
-EGwContainerType e_gw_container_get_container_type (EGwContainer *container);
-void         e_gw_container_get_user_list (EGwContainer *container, GList **user_list);
-void         e_gw_container_form_message (SoupSoapMessage *msg, gchar *id, GList *new_list, const gchar *sub, const gchar *mesg, gint flag);
-gboolean e_gw_container_get_is_system_folder (EGwContainer *container);
-void e_gw_container_set_is_system_folder (EGwContainer *container, gboolean is_system_folder);
-
-G_END_DECLS
-
-#endif
diff --git a/servers/groupwise/e-gw-filter.c b/servers/groupwise/e-gw-filter.c
deleted file mode 100644 (file)
index 0de8fa4..0000000
+++ /dev/null
@@ -1,261 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors :
- * Sivaiah Nallagatla <snallagatla@novell.com>
- *
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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 "e-gw-filter.h"
-#include "e-gw-message.h"
-
-G_DEFINE_TYPE (EGwFilter, e_gw_filter, G_TYPE_OBJECT)
-
-static GObjectClass *parent_class = NULL;
-
-struct _FilterComponent {
-       gint operation;
-       gchar *field_name;
-       gchar *field_value;
-       gint num_of_conditions;
-};
-
-typedef struct _FilterComponent  FilterComponent;
-
-struct _EGwFilterPrivate {
-       GSList *component_list;
-       gint  filter_group_type; /* stores, whether all condtions are to be met or any one of them*/
-
-};
-
-void
-e_gw_filter_add_filter_component (EGwFilter *filter, EGwFilterOpType operation, const gchar *field_name, const gchar *field_value)
-{
-       FilterComponent *component;
-
-       g_return_if_fail (E_IS_GW_FILTER (filter));
-       g_return_if_fail (field_name != NULL);
-       g_return_if_fail (field_value != NULL);
-
-       component = g_new0 (FilterComponent, 1);
-       component->operation = operation;
-       component->field_name = g_strdup (field_name);
-       component->field_value = g_strdup (field_value);
-       filter->priv->component_list = g_slist_prepend (filter->priv->component_list, component);
-
-}
-
-void
-e_gw_filter_group_conditions (EGwFilter *filter, EGwFilterOpType operation, gint num_of_condtions)
-{
-       FilterComponent *component;
-
-       g_return_if_fail (E_IS_GW_FILTER (filter));
-       g_return_if_fail ( operation == E_GW_FILTER_OP_AND || operation == E_GW_FILTER_OP_OR ||
-                         operation == E_GW_FILTER_OP_NOT);
-       component = g_new0 (FilterComponent, 1);
-       component->operation = operation;
-       component->num_of_conditions =  num_of_condtions;
-       filter->priv->component_list = g_slist_prepend (filter->priv->component_list, component);
-}
-
-static void
-append_child_component (FilterComponent* filter_component, SoupSoapMessage *msg)
-{
-
-       const gchar *operation_name;
-
-       g_return_if_fail (SOUP_IS_SOAP_MESSAGE (msg));
-       soup_soap_message_start_element (msg, "element", NULL, NULL);
-       operation_name = NULL;
-
-       switch (filter_component->operation) {
-
-               case E_GW_FILTER_OP_EQUAL :
-                       operation_name = "eq";
-                       break;
-               case E_GW_FILTER_OP_NOTEQUAL :
-                       operation_name = "ne";
-                       break;
-               case E_GW_FILTER_OP_GREATERTHAN :
-                       operation_name = "gt";
-                       break;
-               case E_GW_FILTER_OP_LESSTHAN :
-                       operation_name = "lt";
-                       break;
-               case E_GW_FILTER_OP_GREATERTHAN_OR_EQUAL :
-                       operation_name = "gte";
-                       break;
-               case E_GW_FILTER_OP_LESSTHAN_OR_EQUAL :
-                       operation_name = "lte";
-                       break;
-               case E_GW_FILTER_OP_CONTAINS :
-                       operation_name = "contains";
-                       break;
-               case E_GW_FILTER_OP_CONTAINSWORD :
-                       operation_name = "containsWord";
-                       break;
-               case E_GW_FILTER_OP_BEGINS :
-                       operation_name = "begins";
-                       break;
-               case E_GW_FILTER_OP_EXISTS :
-                       operation_name = "exists";
-                       break;
-               case E_GW_FILTER_OP_NOTEXISTS :
-                       operation_name = "notExist";
-                       break;
-
-       }
-
-       if (operation_name != NULL) {
-
-                       e_gw_message_write_string_parameter (msg, "op", NULL, operation_name);
-                       e_gw_message_write_string_parameter (msg, "field", NULL, filter_component->field_name);
-                       e_gw_message_write_string_parameter (msg, "value", NULL, filter_component->field_value);
-       }
-
-       soup_soap_message_end_element (msg);
-}
-
-static GSList*
-append_complex_component (GSList *component_list, SoupSoapMessage *msg)
-{
-       FilterComponent *filter_component;
-       gint num_of_condtions;
-       gint i;
-
-       filter_component = (FilterComponent* )component_list->data;
-       if (filter_component->operation == E_GW_FILTER_OP_AND || filter_component->operation == E_GW_FILTER_OP_OR
-           ||  filter_component->operation == E_GW_FILTER_OP_NOT ) {
-
-               soup_soap_message_start_element (msg, "group", NULL, NULL);
-               if (filter_component->operation == E_GW_FILTER_OP_AND)
-                       e_gw_message_write_string_parameter (msg, "op", NULL, "and");
-               else if (filter_component->operation == E_GW_FILTER_OP_OR)
-                       e_gw_message_write_string_parameter (msg, "op", NULL, "or");
-               else
-                       e_gw_message_write_string_parameter (msg, "op", NULL, "not");
-       }
-       num_of_condtions = filter_component->num_of_conditions;
-       for ( i = 0; i < num_of_condtions && component_list; i++) {
-               component_list = g_slist_next (component_list);
-               filter_component = (FilterComponent *)component_list->data;
-               if (filter_component->operation == E_GW_FILTER_OP_AND || filter_component->operation == E_GW_FILTER_OP_OR
-                   || filter_component->operation == E_GW_FILTER_OP_NOT ) {
-                       component_list = append_complex_component (component_list, msg);
-               }
-               else
-                       append_child_component (filter_component, msg);
-
-       }
-       soup_soap_message_end_element (msg);
-
-       return component_list;
-}
-
-void
-e_gw_filter_append_to_soap_message (EGwFilter *filter, SoupSoapMessage *msg)
-{
-       EGwFilterPrivate *priv;
-       GSList *component_list;
-       FilterComponent *filter_component;
-
-       g_return_if_fail (E_IS_GW_FILTER (filter));
-       g_return_if_fail (SOUP_IS_SOAP_MESSAGE (msg));
-
-       priv = filter->priv;
-       component_list = priv->component_list;
-
-       soup_soap_message_start_element (msg, "filter", NULL, NULL);
-       for (; component_list != NULL; component_list = g_slist_next (component_list)) {
-               filter_component = (FilterComponent *) (component_list->data);
-               if (filter_component->operation == E_GW_FILTER_OP_AND || filter_component->operation == E_GW_FILTER_OP_OR
-                   || filter_component->operation == E_GW_FILTER_OP_NOT) {
-                       component_list = append_complex_component (component_list, msg);
-               }
-               else
-                       append_child_component (filter_component, msg);
-       soup_soap_message_end_element (msg); /* end filter */
-
-       }
-}
-
-static void
-e_gw_filter_finalize (GObject *object)
-{
-       EGwFilter *filter;
-       EGwFilterPrivate *priv;
-       GSList *filter_components;
-       FilterComponent *component;
-
-       filter = E_GW_FILTER (object);
-       priv = filter->priv;
-       filter_components = priv->component_list;
-       for (; filter_components != NULL; filter_components = g_slist_next (filter_components)) {
-               component = filter_components->data;
-               g_free (component->field_name);
-               g_free (component->field_value);
-               g_free (filter_components->data);
-       }
-
-       g_slist_free (priv->component_list);
-       g_free (priv);
-       filter->priv = NULL;
-       if (parent_class->finalize)
-               (* parent_class->finalize) (object);
-}
-
-static void
-e_gw_filter_dispose (GObject *object)
-{
-
-       if (parent_class->dispose)
-               (* parent_class->dispose) (object);
-
-}
-
-static void
-e_gw_filter_init (EGwFilter *filter)
-{
-       EGwFilterPrivate *priv;
-
-       priv = g_new0 (EGwFilterPrivate, 1);
-       priv->filter_group_type = E_GW_FILTER_OP_AND; /*by default all condtions are to be met*/
-       priv->component_list = NULL;
-       filter->priv = priv;
-}
-
-static void
-e_gw_filter_class_init (EGwFilterClass *klass)
-{
-       GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-       parent_class = g_type_class_peek_parent (klass);
-       object_class->dispose = e_gw_filter_dispose;
-       object_class->finalize = e_gw_filter_finalize;
-}
-
-EGwFilter *
-e_gw_filter_new (void)
-{
-       return g_object_new (E_TYPE_GW_FILTER, NULL);
-}
diff --git a/servers/groupwise/e-gw-filter.h b/servers/groupwise/e-gw-filter.h
deleted file mode 100644 (file)
index 9672b48..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors :
- * Sivaiah Nallagatla <snallagatla@novell.com>
- *
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- */
-
-#ifndef E_GW_FILTER_H
-#define E_GW_FILTER_H
-
-#include "soup-soap-message.h"
-#include "soup-soap-response.h"
-
-G_BEGIN_DECLS
-
-#define E_TYPE_GW_FILTER           (e_gw_filter_get_type ())
-#define E_GW_FILTER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_GW_FILTER, EGwFilter))
-#define E_GW_FILTER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_GW_FILTER, EGwFilterClass))
-#define E_IS_GW_FILTER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_GW_FILTER))
-#define E_IS_GW_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_GW_FILTER))
-
-typedef struct _EGwFilter        EGwFilter;
-typedef struct _EGwFilterClass   EGwFilterClass;
-typedef struct _EGwFilterPrivate EGwFilterPrivate;
-
-typedef enum {
-       E_GW_FILTER_OP_AND,
-       E_GW_FILTER_OP_OR,
-       E_GW_FILTER_OP_NOT,
-       E_GW_FILTER_OP_EQUAL,
-       E_GW_FILTER_OP_NOTEQUAL,
-       E_GW_FILTER_OP_GREATERTHAN,
-       E_GW_FILTER_OP_LESSTHAN,
-       E_GW_FILTER_OP_GREATERTHAN_OR_EQUAL,
-       E_GW_FILTER_OP_LESSTHAN_OR_EQUAL,
-       E_GW_FILTER_OP_CONTAINS,
-       E_GW_FILTER_OP_CONTAINSWORD,
-       E_GW_FILTER_OP_BEGINS,
-       E_GW_FILTER_OP_EXISTS,
-       E_GW_FILTER_OP_NOTEXISTS
-
-} EGwFilterOpType;
-
-struct _EGwFilter {
-       GObject parent;
-       EGwFilterPrivate *priv;
-};
-
-struct _EGwFilterClass {
-       GObjectClass parent_class;
-};
-
-GType       e_gw_filter_get_type (void);
-EGwFilter*  e_gw_filter_new (void);
-void        e_gw_filter_add_filter_component (EGwFilter *filter, EGwFilterOpType operation, const gchar *field_name, const gchar *field_value);
-void        e_gw_filter_append_to_soap_message (EGwFilter *filter, SoupSoapMessage *msg);
-void        e_gw_filter_group_conditions (EGwFilter *filter, EGwFilterOpType operation, gint num_of_condtions);
-
-G_END_DECLS
-
-#endif
diff --git a/servers/groupwise/e-gw-item.c b/servers/groupwise/e-gw-item.c
deleted file mode 100644 (file)
index 7b1f952..0000000
+++ /dev/null
@@ -1,3623 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors :
- *  JP Rosevear <jpr@ximian.com>
- *  Rodrigo Moya <rodrigo@ximian.com>
- *  Harish Krishnaswamy <kharish@novell.com>
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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 <glib.h>
-#include <glib/gprintf.h>
-#include <libsoup/soup-misc.h>
-#include "e-gw-item.h"
-#include "e-gw-connection.h"
-#include "e-gw-message.h"
-
-G_DEFINE_TYPE (EGwItem, e_gw_item, G_TYPE_OBJECT)
-
-struct _EGwItemPrivate {
-       EGwItemType item_type;
-       gchar *container;
-       GList *category_list; /*list of category ids*/
-
-       /* properties */
-       gchar *id;
-       gchar *creation_date;
-       gchar *delivered_date;
-       gchar *start_date;
-       gchar *end_date;
-       gchar *due_date;
-       gchar *completed_date;
-       gchar *modified_date;
-       gboolean completed;
-       gboolean is_allday_event;
-       gchar *subject;
-       gchar *message;
-       gchar *classification;
-       gchar *accept_level;
-       gchar *priority;
-       gchar *task_priority;
-       gchar *place;
-       gchar *source;
-       gchar *security;
-       GSList *recipient_list;
-       GSList *recurrence_dates;
-       GSList *exdate_list;
-       EGwItemRecurrenceRule *rrule;
-       gint recurrence_key;
-       gint trigger; /* alarm */
-       /*message size*/
-       gint size;
-       EGwItemOrganizer *organizer;
-
-       /*properties for mail*/
-       gchar *from;
-       gchar *to;
-       gchar *content_type;
-       gchar *msg_body_id;
-       gint item_status;
-       /*Attachments*/
-       gboolean has_attachment;
-       GSList *attach_list;
-       /*linkInfo for replies*/
-       EGwItemLinkInfo *link_info;
-
-       /* properties for tasks/calendars */
-       gchar *icalid;
-       /* if the self is not the organizer of the item, the
-        * status is not reflected in the recipientStatus.
-        * Hence it should be gleaned from the 'status' element
-        * of the Mail, the parent item.*/
-       guint32 self_status;
-       /* properties for category items*/
-       gchar *category_name;
-
-       /* properties for contacts */
-       FullName *full_name;
-       GList *email_list;
-       GList *im_list;
-       GHashTable *simple_fields;
-       GList *member_list;
-       GHashTable *addresses;
-
-       /***** Send Options *****/
-
-       gboolean set_sendoptions;
-       /* Reply Request */
-       gchar *reply_within;
-       gboolean reply_request_set;
-
-       /* Status Tracking through sent Item */
-       EGwItemTrack track_info;
-       gboolean autodelete;
-
-       /* Return Notification */
-       EGwItemReturnNotify notify_completed;
-       EGwItemReturnNotify notify_accepted;
-       EGwItemReturnNotify notify_declined;
-       EGwItemReturnNotify notify_opened;
-       EGwItemReturnNotify notify_deleted;
-
-       /* Expiration Date */
-       gchar *expires;
-
-       /* Delay delivery */
-       gchar *delay_until;
-
-       /* changes */
-       GHashTable *additions;
-       GHashTable *updates;
-       GHashTable *deletions;
-
-       gboolean internet;
-
-       /* Message Threading */
-       gchar *message_id;
-       gchar *parent_threads;
-
-       /*padding*/
-       guint padding[10];
-};
-
-static GObjectClass *parent_class = NULL;
-
-static void
-free_recipient (EGwItemRecipient *recipient, gpointer data)
-{
-       g_free (recipient->email);
-       g_free (recipient->display_name);
-       g_free (recipient->delivered_date);
-       g_free (recipient->opened_date);
-       g_free (recipient->accepted_date);
-       g_free (recipient->deleted_date);
-       g_free (recipient->declined_date);
-       g_free (recipient->completed_date);
-       g_free (recipient->undelivered_date);
-       g_free (recipient);
-}
-
-static void
-free_postal_address (gpointer  postal_address)
-{
-       PostalAddress *address;
-       address = (PostalAddress *) postal_address;
-       if (address) {
-               g_free (address->street_address);
-               g_free (address->location);
-               g_free (address->city);
-               g_free (address->country);
-               g_free (address->state);
-               g_free (address->postal_code);
-               g_free (address);
-       }
-}
-
-static void
-free_full_name (gpointer full_name)
-{
-       FullName *name = (FullName *) full_name;
-       g_free (name->name_prefix);
-       g_free (name->first_name);
-       g_free (name->middle_name);
-       g_free (name->last_name);
-       g_free (name->name_suffix);
-       g_free (name);
-
-}
-
-static void
-free_string (gpointer s, gpointer data)
-{
-       if (s)
-               free (s);
-}
-
-static void
-free_attach (gpointer s, gpointer data)
-{
-       EGwItemAttachment *attach = (EGwItemAttachment *) s;
-       if (attach) {
-               if (attach->id)
-                       g_free (attach->id), attach->id = NULL;
-               if (attach->name)
-                       g_free (attach->name), attach->name = NULL;
-               if (attach->contentid)
-                       g_free (attach->contentid), attach->contentid= NULL;
-               if (attach->contentType)
-                       g_free (attach->contentType), attach->contentType = NULL;
-               if (attach->date)
-                       g_free (attach->date), attach->date = NULL;
-               if (attach->data)
-                       g_free (attach->data), attach->data = NULL;
-
-               g_free (attach);
-       }
-
-}
-static void
-free_member (gpointer member, gpointer data)
-{
-       EGroupMember *group_member = (EGroupMember *) member;
-       if (group_member->id)
-               g_free (group_member->id);
-       if (group_member->email)
-               g_free (group_member->email);
-       if (group_member->name)
-               g_free (group_member->name);
-       g_free (group_member);
-}
-
-static void
-free_im_address ( gpointer address, gpointer data)
-{
-       IMAddress *im_address;
-       im_address = (IMAddress *) address;
-
-       if (im_address) {
-               if (im_address->service)
-                       g_free (im_address->service);
-               if (im_address->address)
-                       g_free (im_address->address);
-               g_free (im_address);
-       }
-}
-
-static void
-free_link_info (EGwItemLinkInfo *info)
-{
-       if (info) {
-               if (info->id )
-                       g_free (info->id), info->id = NULL;
-               if (info->type)
-                       g_free (info->type), info->type = NULL;
-               if (info->thread)
-                       g_free (info->thread), info->thread = NULL;
-               g_free (info);
-               info = NULL;
-       }
-}
-
-static void
-free_changes ( GHashTable *changes)
-{
-       gpointer value;
-       if (!changes)
-               return;
-       value = g_hash_table_lookup (changes, "full_name");
-       if (value)
-               free_full_name (value);
-       value = g_hash_table_lookup (changes, "email");
-       if (value)
-               g_list_free ((GList*) value);
-       value = g_hash_table_lookup (changes, "ims");
-       if (value)
-               g_list_free ((GList*) value);
-       value = g_hash_table_lookup (changes, "Home");
-       if (value)
-               free_postal_address (value);
-       value = g_hash_table_lookup (changes, "Office");
-       if (value)
-               free_postal_address (value);
-       g_hash_table_destroy (changes);
-}
-static void
-e_gw_item_dispose (GObject *object)
-{
-       EGwItem *item = (EGwItem *) object;
-       EGwItemPrivate *priv;
-
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       priv = item->priv;
-       if (priv) {
-               if (priv->container) {
-                       g_free (priv->container);
-                       priv->container = NULL;
-               }
-
-               if (priv->id) {
-                       g_free (priv->id);
-                       priv->id = NULL;
-               }
-
-               if (priv->subject) {
-                       g_free (priv->subject);
-                       priv->subject = NULL;
-               }
-
-               if (priv->message) {
-                       g_free (priv->message);
-                       priv->message = NULL;
-               }
-
-               if (priv->classification) {
-                       g_free (priv->classification);
-                       priv->classification = NULL;
-               }
-
-               if (priv->security) {
-                       g_free (priv->security);
-                       priv->security = NULL;
-               }
-
-               if (priv->accept_level) {
-                       g_free (priv->accept_level);
-                       priv->accept_level = NULL;
-               }
-
-               if (priv->priority) {
-                       g_free (priv->priority);
-                       priv->priority = NULL;
-               }
-
-               if (priv->task_priority) {
-                       g_free (priv->task_priority);
-                       priv->task_priority = NULL;
-               }
-
-               if (priv->place) {
-                       g_free (priv->place);
-                       priv->place = NULL;
-               }
-
-               if (priv->from) {
-                       g_free (priv->from);
-                       priv->from = NULL;
-               }
-
-               if (priv->to) {
-                       g_free (priv->to);
-                       priv->to = NULL;
-               }
-
-               if (priv->content_type) {
-                       g_free (priv->content_type);
-                       priv->content_type = NULL;
-               }
-               if (priv->msg_body_id) {
-                       g_free (priv->msg_body_id);
-                       priv->msg_body_id = NULL;
-               }
-
-               if (priv->icalid) {
-                       g_free (priv->icalid);
-                       priv->icalid = NULL;
-               }
-
-               if (priv->reply_within) {
-                       g_free (priv->reply_within);
-                       priv->reply_within = NULL;
-               }
-
-               if (priv->expires) {
-                       g_free (priv->expires);
-                       priv->expires = NULL;
-               }
-
-               if (priv->delay_until) {
-                       g_free (priv->delay_until);
-                       priv->delay_until = NULL;
-               }
-
-               if (priv->recipient_list) {
-                       g_slist_foreach (priv->recipient_list, (GFunc) free_recipient, NULL);
-                       g_slist_free (priv->recipient_list);
-                       priv->recipient_list = NULL;
-               }
-
-               if (priv->organizer) {
-                       g_free (priv->organizer->display_name);
-                       g_free (priv->organizer->email);
-                       g_free (priv->organizer);
-                       priv->organizer = NULL;
-               }
-
-               if (priv->recurrence_dates) {
-                       g_slist_foreach (priv->recurrence_dates, free_string, NULL);
-                       g_slist_free (priv->recurrence_dates);
-                       priv->recurrence_dates = NULL;
-               }
-
-               if (priv->exdate_list) {
-                       g_slist_foreach (priv->exdate_list, free_string, NULL);
-                       g_slist_free (priv->exdate_list);
-                       priv->exdate_list = NULL;
-               }
-
-               if (priv->rrule) {
-                       /*TODO free all the strings */
-                       priv->rrule = NULL;
-               }
-
-               if (priv->full_name) {
-                       free_full_name (priv->full_name);
-                       priv->full_name = NULL;
-                       }
-
-               if (priv->simple_fields)
-                       g_hash_table_destroy (priv->simple_fields);
-
-               if (priv->addresses)
-                       g_hash_table_destroy (priv->addresses);
-
-               if (priv->email_list) {
-                       g_list_foreach (priv->email_list,  free_string , NULL);
-                       g_list_free (priv->email_list);
-                       priv->email_list = NULL;
-               }
-
-               if (priv->member_list) {
-                       g_list_foreach (priv->member_list,  free_member, NULL);
-                       g_list_free (priv->member_list);
-                       priv->member_list = NULL;
-               }
-
-               if (priv->im_list) {
-                       g_list_foreach (priv->im_list, free_im_address, NULL);
-                       g_list_free (priv->im_list);
-                       priv->im_list = NULL;
-               }
-
-               if (priv->category_list) {
-                       g_list_foreach (priv->category_list,  free_string, NULL);
-                       g_list_free (priv->category_list);
-                       priv->category_list = NULL;
-               }
-
-               if (priv->attach_list) {
-                       g_slist_foreach (priv->attach_list, free_attach, NULL);
-                       g_slist_free (priv->attach_list);
-                       priv->attach_list = NULL;
-               }
-
-               if (priv->category_name) {
-                       g_free (priv->category_name);
-                       priv->category_name = NULL;
-               }
-
-               if (priv->source) {
-                       g_free (priv->source);
-                       priv->source = NULL;
-               }
-
-               if (priv->link_info) {
-                       free_link_info (priv->link_info);
-                       priv->link_info = NULL;
-               }
-
-               if (priv->end_date) {
-                       g_free (priv->end_date);
-                       priv->end_date = NULL;
-               }
-
-               if (priv->delivered_date) {
-                       g_free (priv->delivered_date);
-                       priv->delivered_date = NULL;
-               }
-
-               if (priv->modified_date) {
-                       g_free (priv->modified_date);
-                       priv->modified_date = NULL;
-               }
-
-               if (priv->start_date) {
-                       g_free (priv->start_date);
-                       priv->start_date = NULL;
-               }
-
-               if (priv->creation_date) {
-                       g_free (priv->creation_date);
-                       priv->creation_date = NULL;
-               }
-
-               if (priv->message_id) {
-                       g_free (priv->message_id);
-                       priv->message_id = NULL;
-               }
-
-               if (priv->parent_threads) {
-                       g_free (priv->parent_threads);
-                       priv->parent_threads = NULL;
-               }
-
-               free_changes (priv->additions);
-               free_changes (priv->deletions);
-               free_changes (priv->updates);
-
-       }
-
-       if (parent_class->dispose)
-               (* parent_class->dispose) (object);
-}
-
-static void
-e_gw_item_finalize (GObject *object)
-{
-       EGwItem *item = (EGwItem *) object;
-       EGwItemPrivate *priv;
-
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       priv = item->priv;
-
-       /* clean up */
-       g_free (priv);
-       item->priv = NULL;
-
-       if (parent_class->finalize)
-               (* parent_class->finalize) (object);
-}
-
-static void
-e_gw_item_class_init (EGwItemClass *klass)
-{
-       GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-       parent_class = g_type_class_peek_parent (klass);
-
-       object_class->dispose = e_gw_item_dispose;
-       object_class->finalize = e_gw_item_finalize;
-}
-
-static void
-e_gw_item_init (EGwItem *item)
-{
-       EGwItemPrivate *priv;
-
-       /* allocate internal structure */
-       priv = g_new0 (EGwItemPrivate, 1);
-       priv->item_type = E_GW_ITEM_TYPE_UNKNOWN;
-       priv->creation_date = NULL;
-       priv->delivered_date = NULL;
-       priv->modified_date = NULL;
-       priv->start_date = NULL;
-       priv->end_date = NULL;
-       priv->due_date = NULL;
-       priv->completed_date = NULL;
-       priv->trigger = 0;
-       priv->recipient_list = NULL;
-       priv->organizer = NULL;
-       priv->recurrence_dates = NULL;
-       priv->completed = FALSE;
-       priv->is_allday_event = FALSE;
-       priv->im_list = NULL;
-       priv->email_list = NULL;
-       priv->member_list = NULL;
-       priv->category_list = NULL;
-       priv->reply_within = NULL;
-       priv->reply_request_set = FALSE;
-       priv->autodelete = FALSE;
-       priv->set_sendoptions = FALSE;
-       priv->expires = NULL;
-       priv->delay_until = NULL;
-       priv->attach_list = NULL;
-       priv->simple_fields = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_free);
-       priv->full_name = g_new0 (FullName, 1);
-       priv->addresses = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, free_postal_address);
-       priv->additions = g_hash_table_new (g_str_hash, g_str_equal);
-       priv->updates =   g_hash_table_new (g_str_hash, g_str_equal);
-       priv->deletions = g_hash_table_new (g_str_hash, g_str_equal);
-       priv->self_status = 0;
-       priv->link_info = NULL;
-       priv->msg_body_id = NULL;
-       priv->has_attachment = FALSE;
-       priv->internet = FALSE;
-       priv->message_id = NULL;
-       priv->parent_threads = NULL;
-       item->priv = priv;
-
-}
-
-void
-e_gw_item_free_cal_id (EGwItemCalId *calid)
-{
-       if (calid->item_id) {
-               g_free (calid->item_id);
-               calid->item_id = NULL;
-       }
-
-       if (calid->ical_id) {
-               g_free (calid->ical_id);
-               calid->ical_id = NULL;
-       }
-
-       if (calid->recur_key) {
-               g_free (calid->recur_key);
-               calid->recur_key = NULL;
-       }
-
-       if (calid->start_date) {
-               g_free (calid->start_date);
-               calid->start_date = NULL;
-       }
-
-       g_free (calid);
-}
-
-EGwItem *
-e_gw_item_new_empty (void)
-{
-       return g_object_new (E_TYPE_GW_ITEM, NULL);
-}
-
-static void
-set_recipient_list_from_soap_parameter (EGwItem *item, SoupSoapParameter *param)
-{
-       SoupSoapParameter *param_recipient;
-       gchar *email, *cn;
-       EGwItemRecipient *recipient;
-       GList *email_list;
-
-       email_list = e_gw_item_get_email_list (item);
-
-       for (param_recipient = soup_soap_parameter_get_first_child_by_name (param, "recipient");
-                       param_recipient != NULL;
-                       param_recipient = soup_soap_parameter_get_next_child_by_name (param_recipient, "recipient")) {
-               SoupSoapParameter *subparam;
-
-               recipient = g_new0 (EGwItemRecipient, 1);
-               subparam = soup_soap_parameter_get_first_child_by_name (param_recipient, "email");
-               if (subparam) {
-                       email = soup_soap_parameter_get_string_value (subparam);
-                       if (email)
-                               recipient->email = email;
-               }
-               subparam = soup_soap_parameter_get_first_child_by_name (param_recipient, "displayName");
-               if (subparam) {
-                       cn = soup_soap_parameter_get_string_value (subparam);
-                       if (cn)
-                               recipient->display_name = cn;
-               }
-
-               subparam = soup_soap_parameter_get_first_child_by_name (param_recipient, "distType");
-               if (subparam) {
-                       gchar *dist_type;
-                       dist_type = soup_soap_parameter_get_string_value (subparam);
-                       if (!strcmp (dist_type, "TO"))
-                               recipient->type = E_GW_ITEM_RECIPIENT_TO;
-                       else if (!strcmp (dist_type, "CC"))
-                               recipient->type = E_GW_ITEM_RECIPIENT_CC;
-                       else if (!strcmp (dist_type, "BC"))
-                               recipient->type = E_GW_ITEM_RECIPIENT_BC;
-                       else
-                               recipient->type = E_GW_ITEM_RECIPIENT_NONE;
-                       g_free (dist_type);
-               }
-               /*FIXME  gw recipientTypes need to be added after the server is fixed. */
-
-               /* update Recipient Status
-                look for accepted/declined and update the item else set it
-                to none. */
-               subparam = soup_soap_parameter_get_first_child_by_name (param_recipient, "recipientStatus");
-               if (subparam) {
-                       gchar *formatted_date, *value;
-                       SoupSoapParameter *temp_param;
-
-                       recipient->status_enabled = TRUE;
-                       if ((temp_param = soup_soap_parameter_get_first_child_by_name (subparam, "deleted"))) {
-                               recipient->status = E_GW_ITEM_STAT_DELETED;
-                               value = soup_soap_parameter_get_string_value (temp_param);
-                               formatted_date = e_gw_connection_format_date_string (value);
-                               recipient->deleted_date = g_strdup (formatted_date);
-                               g_free (value), value = NULL;
-                               g_free (formatted_date), formatted_date = NULL;
-                       }
-                       if ((temp_param = soup_soap_parameter_get_first_child_by_name (subparam, "declined"))) {
-                               recipient->status = E_GW_ITEM_STAT_DECLINED;
-                               value = soup_soap_parameter_get_string_value (temp_param);
-                               formatted_date = e_gw_connection_format_date_string (value);
-                               recipient->declined_date = g_strdup (formatted_date);
-                               g_free (value), value = NULL;
-                               g_free (formatted_date), formatted_date = NULL;
-
-                       } if ( (temp_param = soup_soap_parameter_get_first_child_by_name (subparam, "accepted"))) {
-                               recipient->status = E_GW_ITEM_STAT_ACCEPTED;
-                               value = soup_soap_parameter_get_string_value (temp_param);
-                               formatted_date = e_gw_connection_format_date_string (value);
-                               recipient->accepted_date = g_strdup (formatted_date);
-                               g_free (value), value = NULL;
-                               g_free (formatted_date), formatted_date = NULL;
-                       } else
-                               recipient->status = E_GW_ITEM_STAT_NONE;
-                       temp_param = soup_soap_parameter_get_first_child_by_name (subparam, "completed");
-                       if (temp_param) {
-                               value = soup_soap_parameter_get_string_value (temp_param);
-                               formatted_date = e_gw_connection_format_date_string (value);
-                               e_gw_item_set_completed_date (item, formatted_date);
-                               recipient->completed_date = g_strdup (formatted_date);
-                               g_free (value), value = NULL;
-                               g_free (formatted_date), formatted_date = NULL;
-                       }
-                       if ( (temp_param = soup_soap_parameter_get_first_child_by_name (subparam, "opened"))) {
-                               value = soup_soap_parameter_get_string_value (temp_param);
-                               formatted_date = e_gw_connection_format_date_string (value);
-                               recipient->opened_date = g_strdup (formatted_date);
-                               g_free (value), value = NULL;
-                               g_free (formatted_date), formatted_date = NULL;
-                       }
-                       if ( ( temp_param = soup_soap_parameter_get_first_child_by_name (subparam, "delivered"))) {
-                               value = soup_soap_parameter_get_string_value (temp_param);
-                               formatted_date = e_gw_connection_format_date_string (value);
-                               recipient->delivered_date = g_strdup (formatted_date);
-                               g_free (value), value = NULL;
-                               g_free (formatted_date), formatted_date = NULL;
-                       }
-                       if ( (temp_param = soup_soap_parameter_get_first_child_by_name (subparam, "undeliverable_date"))) {
-                               value = soup_soap_parameter_get_string_value (temp_param);
-                               formatted_date = e_gw_connection_format_date_string (value);
-                               recipient->undelivered_date = g_strdup (formatted_date);
-                               g_free (value), value = NULL;
-                               g_free (formatted_date), formatted_date = NULL;
-                       }
-               } else {
-                       /* if recipientStatus is not provided, use the
-                        * self_status, obtained from the mail properties. */
-                       if (!strcmp ((const gchar *)email_list->data, recipient->email))
-                               recipient->status = item->priv->self_status & (E_GW_ITEM_STAT_DECLINED |
-                                                                               E_GW_ITEM_STAT_ACCEPTED);
-                       else
-                               recipient->status = E_GW_ITEM_STAT_NONE;
-               }
-
-               item->priv->recipient_list = g_slist_append (item->priv->recipient_list, recipient);
-       }
-}
-
-static EGwItemReturnNotify
-get_notification_value (SoupSoapParameter *param, const gchar *param_name)
-{
-       SoupSoapParameter *subparam;
-
-       if ((subparam = soup_soap_parameter_get_first_child_by_name (param, param_name))) {
-               gchar *value = NULL;
-
-               subparam = soup_soap_parameter_get_first_child_by_name (subparam, "mail");
-               if (subparam)
-                       value = soup_soap_parameter_get_string_value (subparam);
-               if (value && !g_ascii_strcasecmp (value, "1")) {
-                       g_free (value), value = NULL;
-                       return E_GW_ITEM_NOTIFY_MAIL;
-               }
-               g_free (value), value = NULL;
-       }
-       return E_GW_ITEM_NOTIFY_NONE;
-}
-
-static void
-set_sendoptions_from_soap_parameter (EGwItem *item, SoupSoapParameter *param)
-{
-       EGwItemPrivate *priv;
-       SoupSoapParameter *subparam, *child;
-       gchar *value = NULL;
-
-       priv = item->priv;
-
-       if ((subparam = soup_soap_parameter_get_first_child_by_name (param, "requestReply"))) {
-               child = soup_soap_parameter_get_first_child_by_name (subparam, "whenConvenient");
-               if (child) {
-                       value = soup_soap_parameter_get_string_value (child);
-                       if (value && !g_ascii_strcasecmp (value, "1"))
-                               priv->reply_request_set = TRUE;
-                       g_free (value), value = NULL;
-               }
-
-               if (!priv->reply_request_set) {
-                       child = soup_soap_parameter_get_first_child_by_name (subparam, "byDate");
-
-                       if (child)
-                               value = soup_soap_parameter_get_string_value (child);
-                       if (value) {
-                               gchar *date;
-                               date = e_gw_connection_format_date_string (value);
-                               priv->reply_request_set = TRUE;
-                               priv->reply_within = date;
-                       }
-
-               }
-               g_free (value), value = NULL;
-       }
-
-       if ( (subparam = soup_soap_parameter_get_first_child_by_name (param, "statusTracking"))) {
-               value = soup_soap_parameter_get_string_value (subparam);
-              if (value) {
-                      if (!g_ascii_strcasecmp (value, "Delivered"))
-                              priv->track_info = E_GW_ITEM_DELIVERED;
-                      else if (!g_ascii_strcasecmp (value, "DeliveredAndOpened"))
-                               priv->track_info = E_GW_ITEM_DELIVERED_OPENED;
-                      else if (!g_ascii_strcasecmp (value, "All"))
-                               priv->track_info = E_GW_ITEM_ALL;
-
-                      g_free (value), value = NULL;
-
-                      value = soup_soap_parameter_get_property (subparam, "autoDelete");
-                      if (value && !g_ascii_strcasecmp (value, "1"))
-                               priv->autodelete = TRUE;
-                      g_free (value), value = NULL;
-              }
-       }
-
-       if ( (subparam = soup_soap_parameter_get_first_child_by_name (param, "notification"))) {
-               priv->notify_opened = get_notification_value (subparam, "opened");
-               priv->notify_deleted = get_notification_value (subparam, "deleted");
-               priv->notify_accepted = get_notification_value (subparam, "accepted");
-               priv->notify_declined = get_notification_value (subparam, "declined");
-               priv->notify_completed = get_notification_value (subparam, "completed");
-       }
-}
-
-gchar *
-e_gw_item_get_field_value (EGwItem *item, const gchar *field_name)
-{
-       gpointer value;
-
-       g_return_val_if_fail (field_name != NULL, NULL);
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-
-       if (item->priv->simple_fields == NULL)
-               return NULL;
-
-       value =  (gchar *) g_hash_table_lookup (item->priv->simple_fields, field_name);
-       if (value)
-               return value;
-
-       return NULL;
-}
-
-void
-e_gw_item_set_field_value (EGwItem *item, const gchar *field_name, gchar * field_value)
-{
-       g_return_if_fail (field_name != NULL);
-       g_return_if_fail (field_name != NULL);
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       if (item->priv->simple_fields != NULL)
-               g_hash_table_insert (item->priv->simple_fields, (gpointer) field_name, g_strdup (field_value));
-
-}
-guint32
-e_gw_item_get_item_status (EGwItem *item)
-{
-
-       return item->priv->self_status;
-}
-GList *
-e_gw_item_get_email_list (EGwItem *item)
-{
-       return item->priv->email_list;
-
-}
-
-void
-e_gw_item_set_email_list (EGwItem *item, GList* email_list)
-{
-       item->priv->email_list = email_list;
-}
-
-GList *
-e_gw_item_get_im_list (EGwItem *item)
-
-{
-       return item->priv->im_list;
-}
-
-void
-e_gw_item_set_im_list (EGwItem *item, GList *im_list)
-{
-       item->priv->im_list = im_list;
-}
-FullName*
-e_gw_item_get_full_name (EGwItem *item)
-{
-       return item->priv->full_name;
-}
-
-void
-e_gw_item_set_full_name (EGwItem *item, FullName *full_name)
-{
-       item->priv->full_name = full_name;
-}
-
-GList *
-e_gw_item_get_member_list (EGwItem *item)
-{
-       return item->priv->member_list;
-}
-
-void
-e_gw_item_set_member_list (EGwItem *item, GList *list)
-{
-       item->priv->member_list = list;
-
-}
-
-void
-e_gw_item_set_address (EGwItem *item, const gchar *address_type, PostalAddress *address)
-{
-       if (address_type && address)
-               g_hash_table_insert (item->priv->addresses, (gpointer) address_type, address);
-
-}
-
-PostalAddress *e_gw_item_get_address (EGwItem *item, const gchar *address_type)
-{
-       return (PostalAddress *) g_hash_table_lookup (item->priv->addresses, address_type);
-}
-
-void
-e_gw_item_set_categories (EGwItem *item, GList *category_list)
-{
-       item->priv->category_list = category_list;
-
-}
-
-GList*
-e_gw_item_get_categories (EGwItem *item)
-{
-       return item->priv->category_list;
-}
-
-void
-e_gw_item_set_category_name (EGwItem *item, gchar *category_name)
-{
-       item->priv->category_name = category_name;
-}
-
-gchar *
-e_gw_item_get_category_name (EGwItem *item)
-{
-       return item->priv->category_name;
-}
-
-const gchar *
-e_gw_item_get_parent_thread_ids (EGwItem *item)
-{
-       return item->priv->parent_threads;
-}
-
-const gchar *
-e_gw_item_get_message_id (EGwItem *item)
-{
-       return item->priv->message_id;
-}
-
-void e_gw_item_set_change (EGwItem *item, EGwItemChangeType change_type, const gchar *field_name, gpointer field_value)
-{
-       GHashTable *hash_table;
-       EGwItemPrivate *priv;
-
-       priv = item->priv;
-       hash_table = NULL;
-       switch (change_type) {
-       case E_GW_ITEM_CHANGE_TYPE_ADD :
-               hash_table = priv->additions;
-               break;
-       case E_GW_ITEM_CHANGE_TYPE_UPDATE :
-               hash_table = priv->updates;
-               break;
-       case E_GW_ITEM_CHANGE_TYPE_DELETE :
-               hash_table = priv->deletions;
-               break;
-       case E_GW_ITEM_CHNAGE_TYPE_UNKNOWN :
-               hash_table = NULL;
-               break;
-
-       }
-
-       if (hash_table)
-               g_hash_table_insert (hash_table, (gpointer) field_name, field_value);
-
-}
-
-static void
-set_common_addressbook_item_fields_from_soap_parameter (EGwItem *item, SoupSoapParameter *param)
-{
-       SoupSoapParameter *subparam, *category_param;
-       GHashTable *simple_fields;
-       gchar *value;
-       EGwItemPrivate *priv;
-       if (strcmp (soup_soap_parameter_get_name (param), "item") != 0) {
-               g_warning (G_STRLOC ": Invalid SOAP parameter %s", soup_soap_parameter_get_name (param));
-               return;
-       }
-       priv = item->priv;
-       simple_fields = priv->simple_fields;
-
-       subparam = soup_soap_parameter_get_first_child_by_name(param, "id");
-       if (subparam) {
-               value = soup_soap_parameter_get_string_value (subparam);
-               g_hash_table_insert (simple_fields, (gpointer) "id", value);
-               item->priv->id = g_strdup (value);
-       }
-       value = NULL;
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "modified");
-       if (subparam) {
-               value = soup_soap_parameter_get_string_value (subparam);
-               g_hash_table_insert (simple_fields, (gpointer) "modified_time", value);
-       }
-       value = NULL;
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "comment");
-       if (subparam) {
-               value = soup_soap_parameter_get_string_value (subparam);
-               if (value)
-                       g_hash_table_insert (simple_fields , (gpointer) "comment", value);
-       }
-       value = NULL;
-       subparam = soup_soap_parameter_get_first_child_by_name(param, "name");
-       if (subparam) {
-               value = soup_soap_parameter_get_string_value (subparam);
-               if (value)
-                       g_hash_table_insert (simple_fields, (gpointer) "name", value);
-       }
-       value = NULL;
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "categories");
-       if (subparam) {
-               for (category_param = soup_soap_parameter_get_first_child_by_name (subparam, "category");
-                    category_param != NULL;
-                    category_param = soup_soap_parameter_get_next_child_by_name (category_param, "category")) {
-
-                       value = soup_soap_parameter_get_string_value (category_param);
-                       if (value) {
-                               gchar **components = g_strsplit (value, "@", -1);
-                               g_free (value);
-                               value = components[0];
-                               priv->category_list = g_list_append (priv->category_list, g_strdup (value));
-                               g_strfreev (components);
-
-                       }
-
-               }
-       }
-
-}
-
-static void
-set_postal_address_from_soap_parameter (PostalAddress *address, SoupSoapParameter *param)
-{
-       SoupSoapParameter *subparam;
-       gchar *value;
-
-       subparam= soup_soap_parameter_get_first_child_by_name (param, "streetAddress");
-       if (subparam) {
-               value = soup_soap_parameter_get_string_value (subparam);
-               if (value)
-                       address->street_address = value;
-       }
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "location");
-       if (subparam) {
-               value = soup_soap_parameter_get_string_value (subparam);
-
-               if (value)
-                       address->location = value;
-       }
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "city");
-       if (subparam) {
-               value = soup_soap_parameter_get_string_value (subparam);
-               if (value)
-                       address->city = value;
-       }
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "state");
-       if (subparam) {
-               value = soup_soap_parameter_get_string_value (subparam);
-               if (value)
-                       address->state = value;
-       }
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "postalCode");
-       if (subparam) {
-               value = soup_soap_parameter_get_string_value (subparam);
-               if (value)
-                       address->postal_code = value;
-       }
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "country");
-       if (subparam) {
-               value = soup_soap_parameter_get_string_value (subparam);
-               if (value)
-                       address->country = value;
-       }
-
-}
-
-static void
-set_contact_fields_from_soap_parameter (EGwItem *item, SoupSoapParameter *param)
-{
-       gchar *value;
-       gchar *type;
-       gchar *primary_email;
-       SoupSoapParameter *subparam;
-       SoupSoapParameter *temp;
-       SoupSoapParameter *second_level_child;
-       GHashTable *simple_fields;
-       FullName *full_name;
-       PostalAddress *address;
-
-       value = NULL;
-       if (strcmp (soup_soap_parameter_get_name (param), "item") != 0) {
-               g_warning (G_STRLOC ": Invalid SOAP parameter %s", soup_soap_parameter_get_name (param));
-               return;
-       }
-       set_common_addressbook_item_fields_from_soap_parameter (item, param);
-       simple_fields = item->priv->simple_fields;
-       full_name = item->priv->full_name;
-       if (full_name) {
-               subparam = soup_soap_parameter_get_first_child_by_name (param, "fullName");
-               if (subparam) {
-                       temp = soup_soap_parameter_get_first_child_by_name(subparam, "namePrefix");
-                       if (temp) {
-                               value = soup_soap_parameter_get_string_value (temp);
-                               if (value)
-                                       full_name->name_prefix = value;
-                       }
-                       temp = soup_soap_parameter_get_first_child_by_name(subparam, "firstName");
-                       if (temp) {
-                               value = soup_soap_parameter_get_string_value (temp);
-                               if (value)
-                                       full_name->first_name = value;
-                       }
-                       temp = soup_soap_parameter_get_first_child_by_name(subparam, "middleName");
-                       if (temp) {
-                               value = soup_soap_parameter_get_string_value (temp);
-                               if (value)
-                                       full_name->middle_name = value;
-                       }
-                       temp = soup_soap_parameter_get_first_child_by_name(subparam, "lastName");
-                       if (temp) {
-                               value = soup_soap_parameter_get_string_value (temp);
-                               if (value)
-                                       full_name->last_name = value;
-                       }
-                       temp = soup_soap_parameter_get_first_child_by_name(subparam, "nameSuffix");
-                       if (temp) {
-                               value = soup_soap_parameter_get_string_value (temp);
-                               if (value)
-                                       full_name->name_suffix = value;
-                       }
-               }
-       }
-       subparam = soup_soap_parameter_get_first_child_by_name(param, "emailList");
-       if (subparam) {
-               primary_email = NULL;
-               value = soup_soap_parameter_get_property(subparam, "primary");
-               if (value) {
-                       primary_email = value;
-                       item->priv->email_list = g_list_append (item->priv->email_list, g_strdup (primary_email));
-               }
-               for ( temp = soup_soap_parameter_get_first_child (subparam); temp != NULL; temp = soup_soap_parameter_get_next_child (temp)) {
-                       value = soup_soap_parameter_get_string_value (temp);
-                       if (value) {
-                               if (!primary_email || !g_str_equal (primary_email, value))
-                                       item->priv->email_list = g_list_append (item->priv->email_list, value);
-                               else
-                                       g_free (value);
-                       }
-               }
-               g_free (primary_email);
-       }
-
-       subparam =  soup_soap_parameter_get_first_child_by_name(param, "imList");
-       if (subparam) {
-               for ( temp = soup_soap_parameter_get_first_child (subparam); temp != NULL; temp = soup_soap_parameter_get_next_child (temp))
-                       {
-                               IMAddress *im_address = g_new0 (IMAddress, 1);
-                               im_address->address = im_address->service = NULL;
-                               second_level_child = soup_soap_parameter_get_first_child_by_name (temp, "service");
-                               if (second_level_child) {
-                                       value = soup_soap_parameter_get_string_value (second_level_child);
-                                       if (value )
-                                               im_address->service = value;
-                               }
-                               second_level_child = soup_soap_parameter_get_first_child_by_name (temp, "address");
-                               if (second_level_child) {
-                                       value = soup_soap_parameter_get_string_value (second_level_child);
-                                       if (value)
-                                               im_address->address = value;
-                               }
-                               if (im_address->service && im_address->address)
-                                       item->priv->im_list = g_list_append (item->priv->im_list, im_address);
-                               else
-                                       free_im_address (im_address, NULL);
-
-                       }
-       }
-
-       subparam =  soup_soap_parameter_get_first_child_by_name(param, "phoneList");
-       if (subparam) {
-               g_hash_table_insert (simple_fields, (gpointer) "default_phone", soup_soap_parameter_get_property(subparam, "default"));
-               for ( temp = soup_soap_parameter_get_first_child (subparam); temp != NULL; temp = soup_soap_parameter_get_next_child (temp))
-                       {
-                               const gchar *key = NULL;
-
-                               type =  soup_soap_parameter_get_property (temp, "type");
-                               switch (*type) {
-                                       case 'O' :
-                                               key = "phone_Office";
-                                               break;
-                                       case 'H' :
-                                               key = "phone_Home";
-                                               break;
-                                       case 'P' :
-                                               key = "phone_Pager";
-                                               break;
-                                       case 'M' :
-                                               key = "phone_Mobile";
-                                               break;
-                                       case 'F' :
-                                               key = "phone_Fax";
-                                               break;
-                                       default:
-                                               /* It should never come here. For the worst */
-                                               key = "phone_";
-                                               break;
-                               };
-
-                               if (type) {
-                                       value = soup_soap_parameter_get_string_value (temp);
-                                       g_hash_table_insert (item->priv->simple_fields, (gchar *)key, value);
-                                       g_free (type);
-                               }
-                       }
-       }
-       subparam =  soup_soap_parameter_get_first_child_by_name(param, "personalInfo");
-       if (subparam) {
-               temp = soup_soap_parameter_get_first_child_by_name (subparam, "birthday");
-               if (temp) {
-                       value = soup_soap_parameter_get_string_value (temp);
-                       if (value)
-                               g_hash_table_insert (simple_fields, (gpointer) "birthday", value);
-
-               }
-               temp = soup_soap_parameter_get_first_child_by_name (subparam, "website");
-               if (temp) {
-                       value = soup_soap_parameter_get_string_value (temp);
-                       if (value)
-                               g_hash_table_insert (simple_fields, (gpointer) "website", value);
-               }
-       }
-
-       subparam =  soup_soap_parameter_get_first_child_by_name(param, "officeInfo");
-       if (subparam) {
-               temp = soup_soap_parameter_get_first_child_by_name (subparam, "organization");
-               if (temp) {
-                       value = soup_soap_parameter_get_string_value (temp);
-                       if (value)
-                               g_hash_table_insert (simple_fields, (gpointer) "organization", value);
-                       value = soup_soap_parameter_get_property(temp, "uid");
-                       if (value)
-                               g_hash_table_insert (simple_fields, (gpointer) "organization_id", value);
-               }
-               temp = soup_soap_parameter_get_first_child_by_name (subparam, "department");
-               if (temp) {
-                       value = soup_soap_parameter_get_string_value (temp);
-                       if (value)
-                               g_hash_table_insert (simple_fields, (gpointer) "department", value);
-               }
-               temp = soup_soap_parameter_get_first_child_by_name (subparam, "title");
-               if (temp) {
-                       value = soup_soap_parameter_get_string_value (temp);
-                       if (value)
-                               g_hash_table_insert (simple_fields, (gpointer) "title", value);
-               }
-
-       }
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "addressList");
-       if (subparam) {
-               for ( temp = soup_soap_parameter_get_first_child (subparam); temp != NULL; temp = soup_soap_parameter_get_next_child (temp)) {
-                       const gchar *add = NULL;
-                       address = g_new0 (PostalAddress, 1);
-                       set_postal_address_from_soap_parameter (address, temp);
-                       value = soup_soap_parameter_get_property(temp, "type");
-
-                       if (value && value[0] == 'H')
-                               add = "Home";
-                       else if (value && value[0] == 'O')
-                               add = "Office";
-                       else
-                               add = "Other";
-
-                       if (value)
-                               g_hash_table_insert (item->priv->addresses, (gchar *) add, address);
-                       else
-                               free_postal_address (address);
-                       g_free (value);
-               }
-
-       }
-
-}
-static void
-set_group_fields_from_soap_parameter (EGwItem *item, SoupSoapParameter *param)
-{
-
-       gchar *value;
-       SoupSoapParameter *subparam, *temp, *second_level_child;
-       GHashTable *simple_fields;
-
-       if (strcmp (soup_soap_parameter_get_name (param), "item") != 0) {
-               g_warning (G_STRLOC ": Invalid SOAP parameter %s", soup_soap_parameter_get_name (param));
-               return;
-       }
-
-       set_common_addressbook_item_fields_from_soap_parameter (item, param);
-       simple_fields = item->priv->simple_fields;
-
-       /* set name as the ful name also , as it is needed for searching*/
-       value = g_hash_table_lookup (simple_fields, "name");
-       if (value)
-               item->priv->full_name->first_name = g_strdup (value);
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "members");
-       if (subparam) {
-               gchar *id, *email;
-               for ( temp = soup_soap_parameter_get_first_child (subparam); temp != NULL; temp = soup_soap_parameter_get_next_child (temp)) {
-                       id = email = NULL;
-                       second_level_child = soup_soap_parameter_get_first_child_by_name (temp, "email");
-                       if (second_level_child)
-                               email = soup_soap_parameter_get_string_value (second_level_child);
-                       second_level_child = soup_soap_parameter_get_first_child_by_name (temp, "id");
-                       if (second_level_child)
-                               id = soup_soap_parameter_get_string_value (second_level_child);
-
-                       if (id && email) {
-                               EGroupMember *member = g_new0 (EGroupMember, 1);
-                               member->id = id;
-                               member->email = email;
-                               second_level_child = soup_soap_parameter_get_first_child_by_name (temp, "name");
-                               member->name =  soup_soap_parameter_get_string_value (second_level_child);
-                               item->priv->member_list = g_list_append (item->priv->member_list, member);
-                       } else {
-                               g_free (id);
-                               g_free (email);
-                       }
-               }
-       }
-
-}
-
-static void
-set_resource_fields_from_soap_parameter (EGwItem *item, SoupSoapParameter *param)
-{
-
-       gchar *value;
-       SoupSoapParameter *subparam;
-       GHashTable *simple_fields;
-
-       if (strcmp (soup_soap_parameter_get_name (param), "item") != 0) {
-               g_warning (G_STRLOC ": Invalid SOAP parameter %s", soup_soap_parameter_get_name (param));
-               return;
-       }
-
-       set_common_addressbook_item_fields_from_soap_parameter (item, param);
-       simple_fields = item->priv->simple_fields;
-
-       /* set name as the ful name also , as it is needed for searching*/
-       value = g_hash_table_lookup (simple_fields, "name");
-       if (value)
-               item->priv->full_name->first_name = g_strdup (value);
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "phone");
-       if (subparam) {
-               value = soup_soap_parameter_get_string_value (subparam);
-               if (value)
-                       g_hash_table_insert (simple_fields, (gpointer) "default_phone", value);
-       }
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "email");
-       if (subparam) {
-               value = soup_soap_parameter_get_string_value (subparam);
-               if (value)
-                       item->priv->email_list = g_list_append (item->priv->email_list, value);
-       }
-
-}
-
-static void
-set_organization_fields_from_soap_parameter (EGwItem *item, SoupSoapParameter *param)
-{
-
-       gchar *value;
-       SoupSoapParameter *subparam;
-       PostalAddress *address;
-       GHashTable *simple_fields;
-
-       if (strcmp (soup_soap_parameter_get_name (param), "item") != 0) {
-               g_warning (G_STRLOC ": Invalid SOAP parameter %s", soup_soap_parameter_get_name (param));
-               return;
-       }
-       set_common_addressbook_item_fields_from_soap_parameter (item, param);
-       simple_fields = item->priv->simple_fields;
-
-       /* set name as the ful name also , as it is needed for searching*/
-       value = g_hash_table_lookup (simple_fields, "name");
-       if (value)
-               item->priv->full_name->first_name = g_strdup (value);
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "phone");
-       if (subparam) {
-               value = soup_soap_parameter_get_string_value (subparam);
-               if (value)
-                       g_hash_table_insert (simple_fields, (gpointer) "default_phone", value);
-       }
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "fax");
-       if (subparam) {
-               value = soup_soap_parameter_get_string_value (subparam);
-               if (value)
-                       g_hash_table_insert (simple_fields, (gpointer) "phone_Fax", value);
-       }
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "address");
-       if (subparam) {
-               address = g_new0 (PostalAddress, 1);
-               set_postal_address_from_soap_parameter (address, subparam);
-               g_hash_table_insert (item->priv->addresses, (gpointer) "Office", address);
-
-       }
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "website");
-       if (subparam) {
-               value = soup_soap_parameter_get_string_value (subparam);
-               if (value)
-                       g_hash_table_insert (simple_fields, (gpointer) "website", value);
-       }
-
-}
-
-static void
-append_postal_address_to_soap_message (SoupSoapMessage *msg, PostalAddress *address, const gchar *address_type)
-{
-       soup_soap_message_start_element (msg, "address", NULL, NULL);
-       soup_soap_message_add_attribute (msg, "type", address_type, NULL, NULL);
-       if (address->street_address)
-               e_gw_message_write_string_parameter (msg, "streetAddress", NULL, address->street_address);
-       if (address->location)
-               e_gw_message_write_string_parameter (msg, "location", NULL, address->location);
-       if (address->city)
-               e_gw_message_write_string_parameter (msg, "city", NULL, address->city);
-       if (address->state)
-               e_gw_message_write_string_parameter (msg, "state", NULL, address->state);
-       if (address->postal_code)
-               e_gw_message_write_string_parameter (msg, "postalCode", NULL, address->postal_code);
-       if (address->country)
-               e_gw_message_write_string_parameter (msg, "country", NULL, address->country);
-       soup_soap_message_end_element (msg);
-
-}
-
-static void
-append_common_addressbook_item_fields_to_soap_message (GHashTable *simple_fields, GList *category_list,  SoupSoapMessage *msg)
-{
-       gchar * value;
-
-       value =  g_hash_table_lookup (simple_fields, "name");
-       if (value)
-               e_gw_message_write_string_parameter (msg, "name", NULL, value);
-
-       soup_soap_message_start_element (msg, "categories", NULL, NULL);
-       if (category_list && category_list->data)
-               soup_soap_message_add_attribute (msg, "types:primary", category_list->data, NULL, NULL);
-       for (; category_list != NULL; category_list = g_list_next (category_list))
-               if (category_list->data) {
-                       e_gw_message_write_string_parameter (msg, "category", NULL, category_list->data);
-               }
-       soup_soap_message_end_element (msg);
-
-       value = g_hash_table_lookup (simple_fields, "comment");
-       if (value)
-               e_gw_message_write_string_parameter (msg, "comment", NULL, value);
-
-}
-
-static void
-append_full_name_to_soap_message (FullName *full_name, gchar *display_name, SoupSoapMessage *msg)
-{
-       g_return_if_fail (full_name != NULL);
-       soup_soap_message_start_element (msg, "fullName", NULL, NULL);
-       if (display_name)
-               e_gw_message_write_string_parameter (msg, "displayName", NULL, display_name);
-       if (full_name->name_prefix)
-               e_gw_message_write_string_parameter (msg, "namePrefix", NULL, full_name->name_prefix);
-       if (full_name->first_name)
-               e_gw_message_write_string_parameter (msg, "firstName", NULL, full_name->first_name);
-       if (full_name->middle_name)
-               e_gw_message_write_string_parameter (msg, "middleName", NULL, full_name->middle_name);
-       if (full_name->last_name)
-               e_gw_message_write_string_parameter (msg, "lastName", NULL, full_name->last_name);
-       if (full_name->name_suffix)
-               e_gw_message_write_string_parameter (msg, "nameSuffix", NULL, full_name->name_suffix);
-       soup_soap_message_end_element (msg);
-
-}
-
-static void
-append_email_list_soap_message (GList *email_list, SoupSoapMessage *msg)
-{
-       g_return_if_fail (email_list != NULL);
-
-       soup_soap_message_start_element (msg, "emailList", NULL, NULL);
-       soup_soap_message_add_attribute (msg, "primary", email_list->data, NULL, NULL);
-       for (; email_list != NULL; email_list = g_list_next (email_list))
-               if (email_list->data)
-                       e_gw_message_write_string_parameter (msg, "email", NULL, email_list->data);
-       soup_soap_message_end_element (msg);
-
-}
-
-static void
-append_im_list_to_soap_message (GList *ims, SoupSoapMessage *msg)
-{
-       IMAddress *address;
-       g_return_if_fail (ims != NULL);
-
-       soup_soap_message_start_element (msg, "imList", NULL, NULL);
-       for (; ims != NULL; ims = g_list_next (ims)) {
-               soup_soap_message_start_element (msg, "im", NULL, NULL);
-               address = (IMAddress *) ims->data;
-               e_gw_message_write_string_parameter (msg, "service", NULL, address->service);
-               e_gw_message_write_string_parameter (msg, "address", NULL, address->address);
-               soup_soap_message_end_element (msg);
-       }
-       soup_soap_message_end_element (msg);
-
-}
-static void
-append_phone_list_to_soap_message (GHashTable *simple_fields, SoupSoapMessage *msg)
-{
-       gchar *value;
-
-       g_return_if_fail (simple_fields != NULL);
-
-       soup_soap_message_start_element (msg, "phoneList", NULL, NULL);
-       value = g_hash_table_lookup (simple_fields, "default_phone");
-       if (value)
-               soup_soap_message_add_attribute (msg, "default", value, NULL, NULL);
-       value = g_hash_table_lookup (simple_fields, "phone_Office");
-       if (value)
-               e_gw_message_write_string_parameter_with_attribute (msg, "phone", NULL, value, "type", "Office");
-       value = g_hash_table_lookup (simple_fields, "phone_Home");
-       if (value)
-               e_gw_message_write_string_parameter_with_attribute (msg, "phone", NULL, value, "type", "Home");
-       value = g_hash_table_lookup (simple_fields, "phone_Pager");
-       if (value)
-               e_gw_message_write_string_parameter_with_attribute (msg, "phone", NULL, value, "type", "Pager");
-       value = g_hash_table_lookup (simple_fields, "phone_Mobile");
-       if (value)
-               e_gw_message_write_string_parameter_with_attribute (msg, "phone", NULL, value, "type", "Mobile");
-       value = g_hash_table_lookup (simple_fields, "phone_Fax");
-       if (value)
-               e_gw_message_write_string_parameter_with_attribute (msg, "phone", NULL, value, "type", "Fax");
-
-       soup_soap_message_end_element (msg);
-
-}
-
-static void
-append_office_info_to_soap_message (GHashTable *simple_fields, SoupSoapMessage *msg)
-{
-       gchar *value;
-       gchar *org_name;
-       g_return_if_fail (simple_fields != NULL);
-
-       soup_soap_message_start_element (msg, "officeInfo", NULL, NULL);
-       value = g_hash_table_lookup (simple_fields, "organization_id");
-       org_name = g_hash_table_lookup (simple_fields, "organization");
-       if (value && org_name)
-               e_gw_message_write_string_parameter_with_attribute (msg, "organization", NULL, org_name, "uid", value);
-       else if (org_name)
-               e_gw_message_write_string_parameter (msg, "organization", NULL, org_name);
-       value = g_hash_table_lookup (simple_fields, "department");
-       if (value)
-               e_gw_message_write_string_parameter (msg, "department", NULL, value);
-
-               value = g_hash_table_lookup (simple_fields, "title");
-       if (value)
-               e_gw_message_write_string_parameter (msg, "title", NULL, value);
-
-       value = g_hash_table_lookup (simple_fields, "website");
-       if (value)
-               e_gw_message_write_string_parameter (msg, "website", NULL, value);
-       soup_soap_message_end_element (msg);
-
-}
-
-static void
-append_personal_info_to_soap_message (GHashTable *simple_fields, SoupSoapMessage *msg)
-{
-       gchar *value;
-
-       g_return_if_fail (simple_fields != NULL);
-
-       soup_soap_message_start_element (msg, "personalInfo", NULL, NULL);
-       value =  g_hash_table_lookup (simple_fields, "birthday");
-       if (value)
-               e_gw_message_write_string_parameter (msg, "birthday", NULL, value);
-       value =  g_hash_table_lookup (simple_fields, "website");
-       if (value)
-               e_gw_message_write_string_parameter (msg, "website",NULL,  value);
-
-       soup_soap_message_end_element (msg);
-
-}
-
-static void
-append_contact_fields_to_soap_message (EGwItem *item, SoupSoapMessage *msg)
-{
-       gchar * value;
-       GHashTable *simple_fields;
-       FullName *full_name;
-       PostalAddress *postal_address;
-
-       simple_fields = item->priv->simple_fields;
-       value = g_hash_table_lookup (simple_fields, "id");
-       if (value)
-               e_gw_message_write_string_parameter (msg, "id", NULL, value);
-
-       if (item->priv->container)
-               e_gw_message_write_string_parameter (msg, "container", NULL, item->priv->container);
-
-       append_common_addressbook_item_fields_to_soap_message (simple_fields, item->priv->category_list, msg);
-       value =  g_hash_table_lookup (simple_fields, "name");
-
-       full_name = item->priv->full_name;
-
-       if (full_name)
-               append_full_name_to_soap_message (full_name, value, msg);
-
-       if (item->priv->email_list)
-               append_email_list_soap_message (item->priv->email_list, msg);
-
-       if (item->priv->im_list)
-               append_im_list_to_soap_message (item->priv->im_list, msg);
-
-       if (simple_fields)
-               append_phone_list_to_soap_message (simple_fields, msg);
-
-       soup_soap_message_start_element (msg, "addressList", NULL, NULL);
-       postal_address = g_hash_table_lookup (item->priv->addresses, "Home");
-       if (postal_address)
-               append_postal_address_to_soap_message (msg, postal_address, "Home");
-       postal_address = g_hash_table_lookup (item->priv->addresses, "Office");
-       if (postal_address)
-               append_postal_address_to_soap_message (msg, postal_address, "Office");
-       soup_soap_message_end_element (msg);
-       append_office_info_to_soap_message (simple_fields, msg);
-       append_personal_info_to_soap_message (simple_fields, msg);
-
-}
-
-static void
-append_group_fields_to_soap_message (EGwItem *item, SoupSoapMessage *msg)
-{
-       GHashTable *simple_fields;
-       GList *members;
-
-       simple_fields = item->priv->simple_fields;
-       append_common_addressbook_item_fields_to_soap_message (simple_fields, item->priv->category_list, msg);
-       if (item->priv->container)
-               e_gw_message_write_string_parameter (msg, "container", NULL, item->priv->container);
-       soup_soap_message_start_element (msg, "members", NULL, NULL);
-       members = g_list_copy (item->priv->member_list);
-       for (; members != NULL; members = g_list_next (members)) {
-               EGroupMember *member = (EGroupMember *) members->data;
-               soup_soap_message_start_element (msg, "member", NULL, NULL);
-               e_gw_message_write_string_parameter (msg, "id", NULL, member->id);
-               e_gw_message_write_string_parameter (msg, "distType", NULL, "TO");
-               e_gw_message_write_string_parameter (msg, "itemType", NULL, "Contact");
-               soup_soap_message_end_element (msg);
-
-       }
-       soup_soap_message_end_element (msg);
-
-}
-
-EGwItem *
-e_gw_item_new_from_soap_parameter (const gchar *email, const gchar *container, SoupSoapParameter *param)
-{
-       EGwItem *item;
-       gchar *item_type, *internet_prop;
-       SoupSoapParameter *subparameter, *child, *category_param, *attachment_param;
-       gboolean is_group_item = TRUE;
-       GList *user_email = NULL;
-
-       g_return_val_if_fail (param != NULL, NULL);
-
-       if (strcmp (soup_soap_parameter_get_name (param), "item") != 0) {
-               g_warning (G_STRLOC ": Invalid SOAP parameter %s", soup_soap_parameter_get_name (param));
-               return NULL;
-       }
-
-       item = g_object_new (E_TYPE_GW_ITEM, NULL);
-       item_type = soup_soap_parameter_get_property (param, "type");
-
-       internet_prop = soup_soap_parameter_get_property (param, "internet");
-
-       if (internet_prop && !g_ascii_strcasecmp (internet_prop, "1"))
-               item->priv->internet = TRUE;
-       g_free (internet_prop);
-
-       if (!g_ascii_strcasecmp (item_type, "Mail"))
-               item->priv->item_type = E_GW_ITEM_TYPE_MAIL;
-       else if (!g_ascii_strcasecmp (item_type, "Appointment"))
-               item->priv->item_type = E_GW_ITEM_TYPE_APPOINTMENT;
-       else if (!g_ascii_strcasecmp (item_type, "Task"))
-               item->priv->item_type = E_GW_ITEM_TYPE_TASK;
-       else if (!g_ascii_strcasecmp (item_type, "Note"))
-               item->priv->item_type = E_GW_ITEM_TYPE_NOTE;
-       else if (!g_ascii_strcasecmp (item_type, "Contact") ) {
-               item->priv->item_type = E_GW_ITEM_TYPE_CONTACT;
-               set_contact_fields_from_soap_parameter (item, param);
-               g_free (item_type);
-               return item;
-       }
-       else if (!g_ascii_strcasecmp (item_type,"SharedNotification"))
-               item->priv->item_type = E_GW_ITEM_TYPE_NOTIFICATION;
-
-       else if (!g_ascii_strcasecmp (item_type, "Organization")) {
-
-               item->priv->item_type =  E_GW_ITEM_TYPE_ORGANISATION;
-               set_organization_fields_from_soap_parameter (item, param);
-               g_free (item_type);
-               return item;
-       }
-
-       else if (!g_ascii_strcasecmp (item_type, "Resource")) {
-
-               item->priv->item_type = E_GW_ITEM_TYPE_CONTACT;
-               set_resource_fields_from_soap_parameter (item, param);
-               g_free (item_type);
-               return item;
-       }
-
-       else if (!g_ascii_strcasecmp (item_type, "Group")) {
-               item->priv->item_type = E_GW_ITEM_TYPE_GROUP;
-               set_group_fields_from_soap_parameter (item, param);
-               g_free (item_type);
-               return item;
-       }
-
-       else {
-               g_free (item_type);
-               g_object_unref (item);
-               return NULL;
-       }
-
-       g_free (item_type);
-
-       item->priv->container = g_strdup (container);
-       /* set the email of the user */
-       user_email = g_list_append (user_email, g_strdup (email));
-       e_gw_item_set_email_list (item, user_email);
-
-       /* If the parameter consists of changes - populate deltas */
-       subparameter = soup_soap_parameter_get_first_child_by_name (param, "changes");
-       if (subparameter) {
-               SoupSoapParameter *changes = subparameter;
-               subparameter = soup_soap_parameter_get_first_child_by_name (changes, "add");
-               if (!subparameter)
-                       subparameter = soup_soap_parameter_get_first_child_by_name (changes, "delete");
-               if (!subparameter)
-                       subparameter = soup_soap_parameter_get_first_child_by_name (changes, "update");
-       }
-       else subparameter = param; /* The item is a complete one, not a delta  */
-
-       /* now add all properties to the private structure */
-       for (child = soup_soap_parameter_get_first_child (subparameter);
-                       child != NULL;
-                       child = soup_soap_parameter_get_next_child (child)) {
-               const gchar *name;
-               gchar *value = NULL;
-
-               name = soup_soap_parameter_get_name (child);
-
-               if (!g_ascii_strcasecmp (name, "security")) {
-                       item->priv->security = soup_soap_parameter_get_string_value (child);
-                       item->priv->classification = soup_soap_parameter_get_string_value (child);
-                       continue;
-               }
-               if (!g_ascii_strcasecmp (name, "acceptLevel"))
-                       item->priv->accept_level = soup_soap_parameter_get_string_value (child);
-
-               else if (!g_ascii_strcasecmp (name, "class")) {
-                       item->priv->classification = soup_soap_parameter_get_string_value (child);
-
-               } else if (!g_ascii_strcasecmp (name, "completed")) {
-                       value = soup_soap_parameter_get_string_value (child);
-                       if (!g_ascii_strcasecmp (value, "1"))
-                               item->priv->completed = TRUE;
-                       else
-                               item->priv->completed = FALSE;
-                       g_free (value);
-
-               } else if (!g_ascii_strcasecmp (name, "allDayEvent")) {
-                       value = soup_soap_parameter_get_string_value (child);
-                       if (!g_ascii_strcasecmp (value, "1"))
-                               item->priv->is_allday_event = TRUE;
-                       else
-                               item->priv->is_allday_event = FALSE;
-                       g_free (value);
-
-               } else if (!g_ascii_strcasecmp (name, "status")) {
-                       SoupSoapParameter *status_param;
-                       const gchar *status_name;
-                       item->priv->self_status = 0;
-                       for (status_param = soup_soap_parameter_get_first_child (child); status_param != NULL;
-                                       status_param = soup_soap_parameter_get_next_child (status_param)) {
-                               status_name = soup_soap_parameter_get_name (status_param);
-
-                               if (!strcmp (status_name, "accepted"))
-                                       item->priv->self_status |= E_GW_ITEM_STAT_ACCEPTED;
-                               else if (!strcmp (status_name, "declined"))
-                                       item->priv->self_status |= E_GW_ITEM_STAT_DECLINED;
-                               else if (!strcmp (status_name, "deleted"))
-                                       item->priv->self_status |= E_GW_ITEM_STAT_DELETED;
-                               else if (!strcmp (status_name, "read"))
-                                       item->priv->self_status |= E_GW_ITEM_STAT_READ;
-                               else if (!strcmp (status_name, "opened"))
-                                       item->priv->self_status |= E_GW_ITEM_STAT_OPENED;
-                               else if (!strcmp (status_name, "completed"))
-                                       item->priv->self_status |= E_GW_ITEM_STAT_COMPLETED;
-                               else if (!strcmp (status_name, "forwarded"))
-                                       item->priv->self_status |= E_GW_ITEM_STAT_FORWARDED;
-                               else if (!strcmp (status_name, "replied"))
-                                       item->priv->self_status |= E_GW_ITEM_STAT_REPLIED;
-                               else if (!strcmp (status_name, "delegated"))
-                                       item->priv->self_status |= E_GW_ITEM_STAT_DELEGATED;
-                       }
-
-               } else if (!g_ascii_strcasecmp (name, "created")) {
-                       gchar *formatted_date;
-                       value = soup_soap_parameter_get_string_value (child);
-                       formatted_date = e_gw_connection_format_date_string (value);
-                       e_gw_item_set_creation_date (item, formatted_date);
-                       g_free (value);
-                       g_free (formatted_date);
-
-               } else if (!g_ascii_strcasecmp (name, "delivered")) {
-                       gchar *formatted_date;
-                       value = soup_soap_parameter_get_string_value (child);
-                       formatted_date = e_gw_connection_format_date_string (value);
-                       e_gw_item_set_delivered_date (item, formatted_date);
-                       g_free (value);
-                       g_free (formatted_date);
-
-               } else if (!g_ascii_strcasecmp (name, "modified")) {
-                       gchar *formatted_date;
-                       value = soup_soap_parameter_get_string_value (child);
-                       formatted_date = e_gw_connection_format_date_string (value);
-                       e_gw_item_set_modified_date (item, formatted_date);
-                       g_free (value);
-                       g_free (formatted_date);
-               } else if (!g_ascii_strcasecmp (name, "distribution")) {
-                       SoupSoapParameter *tp;
-
-                       tp = soup_soap_parameter_get_first_child_by_name (child, "recipients");
-                       if (tp) {
-                               g_slist_foreach (item->priv->recipient_list, (GFunc) free_recipient, NULL);
-                               item->priv->recipient_list = NULL;
-                               set_recipient_list_from_soap_parameter (item, tp);
-                       }
-
-                       tp = soup_soap_parameter_get_first_child_by_name (child, "sendoptions");
-                       if (tp)
-                               set_sendoptions_from_soap_parameter (item, tp);
-
-                       tp = soup_soap_parameter_get_first_child_by_name (child, "from");
-                       if (tp && is_group_item) {
-                               SoupSoapParameter *subparam;
-                               EGwItemOrganizer *organizer = g_new0 (EGwItemOrganizer, 1);
-
-                               subparam = soup_soap_parameter_get_first_child_by_name (tp, "displayName");
-                               if (subparam)
-                                       organizer->display_name = soup_soap_parameter_get_string_value (subparam);
-                               subparam = soup_soap_parameter_get_first_child_by_name (tp, "email");
-                               if (subparam)
-                                       organizer->email = soup_soap_parameter_get_string_value (subparam);
-                               e_gw_item_set_organizer (item, organizer);
-                       }
-               } else if (!g_ascii_strcasecmp (name, "size")) {
-                       item->priv->size = soup_soap_parameter_get_int_value (child);
-
-               } else if (!g_ascii_strcasecmp (name, "hasAttachment")) {
-                       item->priv->has_attachment = soup_soap_parameter_get_int_value (child);
-
-               } else if (!g_ascii_strcasecmp (name, "options")) {
-                       SoupSoapParameter *subparam;
-
-                       subparam = soup_soap_parameter_get_first_child_by_name (child, "priority");
-                       if (subparam) {
-                               item->priv->priority = soup_soap_parameter_get_string_value (subparam);
-                       }
-
-                       subparam = soup_soap_parameter_get_first_child_by_name (child, "expires");
-                       if (subparam)
-                               value = soup_soap_parameter_get_string_value (subparam);
-                       if (value)
-                               item->priv->expires = g_strdup (value);
-                       g_free (value), value = NULL;
-
-                       subparam = soup_soap_parameter_get_first_child_by_name (child, "delayDeliveryUntil");
-                       if (subparam)
-                               value = soup_soap_parameter_get_string_value (subparam);
-                       if (value)
-                               item->priv->delay_until = g_strdup (value);
-                       g_free (value), value = NULL;
-
-               } else if (!g_ascii_strcasecmp (name, "dueDate")) {
-                       gchar *formatted_date;
-                       value = soup_soap_parameter_get_string_value (child);
-                       formatted_date = e_gw_connection_format_date_string (value);
-                       e_gw_item_set_due_date (item, formatted_date);
-                       g_free (value);
-                       g_free (formatted_date);
-
-               } else if (!g_ascii_strcasecmp (name, "endDate") || !g_ascii_strcasecmp (name, "endDay")) {
-                       gchar *formatted_date;
-                       value = soup_soap_parameter_get_string_value (child);
-                       formatted_date = e_gw_connection_format_date_string (value);
-                       e_gw_item_set_end_date (item, formatted_date);
-                       g_free (value);
-                       g_free (formatted_date);
-
-               } else if (!g_ascii_strcasecmp (name, "to")) {
-                       gchar *to;
-                       to = soup_soap_parameter_get_string_value (child);
-                       e_gw_item_set_to (item, to);
-                       g_free (to);
-               } else if (!g_ascii_strcasecmp (name, "iCalId"))
-                       item->priv->icalid = soup_soap_parameter_get_string_value (child);
-
-               else if (!g_ascii_strcasecmp (name, "categories")) {
-                       for (category_param = soup_soap_parameter_get_first_child_by_name (child, "category");
-                                       category_param != NULL;
-                                       category_param = soup_soap_parameter_get_next_child_by_name (category_param, "category")) {
-
-                               value = soup_soap_parameter_get_string_value (category_param);
-                               if (value) {
-                                       gchar **components = g_strsplit (value, "@", -1);
-                                       g_free (value);
-                                       value = components[0];
-                                       item->priv->category_list = g_list_append (item->priv->category_list, g_strdup (value));
-                                       g_strfreev (components);
-                               }
-                       }
-
-               } else if (!g_ascii_strcasecmp (name, "id"))
-                       item->priv->id = soup_soap_parameter_get_string_value (child);
-               else if (!g_ascii_strcasecmp (name, "recurrenceKey"))
-                       item->priv->recurrence_key = soup_soap_parameter_get_int_value (child);
-               else if (!g_ascii_strcasecmp (name, "message")) {
-                       SoupSoapParameter *part;
-                       gsize len;
-                       gchar *msg;
-                       gchar *length;
-
-                       part = soup_soap_parameter_get_first_child_by_name (child, "part");
-                       msg = soup_soap_parameter_get_string_value (part);
-                       length = soup_soap_parameter_get_property (part, "length");
-
-                       if (msg && length && atoi (length) > 0) {
-                               len = atoi (length);
-                               item->priv->message = (gchar *) g_base64_decode (msg, &len);
-                               if (!(item->priv->message)) {
-                                       item->priv->msg_body_id = soup_soap_parameter_get_property (part, "id");
-                               }
-                               item->priv->content_type = soup_soap_parameter_get_property (part, "contentType");
-                       }
-
-                       g_free (length);
-                       g_free (msg);
-
-               } else if (!g_ascii_strcasecmp (name, "attachments")) {
-                       for (attachment_param = soup_soap_parameter_get_first_child_by_name(child,"attachment");
-                                       attachment_param != NULL;
-                                       attachment_param = soup_soap_parameter_get_next_child_by_name (attachment_param, "attachment")) {
-
-                               SoupSoapParameter *temp;
-                               EGwItemAttachment *attach = g_new0 (EGwItemAttachment, 1);
-
-                               temp = soup_soap_parameter_get_first_child_by_name (attachment_param, "id");
-                               if (temp) {
-                                       attach->id = soup_soap_parameter_get_string_value (temp);
-                                       attach->item_reference =  soup_soap_parameter_get_property (temp, "itemReference");
-                               }
-
-                               temp = soup_soap_parameter_get_first_child_by_name (attachment_param, "contentId");
-                               if (temp)
-                                       attach->contentid = soup_soap_parameter_get_string_value (temp);
-
-                               temp = soup_soap_parameter_get_first_child_by_name (attachment_param, "name");
-                               if (temp)
-                                       attach->name = soup_soap_parameter_get_string_value (temp);
-
-                               temp = soup_soap_parameter_get_first_child_by_name (attachment_param, "contentType");
-                               if (temp)
-                                       attach->contentType = soup_soap_parameter_get_string_value (temp);
-
-                               temp = soup_soap_parameter_get_first_child_by_name (attachment_param, "size");
-                               if (temp) {
-                                       value = soup_soap_parameter_get_string_value (temp);
-                                       attach->size = atoi (value);
-                                       g_free (value);
-                               }
-
-                               temp = soup_soap_parameter_get_first_child_by_name (attachment_param, "date");
-                               if (temp)
-                                       attach->date = soup_soap_parameter_get_string_value (temp);
-
-                               temp = soup_soap_parameter_get_first_child_by_name (attachment_param, "hidden");
-                               if (temp)
-                                       if (soup_soap_parameter_get_int_value (temp) == 1)
-                                               attach->hidden = TRUE;
-
-                               item->priv->attach_list = g_slist_append (item->priv->attach_list, attach);
-                       }
-
-               } else if (!g_ascii_strcasecmp (name, "place"))
-                       item->priv->place = soup_soap_parameter_get_string_value (child);
-
-               else if (!g_ascii_strcasecmp (name, "taskPriority")) {
-                       gchar *priority;
-
-                       priority = soup_soap_parameter_get_string_value (child);
-                       e_gw_item_set_task_priority (item, priority);
-                       g_free (priority);
-               }
-
-               else if (!g_ascii_strcasecmp (name, "startDate") || !g_ascii_strcasecmp (name, "startDay")) {
-                       gchar *formatted_date;
-                       value = soup_soap_parameter_get_string_value (child);
-                       formatted_date = e_gw_connection_format_date_string (value);
-                       e_gw_item_set_start_date (item, formatted_date);
-                       g_free (value);
-                       g_free (formatted_date);
-
-               } else if (!g_ascii_strcasecmp (name, "subject"))
-                       item->priv->subject = soup_soap_parameter_get_string_value (child);
-               else if (!g_ascii_strcasecmp (name, "source")) {
-                       value = soup_soap_parameter_get_string_value (child);
-                       if (!strcmp (value, "personal")) {
-                               if (item->priv->item_type == E_GW_ITEM_TYPE_TASK ||
-                                               item->priv->item_type == E_GW_ITEM_TYPE_APPOINTMENT)
-                                       is_group_item = FALSE;
-                       }
-                       g_free (value);
-               } else if (!g_ascii_strcasecmp (name, "link")) {
-                       SoupSoapParameter *subparam;
-                       EGwItemLinkInfo *info = g_new0 (EGwItemLinkInfo, 1);
-
-                       subparam = soup_soap_parameter_get_first_child_by_name (child, "id");
-                       if (subparam)
-                               info->id = soup_soap_parameter_get_string_value (subparam);
-
-                       subparam = soup_soap_parameter_get_first_child_by_name (child, "type");
-                       if (subparam)
-                               info->type =soup_soap_parameter_get_string_value (subparam);
-
-                       subparam = soup_soap_parameter_get_first_child_by_name (child, "thread");
-                       if (subparam)
-                               info->thread =soup_soap_parameter_get_string_value (subparam);
-
-                       e_gw_item_set_link_info (item, info);
-
-               } else if (!g_ascii_strcasecmp (name, "alarm")) {
-                       gchar *enabled;
-                       enabled = soup_soap_parameter_get_property (child, "enabled");
-                       if (enabled && !g_ascii_strcasecmp (enabled, "1") ) {
-                               value = soup_soap_parameter_get_string_value (child);
-                               /* convert it into integer */
-                               item->priv->trigger = atoi (value);
-                               g_free (value);
-                       }
-                       g_free (enabled);
-               } else if (!g_ascii_strcasecmp (name, "threading")) {
-                       SoupSoapParameter *subparam;
-
-                       subparam = soup_soap_parameter_get_first_child_by_name (child, "parent");
-                       if (subparam)
-                               item->priv->parent_threads = soup_soap_parameter_get_string_value (subparam);
-
-               } else if (!g_ascii_strcasecmp (name, "messageId")) {
-                       item->priv->message_id = soup_soap_parameter_get_string_value (child);
-               }
-
-       }
-
-return item;
-}
-
-EGwItemType
-e_gw_item_get_item_type (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), E_GW_ITEM_TYPE_UNKNOWN);
-
-       return item->priv->item_type;
-}
-
-void
-e_gw_item_set_item_type (EGwItem *item, EGwItemType new_type)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       item->priv->item_type = new_type;
-}
-
-const gchar *
-e_gw_item_get_container_id (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-
-       return (const gchar *) item->priv->container;
-}
-
-void
-e_gw_item_set_container_id (EGwItem *item, const gchar *new_id)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       if (item->priv->container)
-               g_free (item->priv->container);
-       item->priv->container = g_strdup (new_id);
-}
-
-const gchar *
-e_gw_item_get_icalid (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-
-       return (const gchar *) item->priv->icalid;
-}
-
-void
-e_gw_item_set_icalid (EGwItem *item, const gchar *new_icalid)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       if (item->priv->icalid)
-               g_free (item->priv->icalid);
-       item->priv->icalid = g_strdup (new_icalid);
-}
-
-const gchar *
-e_gw_item_get_id (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-
-       return (const gchar *) item->priv->id;
-}
-
-void
-e_gw_item_set_id (EGwItem *item, const gchar *new_id)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       if (item->priv->id)
-               g_free (item->priv->id);
-       item->priv->id = g_strdup (new_id);
-}
-
-gint
-e_gw_item_get_mail_size (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), 0);
-
-       return item->priv->size;
-}
-
-gboolean
-e_gw_item_has_attachment (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), 0);
-
-       return item->priv->has_attachment;
-}
-
-gboolean
-e_gw_item_is_from_internet (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), 0);
-
-       return item->priv->internet;
-}
-
-gchar *
-e_gw_item_get_creation_date (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-
-       return item->priv->creation_date;
-}
-
-void
-e_gw_item_set_creation_date (EGwItem *item, const gchar *new_date)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       if (item->priv->creation_date)
-               g_free (item->priv->creation_date);
-       item->priv->creation_date = g_strdup (new_date);
-}
-
-gchar *
-e_gw_item_get_delivered_date (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-
-       return item->priv->delivered_date;
-}
-
-void
-e_gw_item_set_delivered_date (EGwItem *item, const gchar *new_date)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       if (item->priv->delivered_date)
-               g_free (item->priv->delivered_date);
-       item->priv->delivered_date = g_strdup (new_date);
-}
-
-const gchar *
-e_gw_item_get_modified_date (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-
-       return item->priv->modified_date;
-}
-
-void
-e_gw_item_set_modified_date (EGwItem *item, const gchar *new_date)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       if (item->priv->modified_date)
-               g_free (item->priv->modified_date);
-       item->priv->modified_date = g_strdup (new_date);
-}
-
-gchar *
-e_gw_item_get_start_date (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-
-       return item->priv->start_date;
-}
-
-void
-e_gw_item_set_start_date (EGwItem *item, const gchar *new_date)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       if (item->priv->start_date)
-               g_free (item->priv->start_date);
-       item->priv->start_date = g_strdup (new_date);
-}
-
-gchar *
-e_gw_item_get_end_date (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-
-       return item->priv->end_date;
-}
-
-void
-e_gw_item_set_end_date (EGwItem *item, const gchar *new_date)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       if (item->priv->end_date)
-               g_free (item->priv->end_date);
-       item->priv->end_date = g_strdup (new_date);
-}
-
-gchar *
-e_gw_item_get_due_date (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-
-       return item->priv->due_date;
-}
-
-void
-e_gw_item_set_due_date (EGwItem *item, const gchar *new_date)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       if (item->priv->due_date)
-               g_free (item->priv->due_date);
-       item->priv->due_date = g_strdup (new_date);
-}
-
-gchar *
-e_gw_item_get_completed_date (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-
-       return item->priv->completed_date;
-}
-
-void
-e_gw_item_set_completed_date (EGwItem *item, const gchar *new_date)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       if (item->priv->completed_date)
-               g_free (item->priv->completed_date);
-       item->priv->completed_date = g_strdup (new_date);
-}
-
-const gchar *
-e_gw_item_get_subject (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-
-       return (const gchar *) item->priv->subject;
-}
-
-void
-e_gw_item_set_subject (EGwItem *item, const gchar *new_subject)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       if (item->priv->subject)
-               g_free (item->priv->subject);
-       item->priv->subject = g_strdup (new_subject);
-}
-
-const gchar *
-e_gw_item_get_message (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-
-       return (const gchar *) item->priv->message;
-}
-
-void
-e_gw_item_set_message (EGwItem *item, const gchar *new_message)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       if (item->priv->message)
-               g_free (item->priv->message);
-       item->priv->message = g_strdup (new_message);
-}
-
-const gchar *
-e_gw_item_get_place (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-
-       return item->priv->place;
-}
-
-void
-e_gw_item_set_place (EGwItem *item, const gchar *new_place)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       if (item->priv->place)
-               g_free (item->priv->place);
-       item->priv->place = g_strdup (new_place);
-}
-
-const gchar *
-e_gw_item_get_classification (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-
-       return (const gchar *) item->priv->classification;
-}
-
-void
-e_gw_item_set_classification (EGwItem *item, const gchar *new_class)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       if (item->priv->classification)
-               g_free (item->priv->classification);
-       item->priv->classification = g_strdup (new_class);
-}
-
-const gchar *
-e_gw_item_get_security (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-
-       return (const gchar *) item->priv->security;
-}
-
-void
-e_gw_item_set_security (EGwItem *item, const gchar *new_class)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       if (item->priv->security)
-               g_free (item->priv->security);
-       item->priv->security = g_strdup (new_class);
-}
-
-gboolean
-e_gw_item_get_completed (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), FALSE);
-
-       return item->priv->completed;
-}
-
-void
-e_gw_item_set_completed (EGwItem *item, gboolean new_completed)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       item->priv->completed = new_completed;
-}
-
-gboolean
-e_gw_item_get_is_allday_event (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), FALSE);
-
-       return item->priv->is_allday_event;
-}
-
-void
-e_gw_item_set_is_allday_event (EGwItem *item, gboolean allday_event)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       item->priv->is_allday_event = allday_event;
-}
-
-const gchar *
-e_gw_item_get_accept_level (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-
-       return (const gchar *) item->priv->accept_level;
-}
-
-void
-e_gw_item_set_accept_level (EGwItem *item, const gchar *new_level)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       if (item->priv->accept_level)
-               g_free (item->priv->accept_level);
-       item->priv->accept_level = g_strdup (new_level);
-}
-
-const gchar *
-e_gw_item_get_priority (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-       return (const gchar *) item->priv->priority;
-}
-
-void
-e_gw_item_set_priority (EGwItem *item, const gchar *new_priority)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       if (item->priv->priority)
-               g_free (item->priv->priority);
-       item->priv->priority = g_strdup (new_priority);
-}
-
-const gchar *
-e_gw_item_get_task_priority (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-
-       return (const gchar *) item->priv->task_priority;
-}
-
-void
-e_gw_item_set_task_priority (EGwItem *item, const gchar *new_priority)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       if (item->priv->task_priority)
-               g_free (item->priv->task_priority);
-       item->priv->task_priority = g_strdup (new_priority);
-}
-GSList *
-e_gw_item_get_recipient_list (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-       return item->priv->recipient_list;
-}
-
-void
-e_gw_item_set_recipient_list (EGwItem  *item, GSList *new_recipient_list)
-{
-       /* free old list and set a new one*/
-       g_slist_foreach (item->priv->recipient_list, (GFunc) free_recipient, NULL);
-       g_slist_free (item->priv->recipient_list);
-       item->priv->recipient_list = new_recipient_list;
-}
-
-EGwItemOrganizer *
-e_gw_item_get_organizer (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-       return item->priv->organizer;
-}
-
-void
-e_gw_item_set_attach_id_list (EGwItem *item, GSList *attach_list)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-       if (attach_list) {
-               g_slist_foreach (item->priv->attach_list, (GFunc)free_attach, NULL);
-               g_slist_free (item->priv->attach_list);
-       }
-       item->priv->attach_list = attach_list;
-}
-
-GSList *
-e_gw_item_get_attach_id_list (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-       return item->priv->attach_list;
-}
-
-void
-e_gw_item_set_organizer (EGwItem  *item, EGwItemOrganizer *organizer)
-{
-       /* free organizer */
-       if (item->priv->organizer) {
-               g_free (item->priv->organizer->display_name);
-               g_free (item->priv->organizer->email);
-               g_free (item->priv->organizer);
-       }
-       item->priv->organizer = organizer;
-}
-
-GSList *
-e_gw_item_get_recurrence_dates (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-       return item->priv->recurrence_dates;
-}
-
-void
-e_gw_item_set_recurrence_dates (EGwItem  *item, GSList *new_recurrence_dates)
-{
-       /* free old list and set a new one*/
-       g_slist_foreach (item->priv->recurrence_dates, free_string, NULL);
-       /*free the list */
-       g_slist_free (item->priv->recurrence_dates);
-       item->priv->recurrence_dates = new_recurrence_dates;
-}
-
-GSList *
-e_gw_item_get_exdate_list (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-       return item->priv->exdate_list;
-}
-
-void
-e_gw_item_set_exdate_list (EGwItem  *item, GSList *new_exdate_list)
-{
-       /* free old list and set a new one*/
-       g_slist_foreach (item->priv->exdate_list, free_string, NULL);
-       /*free the list */
-       g_slist_free (item->priv->exdate_list);
-       item->priv->exdate_list = new_exdate_list;
-}
-
-EGwItemRecurrenceRule *
-e_gw_item_get_rrule (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-       return item->priv->rrule;
-}
-
-void
-e_gw_item_set_rrule (EGwItem  *item, EGwItemRecurrenceRule *new_rrule)
-{
-       if (item->priv->rrule) {
-       /* TODO free old list and set a new one*/
-       }
-       item->priv->rrule = new_rrule;
-}
-
-gint
-e_gw_item_get_recurrence_key (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), 0);
-       return item->priv->recurrence_key;
-}
-
-void
-e_gw_item_set_recurrence_key (EGwItem *item, gint recur_key)
-{
-       item->priv->recurrence_key = recur_key;
-}
-
-gint
-e_gw_item_get_trigger (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), 0);
-
-       return item->priv->trigger;
-}
-
-void
-e_gw_item_set_trigger (EGwItem *item, gint trigger)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       item->priv->trigger = trigger;
-}
-
-void
-e_gw_item_set_to (EGwItem *item, const gchar *to)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-       item->priv->to = g_strdup (to);
-}
-
-const gchar *
-e_gw_item_get_to (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-       return item->priv->to;
-}
-
-const gchar *
-e_gw_item_get_msg_content_type (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-       return item->priv->content_type;
-}
-
-const gchar *
-e_gw_item_get_msg_body_id (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-
-       return item->priv->msg_body_id;
-}
-
-void
-e_gw_item_set_sendoptions (EGwItem *item, gboolean set)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       item->priv->set_sendoptions = set;
-}
-
-void
-e_gw_item_set_reply_request (EGwItem *item, gboolean set)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       item->priv->reply_request_set = set;
-}
-
-gboolean
-e_gw_item_get_reply_request (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), FALSE);
-
-       return item->priv->reply_request_set;
-}
-
-void
-e_gw_item_set_reply_within (EGwItem *item, gchar *reply_within)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       item->priv->reply_within = g_strdup (reply_within);
-}
-
-gchar *
-e_gw_item_get_reply_within (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-
-       return item->priv->reply_within;
-}
-
-void
-e_gw_item_set_track_info (EGwItem *item, EGwItemTrack track_info)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       item->priv->track_info = track_info;
-}
-
-EGwItemTrack
-e_gw_item_get_track_info (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), E_GW_ITEM_NONE);
-
-       return item->priv->track_info;
-}
-
-void
-e_gw_item_set_autodelete (EGwItem *item, gboolean set)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       item->priv->autodelete = set;
-}
-
-gboolean
-e_gw_item_get_autodelete (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), FALSE);
-
-       return item->priv->autodelete;
-}
-
-void
-e_gw_item_set_notify_completed (EGwItem *item, EGwItemReturnNotify notify)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       item->priv->notify_completed = notify;
-}
-
-EGwItemReturnNotify
-e_gw_item_get_notify_completed (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), FALSE);
-
-       return item->priv->notify_completed;
-}
-
-void
-e_gw_item_set_notify_accepted (EGwItem *item, EGwItemReturnNotify notify)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       item->priv->notify_accepted = notify;
-}
-
-EGwItemReturnNotify
-e_gw_item_get_notify_accepted (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), FALSE);
-
-       return item->priv->notify_accepted;
-}
-
-void
-e_gw_item_set_notify_declined (EGwItem *item, EGwItemReturnNotify notify)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       item->priv->notify_declined = notify;
-}
-
-EGwItemReturnNotify
-e_gw_item_get_notify_declined (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), FALSE);
-
-       return item->priv->notify_declined;
-}
-
-void
-e_gw_item_set_notify_opened (EGwItem *item, EGwItemReturnNotify notify)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       item->priv->notify_opened = notify;
-}
-
-EGwItemReturnNotify
-e_gw_item_get_notify_opened (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), FALSE);
-
-       return item->priv->notify_opened;
-}
-
-void
-e_gw_item_set_notify_deleted (EGwItem *item, EGwItemReturnNotify notify)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       item->priv->notify_deleted = notify;
-}
-
-EGwItemReturnNotify
-e_gw_item_get_notify_deleted (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), FALSE);
-
-       return item->priv->notify_deleted;
-}
-
-void
-e_gw_item_set_expires (EGwItem *item, gchar *expires)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       item->priv->expires = g_strdup (expires);
-}
-
-gchar *
-e_gw_item_get_expires (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-
-       return item->priv->expires;
-}
-
-void
-e_gw_item_set_delay_until (EGwItem *item, gchar *delay_until)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       item->priv->delay_until = g_strdup (delay_until);
-}
-
-gchar *
-e_gw_item_get_delay_until (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-
-       return item->priv->delay_until;
-}
-
-void
-e_gw_item_set_source (EGwItem *item, const gchar *source)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-       item->priv->source = g_strdup (source);
-}
-
-void
-e_gw_item_set_content_type (EGwItem *item, const gchar *content_type)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-
-       if (item->priv->content_type)
-               g_free (item->priv->content_type);
-       item->priv->content_type= g_strdup (content_type);
-}
-
-gchar *
-e_gw_item_get_content_type (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-
-       return item->priv->content_type;
-}
-
-void
-e_gw_item_set_link_info (EGwItem *item, EGwItemLinkInfo *info)
-{
-       g_return_if_fail (E_IS_GW_ITEM (item));
-       item->priv->link_info = info;
-}
-
-EGwItemLinkInfo *
-e_gw_item_get_link_info (EGwItem *item)
-{
-       g_return_val_if_fail (E_IS_GW_ITEM (item), NULL);
-       return item->priv->link_info;
-}
-
-static void
-add_return_notification (SoupSoapMessage *msg, const gchar *option, EGwItemReturnNotify value)
-{
-       soup_soap_message_start_element (msg, option, NULL, NULL);
-
-       switch (value) {
-               case E_GW_ITEM_NOTIFY_MAIL:
-                       e_gw_message_write_string_parameter (msg, "mail", NULL, "1");
-                       break;
-               case E_GW_ITEM_NOTIFY_NONE:
-                       e_gw_message_write_string_parameter (msg, "mail", NULL, "0");
-       }
-
-       soup_soap_message_end_element (msg);
-}
-
-static void
-append_gw_item_options (SoupSoapMessage *msg, EGwItem *item)
-{
-       EGwItemPrivate *priv;
-
-       priv = item->priv;
-
-       soup_soap_message_start_element (msg, "options", NULL, NULL);
-
-       /* Priority */
-       e_gw_message_write_string_parameter (msg, "priority", NULL, priv->priority ? priv->priority : "0");
-
-       /* Expiration date */
-       e_gw_message_write_string_parameter (msg, "expires", NULL, priv->expires ? priv->expires : "0");
-
-       /* Delay delivery */
-       e_gw_message_write_string_parameter (msg, "delayDeliveryUntil", NULL, priv->delay_until ? priv->delay_until : "0");
-
-       soup_soap_message_end_element (msg);
-}
-
-void
-e_gw_item_add_distribution_to_soap_message (EGwItem *item, SoupSoapMessage *msg)
-{
-       GSList *rl;
-       EGwItemPrivate *priv;
-       EGwItemOrganizer *organizer;
-       GSList *recipient_list;
-
-       priv = item->priv;
-       organizer = priv->organizer;
-       recipient_list = priv->recipient_list;
-
-       /* start distribution element */
-       soup_soap_message_start_element (msg, "distribution", NULL, NULL);
-       if (organizer) {
-               soup_soap_message_start_element (msg, "from", NULL, NULL);
-               e_gw_message_write_string_parameter (msg, "displayName", NULL,
-                               organizer->display_name ? organizer->display_name : "");
-               e_gw_message_write_string_parameter (msg, "email", NULL,
-                               organizer->email ? organizer->email : "");
-
-               soup_soap_message_end_element (msg);
-       }
-       /* start recipients */
-       soup_soap_message_start_element (msg, "recipients", NULL, NULL);
-       /* add each recipient */
-       for (rl = recipient_list; rl != NULL; rl = rl->next) {
-               const gchar *dist_type;
-               const gchar *status = NULL;
-
-               EGwItemRecipient *recipient = (EGwItemRecipient *) rl->data;
-
-               soup_soap_message_start_element (msg, "recipient", NULL, NULL);
-               e_gw_message_write_string_parameter (msg, "displayName", NULL, recipient->display_name ? recipient->display_name : "");
-               e_gw_message_write_string_parameter (msg, "email", NULL, recipient->email ? recipient->email : "");
-               if (recipient->type == E_GW_ITEM_RECIPIENT_TO)
-                       dist_type = "TO";
-               else if (recipient->type == E_GW_ITEM_RECIPIENT_CC)
-                       dist_type = "CC";
-               else if (recipient->type == E_GW_ITEM_RECIPIENT_BC)
-                       dist_type = "BC";
-               else
-                       dist_type ="";
-               e_gw_message_write_string_parameter (msg, "distType", NULL, dist_type);
-               /* add recip_status */
-               if (recipient->status == E_GW_ITEM_STAT_ACCEPTED)
-                       status = "accepted";
-               else if (recipient->status == E_GW_ITEM_STAT_DECLINED)
-                       status = "declined";
-               else
-                       status = "";
-               if (status && *status)
-                       e_gw_message_write_string_parameter (msg, "recipientStatus", NULL, status);
-
-               soup_soap_message_end_element (msg);
-       }
-
-       soup_soap_message_end_element (msg);
-
-       if (priv->set_sendoptions) {
-               soup_soap_message_start_element (msg, "sendoptions", NULL, NULL);
-
-               soup_soap_message_start_element (msg, "requestReply", NULL, NULL);
-               if (priv->reply_request_set) {
-
-                       if (priv->reply_within)
-                               e_gw_message_write_string_parameter (msg, "byDate", NULL, priv->reply_within);
-                       else
-                               e_gw_message_write_string_parameter (msg, "whenConvenient", NULL, "1");
-
-               } else
-                       soup_soap_message_write_string (msg, "0");
-               soup_soap_message_end_element (msg);
-
-               soup_soap_message_start_element (msg, "statusTracking", NULL, NULL);
-
-               soup_soap_message_add_attribute (msg, "autoDelete", priv->autodelete ? "1" : "0", NULL, NULL);
-
-               switch (priv->track_info) {
-                       case E_GW_ITEM_DELIVERED : soup_soap_message_write_string (msg, "Delivered");
-                                break;
-                       case E_GW_ITEM_DELIVERED_OPENED : soup_soap_message_write_string (msg, "DeliveredAndOpened");
-                                break;
-                       case E_GW_ITEM_ALL : soup_soap_message_write_string (msg, "All");
-                                break;
-                       default: soup_soap_message_write_string (msg, "None");
-               }
-
-               soup_soap_message_end_element (msg);
-
-               soup_soap_message_start_element (msg, "notification", NULL, NULL);
-               switch (priv->item_type) {
-
-               case E_GW_ITEM_TYPE_TASK :
-                       add_return_notification (msg, "completed", priv->notify_completed);
-
-               case E_GW_ITEM_TYPE_APPOINTMENT:
-                       add_return_notification (msg, "accepted", priv->notify_accepted);
-                       add_return_notification (msg, "declined", priv->notify_declined);
-                       add_return_notification (msg, "opened", priv->notify_opened);
-                       break;
-
-               default:
-                       add_return_notification (msg, "opened", priv->notify_opened);
-                       add_return_notification (msg, "deleted", priv->notify_deleted);
-               }
-               soup_soap_message_end_element (msg);
-
-               soup_soap_message_end_element (msg);
-       }
-
-       soup_soap_message_end_element (msg);
-}
-
-static void
-add_attachment_to_soap_message (EGwItemAttachment *attachment, SoupSoapMessage *msg)
-{
-       gchar *size = NULL;
-
-       soup_soap_message_start_element (msg, "attachment", NULL, NULL);
-
-       /*id*/
-       if (attachment->id && attachment->item_reference)
-               e_gw_message_write_string_parameter_with_attribute (msg,"id", NULL, attachment->id, "itemReference", attachment->item_reference);
-       else if (attachment->id)
-               e_gw_message_write_string_parameter (msg, "id", NULL, attachment->id);
-       else
-               e_gw_message_write_string_parameter (msg, "id", NULL, "");
-       /*name*/
-       e_gw_message_write_string_parameter (msg, "name", NULL, attachment->name);
-       /*content id*/
-       e_gw_message_write_string_parameter (msg, "contentId", NULL, attachment->contentid);
-       /*content type*/
-       e_gw_message_write_string_parameter (msg, "contentType", NULL, attachment->contentType);
-       /*size*/
-       if (attachment->size > 0) {
-               size = g_strdup_printf ("%d", attachment->size);
-               e_gw_message_write_string_parameter (msg, "size", NULL, size);
-       }
-       /*date*/
-       if (attachment->date)
-               e_gw_message_write_string_parameter (msg, "date", NULL, attachment->date);
-
-       /*data*/
-       if (attachment->size > 0) {
-               soup_soap_message_start_element (msg, "data", NULL, NULL);
-               soup_soap_message_add_attribute (msg, "contentId", attachment->id, NULL, NULL);
-               soup_soap_message_add_attribute (msg, "contentType", attachment->contentType, NULL, NULL);
-               soup_soap_message_add_attribute (msg, "length", size, NULL, NULL);
-               soup_soap_message_write_string (msg, attachment->data);
-               soup_soap_message_end_element (msg);
-       }
-
-       soup_soap_message_end_element (msg);
-       g_free (size);
-}
-
-static void
-e_gw_item_set_calendar_item_elements (EGwItem *item, SoupSoapMessage *msg)
-{
-       EGwItemPrivate *priv = item->priv;
-       gchar *dtstring;
-
-       if (priv->id)
-               e_gw_message_write_string_parameter (msg, "id", NULL, priv->id);
-       if (priv->container)
-               e_gw_message_write_string_parameter (msg, "container", NULL, priv->container);
-
-       if (priv->icalid)
-               e_gw_message_write_string_parameter (msg, "iCalId", NULL, priv->icalid);
-
-       if (item->priv->source)
-               e_gw_message_write_string_parameter (msg, "source", NULL, item->priv->source );
-
-       if (priv->classification)
-               e_gw_message_write_string_parameter (msg, "class", NULL, priv->classification);
-       else
-               e_gw_message_write_string_parameter (msg, "class", NULL, "");
-
-       e_gw_message_write_string_parameter (msg, "subject", NULL, priv->subject ? priv->subject : "");
-
-       if (priv->recipient_list != NULL) {
-               e_gw_item_add_distribution_to_soap_message (item, msg);
-               if (priv->set_sendoptions)
-                       append_gw_item_options (msg, item);
-       }
-
-       soup_soap_message_start_element (msg, "message", NULL, NULL);
-       if (priv->message) {
-               gchar *str;
-
-               str = g_base64_encode ((guchar *) priv->message, strlen (priv->message));
-               dtstring = g_strdup_printf ("%d", (gint)strlen (str));
-               soup_soap_message_add_attribute (msg, "length", dtstring, NULL, NULL);
-               g_free (dtstring);
-               soup_soap_message_write_string (msg, str);
-               g_free (str);
-       } else {
-               soup_soap_message_add_attribute (msg, "length", "0", NULL, NULL);
-               soup_soap_message_write_string (msg, "");
-       }
-
-       soup_soap_message_end_element (msg);
-
-       if (priv->start_date) {
-               e_gw_message_write_string_parameter (msg, "startDate", NULL,
-                               priv->start_date);
-       }
-
-       if (priv->category_list) {
-                       soup_soap_message_start_element (msg, "categories", NULL, NULL);
-
-                       if (priv->category_list && priv->category_list->data)
-                               soup_soap_message_add_attribute (msg, "types:primary", priv->category_list->data, NULL, NULL);
-
-                       for (; priv->category_list != NULL; priv->category_list = g_list_next (priv->category_list))
-                               if (priv->category_list->data) {
-                                       e_gw_message_write_string_parameter (msg, "category", NULL, priv->category_list->data);
-                               }
-                       soup_soap_message_end_element (msg);
-               }
-
-       /* handle recurrences */
-        if (item->priv->rrule) {
-               EGwItemRecurrenceRule *rrule = item->priv->rrule;
-
-               soup_soap_message_start_element (msg, "rrule", NULL, NULL);
-
-               e_gw_message_write_string_parameter (msg, "frequency", NULL, rrule->frequency);
-               e_gw_message_write_int_parameter (msg, "interval", NULL, rrule->interval);
-
-               if (rrule->until)
-                       e_gw_message_write_string_parameter (msg, "until", NULL, rrule->until);
-               else
-                       e_gw_message_write_int_parameter (msg, "count", NULL, rrule->count);
-
-               /* byDay */
-               if (rrule->by_day[0]) {
-                       gint i, max_elements;
-                       soup_soap_message_start_element (msg, "byDay", NULL, NULL);
-                       max_elements = G_N_ELEMENTS (rrule->by_day);
-                       /* expand into  a sequence of 'day' here  */
-                       for (i = 0; i < max_elements && rrule->by_day[i] != E_GW_ITEM_RECUR_END_MARKER; i++) {
-                               const gchar *dow = e_gw_recur_get_day_of_week (rrule->by_day[i]);
-
-                               if (rrule->by_setpos[i] == E_GW_ITEM_RECUR_END_MARKER)
-                                       e_gw_message_write_string_parameter (msg, "day", NULL, dow);
-                               else {
-                                       gchar occur[3];
-
-                                       g_sprintf (occur, "%d", rrule->by_setpos [i]);
-                                       e_gw_message_write_string_parameter_with_attribute (msg, "day", NULL, dow, "occurrence", occur);
-                               }
-                       }
-                       soup_soap_message_end_element (msg);
-               }
-
-               /* byMonthDay*/
-               if (rrule->by_month_day) {
-                       gint i, max_elements;
-                       gchar month_day[3];
-
-                       soup_soap_message_start_element (msg, "byMonthDay", NULL, NULL);
-                       max_elements = G_N_ELEMENTS (rrule->by_month_day);
-                       /* expand into  a sequence of 'day' here  */
-                       for (i = 0; i < max_elements && rrule->by_month_day[i] != E_GW_ITEM_RECUR_END_MARKER; i++) {
-                               /*TODO occurence attribute */
-                               g_sprintf (month_day, "%d", rrule->by_month_day [i]);
-                               e_gw_message_write_string_parameter (msg, "day", NULL, month_day);
-
-                       }
-                       soup_soap_message_end_element (msg);
-               }
-               /* byYearDay */
-       if (rrule->by_year_day) {
-                       gint i, max_elements;
-                       gchar year_day[4];
-                       soup_soap_message_start_element (msg, "byYearDay", NULL, NULL);
-                       max_elements = G_N_ELEMENTS (rrule->by_year_day);
-                       /* expand into  a sequence of 'day' here  */
-                       for (i = 0; i < max_elements && rrule->by_year_day[i] != E_GW_ITEM_RECUR_END_MARKER; i++) {
-                               /*TODO occurence attribute */
-                               g_sprintf (year_day, "%d", rrule->by_year_day [i]);
-                               e_gw_message_write_string_parameter (msg, "day", NULL, year_day);
-
-                       }
-               soup_soap_message_end_element (msg);
-               }
-               /* byMonth */
-               if (rrule->by_month) {
-                       gint i, max_elements;
-                       gchar month[3];
-                       soup_soap_message_start_element (msg, "byMonth", NULL, NULL);
-                       max_elements = G_N_ELEMENTS (rrule->by_month);
-                       /* expand into  a sequence of 'month' here  */
-                       for (i = 0; i < max_elements && rrule->by_month[i] != E_GW_ITEM_RECUR_END_MARKER; i++) {
-                               /*TODO occurence attribute */
-                               g_sprintf (month, "%d", rrule->by_month [i]);
-                               e_gw_message_write_string_parameter (msg, "month", NULL, month);
-
-                       }
-                       soup_soap_message_end_element (msg);
-               }
-               soup_soap_message_end_element (msg);
-
-       } else if (item->priv->recurrence_dates) {
-               GSList *date;
-               soup_soap_message_start_element (msg, "rdate", NULL, NULL);
-               for (date = item->priv->recurrence_dates; date != NULL; date = g_slist_next (date)) {
-                       e_gw_message_write_string_parameter (msg, "date", NULL, (gchar *) date->data);
-               }
-               soup_soap_message_end_element (msg);
-       }
-
-       if (item->priv->exdate_list) {
-               GSList *date;
-               soup_soap_message_start_element (msg, "exdate", NULL, NULL);
-               for (date = item->priv->exdate_list; date != NULL; date = g_slist_next (date)) {
-                       e_gw_message_write_string_parameter (msg, "date", NULL, (gchar *) date->data);
-               }
-               soup_soap_message_end_element (msg);
-       }
-       /*xxx - byday, bymonthday and byyearday not handled - FIXME */
-
-       /*attachments*/
-       if (priv->attach_list) {
-               GSList *al;
-               soup_soap_message_start_element (msg, "attachments", NULL, NULL);
-               for (al = priv->attach_list; al != NULL;  al = al->next) {
-                       EGwItemAttachment *attachment = (EGwItemAttachment *)al->data;
-                       add_attachment_to_soap_message (attachment, msg);
-
-               }
-               soup_soap_message_end_element (msg);
-       }
-}
-
-gboolean
-e_gw_item_append_to_soap_message (EGwItem *item, SoupSoapMessage *msg)
-{
-       EGwItemPrivate *priv;
-       gchar *alarm;
-
-       g_return_val_if_fail (E_IS_GW_ITEM (item), FALSE);
-       g_return_val_if_fail (SOUP_IS_SOAP_MESSAGE (msg), FALSE);
-
-       priv = item->priv;
-
-       soup_soap_message_start_element (msg, "item", "types", NULL);
-
-       switch (priv->item_type) {
-       case E_GW_ITEM_TYPE_MAIL :
-               soup_soap_message_add_attribute (msg, "type", "Mail", "xsi", NULL);
-
-               if (priv->security)
-                       e_gw_message_write_string_parameter (msg, "security", NULL, priv->security);
-
-               /*The subject*/
-               if (priv->subject)
-                       e_gw_message_write_string_parameter (msg, "subject", NULL, priv->subject);
-               /*distribution*/
-               e_gw_item_add_distribution_to_soap_message (item, msg);
-
-               if (priv->set_sendoptions) {
-                       /* item options */
-                       append_gw_item_options (msg, item);
-               }
-               /*container*/
-               if (item->priv->container)
-                       e_gw_message_write_string_parameter (msg, "container", NULL, item->priv->container);
-               if (item->priv->source)
-                       e_gw_message_write_string_parameter (msg, "source", NULL, item->priv->source);
-
-               /*message*/
-               soup_soap_message_start_element (msg, "message", NULL, NULL);
-               if (priv->message) {
-                       gchar *str;
-                       gchar *str_len;
-
-                       str = g_base64_encode ((guchar *) priv->message, strlen (priv->message));
-                       /*str = g_strdup (priv->message);*/
-                       str_len = g_strdup_printf ("%d", str ? (gint)strlen (str) : 0);
-                       soup_soap_message_start_element (msg, "part", NULL, NULL);
-                       soup_soap_message_add_attribute (msg, "length", str_len, NULL, NULL);
-                       soup_soap_message_add_attribute (msg, "contentType", priv->content_type, NULL, NULL);
-                       g_free (str_len);
-                       soup_soap_message_write_string (msg, str);
-                       soup_soap_message_end_element (msg);
-                       g_free (str);
-               } else {
-                       soup_soap_message_add_attribute (msg, "length", "0", NULL, NULL);
-                       soup_soap_message_write_string (msg, "");
-               }
-
-               soup_soap_message_end_element (msg);
-
-               /*attachments*/
-               if (priv->attach_list) {
-                       GSList *al;
-                       soup_soap_message_start_element (msg, "attachments", NULL, NULL);
-                       for (al = priv->attach_list; al != NULL;  al = al->next) {
-                               EGwItemAttachment *attachment = (EGwItemAttachment *)al->data;
-                               add_attachment_to_soap_message (attachment, msg);
-                       }
-                       soup_soap_message_end_element (msg);
-               }
-
-               /*Link info - used when a mail is being replied to or forwarded*/
-               if (priv->link_info) {
-                       soup_soap_message_start_element (msg, "link", NULL, NULL);
-                       e_gw_message_write_string_parameter (msg, "id", NULL, priv->link_info->id);
-                       e_gw_message_write_string_parameter (msg, "type", NULL, priv->link_info->type);
-                       e_gw_message_write_string_parameter (msg, "thread", NULL, priv->link_info->thread);
-                       soup_soap_message_end_element (msg);
-               }
-
-               break;
-
-       case E_GW_ITEM_TYPE_APPOINTMENT :
-               soup_soap_message_add_attribute (msg, "type", "Appointment", "xsi", NULL);
-
-               /* Calendar Item properties. */
-               e_gw_item_set_calendar_item_elements (item, msg);
-
-               /* Appointment specific properties */
-               if (priv->end_date) {
-                       e_gw_message_write_string_parameter (msg, "endDate", NULL, priv->end_date);
-               } else
-                       e_gw_message_write_string_parameter (msg, "endDate", NULL, "");
-
-               e_gw_message_write_string_parameter (msg, "acceptLevel", NULL, priv->accept_level ? priv->accept_level : "");
-               if (priv->is_allday_event)
-                       e_gw_message_write_string_parameter (msg, "allDayEvent", NULL, "1");
-               else
-                       e_gw_message_write_string_parameter (msg, "allDayEvent", NULL ,"0");
-
-               if (priv->trigger != 0) {
-                       alarm = g_strdup_printf ("%d", priv->trigger);
-                       e_gw_message_write_string_parameter_with_attribute (msg, "alarm", NULL, alarm, "enabled", "1");
-                       g_free (alarm);
-               }
-               e_gw_message_write_string_parameter (msg, "place", NULL, priv->place ? priv->place : "");
-
-               break;
-
-       case E_GW_ITEM_TYPE_TASK :
-               soup_soap_message_add_attribute (msg, "type", "Task", "xsi", NULL);
-
-               /* Calendar Item properties. */
-               e_gw_item_set_calendar_item_elements (item, msg);
-
-               /* Task specific properties */
-               if (priv->due_date) {
-                       e_gw_message_write_string_parameter (msg, "dueDate", NULL, priv->due_date);
-               } else
-                       e_gw_message_write_string_parameter (msg, "dueDate", NULL, "");
-
-               e_gw_message_write_string_parameter (msg, "taskPriority", NULL, priv->task_priority ? priv->task_priority : "");
-               if (priv->completed)
-                       e_gw_message_write_string_parameter (msg, "completed", NULL, "1");
-               else
-                       e_gw_message_write_string_parameter (msg, "completed", NULL, "0");
-
-               break;
-       case E_GW_ITEM_TYPE_NOTE:
-               soup_soap_message_add_attribute (msg, "type", "Note", "xsi", NULL);
-
-               e_gw_item_set_calendar_item_elements (item, msg);
-               break;
-       case E_GW_ITEM_TYPE_CONTACT :
-               soup_soap_message_add_attribute (msg, "type", "Contact", "xsi", NULL);
-               append_contact_fields_to_soap_message (item, msg);
-               soup_soap_message_end_element (msg);
-               return TRUE;
-       case E_GW_ITEM_TYPE_GROUP :
-               soup_soap_message_add_attribute (msg, "type", "Group", "xsi", NULL);
-               append_group_fields_to_soap_message (item, msg);
-               soup_soap_message_end_element (msg);
-               return TRUE;
-       case E_GW_ITEM_TYPE_ORGANISATION :
-               soup_soap_message_add_attribute (msg, "type", "Organization", "xsi", NULL);
-               append_contact_fields_to_soap_message (item, msg);
-               soup_soap_message_end_element (msg);
-               return TRUE;
-       case E_GW_ITEM_TYPE_CATEGORY :
-               soup_soap_message_add_attribute (msg, "type", "Category", "xsi", NULL);
-               e_gw_message_write_string_parameter (msg, "name", NULL, item->priv->category_name);
-               soup_soap_message_end_element (msg);
-               return TRUE;
-       default :
-               g_warning (G_STRLOC ": Unknown type for item");
-               return FALSE;
-       }
-
-       soup_soap_message_end_element (msg);
-
-       return TRUE;
-}
-
-static void
-append_contact_changes_to_soap_message (EGwItem *item, SoupSoapMessage *msg, gint change_type)
-{
-       GHashTable *changes;
-       EGwItemPrivate *priv;
-       FullName *full_name;
-       gchar *value;
-       GList *list;
-       PostalAddress *postal_address;
-
-       priv = item->priv;
-       changes = NULL;
-       switch (change_type) {
-       case E_GW_ITEM_CHANGE_TYPE_ADD :
-               changes = priv->additions;
-               soup_soap_message_start_element (msg, "add", NULL, NULL);
-               break;
-       case E_GW_ITEM_CHANGE_TYPE_UPDATE :
-               changes = priv->updates;
-               soup_soap_message_start_element (msg, "update", NULL, NULL);
-               break;
-       case E_GW_ITEM_CHANGE_TYPE_DELETE :
-               soup_soap_message_start_element (msg, "delete", NULL, NULL);
-               changes = priv->deletions;
-               break;
-
-       }
-       if (!changes)
-               return;
-       list = g_hash_table_lookup (changes, "categories");
-       append_common_addressbook_item_fields_to_soap_message (changes, list, msg);
-       full_name = g_hash_table_lookup (changes, "full_name");
-       value = g_hash_table_lookup (changes, "name");
-       if (full_name)
-               append_full_name_to_soap_message (full_name, value, msg);
-       list = g_hash_table_lookup (changes, "email");
-       if (list)
-               append_email_list_soap_message (list, msg);
-       list = g_hash_table_lookup (changes, "ims");
-       if (list)
-               append_im_list_to_soap_message (list, msg);
-       append_phone_list_to_soap_message (changes, msg);
-
-       soup_soap_message_start_element (msg, "addressList", NULL, NULL);
-       postal_address = g_hash_table_lookup (changes, "Home");
-       if (postal_address)
-               append_postal_address_to_soap_message (msg, postal_address, "Home");
-       postal_address = g_hash_table_lookup (changes, "Office");
-       if (postal_address)
-               append_postal_address_to_soap_message (msg, postal_address, "Office");
-       soup_soap_message_end_element (msg);
-
-       append_office_info_to_soap_message (changes, msg);
-       append_personal_info_to_soap_message (changes, msg);
-
-       soup_soap_message_end_element (msg);
-
-}
-
-static void
-append_event_changes_to_soap_message (EGwItem *item, SoupSoapMessage *msg, gint change_type)
-{
-       GHashTable *changes;
-       EGwItemPrivate *priv;
-
-       priv = item->priv;
-       changes = NULL;
-       switch (change_type) {
-       case E_GW_ITEM_CHANGE_TYPE_ADD :
-               changes = priv->additions;
-               if (!changes)
-                       return;
-               soup_soap_message_start_element (msg, "add", NULL, NULL);
-               break;
-       case E_GW_ITEM_CHANGE_TYPE_UPDATE :
-               changes = priv->updates;
-               if (!changes)
-                       return;
-               soup_soap_message_start_element (msg, "update", NULL, NULL);
-               break;
-       case E_GW_ITEM_CHANGE_TYPE_DELETE :
-               changes = priv->deletions;
-               if (!changes)
-                       return;
-               soup_soap_message_start_element (msg, "delete", NULL, NULL);
-               break;
-       }
-       if (g_hash_table_lookup (changes, "categories")) {
-               GList *list;
-               list = g_hash_table_lookup (changes, "categories");
-
-               soup_soap_message_start_element (msg, "categories", NULL, NULL);
-               if (list != NULL && list->data)
-                       soup_soap_message_add_attribute (msg, "types:primary",list->data, NULL, NULL);
-                       for (; list != NULL; list = g_list_next (list))
-                               if (list->data) {
-                                       e_gw_message_write_string_parameter (msg, "category", NULL, list->data);
-                       }
-               soup_soap_message_end_element (msg);
-               g_list_free (list);
-       }
-       if (g_hash_table_lookup (changes, "subject"))
-               e_gw_message_write_string_parameter (msg, "subject", NULL, priv->subject ? priv->subject : "");
-       if (g_hash_table_lookup (changes, "start_date")) {
-               if (priv->start_date) {
-                       e_gw_message_write_string_parameter (msg, "startDate", NULL, priv->start_date);
-               }
-       }
-       if (g_hash_table_lookup (changes, "end_date")) {
-               if (priv->end_date) {
-                       e_gw_message_write_string_parameter (msg, "endDate", NULL, priv->end_date);
-               }
-       }
-       if (g_hash_table_lookup (changes, "allDayEvent"))
-               e_gw_message_write_string_parameter (msg, "allDayEvent", NULL, priv->is_allday_event ? "1" : "0");
-       if (g_hash_table_lookup (changes, "message")) {
-               soup_soap_message_start_element (msg, "message", NULL, NULL);
-               if (priv->message) {
-                       gchar *str, *message;
-
-                       str = g_base64_encode ((guchar *) priv->message, strlen (priv->message));
-                       message = g_strdup_printf ("%d", (gint)strlen (str));
-                       soup_soap_message_add_attribute (msg, "length", message, NULL, NULL);
-                       g_free (message);
-                       soup_soap_message_write_string (msg, str);
-                       g_free (str);
-               } else {
-                       soup_soap_message_add_attribute (msg, "length", "0", NULL, NULL);
-                       soup_soap_message_write_string (msg, "");
-               }
-
-               soup_soap_message_end_element (msg);
-       }
-       if (g_hash_table_lookup (changes, "classification"))
-               e_gw_message_write_string_parameter (msg, "class", NULL, priv->classification);
-       if (g_hash_table_lookup (changes, "task_priority")) {
-               e_gw_message_write_string_parameter (msg, "taskPriority", NULL, priv->task_priority);
-       }
-       if (g_hash_table_lookup (changes, "accept_level"))
-               e_gw_message_write_string_parameter (msg, "acceptLevel", NULL, priv->accept_level ? priv->accept_level : "");
-       if (g_hash_table_lookup (changes, "place"))
-               e_gw_message_write_string_parameter (msg, "place", NULL, priv->place ? priv->place : "");
-       if (g_hash_table_lookup (changes, "alarm")) {
-               if (priv->trigger != 0) {
-                       gchar *alarm = g_strdup_printf ("%d", priv->trigger);
-                       e_gw_message_write_string_parameter_with_attribute (msg, "alarm", NULL, alarm, "enabled", "1");
-                       g_free (alarm);
-               }
-               else
-                       e_gw_message_write_string_parameter_with_attribute (msg, "alarm", NULL, "0", "enabled", "0");
-       }
-       if (g_hash_table_lookup (changes, "completed"))
-               e_gw_message_write_string_parameter (msg, "completed", NULL, priv->completed ? "1" : "0");
-       if (g_hash_table_lookup (changes, "due_date"))
-               e_gw_message_write_string_parameter (msg, "dueDate", NULL, priv->due_date);
-       soup_soap_message_end_element (msg);
-
-}
-
-gboolean
-e_gw_item_append_changes_to_soap_message (EGwItem *item, SoupSoapMessage *msg)
-{
-       EGwItemPrivate *priv;
-       gchar *value;
-       g_return_val_if_fail (E_IS_GW_ITEM (item), FALSE);
-       g_return_val_if_fail (SOUP_IS_SOAP_MESSAGE (msg), FALSE);
-
-       priv = item->priv;
-
-       soup_soap_message_start_element (msg, "updates", NULL, NULL);
-
-       switch (priv->item_type) {
-       case E_GW_ITEM_TYPE_CONTACT :
-       case E_GW_ITEM_TYPE_ORGANISATION :
-               append_contact_changes_to_soap_message (item, msg, E_GW_ITEM_CHANGE_TYPE_ADD);
-               append_contact_changes_to_soap_message (item, msg, E_GW_ITEM_CHANGE_TYPE_UPDATE);
-               append_contact_changes_to_soap_message (item, msg, E_GW_ITEM_CHANGE_TYPE_DELETE);
-               soup_soap_message_end_element (msg);
-               return TRUE;
-       case E_GW_ITEM_TYPE_GROUP :
-               soup_soap_message_start_element (msg, "update", NULL, NULL);
-               value = g_hash_table_lookup (item->priv->simple_fields, "name");
-               if (value)
-                       e_gw_message_write_string_parameter (msg, "name", NULL, value);
-               soup_soap_message_end_element (msg);
-               soup_soap_message_end_element (msg);
-               return TRUE;
-       case E_GW_ITEM_TYPE_APPOINTMENT:
-       case E_GW_ITEM_TYPE_TASK :
-       case E_GW_ITEM_TYPE_NOTE:
-               append_event_changes_to_soap_message (item, msg, E_GW_ITEM_CHANGE_TYPE_ADD);
-               append_event_changes_to_soap_message (item, msg, E_GW_ITEM_CHANGE_TYPE_UPDATE);
-               append_event_changes_to_soap_message (item, msg, E_GW_ITEM_CHANGE_TYPE_DELETE);
-               soup_soap_message_end_element (msg);
-               return TRUE;
-       default :
-               g_warning (G_STRLOC ": Unknown type for item");
-               return FALSE;
-       }
-
-}
diff --git a/servers/groupwise/e-gw-item.h b/servers/groupwise/e-gw-item.h
deleted file mode 100644 (file)
index 180ef94..0000000
+++ /dev/null
@@ -1,333 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors :
- *  JP Rosevear <jpr@ximian.com>
- *  Rodrigo Moya <rodrigo@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- */
-
-#ifndef E_GW_ITEM_H
-#define E_GW_ITEM_H
-
-#include "soup-soap-message.h"
-#include "soup-soap-response.h"
-#include "e-gw-recur-utils.h"
-
-G_BEGIN_DECLS
-
-#define E_TYPE_GW_ITEM            (e_gw_item_get_type ())
-#define E_GW_ITEM(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_GW_ITEM, EGwItem))
-#define E_GW_ITEM_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_GW_ITEM, EGwItemClass))
-#define E_IS_GW_ITEM(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_GW_ITEM))
-#define E_IS_GW_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_GW_ITEM))
-
-typedef struct _EGwItem        EGwItem;
-typedef struct _EGwItemClass   EGwItemClass;
-typedef struct _EGwItemPrivate EGwItemPrivate;
-
-typedef enum {
-       E_GW_ITEM_TYPE_MAIL,
-       E_GW_ITEM_TYPE_APPOINTMENT,
-       E_GW_ITEM_TYPE_TASK,
-       E_GW_ITEM_TYPE_CONTACT,
-       E_GW_ITEM_TYPE_GROUP,
-       E_GW_ITEM_TYPE_ORGANISATION,
-       E_GW_ITEM_TYPE_RESOURCE,
-       E_GW_ITEM_TYPE_CATEGORY,
-       E_GW_ITEM_TYPE_NOTIFICATION,
-       E_GW_ITEM_TYPE_NOTE,
-       E_GW_ITEM_TYPE_UNKNOWN
-
-} EGwItemType;
-
-typedef enum {
-       E_GW_ITEM_CHANGE_TYPE_ADD,
-       E_GW_ITEM_CHANGE_TYPE_UPDATE,
-       E_GW_ITEM_CHANGE_TYPE_DELETE,
-       E_GW_ITEM_CHNAGE_TYPE_UNKNOWN
-
-} EGwItemChangeType;
-
-typedef enum {
-       E_GW_ITEM_STAT_ACCEPTED = 1<<0,
-       E_GW_ITEM_STAT_COMPLETED = 1<<1,
-       E_GW_ITEM_STAT_DELEGATED = 1<<2,
-       E_GW_ITEM_STAT_DELETED   = 1<<3,
-       E_GW_ITEM_STAT_FORWARDED = 1<<4,
-       E_GW_ITEM_STAT_OPENED    = 1<<5,
-       E_GW_ITEM_STAT_READ      = 1<<6,
-       E_GW_ITEM_STAT_REPLIED   = 1<<7,
-       E_GW_ITEM_STAT_DECLINED  = 1<<8,
-       E_GW_ITEM_STAT_NONE      = 1<<31
-} EGwItemStatus;
-
-struct _EGwItem {
-       GObject parent;
-       EGwItemPrivate *priv;
-};
-
-struct _EGwItemClass {
-       GObjectClass parent_class;
-};
-
-/* structures defined to hold contact item fields */
-typedef struct {
-       gchar *name_prefix;
-       gchar *first_name;
-       gchar *middle_name;
-       gchar *last_name;
-       gchar *name_suffix;
-} FullName;
-
-typedef struct {
-       gchar *street_address;
-       gchar *location;
-       gchar *city;
-       gchar *state;
-       gchar *postal_code;
-       gchar *country;
-} PostalAddress;
-
-typedef struct {
-
-       gchar *service;
-       gchar *address;
-}IMAddress;
-
-typedef struct {
-       gchar *id;
-       gchar *email;
-       gchar *name;
-} EGroupMember;
-
-typedef struct {
-       gchar *email;
-       gchar *display_name;
-} EGwItemOrganizer;
-
-typedef struct {
-       gchar *id;
-       gchar *name;
-       gchar *item_reference;
-       gchar *contentid;
-       gchar *contentType;
-       gint size;
-       gchar *date;
-       gchar *data;
-       gboolean hidden;
-} EGwItemAttachment;
-
-typedef enum {
-       E_GW_ITEM_NOTIFY_NONE,
-       E_GW_ITEM_NOTIFY_MAIL
-} EGwItemReturnNotify;
-
-typedef enum {
-       E_GW_ITEM_NONE,
-       E_GW_ITEM_DELIVERED,
-       E_GW_ITEM_DELIVERED_OPENED,
-       E_GW_ITEM_ALL
-} EGwItemTrack;
-
-typedef struct {
-       gchar *id;
-       gchar *type;
-       gchar *thread;
-} EGwItemLinkInfo;
-
-typedef struct {
-       gchar *item_id;
-       gchar *ical_id;
-       gchar *recur_key;
-       gchar *start_date;
-} EGwItemCalId;
-
-GType       e_gw_item_get_type (void);
-EGwItem    *e_gw_item_new_empty (void);
-EGwItem    *e_gw_item_new_from_soap_parameter (const gchar *email, const gchar *container, SoupSoapParameter *param);
-
-EGwItemType e_gw_item_get_item_type (EGwItem *item);
-void        e_gw_item_set_item_type (EGwItem *item, EGwItemType new_type);
-const gchar *e_gw_item_get_container_id (EGwItem *item);
-void        e_gw_item_set_container_id (EGwItem *item, const gchar *new_id);
-const gchar *e_gw_item_get_icalid (EGwItem *item);
-void        e_gw_item_set_icalid (EGwItem *item, const gchar *new_icalid);
-const gchar *e_gw_item_get_id (EGwItem *item);
-void        e_gw_item_set_id (EGwItem *item, const gchar *new_id);
-gchar       *e_gw_item_get_creation_date (EGwItem *item);
-void        e_gw_item_set_creation_date (EGwItem *item, const gchar *new_date);
-gchar       *e_gw_item_get_delivered_date (EGwItem *item);
-void        e_gw_item_set_delivered_date (EGwItem *item, const gchar *new_date);
-const gchar  *e_gw_item_get_modified_date (EGwItem *item);
-void        e_gw_item_set_modified_date (EGwItem *item, const gchar *new_date);
-gchar       *e_gw_item_get_start_date (EGwItem *item);
-void        e_gw_item_set_start_date (EGwItem *item, const gchar *new_date);
-gchar       *e_gw_item_get_completed_date (EGwItem *item);
-void        e_gw_item_set_completed_date (EGwItem *item, const gchar *new_date);
-gchar       *e_gw_item_get_end_date (EGwItem *item);
-void        e_gw_item_set_end_date (EGwItem *item, const gchar *new_date);
-gchar       *e_gw_item_get_due_date (EGwItem *item);
-void        e_gw_item_set_due_date (EGwItem *item, const gchar *new_date);
-const gchar *e_gw_item_get_subject (EGwItem *item);
-void        e_gw_item_set_subject (EGwItem *item, const gchar *new_subject);
-const gchar *e_gw_item_get_message (EGwItem *item);
-void        e_gw_item_set_message (EGwItem *item, const gchar *new_message);
-const gchar *e_gw_item_get_place (EGwItem *item);
-void        e_gw_item_set_place (EGwItem *item, const gchar *new_place);
-const gchar *e_gw_item_get_security (EGwItem *item);
-void        e_gw_item_set_security (EGwItem *item, const gchar *new_class);
-gboolean    e_gw_item_get_completed (EGwItem *item);
-void        e_gw_item_set_completed (EGwItem *item, gboolean new_completed);
-gboolean    e_gw_item_get_is_allday_event (EGwItem *item);
-void       e_gw_item_set_is_allday_event (EGwItem *item, gboolean is_allday);
-gchar *       e_gw_item_get_field_value (EGwItem *item, const gchar *field_name);
-void        e_gw_item_set_field_value (EGwItem *item, const gchar *field_name, gchar * field_value);
-GList*      e_gw_item_get_email_list (EGwItem *item);
-void        e_gw_item_set_email_list (EGwItem *item, GList *email_list);
-FullName*   e_gw_item_get_full_name (EGwItem *item);
-void        e_gw_item_set_full_name (EGwItem *item, FullName* full_name);
-GList*      e_gw_item_get_member_list (EGwItem *item);
-void        e_gw_item_set_member_list (EGwItem *item, GList *list);
-PostalAddress* e_gw_item_get_address (EGwItem *item, const gchar *address_type);
-void        e_gw_item_set_address (EGwItem *item, const gchar *addres_type, PostalAddress *address);
-GList*      e_gw_item_get_im_list (EGwItem *item);
-void        e_gw_item_set_im_list (EGwItem *item, GList *im_list);
-void        e_gw_item_set_categories (EGwItem *item, GList *category_list);
-GList*      e_gw_item_get_categories (EGwItem *item);
-void       e_gw_item_set_to (EGwItem *item, const gchar *to);
-const gchar * e_gw_item_get_to (EGwItem *item);
-const gchar *e_gw_item_get_msg_content_type (EGwItem *item);
-guint32     e_gw_item_get_item_status (EGwItem *item);
-void       e_gw_item_set_content_type (EGwItem *item, const gchar *content_type);
-void       e_gw_item_set_link_info (EGwItem *item, EGwItemLinkInfo *info);
-EGwItemLinkInfo *e_gw_item_get_link_info (EGwItem *item);
-gchar      *e_gw_item_get_content_type (EGwItem *item);
-const gchar *e_gw_item_get_msg_body_id (EGwItem *item);
-gint       e_gw_item_get_mail_size (EGwItem *item);
-void e_gw_item_set_change (EGwItem *item, EGwItemChangeType change_type, const gchar *field_name, gpointer field_value);
-gboolean e_gw_item_append_changes_to_soap_message (EGwItem *item, SoupSoapMessage *msg);
-void e_gw_item_set_category_name (EGwItem *item, gchar *cateogry_name);
-gchar * e_gw_item_get_category_name (EGwItem *item);
-void e_gw_item_set_sendoptions (EGwItem *item, gboolean set);
-void e_gw_item_set_reply_request (EGwItem *item, gboolean set);
-gboolean e_gw_item_get_reply_request (EGwItem *item);
-void e_gw_item_set_reply_within (EGwItem *item, gchar *reply_within);
-gchar *e_gw_item_get_reply_within (EGwItem *item);
-void e_gw_item_set_track_info (EGwItem *item, EGwItemTrack track_info);
-EGwItemTrack e_gw_item_get_track_info (EGwItem *item);
-void e_gw_item_set_autodelete (EGwItem *item, gboolean set);
-gboolean e_gw_item_get_autodelete (EGwItem *item);
-void e_gw_item_set_notify_completed (EGwItem *item, EGwItemReturnNotify notify);
-EGwItemReturnNotify e_gw_item_get_notify_completed (EGwItem *item);
-void e_gw_item_set_notify_accepted (EGwItem *item, EGwItemReturnNotify notify);
-EGwItemReturnNotify e_gw_item_get_notify_accepted (EGwItem *item);
-void e_gw_item_set_notify_declined (EGwItem *item, EGwItemReturnNotify notify);
-EGwItemReturnNotify e_gw_item_get_notify_declined (EGwItem *item);
-void e_gw_item_set_notify_opened (EGwItem *item, EGwItemReturnNotify notify);
-EGwItemReturnNotify e_gw_item_get_notify_opened (EGwItem *item);
-void e_gw_item_set_notify_deleted (EGwItem *item, EGwItemReturnNotify notify);
-EGwItemReturnNotify e_gw_item_get_notify_deleted (EGwItem *item);
-void e_gw_item_set_expires (EGwItem *item, gchar *expires);
-gchar *e_gw_item_get_expires (EGwItem *item);
-void e_gw_item_set_delay_until (EGwItem *item, gchar *delay_until);
-gchar *e_gw_item_get_delay_until (EGwItem *item);
-void e_gw_item_free_cal_id (EGwItemCalId *calid);
-
-#define E_GW_ITEM_CLASSIFICATION_PUBLIC       "Public"
-#define E_GW_ITEM_CLASSIFICATION_PRIVATE      "Private"
-#define E_GW_ITEM_CLASSIFICATION_CONFIDENTIAL "Confidential"
-
-const gchar *e_gw_item_get_classification (EGwItem *item);
-void        e_gw_item_set_classification (EGwItem *item, const gchar *new_class);
-
-#define E_GW_ITEM_ACCEPT_LEVEL_BUSY          "Busy"
-#define E_GW_ITEM_ACCEPT_LEVEL_OUT_OF_OFFICE "OutOfOffice"
-#define E_GW_ITEM_ACCEPT_LEVEL_FREE         "Free"
-
-const gchar *e_gw_item_get_accept_level (EGwItem *item);
-void        e_gw_item_set_accept_level (EGwItem *item, const gchar *new_level);
-
-#define E_GW_ITEM_PRIORITY_HIGH     "High"
-#define E_GW_ITEM_PRIORITY_STANDARD "Standard"
-#define E_GW_ITEM_PRIORITY_LOW      "Low"
-
-const gchar *e_gw_item_get_priority (EGwItem *item);
-void        e_gw_item_set_priority (EGwItem *item, const gchar *new_priority);
-
-const gchar *e_gw_item_get_task_priority (EGwItem *item);
-void        e_gw_item_set_task_priority (EGwItem *item, const gchar *new_priority);
-
-GSList *e_gw_item_get_recipient_list (EGwItem *item);
-void e_gw_item_set_recipient_list (EGwItem *item, GSList *new_recipient_list);
-
-EGwItemOrganizer *e_gw_item_get_organizer (EGwItem *item);
-void e_gw_item_set_organizer (EGwItem  *item, EGwItemOrganizer *organizer);
-
-GSList * e_gw_item_get_attach_id_list (EGwItem *item);
-void e_gw_item_set_attach_id_list (EGwItem *item, GSList *attach_list);
-
-GSList *e_gw_item_get_recurrence_dates (EGwItem *item);
-void e_gw_item_set_recurrence_dates (EGwItem  *item, GSList *new_recurrence_dates);
-
-GSList *e_gw_item_get_exdate_list (EGwItem *item);
-void e_gw_item_set_exdate_list (EGwItem  *item, GSList *new_exdate_list);
-
-void e_gw_item_set_rrule (EGwItem *item, EGwItemRecurrenceRule *rrule);
-EGwItemRecurrenceRule *e_gw_item_get_rrule (EGwItem *item);
-
-gint e_gw_item_get_recurrence_key (EGwItem *item);
-void e_gw_item_set_recurrence_key (EGwItem *item, gint recurrence_key);
-
-void e_gw_item_set_source (EGwItem *item, const gchar *source);
-
-gint e_gw_item_get_trigger (EGwItem *item);
-void e_gw_item_set_trigger (EGwItem *item, gint trigger);
-
-gboolean e_gw_item_has_attachment (EGwItem *item);
-
-gboolean e_gw_item_is_from_internet (EGwItem *item);
-
-const gchar *e_gw_item_get_parent_thread_ids (EGwItem *item);
-const gchar * e_gw_item_get_message_id (EGwItem *item);
-
-typedef struct {
-       gchar *email;
-       gchar *display_name;
-       gboolean status_enabled;
-       gchar *delivered_date;
-       gchar *opened_date;
-       gchar *accepted_date;
-       gchar *deleted_date;
-       gchar *declined_date;
-       gchar *completed_date;
-       gchar *undelivered_date;
-       enum {
-               E_GW_ITEM_RECIPIENT_TO,
-               E_GW_ITEM_RECIPIENT_CC,
-               E_GW_ITEM_RECIPIENT_BC,
-               E_GW_ITEM_RECIPIENT_NONE
-       } type;
-
-       EGwItemStatus status;
-} EGwItemRecipient;
-
-gboolean    e_gw_item_append_to_soap_message (EGwItem *item, SoupSoapMessage *msg);
-void e_gw_item_add_distribution_to_soap_message (EGwItem *item, SoupSoapMessage *msg);
-G_END_DECLS
-
-#endif
diff --git a/servers/groupwise/e-gw-message.c b/servers/groupwise/e-gw-message.c
deleted file mode 100644 (file)
index ec81ca2..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors :
- *  JP Rosevear <jpr@ximian.com>
- *  Rodrigo Moya <rodrigo@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- */
-
-#include <config.h>
-#include <string.h>
-#include <libsoup/soup-uri.h>
-#include "e-gw-message.h"
-
-SoupSoapMessage *
-e_gw_message_new_with_header (const gchar *uri, const gchar *session_id, const gchar *method_name)
-{
-       SoupSoapMessage *msg;
-
-       msg = soup_soap_message_new (SOUP_METHOD_POST, uri, FALSE, NULL, NULL, NULL);
-       if (!msg) {
-               g_warning (G_STRLOC ": Could not build SOAP message");
-               return NULL;
-       }
-
-       soup_message_headers_append (SOUP_MESSAGE (msg)->request_headers, "Content-Type", "text/xml");
-       soup_message_headers_append (SOUP_MESSAGE (msg)->request_headers, "User-Agent",
-                                    "Evolution/" VERSION);
-       soup_message_headers_append (SOUP_MESSAGE (msg)->request_headers,"Connection",  "Keep-Alive");
-       soup_message_headers_append (SOUP_MESSAGE (msg)->request_headers, "SOAPAction", method_name);
-
-       soup_soap_message_start_envelope (msg);
-       if (session_id && *session_id) {
-               soup_soap_message_start_element (msg, "Header","SOAP-ENV", NULL);
-               soup_soap_message_add_attribute (msg, "encodingStyle", "", "SOAP-ENV", NULL);
-               /* FIXME: cannot use e_gw_message_write_string_parameter as it sets prefix -types*/
-               soup_soap_message_start_element (msg, "session", NULL, NULL);
-               soup_soap_message_write_string (msg, session_id);
-               soup_soap_message_end_element (msg);
-               soup_soap_message_end_element (msg);
-       }
-       soup_soap_message_start_body (msg);
-       soup_soap_message_add_attribute (msg, "encodingStyle", "", "SOAP-ENV", NULL);
-       soup_soap_message_add_namespace (msg, "types", "http://schemas.novell.com/2003/10/NCSP/types.xsd");
-
-       soup_soap_message_start_element (msg, method_name, NULL, NULL);
-
-       return msg;
-}
-
-void
-e_gw_message_write_string_parameter (SoupSoapMessage *msg, const gchar *name, const gchar *prefix, const gchar *value)
-{
-       soup_soap_message_start_element (msg, name, prefix, NULL);
-       soup_soap_message_write_string (msg, value);
-       soup_soap_message_end_element (msg);
-}
-
-void
-e_gw_message_write_string_parameter_with_attribute (SoupSoapMessage *msg,
-                                                   const gchar *name,
-                                                   const gchar *prefix,
-                                                   const gchar *value,
-                                                   const gchar *attribute_name,
-                                                   const gchar *attribute_value)
-{
-       soup_soap_message_start_element (msg, name, prefix, NULL);
-       soup_soap_message_add_attribute (msg, attribute_name, attribute_value, NULL, NULL);
-       soup_soap_message_write_string (msg, value);
-       soup_soap_message_end_element (msg);
-}
-
-void
-e_gw_message_write_base64_parameter (SoupSoapMessage *msg, const gchar *name, const gchar *prefix, const gchar *value)
-{
-       soup_soap_message_start_element (msg, name, prefix, NULL);
-       soup_soap_message_write_base64 (msg, value, strlen (value));
-       soup_soap_message_end_element (msg);
-}
-
-void
-e_gw_message_write_int_parameter (SoupSoapMessage *msg, const gchar *name, const gchar *prefix, glong value)
-{
-       soup_soap_message_start_element (msg, name, prefix, NULL);
-       soup_soap_message_write_int (msg, value);
-       soup_soap_message_end_element (msg);
-}
-
-void
-e_gw_message_write_footer (SoupSoapMessage *msg)
-{
-       soup_soap_message_end_element (msg);
-       soup_soap_message_end_body (msg);
-       soup_soap_message_end_envelope (msg);
-
-       soup_soap_message_persist (msg);
-
-       if (g_getenv ("GROUPWISE_DEBUG") && (atoi (g_getenv ("GROUPWISE_DEBUG")) == 1)) {
-               const gchar *header = soup_message_headers_get (SOUP_MESSAGE (msg)->request_headers, "SOAPAction");
-
-               soup_buffer_free (soup_message_body_flatten (SOUP_MESSAGE (msg)->request_body));
-               if (header && g_str_equal (header, "loginRequest")) {
-                       gchar *body;
-                       gchar *begin = NULL;
-                       gchar *end = NULL;
-
-                       body = g_strdup (SOUP_MESSAGE (msg)->request_body->data);
-                       begin = g_strrstr (body, "<types:password>");
-                       if (begin)
-                               begin = begin + strlen ("<types:password>");
-                       end = g_strrstr (body , "</types:password>");
-                       if (begin && end) {
-                               gchar *tmp;
-                               for (tmp = begin; tmp < end; tmp++)
-                                       *tmp='X';
-
-                       }
-                       fputc ('\n', stdout);
-                       fputs (body, stdout);
-                       fputc ('\n', stdout);
-                       g_free (body);
-               }
-               else {
-
-                       /* print request's body */
-                       fputc ('\n', stdout);
-                       fputs (SOUP_MESSAGE (msg)->request_body->data, stdout);
-                       fputc ('\n', stdout);
-               }
-       }
-}
diff --git a/servers/groupwise/e-gw-message.h b/servers/groupwise/e-gw-message.h
deleted file mode 100644 (file)
index 541e6f6..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors :
- *  JP Rosevear <jpr@ximian.com>
- *  Rodrigo Moya <rodrigo@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- */
-
-#ifndef E_GW_MESSAGE_H
-#define E_GW_MESSAGE_H
-
-#include "soup-soap-message.h"
-
-G_BEGIN_DECLS
-
-SoupSoapMessage *e_gw_message_new_with_header (const gchar *uri, const gchar *session_id, const gchar *method_name);
-void             e_gw_message_write_string_parameter (SoupSoapMessage *msg, const gchar *name,
-                                                     const gchar *prefix, const gchar *value);
-void             e_gw_message_write_string_parameter_with_attribute (SoupSoapMessage *msg,
-                                                                    const gchar *name,
-                                                                    const gchar *prefix,
-                                                                    const gchar *value,
-                                                                    const gchar *attrubute_name,
-                                                                    const gchar *attribute_value);
-void             e_gw_message_write_base64_parameter (SoupSoapMessage *msg,
-                                                     const gchar *name,
-                                                     const gchar *prefix,
-                                                     const gchar *value);
-void e_gw_message_write_int_parameter (SoupSoapMessage *msg, const gchar *name, const gchar *prefix, glong value);
-
-void             e_gw_message_write_footer (SoupSoapMessage *msg);
-
-G_END_DECLS
-
-#endif
diff --git a/servers/groupwise/e-gw-proxy.c b/servers/groupwise/e-gw-proxy.c
deleted file mode 100644 (file)
index b260603..0000000
+++ /dev/null
@@ -1,382 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors :
- *  Sankar P <psankar@novell.com>
- *  Shreyas Srinivasan <sshreyas@novell.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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 "e-gw-proxy.h"
-#include "e-gw-message.h"
-
-void
-e_gw_proxy_construct_proxy_access_list (SoupSoapParameter *param, GList **proxy_list)
-{
-       /* parse the response and create the individual proxy accounts */
-       SoupSoapParameter *subparam;
-       SoupSoapParameter *type_param;
-       SoupSoapParameter *individual_rights;
-       gchar *value;
-
-       *proxy_list = NULL;
-       for (subparam = soup_soap_parameter_get_first_child_by_name (param, "entry");
-                       subparam != NULL;
-                       subparam = soup_soap_parameter_get_next_child_by_name (subparam, "entry")) {
-
-               proxyHandler *aclInstance;
-               aclInstance = (proxyHandler *) g_malloc0 (sizeof (proxyHandler));
-               aclInstance->permissions = 0;
-               aclInstance->flags = 0;
-               type_param = soup_soap_parameter_get_first_child_by_name (subparam, "email");
-               value = NULL;
-               if (type_param) {
-                       value = soup_soap_parameter_get_string_value (type_param);
-                       aclInstance->proxy_email = value;
-               }
-
-               type_param = soup_soap_parameter_get_first_child_by_name (subparam, "displayName");
-               value = NULL;
-               if (type_param) {
-                       value = soup_soap_parameter_get_string_value (type_param);
-                       aclInstance->proxy_name = value;
-               }
-               type_param = soup_soap_parameter_get_first_child_by_name (subparam, "id");
-               value = NULL;
-               if (type_param) {
-                       value = soup_soap_parameter_get_string_value (type_param);
-                       aclInstance->uniqueid = value;
-               } else
-                       aclInstance->uniqueid = NULL;
-
-               type_param = soup_soap_parameter_get_first_child_by_name (subparam, "mail");
-               value = NULL;
-               if (type_param) {
-                       individual_rights= soup_soap_parameter_get_first_child_by_name (type_param,"read");
-                       if (individual_rights) {
-                               aclInstance->permissions |= E_GW_PROXY_MAIL_READ;
-                       }
-                       individual_rights= soup_soap_parameter_get_first_child_by_name (type_param,"write");
-                       if (individual_rights) {
-                               aclInstance->permissions |= E_GW_PROXY_MAIL_WRITE;
-                       }
-               }
-
-               type_param = soup_soap_parameter_get_first_child_by_name (subparam, "appointment");
-               if (type_param) {
-                       individual_rights= soup_soap_parameter_get_first_child_by_name (type_param,"read");
-                       if (individual_rights) {
-                               aclInstance->permissions |= E_GW_PROXY_APPOINTMENT_READ;
-                       }
-                       individual_rights= soup_soap_parameter_get_first_child_by_name (type_param,"write");
-                       if (individual_rights) {
-                               aclInstance->permissions |= E_GW_PROXY_APPOINTMENT_WRITE;
-                       }
-               }
-
-               type_param = soup_soap_parameter_get_first_child_by_name (subparam, "task");
-               if (type_param) {
-                       individual_rights= soup_soap_parameter_get_first_child_by_name (type_param,"read");
-                       if (individual_rights) {
-                               aclInstance->permissions |= E_GW_PROXY_TASK_READ;
-                       }
-                       individual_rights= soup_soap_parameter_get_first_child_by_name (type_param,"write");
-                       if (individual_rights) {
-                               aclInstance->permissions |= E_GW_PROXY_TASK_WRITE;
-                       }
-               }
-
-               type_param = soup_soap_parameter_get_first_child_by_name (subparam, "note");
-               if (type_param) {
-                       individual_rights= soup_soap_parameter_get_first_child_by_name (type_param,"read");
-                       if (individual_rights) {
-                               aclInstance->permissions |= E_GW_PROXY_NOTES_READ;
-                       }
-                       individual_rights= soup_soap_parameter_get_first_child_by_name (type_param,"write");
-                       if (individual_rights) {
-                               aclInstance->permissions |= E_GW_PROXY_NOTES_WRITE;
-                       }
-               }
-
-               type_param = soup_soap_parameter_get_first_child_by_name (subparam, "misc");
-               if (type_param) {
-                       individual_rights= soup_soap_parameter_get_first_child_by_name (type_param,"alarms");
-                       if (individual_rights) {
-                               aclInstance->permissions |= E_GW_PROXY_GET_ALARMS;
-                       }
-                       individual_rights= soup_soap_parameter_get_first_child_by_name (type_param,"notify");
-                       if (individual_rights) {
-                               aclInstance->permissions |= E_GW_PROXY_GET_NOTIFICATIONS;
-                       }
-                       individual_rights= soup_soap_parameter_get_first_child_by_name (type_param,"setup");
-                       if (individual_rights) {
-                               aclInstance->permissions |= E_GW_PROXY_MODIFY_FOLDERS;
-                       }
-                       individual_rights= soup_soap_parameter_get_first_child_by_name (type_param,"readHidden");
-                       if (individual_rights) {
-                               aclInstance->permissions |= E_GW_PROXY_READ_PRIVATE;
-                       }
-               }
-
-               *proxy_list = g_list_append(*proxy_list, aclInstance);
-       }
-}
-
-void
-e_gw_proxy_construct_proxy_list (SoupSoapParameter *param, GList **proxy_info)
-{
-       SoupSoapParameter *subparam;
-       SoupSoapParameter *type_param;
-       gchar *value;
-
-       for (subparam = soup_soap_parameter_get_first_child_by_name (param, "proxy");
-                       subparam != NULL;
-                       subparam = soup_soap_parameter_get_next_child_by_name (subparam, "proxy"))
-       {
-
-               type_param = soup_soap_parameter_get_first_child_by_name (subparam, "displayName");
-               value = NULL;
-               if (type_param) {
-                       value = soup_soap_parameter_get_string_value (type_param);
-                       *proxy_info = g_list_append(*proxy_info, value);
-               }
-               type_param = soup_soap_parameter_get_first_child_by_name (subparam, "email");
-               value = NULL;
-               if (type_param) {
-                       value = soup_soap_parameter_get_string_value (type_param);
-                       *proxy_info = g_list_append(*proxy_info, value);
-               }
-       }
-}
-
-static void
-e_gw_proxy_form_soap_request_from_proxyHandler (SoupSoapMessage *msg, proxyHandler *new_proxy)
-{
-       gboolean added = FALSE;
-       e_gw_message_write_string_parameter (msg, "email", NULL, new_proxy->proxy_email);
-       e_gw_message_write_string_parameter (msg, "displayName", NULL, new_proxy->proxy_name);
-
-       if (new_proxy->permissions & E_GW_PROXY_MAIL_READ) {
-               added = TRUE;
-               soup_soap_message_start_element (msg, "mail", NULL, NULL);
-               e_gw_message_write_int_parameter (msg, "read", NULL, 1);
-       }
-       if (new_proxy->permissions & E_GW_PROXY_MAIL_WRITE) {
-               if (added == FALSE) {
-                       added=TRUE;
-                       soup_soap_message_start_element (msg, "mail", NULL, NULL);
-               }
-               e_gw_message_write_int_parameter (msg, "write", NULL, 1);
-       }
-       if (added == TRUE)
-               soup_soap_message_end_element (msg);
-
-       added = FALSE;
-       if (new_proxy->permissions & E_GW_PROXY_APPOINTMENT_READ) {
-               added=TRUE;
-               soup_soap_message_start_element (msg, "appointment", NULL, NULL);
-               e_gw_message_write_int_parameter (msg, "read", NULL, 1);
-       }
-       if (new_proxy->permissions & E_GW_PROXY_APPOINTMENT_WRITE) {
-               if (added == FALSE)
-               {
-                       added=TRUE;
-                       soup_soap_message_start_element (msg, "appointment", NULL, NULL);
-               }
-               e_gw_message_write_int_parameter (msg, "write", NULL, 1);
-       }
-       if (added == TRUE)
-               soup_soap_message_end_element  (msg);
-
-       added = FALSE;
-       if (new_proxy->permissions & E_GW_PROXY_TASK_READ) {
-               added=TRUE;
-               soup_soap_message_start_element (msg, "task", NULL, NULL);
-               e_gw_message_write_int_parameter (msg, "read", NULL, 1);
-       }
-       if (new_proxy->permissions & E_GW_PROXY_TASK_WRITE) {
-               if (added == FALSE)
-               {
-                       added=TRUE;
-                       soup_soap_message_start_element (msg, "task", NULL, NULL);
-               }
-               e_gw_message_write_int_parameter (msg, "write", NULL, 1);
-       }
-       if (added == TRUE)
-               soup_soap_message_end_element (msg);
-
-       added = FALSE;
-       if (new_proxy->permissions & E_GW_PROXY_NOTES_READ) {
-               added=TRUE;
-               soup_soap_message_start_element (msg, "note", NULL, NULL);
-               e_gw_message_write_int_parameter (msg, "read", NULL, 1);
-       }
-       if (new_proxy->permissions & E_GW_PROXY_NOTES_WRITE) {
-               if (added==FALSE)
-               {
-                       added=TRUE;
-                       soup_soap_message_start_element (msg, "note", NULL, NULL);
-               }
-               e_gw_message_write_int_parameter (msg, "write", NULL, 1);
-       }
-       if (added == TRUE)
-               soup_soap_message_end_element (msg);
-
-       added = FALSE;
-       if (new_proxy->permissions & E_GW_PROXY_GET_ALARMS) {
-               added=TRUE;
-               soup_soap_message_start_element(msg,"misc",NULL,NULL);
-               e_gw_message_write_int_parameter (msg, "alarms", NULL, 1);
-       }
-       if (new_proxy->permissions & E_GW_PROXY_GET_NOTIFICATIONS) {
-               if (added!=TRUE)
-               {
-                       added=TRUE;
-                       soup_soap_message_start_element(msg,"misc",NULL,NULL);
-               }
-               e_gw_message_write_int_parameter (msg, "notify", NULL, 1);
-       }
-
-       if (new_proxy->permissions & E_GW_PROXY_MODIFY_FOLDERS) {
-               if (added!=TRUE)
-               {
-                       added=TRUE;
-                       soup_soap_message_start_element(msg,"misc",NULL,NULL);
-               }
-               e_gw_message_write_int_parameter (msg, "setup", NULL, 1);
-       }
-       if (new_proxy->permissions & E_GW_PROXY_READ_PRIVATE) {
-               if (added!=TRUE)
-               {
-                       added=TRUE;
-                       soup_soap_message_start_element(msg,"misc",NULL,NULL);
-               }
-               e_gw_message_write_int_parameter (msg, "readHidden", NULL, 1);
-       }
-       if (added==TRUE)
-               soup_soap_message_end_element (msg);
-
-}
-
-void
-e_gw_proxy_form_proxy_add_msg (SoupSoapMessage *msg, proxyHandler *new_proxy)
-{
-       soup_soap_message_start_element (msg, "entry", NULL, NULL);
-
-       e_gw_proxy_form_soap_request_from_proxyHandler (msg, new_proxy);
-}
-
-void
-e_gw_proxy_form_proxy_remove_msg (SoupSoapMessage *msg, proxyHandler *removeProxy)
-{
-       e_gw_message_write_string_parameter (msg, "id", NULL, removeProxy->uniqueid);
-}
-
-void
-e_gw_proxy_form_modify_proxy_msg (SoupSoapMessage *msg, proxyHandler *new_proxy)
-{
-       soup_soap_message_start_element (msg, "updates", NULL, NULL);
-
-       soup_soap_message_start_element (msg, "delete", NULL, NULL);
-       soup_soap_message_end_element (msg);
-
-       soup_soap_message_start_element (msg, "add", NULL, NULL);
-       e_gw_proxy_form_soap_request_from_proxyHandler (msg, new_proxy);
-       soup_soap_message_end_element (msg);
-
-       soup_soap_message_end_element (msg);
-}
-
-void
-e_gw_proxy_parse_proxy_login_response (SoupSoapParameter *param, gint *permissions)
-{
-       SoupSoapParameter *subparam;
-       SoupSoapParameter *individual_rights;
-
-       *permissions = 0;
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "mail");
-       if (subparam) {
-               individual_rights= soup_soap_parameter_get_first_child_by_name (subparam,"read");
-               if (individual_rights) {
-                       *permissions |= E_GW_PROXY_MAIL_READ;
-               }
-               individual_rights= soup_soap_parameter_get_first_child_by_name (subparam,"write");
-               if (individual_rights) {
-                       *permissions |= E_GW_PROXY_MAIL_WRITE;
-               }
-       }
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "appointment");
-       if (subparam) {
-               individual_rights= soup_soap_parameter_get_first_child_by_name (subparam,"read");
-               if (individual_rights) {
-                       *permissions |= E_GW_PROXY_APPOINTMENT_READ;
-               }
-               individual_rights= soup_soap_parameter_get_first_child_by_name (subparam,"write");
-               if (individual_rights) {
-                       *permissions |= E_GW_PROXY_APPOINTMENT_WRITE;
-               }
-       }
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "task");
-       if (subparam)   {
-               individual_rights= soup_soap_parameter_get_first_child_by_name (subparam,"read");
-               if (individual_rights) {
-                       *permissions |= E_GW_PROXY_TASK_READ;
-               }
-               individual_rights= soup_soap_parameter_get_first_child_by_name (subparam,"write");
-               if (individual_rights) {
-                       *permissions |= E_GW_PROXY_TASK_WRITE;
-               }
-       }
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "note");
-       if (subparam)   {
-               individual_rights= soup_soap_parameter_get_first_child_by_name (subparam,"read");
-               if (individual_rights) {
-                       *permissions |= E_GW_PROXY_NOTES_READ;
-               }
-               individual_rights= soup_soap_parameter_get_first_child_by_name (subparam,"write");
-               if (individual_rights) {
-                       *permissions |= E_GW_PROXY_NOTES_WRITE;
-               }
-       }
-
-       subparam = soup_soap_parameter_get_first_child_by_name (param, "misc");
-       if (subparam)   {
-               individual_rights= soup_soap_parameter_get_first_child_by_name (subparam,"alarms");
-               if (individual_rights) {
-                       *permissions |= E_GW_PROXY_GET_ALARMS;
-               }
-               individual_rights= soup_soap_parameter_get_first_child_by_name (subparam,"notify");
-               if (individual_rights) {
-                       *permissions |= E_GW_PROXY_GET_NOTIFICATIONS;
-               }
-               individual_rights= soup_soap_parameter_get_first_child_by_name (subparam,"setup");
-               if (individual_rights) {
-                       *permissions |= E_GW_PROXY_MODIFY_FOLDERS;
-               }
-               individual_rights= soup_soap_parameter_get_first_child_by_name (subparam,"readHidden");
-               if (individual_rights) {
-                       *permissions |= E_GW_PROXY_READ_PRIVATE;
-               }
-       }
-}
diff --git a/servers/groupwise/e-gw-proxy.h b/servers/groupwise/e-gw-proxy.h
deleted file mode 100644 (file)
index bebe29b..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors :
- *  Shreyas Srinivasan <sshreyas@novell.com>
- *  Sankar P <psankar@novell.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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 "soup-soap-message.h"
-
-/*State of each proxy grant*/
-
-#define E_GW_PROXY_NEW           (1 << 0)
-#define E_GW_PROXY_DELETED       (1 << 1)
-#define E_GW_PROXY_EDITED          (1 << 2)
-
-/*Permissions associated with a proxy grant*/
-#define E_GW_PROXY_MAIL_READ                (1 << 0)
-#define E_GW_PROXY_MAIL_WRITE               (1 << 1)
-#define E_GW_PROXY_APPOINTMENT_READ         (1 << 2)
-#define E_GW_PROXY_APPOINTMENT_WRITE        (1 << 3)
-#define E_GW_PROXY_NOTES_READ               (1 << 4)
-#define E_GW_PROXY_NOTES_WRITE              (1 << 5)
-#define E_GW_PROXY_TASK_READ                (1 << 6)
-#define E_GW_PROXY_TASK_WRITE               (1 << 7)
-#define E_GW_PROXY_GET_ALARMS               (1 << 8)
-#define E_GW_PROXY_GET_NOTIFICATIONS        (1 << 9)
-#define E_GW_PROXY_MODIFY_FOLDERS           (1 << 10)
-#define E_GW_PROXY_READ_PRIVATE             (1 << 11)
-
-struct _proxyHandler {
-    gchar *uniqueid;
-    gchar *proxy_name;
-    gchar *proxy_email;
-    guint32 flags;
-    guint32 permissions;
-};
-
-typedef struct _proxyHandler proxyHandler;
-
-void e_gw_proxy_construct_proxy_access_list (SoupSoapParameter *param, GList **proxy_list);
-void e_gw_proxy_construct_proxy_list (SoupSoapParameter *param, GList **proxy_info);
-void e_gw_proxy_form_proxy_add_msg (SoupSoapMessage *msg, proxyHandler *new_proxy);
-void e_gw_proxy_form_proxy_remove_msg (SoupSoapMessage *msg, proxyHandler *removeProxy);
-void e_gw_proxy_form_modify_proxy_msg (SoupSoapMessage *msg, proxyHandler *new_proxy);
-void e_gw_proxy_parse_proxy_login_response (SoupSoapParameter *param, gint *permissions);
-
diff --git a/servers/groupwise/e-gw-recur-utils.c b/servers/groupwise/e-gw-recur-utils.c
deleted file mode 100644 (file)
index 7a98a6f..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors :
- *    Harish Krishnaswamy <kharish@novell.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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 "e-gw-recur-utils.h"
-
-static const gchar *days_of_week[7] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
-
-const gchar *
-e_gw_recur_get_day_of_week (gshort day)
-{
-
-       if (day < 1 || day > 7)
-               return "";
-       return days_of_week[day-1];
-}
-
diff --git a/servers/groupwise/e-gw-recur-utils.h b/servers/groupwise/e-gw-recur-utils.h
deleted file mode 100644 (file)
index 47239f1..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors :
- *     Harish Krishnaswamy <kharish@novell.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- */
-
-#ifndef E_GW_RECUR_UTILS_H
-#define E_GW_RECUR_UTILS_H
-
-#include <glib.h>
-
-#define E_GW_ITEM_RECURRENCE_FREQUENCY_DAILY "Daily"
-#define E_GW_ITEM_RECURRENCE_FREQUENCY_WEEKLY "Weekly"
-#define E_GW_ITEM_RECURRENCE_FREQUENCY_MONTHLY "Monthly"
-#define E_GW_ITEM_RECURRENCE_FREQUENCY_YEARLY "Yearly"
-
-#define E_GW_ITEM_RECUR_OCCURRENCE_TYPE_FIRST  "First"
-#define E_GW_ITEM_RECUR_OCCURRENCE_TYPE_SECOND "Second"
-#define E_GW_ITEM_RECUR_OCCURRENCE_TYPE_THIRD  "Third"
-#define E_GW_ITEM_RECUR_OCCURRENCE_TYPE_FOURTH "Fourth"
-#define E_GW_ITEM_RECUR_OCCURRENCE_TYPE_FIFTH  "Fifth"
-#define E_GW_ITEM_RECUR_OCCURRENCE_TYPE_LAST   "Last"
-
-/* XXX - an array would probably be better */
-#define E_GW_ITEM_RECUR_WEEKDAY_SUNDAY "Sunday"
-#define E_GW_ITEM_RECUR_WEEKDAY_MONDAY "Monday"
-#define E_GW_ITEM_RECUR_WEEKDAY_TUESDAY "Tuesday"
-#define E_GW_ITEM_RECUR_WEEKDAY_WEDNESDAY "Wednesday"
-#define E_GW_ITEM_RECUR_WEEKDAY_THURSDAY "Thursday"
-#define E_GW_ITEM_RECUR_WEEKDAY_FRIDAY "Friday"
-#define E_GW_ITEM_RECUR_WEEKDAY_SATURDAY "Saturday"
-
-#define E_GW_ITEM_BY_DAY_SIZE 364 /* 7 days * 52 weeks */
-#define E_GW_ITEM_BY_MONTHDAY_SIZE 32
-#define E_GW_ITEM_BY_YEARDAY_SIZE 367
-#define E_GW_ITEM_BY_MONTH_SIZE 13
-#define E_GW_ITEM_BY_SETPOS_SIZE 367
-
-typedef struct {
-       const gchar *frequency;
-       gchar *until;
-       gint count;
-       gint interval;
-       gshort by_day[E_GW_ITEM_BY_DAY_SIZE];
-       gshort by_month_day[E_GW_ITEM_BY_MONTHDAY_SIZE];
-       gshort by_year_day[E_GW_ITEM_BY_YEARDAY_SIZE];
-       gshort by_month[E_GW_ITEM_BY_MONTH_SIZE];
-       gshort by_setpos[E_GW_ITEM_BY_SETPOS_SIZE];
-} EGwItemRecurrenceRule;
-
-#define E_GW_ITEM_RECUR_END_MARKER  0x7f7f
-
-const gchar *e_gw_recur_get_day_of_week (gshort day);
-
-#endif
diff --git a/servers/groupwise/e-gw-sendoptions.c b/servers/groupwise/e-gw-sendoptions.c
deleted file mode 100644 (file)
index aace978..0000000
+++ /dev/null
@@ -1,631 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors :
- *  JP Rosevear <jpr@ximian.com>
- *  Rodrigo Moya <rodrigo@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; 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 "e-gw-connection.h"
-#include "e-gw-sendoptions.h"
-#include "e-gw-message.h"
-
-G_DEFINE_TYPE (EGwSendOptions, e_gw_sendoptions, G_TYPE_OBJECT)
-
-struct _EGwSendOptionsPrivate {
-       EGwSendOptionsGeneral *gopts;
-       EGwSendOptionsStatusTracking *mopts;
-       EGwSendOptionsStatusTracking *copts;
-       EGwSendOptionsStatusTracking *topts;
-};
-
-static GObjectClass *parent_class = NULL;
-
-static gboolean e_gw_sendoptions_store_settings (SoupSoapParameter *param, EGwSendOptions *opts);
-
-EGwSendOptionsGeneral*
-e_gw_sendoptions_get_general_options (EGwSendOptions *opts)
-{
-       g_return_val_if_fail (opts != NULL || E_IS_GW_SENDOPTIONS (opts), NULL);
-
-       return opts->priv->gopts;
-}
-
-EGwSendOptionsStatusTracking*
-e_gw_sendoptions_get_status_tracking_options (EGwSendOptions *opts, const gchar *type)
-{
-       g_return_val_if_fail (opts != NULL || E_IS_GW_SENDOPTIONS (opts), NULL);
-       g_return_val_if_fail (type != NULL, NULL);
-
-       if (!g_ascii_strcasecmp (type, "mail"))
-               return opts->priv->mopts;
-       else if (!g_ascii_strcasecmp (type, "calendar"))
-               return opts->priv->copts;
-       else if (!g_ascii_strcasecmp (type, "task"))
-               return opts->priv->topts;
-       else
-               return NULL;
-}
-
-static void
-e_gw_sendoptions_dispose (GObject *object)
-{
-       EGwSendOptions *opts = (EGwSendOptions *) object;
-
-       g_return_if_fail (E_IS_GW_SENDOPTIONS (opts));
-
-       if (parent_class->dispose)
-               (* parent_class->dispose) (object);
-}
-
-static void
-e_gw_sendoptions_finalize (GObject *object)
-{
-       EGwSendOptions *opts = (EGwSendOptions *) object;
-       EGwSendOptionsPrivate *priv;
-
-       g_return_if_fail (E_IS_GW_SENDOPTIONS (opts));
-
-       priv = opts->priv;
-
-       if (priv->gopts) {
-               g_free (priv->gopts);
-               priv->gopts = NULL;
-       }
-
-       if (priv->mopts) {
-               g_free (priv->mopts);
-               priv->mopts = NULL;
-       }
-
-       if (priv->copts) {
-               g_free (priv->copts);
-               priv->copts = NULL;
-       }
-
-       if (priv->topts) {
-               g_free (priv->topts);
-               priv->topts = NULL;
-       }
-
-       if (priv) {
-               g_free (priv);
-               opts->priv = NULL;
-       }
-
-       if (parent_class->finalize)
-               (* parent_class->finalize) (object);
-}
-
-static void
-e_gw_sendoptions_class_init (EGwSendOptionsClass *klass)
-{
-       GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-       parent_class = g_type_class_peek_parent (klass);
-
-       object_class->dispose = e_gw_sendoptions_dispose;
-       object_class->finalize = e_gw_sendoptions_finalize;
-}
-
-static void
-e_gw_sendoptions_init (EGwSendOptions *opts)
-{
-       EGwSendOptionsPrivate *priv;
-
-       /* allocate internal structure */
-       priv = g_new0 (EGwSendOptionsPrivate, 1);
-       priv->gopts = g_new0 (EGwSendOptionsGeneral, 1);
-       priv->mopts = g_new0 (EGwSendOptionsStatusTracking, 1);
-       priv->copts = g_new0 (EGwSendOptionsStatusTracking, 1);
-       priv->topts = g_new0 (EGwSendOptionsStatusTracking, 1);
-       opts->priv = priv;
-}
-
-static void
-parse_status_tracking_options (SoupSoapParameter *group_param, guint i, EGwSendOptionsStatusTracking *sopts)
-{
-       SoupSoapParameter *subparam, *field_param, *val_param;
-
-       for (subparam = soup_soap_parameter_get_first_child_by_name(group_param, "setting");
-                            subparam != NULL;
-                            subparam = soup_soap_parameter_get_next_child_by_name (subparam, "setting")) {
-
-               gchar *field = NULL, *val = NULL;
-               field_param = soup_soap_parameter_get_first_child_by_name (subparam, "field");
-               val_param = soup_soap_parameter_get_first_child_by_name (subparam, "value");
-
-               if (field_param) {
-                       field = soup_soap_parameter_get_string_value (field_param);
-                       if (!field)
-                               continue;
-               } else
-                       continue;
-
-               if (!g_ascii_strcasecmp (field + i, "StatusInfo")) {
-                       if (val_param)
-                               val = soup_soap_parameter_get_string_value (val_param);
-
-                       if (val) {
-                               sopts->tracking_enabled = TRUE;
-                               if (!strcmp (val, "Delivered"))
-                                       sopts->track_when = E_GW_DELIVERED;
-                               if (!strcmp (val, "DeliveredAndOpened"))
-                                       sopts->track_when = E_GW_DELIVERED_OPENED;
-                               if (!strcmp (val, "Full"))
-                                       sopts->track_when = E_GW_ALL;
-                               if (!strcmp (val, "None"))
-                                       sopts->tracking_enabled = FALSE;
-                       } else
-                               sopts->tracking_enabled = FALSE;
-
-               } else  if (!g_ascii_strcasecmp (field + i, "AutoDelete")) {
-                       if (val_param)
-                               val = soup_soap_parameter_get_string_value (val_param);
-
-                       if (val) {
-                               if (!strcmp (val, "1"))
-                                       sopts->autodelete = TRUE;
-                               else
-                                       sopts->autodelete = FALSE;
-                       } else
-                               sopts->autodelete = FALSE;
-
-               } else if (!g_ascii_strcasecmp (field + i, "ReturnOpen")) {
-                       if (val_param)
-                               val_param = soup_soap_parameter_get_first_child_by_name (val_param, "mail");
-                       if (val_param)
-                               val = soup_soap_parameter_get_string_value (val_param);
-
-                       if (val && !strcmp (val, "1")) {
-                               sopts->opened = E_GW_RETURN_NOTIFY_MAIL;
-                       } else
-                               sopts->opened = E_GW_RETURN_NOTIFY_NONE;
-
-               } else if (!g_ascii_strcasecmp (field + i, "ReturnDelete")) {
-                       if (val_param)
-                               val_param = soup_soap_parameter_get_first_child_by_name (val_param, "mail");
-
-                       if (val_param)
-                               val = soup_soap_parameter_get_string_value (val_param);
-
-                       if (val && !strcmp (val, "1")) {
-                               sopts->declined = E_GW_RETURN_NOTIFY_MAIL;
-                       } else
-                               sopts->declined = E_GW_RETURN_NOTIFY_NONE;
-
-               } else if (!g_ascii_strcasecmp (field + i, "ReturnAccept")) {
-                       if (val_param)
-                               val_param = soup_soap_parameter_get_first_child_by_name (val_param, "mail");
-
-                       if (val_param)
-                               val = soup_soap_parameter_get_string_value (val_param);
-
-                       if (val && !strcmp (val, "1")) {
-                               sopts->accepted = E_GW_RETURN_NOTIFY_MAIL;
-                       } else
-                               sopts->accepted = E_GW_RETURN_NOTIFY_NONE;
-
-               } else if (!g_ascii_strcasecmp (field + i, "ReturnCompleted")) {
-                       if (val_param)
-                               val_param = soup_soap_parameter_get_first_child_by_name (val_param, "mail");
-
-                       if (val_param)
-                               val = soup_soap_parameter_get_string_value (val_param);
-
-                       if (val && !strcmp (val, "1")) {
-                               sopts->completed = E_GW_RETURN_NOTIFY_MAIL;
-                       } else
-                               sopts->completed = E_GW_RETURN_NOTIFY_NONE;
-
-               }
-               g_free (field);
-               g_free (val);
-       }
-}
-
-/* These are not actually general Options. These can be configured seperatly for
-   each component. Since win32 shows them as general options, we too do the same
-   way. So the Options are take from the mail setttings */
-
-static void
-parse_general_options (SoupSoapParameter *group_param, EGwSendOptionsGeneral *gopts)
-{
-       SoupSoapParameter *subparam, *field_param, *val_param;
-
-       for (subparam = soup_soap_parameter_get_first_child_by_name(group_param, "setting");
-                            subparam != NULL;
-                            subparam = soup_soap_parameter_get_next_child_by_name (subparam, "setting")) {
-               gchar *field = NULL, *val = NULL;
-               field_param = soup_soap_parameter_get_first_child_by_name (subparam, "field");
-               val_param = soup_soap_parameter_get_first_child_by_name (subparam, "value");
-
-               if (field_param) {
-                       field = soup_soap_parameter_get_string_value (field_param);
-                       if (!field)
-                               continue;
-               } else
-                       continue;
-
-               if (!g_ascii_strcasecmp (field, "mailPriority")) {
-                       if (val_param)
-                               val = soup_soap_parameter_get_string_value (val_param);
-
-                       if (val) {
-                               if (!g_ascii_strcasecmp (val, "High"))
-                                       gopts->priority = E_GW_PRIORITY_HIGH;
-                               else if (!g_ascii_strcasecmp (val, "Standard")) {
-                                       gopts->priority = E_GW_PRIORITY_STANDARD;
-                               } else if (!g_ascii_strcasecmp (val, "Low"))
-                                       gopts->priority = E_GW_PRIORITY_LOW;
-                               else
-                                       gopts->priority = E_GW_PRIORITY_UNDEFINED;
-
-                       } else
-                               gopts->priority = E_GW_PRIORITY_UNDEFINED;
-               } else if (!g_ascii_strcasecmp (field, "mailReplyRequested")) {
-                      if (val_param)
-                               val = soup_soap_parameter_get_string_value (val_param);
-
-                       if (val) {
-                               if (!g_ascii_strcasecmp (val, "None"))
-                                       gopts->reply_enabled = FALSE;
-                               else if (!g_ascii_strcasecmp (val, "WhenConvenient")) {
-                                       gopts->reply_enabled = TRUE;
-                                       gopts->reply_convenient = TRUE;
-                               } else {
-                                       gchar *temp;
-                                       gint i = 0;
-
-                                       val_param = soup_soap_parameter_get_first_child_by_name (val_param, "WithinNDays");
-                                       temp = soup_soap_parameter_get_string_value (val_param);
-
-                                       if (temp)
-                                               i = atoi (temp);
-
-                                       gopts->reply_within = i;
-                                       gopts->reply_enabled = TRUE;
-                                       g_free (temp);
-                               }
-                       }
-               } else if (!g_ascii_strcasecmp (field, "mailExpireDays")) {
-                       if (val_param)
-                               val = soup_soap_parameter_get_string_value (val_param);
-
-                       if (val) {
-                               gint i = atoi (val);
-                               if (i != 0)
-                                       gopts->expiration_enabled = TRUE;
-                               else
-                                       gopts->expiration_enabled = FALSE;
-
-                               gopts->expire_after = i;
-                       } else
-                               gopts->expiration_enabled = FALSE;
-               }
-               g_free (field);
-               g_free (val);
-       }
-}
-
-/* These settings are common to all components */
-
-static void
-parse_advanced_settings (SoupSoapParameter *group_param, EGwSendOptionsGeneral *gopts)
-{
-       SoupSoapParameter *subparam, *field_param, *val_param;
-
-       for (subparam = soup_soap_parameter_get_first_child_by_name(group_param, "setting");
-                            subparam != NULL;
-                            subparam = soup_soap_parameter_get_next_child_by_name (subparam, "setting")) {
-               gchar *field = NULL, *val = NULL;
-               field_param = soup_soap_parameter_get_first_child_by_name (subparam, "field");
-               val_param = soup_soap_parameter_get_first_child_by_name (subparam, "value");
-
-               if (field_param) {
-                       field = soup_soap_parameter_get_string_value (field_param);
-                       if (!field)
-                               continue;
-               } else
-                       continue;
-
-               if (!g_ascii_strcasecmp (field, "delayDelivery")) {
-                       if (val_param)
-                               val = soup_soap_parameter_get_string_value (val_param);
-                       if (val) {
-                               gint i = atoi (val);
-                               if (i > 0 ) {
-                                       gopts->delay_enabled = TRUE;
-                                       gopts->delay_until = i;
-                               } else
-                                       gopts->delay_enabled = FALSE;
-                       } else
-                               gopts->delay_enabled = FALSE;
-               }
-
-               g_free (field);
-               g_free (val);
-       }
-}
-
-/* TODO have to handle the locked settings */
-static gboolean
-e_gw_sendoptions_store_settings (SoupSoapParameter *param, EGwSendOptions *opts)
-{
-       SoupSoapParameter *group_param;
-       EGwSendOptionsPrivate *priv;
-
-       priv = opts->priv;
-
-       for (group_param = soup_soap_parameter_get_first_child_by_name(param, "group");
-                            group_param != NULL;
-                            group_param = soup_soap_parameter_get_next_child_by_name (group_param, "group")) {
-               gchar *temp = NULL;
-
-               temp = soup_soap_parameter_get_property (group_param, "type");
-
-               if (!temp)
-                       continue;
-
-               if (!g_ascii_strcasecmp (temp, "MailMessageSettings")) {
-                       parse_status_tracking_options (group_param, 4, priv->mopts);
-                       parse_general_options (group_param, priv->gopts);
-               }
-
-               if (!g_ascii_strcasecmp (temp, "AppointmentMessageSettings")) {
-                       parse_status_tracking_options (group_param, 11, priv->copts);
-               }
-               if (!g_ascii_strcasecmp (temp, "TaskMessageSettings"))
-                       parse_status_tracking_options (group_param, 4, priv->topts);
-
-               if (!g_ascii_strcasecmp (temp, "AdvancedSettings"))
-                       parse_advanced_settings (group_param, priv->gopts);
-
-               g_free (temp);
-       }
-
-       return TRUE;
-}
-
-static void
-e_gw_sendoptions_write_settings (SoupSoapMessage *msg, const gchar *field_name, const gchar *value, const gchar *value_name, gboolean value_direct)
-{
-       soup_soap_message_start_element (msg, "setting", NULL, NULL);
-
-       soup_soap_message_start_element (msg, "field", NULL, NULL);
-       soup_soap_message_write_string (msg, field_name);
-       soup_soap_message_end_element (msg);
-
-       soup_soap_message_start_element (msg, "value", NULL, NULL);
-
-       if (!value_direct)
-               e_gw_message_write_string_parameter (msg, value_name, NULL, value);
-       else
-               soup_soap_message_write_string (msg, value);
-
-       soup_soap_message_end_element (msg);
-
-       soup_soap_message_end_element (msg);
-}
-
-static void
-set_status_tracking_changes (SoupSoapMessage *msg, EGwSendOptionsStatusTracking *n_sopts, EGwSendOptionsStatusTracking *o_sopts, const gchar *comp)
-{
-       gchar *value, *comp_name = NULL;
-
-       if (n_sopts->tracking_enabled != o_sopts->tracking_enabled || n_sopts->track_when != o_sopts->track_when) {
-               if (n_sopts->tracking_enabled) {
-                       if (n_sopts->track_when == E_GW_DELIVERED)
-                               value = g_strdup ("Delivered");
-                       else if (n_sopts->track_when == E_GW_DELIVERED_OPENED)
-                               value = g_strdup ("DeliveredAndOpened");
-                       else
-                               value = g_strdup ("Full");
-               } else
-                       value = g_strdup ("None");
-               comp_name = g_strconcat (comp, "StatusInfo", NULL);
-               e_gw_sendoptions_write_settings (msg, comp_name, value, NULL, TRUE);
-               g_free (comp_name), comp_name = NULL;
-               g_free (value), value = NULL;
-       }
-
-       if (!strcmp (comp, "mail")) {
-               if (n_sopts->autodelete != o_sopts->autodelete) {
-                       if (n_sopts->autodelete)
-                               value = g_strdup ("1");
-                       else
-                               value = g_strdup ("0");
-                       comp_name = g_strconcat (comp, "AutoDelete", NULL);
-                       e_gw_sendoptions_write_settings (msg, comp_name, value, NULL, TRUE);
-                       g_free (comp_name), comp_name = NULL;
-                       g_free (value), value = NULL;
-               }
-       }
-
-       if (n_sopts->opened != o_sopts->opened) {
-               comp_name = g_strconcat (comp, "ReturnOpen", NULL);
-               if (n_sopts->opened == E_GW_RETURN_NOTIFY_MAIL) {
-                       value = g_strdup ("1");
-                       e_gw_sendoptions_write_settings (msg, comp_name, value, "mail", FALSE);
-               } else {
-                       value = g_strdup ("None");
-                       e_gw_sendoptions_write_settings (msg, comp_name, value, NULL, TRUE);
-               }
-
-               g_free (comp_name), comp_name = NULL;
-               g_free (value), value = NULL;
-       }
-
-       if (n_sopts->declined != o_sopts->declined) {
-               comp_name = g_strconcat (comp, "ReturnDelete", NULL);
-               if (n_sopts->declined == E_GW_RETURN_NOTIFY_MAIL) {
-                       value = g_strdup ("1");
-                       e_gw_sendoptions_write_settings (msg, comp_name, value, "mail", FALSE);
-               } else {
-                       value = g_strdup ("None");
-                       e_gw_sendoptions_write_settings (msg, comp_name, value, NULL, TRUE);
-               }
-
-               g_free (comp_name), comp_name = NULL;
-               g_free (value), value = NULL;
-       }
-
-       if (!strcmp (comp, "appointment") || !strcmp (comp, "task")) {
-               if (n_sopts->accepted != o_sopts->accepted) {
-                       comp_name = g_strconcat (comp, "ReturnAccept", NULL);
-                       if (n_sopts->accepted == E_GW_RETURN_NOTIFY_MAIL) {
-                               value = g_strdup ("1");
-                               e_gw_sendoptions_write_settings (msg, comp_name, value, "mail", FALSE);
-                       } else {
-                               value = g_strdup ("None");
-                               e_gw_sendoptions_write_settings (msg, comp_name, value, NULL, TRUE);
-                       }
-
-                       g_free (comp_name), comp_name = NULL;
-                       g_free (value), value = NULL;
-               }
-       }
-
-       if (!strcmp (comp, "task")) {
-               if (n_sopts->completed != o_sopts->completed) {
-                       comp_name = g_strconcat (comp, "ReturnCompleted", NULL);
-                       if (n_sopts->completed == E_GW_RETURN_NOTIFY_MAIL) {
-                               value = g_strdup ("1");
-                               e_gw_sendoptions_write_settings (msg, comp_name, value, "mail", FALSE);
-                       } else {
-                               value = g_strdup ("None");
-                               e_gw_sendoptions_write_settings (msg, comp_name, value, NULL, TRUE);
-                       }
-
-                       g_free (comp_name), comp_name = NULL;
-                       g_free (value), value = NULL;
-               }
-       }
-
-}
-
-static void
-set_general_options_changes (SoupSoapMessage *msg, EGwSendOptionsGeneral *n_gopts, EGwSendOptionsGeneral *o_gopts)
-{
-       gchar *value;
-
-       if (n_gopts->priority != o_gopts->priority) {
-               if (n_gopts->priority == E_GW_PRIORITY_HIGH)
-                       value = g_strdup ("High");
-               else if (n_gopts->priority == E_GW_PRIORITY_STANDARD)
-                       value = g_strdup ("Standard");
-               else if (n_gopts->priority == E_GW_PRIORITY_LOW)
-                       value = g_strdup ("Low");
-               else
-                       value = NULL;
-               e_gw_sendoptions_write_settings (msg, "mailPriority", value, NULL, TRUE);
-               e_gw_sendoptions_write_settings (msg, "appointmentPriority", value, NULL, TRUE);
-               e_gw_sendoptions_write_settings (msg, "taskPriority", value, NULL, TRUE);
-               g_free (value), value = NULL;
-       }
-
-       if (n_gopts->reply_enabled != o_gopts->reply_enabled || n_gopts->reply_convenient != o_gopts->reply_convenient ||
-                       n_gopts->reply_within != o_gopts->reply_within) {
-
-               if (n_gopts->reply_enabled) {
-                       if (n_gopts->reply_convenient)
-                               value = g_strdup ("WhenConvenient");
-                       else
-                               value = g_strdup_printf ("%d", n_gopts->reply_within);
-               } else
-                       value = g_strdup ("None");
-
-               if (n_gopts->reply_enabled && !n_gopts->reply_convenient)
-                       e_gw_sendoptions_write_settings (msg, "mailReplyRequested", value, "WithinNDays" , FALSE);
-               else
-                       e_gw_sendoptions_write_settings (msg, "mailReplyRequested", value, NULL, TRUE);
-
-               g_free (value), value = NULL;
-       }
-
-       if (n_gopts->expiration_enabled != o_gopts->expiration_enabled || n_gopts->expire_after != o_gopts->expire_after) {
-               if (n_gopts->expiration_enabled) {
-                       value = g_strdup_printf ("%d", n_gopts->expire_after);
-               } else
-                       value = g_strdup ("0");
-
-               e_gw_sendoptions_write_settings (msg, "mailExpireDays", value, NULL, TRUE);
-               g_free (value), value = NULL;
-       }
-
-       if (n_gopts->delay_enabled != o_gopts->delay_enabled || n_gopts->delay_until != o_gopts->delay_until) {
-               if (n_gopts->delay_enabled) {
-                       value = g_strdup_printf ("%d", n_gopts->delay_until);
-               } else
-                       value = g_strdup ("-1");
-
-               e_gw_sendoptions_write_settings (msg, "delayDelivery", value, NULL, TRUE);
-               g_free (value), value = NULL;
-       }
-}
-
-/* n_opts has the new options, o_opts has the old options settings */
-gboolean
-e_gw_sendoptions_form_message_to_modify (SoupSoapMessage *msg, EGwSendOptions *n_opts, EGwSendOptions *o_opts)
-{
-       g_return_val_if_fail (n_opts != NULL || o_opts != NULL, FALSE);
-       g_return_val_if_fail (E_IS_GW_SENDOPTIONS (n_opts) || E_IS_GW_SENDOPTIONS (o_opts), FALSE);
-
-       soup_soap_message_start_element (msg, "settings", NULL, NULL);
-
-       set_general_options_changes (msg, n_opts->priv->gopts, o_opts->priv->gopts);
-       set_status_tracking_changes (msg, n_opts->priv->mopts, o_opts->priv->mopts, "mail");
-       set_status_tracking_changes (msg, n_opts->priv->copts, o_opts->priv->copts, "appointment");
-       set_status_tracking_changes (msg, n_opts->priv->topts, o_opts->priv->topts, "task");
-
-       soup_soap_message_end_element (msg);
-
-       return TRUE;
-}
-
-EGwSendOptions *
-e_gw_sendoptions_new (void)
-{
-       EGwSendOptions *opts;
-
-       opts = g_object_new (E_TYPE_GW_SENDOPTIONS, NULL);
-
-       return opts;
-}
-
-EGwSendOptions *
-e_gw_sendoptions_new_from_soap_parameter (SoupSoapParameter *param)
-{
-       EGwSendOptions *opts;
-
-       g_return_val_if_fail (param != NULL, NULL);
-
-       opts = g_object_new (E_TYPE_GW_SENDOPTIONS, NULL);
-
-       if (!e_gw_sendoptions_store_settings (param, opts)) {
-               g_object_unref (opts);
-               return NULL;
-       }
-
-       return opts;
-}
-
diff --git a/servers/groupwise/e-gw-sendoptions.h b/servers/groupwise/e-gw-sendoptions.h
deleted file mode 100644 (file)
index cbb016f..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors :
- *  JP Rosevear <jpr@ximian.com>
- *  Rodrigo Moya <rodrigo@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- * This program 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- */
-
-#ifndef E_GW_SENDOPTIONS_H
-#define E_GW_SENDOPTIONS_H
-
-#include "soup-soap-response.h"
-
-G_BEGIN_DECLS
-
-#define E_TYPE_GW_SENDOPTIONS            (e_gw_sendoptions_get_type ())
-#define E_GW_SENDOPTIONS(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_GW_SENDOPTIONS, EGwSendOptions))
-#define E_GW_SENDOPTIONS_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_GW_SENDOPTIONS, EGwSendOptionsClass))
-#define E_IS_GW_SENDOPTIONS(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_GW_SENDOPTIONS))
-#define E_IS_GW_SENDOPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_GW_SENDOPTIONS))
-
-typedef struct _EGwSendOptions        EGwSendOptions;
-typedef struct _EGwSendOptionsClass   EGwSendOptionsClass;
-typedef struct _EGwSendOptionsPrivate EGwSendOptionsPrivate;
-
-struct _EGwSendOptions {
-       GObject parent;
-       EGwSendOptionsPrivate *priv;
-};
-
-struct _EGwSendOptionsClass {
-       GObjectClass parent_class;
-};
-typedef enum {
-       E_GW_PRIORITY_UNDEFINED,
-       E_GW_PRIORITY_HIGH,
-       E_GW_PRIORITY_STANDARD,
-       E_GW_PRIORITY_LOW
-} EGwSendOptionsPriority;
-
-typedef enum {
-       E_GW_SECURITY_NORMAL,
-       E_GW_SECURITY_PROPRIETARY,
-       E_GW_SECURITY_CONFIDENTIAL,
-       E_GW_SECURITY_SECRET,
-       E_GW_SECURITY_TOP_SECRET,
-       E_GW_SECURITY_FOR_YOUR_EYES_ONLY
-} EGwSendOptionsSecurity;
-
-typedef enum {
-       E_GW_RETURN_NOTIFY_NONE,
-       E_GW_RETURN_NOTIFY_MAIL
-} EGwSendOptionsReturnNotify;
-
-typedef enum {
-       E_GW_DELIVERED = 1,
-       E_GW_DELIVERED_OPENED = 2,
-       E_GW_ALL = 3
-} EGwTrackInfo;
-
-typedef struct {
-       EGwSendOptionsPriority priority;
-       gboolean reply_enabled;
-       gboolean reply_convenient;
-       gint reply_within;
-       gboolean expiration_enabled;
-       gint expire_after;
-       gboolean delay_enabled;
-       gint delay_until;
-} EGwSendOptionsGeneral;
-
-typedef struct {
-       gboolean tracking_enabled;
-       EGwTrackInfo track_when;
-       gboolean autodelete;
-       EGwSendOptionsReturnNotify opened;
-       EGwSendOptionsReturnNotify accepted;
-       EGwSendOptionsReturnNotify declined;
-       EGwSendOptionsReturnNotify completed;
-} EGwSendOptionsStatusTracking;
-
-GType e_gw_sendoptions_get_type (void);
-EGwSendOptions* e_gw_sendoptions_new_from_soap_parameter (SoupSoapParameter *param);
-EGwSendOptionsGeneral* e_gw_sendoptions_get_general_options (EGwSendOptions *opts);
-EGwSendOptionsStatusTracking* e_gw_sendoptions_get_status_tracking_options (EGwSendOptions *opts, const gchar *type);
-gboolean e_gw_sendoptions_form_message_to_modify (SoupSoapMessage *msg, EGwSendOptions *n_opts, EGwSendOptions *o_opts);
-EGwSendOptions * e_gw_sendoptions_new (void);
-
-#endif
diff --git a/servers/groupwise/libegroupwise.pc.in b/servers/groupwise/libegroupwise.pc.in
deleted file mode 100644 (file)
index e5a9ce1..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-datarootdir=@datarootdir@
-datadir=@datadir@
-
-privincludedir=@privincludedir@
-
-Name: libegroupwise
-Description: Client library for accessing groupwise POA through SOAP interface
-Version: @VERSION@
-Requires: libsoup-2.4 >= @LIBSOUP_REQUIRED@ 
-Libs: -L${libdir} -legroupwise-1.2
-Cflags: -I${privincludedir}/groupwise
diff --git a/servers/groupwise/soap-test.c b/servers/groupwise/soap-test.c
deleted file mode 100644 (file)
index 221a8b7..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-#include <config.h>
-#include <glib.h>
-#include "e-gw-connection.h"
-
-static GMainLoop *main_loop;
-static gchar *arg_hostname, *arg_username, *arg_password;
-
-static void
-display_container (EGwContainer *container)
-{
-       g_print (" Container: %s\n", e_gw_container_get_name (container));
-       g_print ("\tID: %s\n", e_gw_container_get_id (container));
-
-       g_print ("\n");
-}
-
-static gboolean
-idle_cb (gpointer data)
-{
-       EGwConnection *cnc;
-
-       cnc = e_gw_connection_new (arg_hostname, arg_username, arg_password);
-       if (E_IS_GW_CONNECTION (cnc)) {
-               GList *container_list = NULL;
-
-               g_print ("Connected to %s!\n", arg_hostname);
-
-               /* get list of containers */
-               g_print ("Getting list of containers...\n");
-               if (e_gw_connection_get_container_list (cnc, "folders", &container_list) == E_GW_CONNECTION_STATUS_OK) {
-                       GList *container;
-
-                       for (container = container_list; container != NULL; container = container->next)
-                               display_container (E_GW_CONTAINER (container->data));
-
-                       e_gw_connection_free_container_list (container_list);
-               }
-
-               g_object_unref (cnc);
-       } else
-               g_print ("ERROR: Could not connect to %s\n", arg_hostname);
-
-       g_main_loop_quit (main_loop);
-
-       return FALSE;
-}
-
-gint
-main (gint argc, gchar *argv[])
-{
-       g_type_init ();
-       g_thread_init (NULL);
-
-       /* Hostname Eg: http(s)://domain_name:/port_number/soap */
-       if (argc != 3 && argc != 4) {
-               g_print ("Usage: %s hosturl username [password]\n", argv[0]);
-               return -1;
-       }
-
-       arg_hostname = argv[1];
-       arg_username = argv[2];
-       if (argc == 4)
-               arg_password = argv[3];
-       else
-               arg_password = NULL;
-
-       main_loop = g_main_loop_new (NULL, TRUE);
-       g_idle_add ((GSourceFunc) idle_cb, NULL);
-       g_main_loop_run (main_loop);
-
-       /* terminate */
-       g_main_loop_unref (main_loop);
-
-       return 0;
-}
diff --git a/servers/groupwise/soup-soap-message.c b/servers/groupwise/soup-soap-message.c
deleted file mode 100644 (file)
index afb03dc..0000000
+++ /dev/null
@@ -1,813 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- */
-
-#include <string.h>
-#include <libsoup/soup.h>
-#include "soup-soap-message.h"
-
-G_DEFINE_TYPE (SoupSoapMessage, soup_soap_message, SOUP_TYPE_MESSAGE)
-
-struct _SoupSoapMessagePrivate {
-       /* Serialization fields */
-       xmlDocPtr doc;
-       xmlNodePtr last_node;
-       xmlNsPtr soap_ns;
-       xmlNsPtr xsi_ns;
-       xmlChar *env_prefix;
-       xmlChar *env_uri;
-       gboolean body_started;
-       gchar *action;
-};
-
-static void
-finalize (GObject *object)
-{
-       SoupSoapMessagePrivate *priv = SOUP_SOAP_MESSAGE (object)->priv;
-
-       if (priv->doc)
-               xmlFreeDoc (priv->doc);
-       if (priv->action)
-               g_free (priv->action);
-       if (priv->env_uri)
-               xmlFree (priv->env_uri);
-       if (priv->env_prefix)
-               xmlFree (priv->env_prefix);
-
-       G_OBJECT_CLASS (soup_soap_message_parent_class)->finalize (object);
-}
-
-static void
-soup_soap_message_class_init (SoupSoapMessageClass *soup_soap_message_class)
-{
-       GObjectClass *object_class = G_OBJECT_CLASS (soup_soap_message_class);
-
-       g_type_class_add_private (soup_soap_message_class, sizeof (SoupSoapMessagePrivate));
-
-       object_class->finalize = finalize;
-}
-
-static void
-soup_soap_message_init (SoupSoapMessage *msg)
-{
-       msg->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               msg, SOUP_TYPE_SOAP_MESSAGE, SoupSoapMessagePrivate);
-
-       /* initialize XML structures */
-       msg->priv->doc = xmlNewDoc ((const xmlChar *)"1.0");
-       msg->priv->doc->standalone = FALSE;
-       msg->priv->doc->encoding = xmlCharStrdup ("UTF-8");
-}
-
-static xmlNsPtr
-fetch_ns (SoupSoapMessage *msg, const gchar *prefix, const gchar *ns_uri)
-{
-       SoupSoapMessagePrivate *priv = msg->priv;
-       xmlNsPtr ns = NULL;
-
-       if (prefix && ns_uri)
-               ns = xmlNewNs (priv->last_node, (const xmlChar *)ns_uri, (const xmlChar *)prefix);
-       else if (prefix && !ns_uri) {
-               ns = xmlSearchNs (priv->doc, priv->last_node, (const xmlChar *)prefix);
-               if (!ns)
-                       ns = xmlNewNs (priv->last_node, (const xmlChar *)"", (const xmlChar *)prefix);
-       }
-
-       return ns;
-}
-
-/**
- * soup_soap_message_new:
- * @method: the HTTP method for the created request.
- * @uri_string: the destination endpoint (as a string).
- * @standalone: ??? FIXME
- * @xml_encoding: ??? FIXME
- * @env_prefix: ??? FIXME
- * @env_uri: ??? FIXME
- *
- * Creates a new empty #SoupSoapMessage, which will connect to @uri_string.
- *
- * Returns: the new #SoupSoapMessage (or %NULL if @uri_string could not be
- * parsed).
- */
-SoupSoapMessage *
-soup_soap_message_new (const gchar *method, const gchar *uri_string,
-                      gboolean standalone, const gchar *xml_encoding,
-                      const gchar *env_prefix, const gchar *env_uri)
-{
-       SoupSoapMessage *msg;
-       SoupURI *uri;
-
-       uri = soup_uri_new (uri_string);
-       if (!uri)
-               return NULL;
-
-       msg = soup_soap_message_new_from_uri (method, uri, standalone,
-                                             xml_encoding, env_prefix, env_uri);
-
-       soup_uri_free (uri);
-
-       return msg;
-}
-
-/**
- * soup_soap_message_new_from_uri:
- * @method: the HTTP method for the created request.
- * @uri: the destination endpoint (as a #SoupURI).
- * @standalone: ??? FIXME
- * @xml_encoding: ??? FIXME
- * @env_prefix: ??? FIXME
- * @env_uri: ??? FIXME
- *
- * Creates a new empty #SoupSoapMessage, which will connect to @uri
- *
- * Returns: the new #SoupSoapMessage
- */
-SoupSoapMessage *
-soup_soap_message_new_from_uri (const gchar *method, SoupURI *uri,
-                               gboolean standalone, const gchar *xml_encoding,
-                               const gchar *env_prefix, const gchar *env_uri)
-{
-       SoupSoapMessage *msg;
-       SoupSoapMessagePrivate *priv;
-
-       msg = g_object_new (SOUP_TYPE_SOAP_MESSAGE,
-                           SOUP_MESSAGE_METHOD, method,
-                           SOUP_MESSAGE_URI, uri,
-                           NULL);
-
-       priv = msg->priv;
-
-       priv->doc->standalone = standalone;
-
-       if (xml_encoding) {
-               xmlFree ((xmlChar *)priv->doc->encoding);
-               priv->doc->encoding = xmlCharStrdup (xml_encoding);
-       }
-
-       if (env_prefix)
-               priv->env_prefix = xmlCharStrdup (env_prefix);
-       if (env_uri)
-               priv->env_uri = xmlCharStrdup (env_uri);
-
-       return msg;
-}
-
-/**
- * soup_soap_message_start_envelope:
- * @msg: the %SoupSoapMessage.
- *
- * Starts the top level SOAP Envelope element.
- */
-void
-soup_soap_message_start_envelope (SoupSoapMessage *msg)
-{
-       SoupSoapMessagePrivate *priv;
-
-       g_return_if_fail (SOUP_IS_SOAP_MESSAGE (msg));
-       priv = msg->priv;
-
-       priv->last_node = priv->doc->xmlRootNode =
-               xmlNewDocNode (priv->doc, NULL, (const xmlChar *)"Envelope", NULL);
-
-       priv->soap_ns = xmlNewNs (priv->doc->xmlRootNode,
-                                 priv->env_uri ? priv->env_uri :
-                                 (const xmlChar *)"http://schemas.xmlsoap.org/soap/envelope/",
-                                 priv->env_prefix ? priv->env_prefix : (const xmlChar *)"SOAP-ENV");
-       if (priv->env_uri) {
-               xmlFree (priv->env_uri);
-               priv->env_uri = NULL;
-       }
-       if (priv->env_prefix) {
-               xmlFree (priv->env_prefix);
-               priv->env_prefix = NULL;
-       }
-
-       xmlSetNs (priv->doc->xmlRootNode, priv->soap_ns);
-
-       xmlNewNs (priv->doc->xmlRootNode,
-                 (const xmlChar *)"http://schemas.xmlsoap.org/soap/encoding/",
-                  (const xmlChar *)"SOAP-ENC");
-       xmlNewNs (priv->doc->xmlRootNode,
-                  (const xmlChar *)"http://www.w3.org/1999/XMLSchema",
-                  (const xmlChar *)"xsd");
-       xmlNewNs (priv->doc->xmlRootNode,
-                 (const xmlChar *)"http://schemas.xmlsoap.org/soap/envelope/",
-                 (const xmlChar *)"SOAP-ENV");
-       priv->xsi_ns = xmlNewNs (priv->doc->xmlRootNode,
-                                (const xmlChar *)"http://www.w3.org/1999/XMLSchema-instance",
-                                (const xmlChar *)"xsi");
-}
-
-/**
- * soup_soap_message_end_envelope:
- * @msg: the %SoupSoapMessage.
- *
- * Closes the top level SOAP Envelope element.
- */
-void
-soup_soap_message_end_envelope (SoupSoapMessage *msg)
-{
-       soup_soap_message_end_element (msg);
-}
-
-/**
- * soup_soap_message_start_body:
- * @msg: the %SoupSoapMessage.
- *
- * Starts the SOAP Body element.
- */
-void
-soup_soap_message_start_body (SoupSoapMessage *msg)
-{
-       SoupSoapMessagePrivate *priv;
-
-       g_return_if_fail (SOUP_IS_SOAP_MESSAGE (msg));
-       priv = msg->priv;
-
-       if (priv->body_started)
-               return;
-
-       priv->last_node = xmlNewChild (priv->last_node,
-                                      priv->soap_ns,
-                                      (const xmlChar *)"Body", NULL);
-
-       priv->body_started = TRUE;
-}
-
-/**
- * soup_soap_message_end_body:
- * @msg: the %SoupSoapMessage.
- *
- * Closes the SOAP Body element.
- */
-void
-soup_soap_message_end_body (SoupSoapMessage *msg)
-{
-       soup_soap_message_end_element (msg);
-}
-
-/**
- * soup_soap_message_start_element:
- * @msg: the #SoupSoapMessage.
- * @name: the element name.
- * @prefix: the namespace prefix
- * @ns_uri: the namespace URI
- *
- * Starts a new arbitrary message element, with @name as the element
- * name, @prefix as the XML Namespace prefix, and @ns_uri as the XML
- * Namespace uri for * the created element.
- *
- * Passing @prefix with no @ns_uri will cause a recursive search for
- * an existing namespace with the same prefix. Failing that a new ns
- * will be created with an empty uri.
- *
- * Passing both @prefix and @ns_uri always causes new namespace
- * attribute creation.
- *
- * Passing NULL for both @prefix and @ns_uri causes no prefix to be
- * used, and the element will be in the default namespace.
- */
-void
-soup_soap_message_start_element (SoupSoapMessage *msg,
-                                const gchar *name,
-                                const gchar *prefix,
-                                const gchar *ns_uri)
-{
-       SoupSoapMessagePrivate *priv;
-
-       g_return_if_fail (SOUP_IS_SOAP_MESSAGE (msg));
-       priv = msg->priv;
-
-       priv->last_node = xmlNewChild (priv->last_node, NULL, (const xmlChar *)name, NULL);
-
-       xmlSetNs (priv->last_node, fetch_ns (msg, prefix, ns_uri));
-
-       if (priv->body_started && !priv->action)
-               priv->action = g_strconcat (ns_uri ? ns_uri : "",
-                                           "#", name, NULL);
-}
-
-/**
- * soup_soap_message_end_element:
- * @msg: the #SoupSoapMessage.
- *
- * Closes the current message element.
- */
-void
-soup_soap_message_end_element (SoupSoapMessage *msg)
-{
-       SoupSoapMessagePrivate *priv;
-
-       g_return_if_fail (SOUP_IS_SOAP_MESSAGE (msg));
-       priv = msg->priv;
-
-       priv->last_node = priv->last_node->parent;
-}
-
-/**
- * soup_soap_message_start_fault:
- * @msg: the #SoupSoapMessage.
- * @faultcode: faultcode element value
- * @faultstring: faultstring element value
- * @faultfactor: faultfactor element value
- *
- * Starts a new SOAP Fault element, creating faultcode, faultstring,
- * and faultfactor child elements.
- *
- * If you wish to add the faultdetail element, use
- * soup_soap_message_start_fault_detail(), and then
- * soup_soap_message_start_element() to add arbitrary sub-elements.
- */
-void
-soup_soap_message_start_fault (SoupSoapMessage *msg,
-                              const gchar *faultcode,
-                              const gchar *faultstring,
-                              const gchar *faultfactor)
-{
-       SoupSoapMessagePrivate *priv;
-
-       g_return_if_fail (SOUP_IS_SOAP_MESSAGE (msg));
-       priv = msg->priv;
-
-       priv->last_node = xmlNewChild (priv->last_node,
-                                      priv->soap_ns,
-                                      (const xmlChar *)"Fault", NULL);
-       xmlNewChild (priv->last_node, priv->soap_ns, (const xmlChar *)"faultcode", (const xmlChar *)faultcode);
-       xmlNewChild (priv->last_node, priv->soap_ns, (const xmlChar *)"faultstring", (const xmlChar *)faultstring);
-
-       priv->last_node = xmlNewChild (priv->last_node, priv->soap_ns,
-                                      (const xmlChar *)"faultfactor", (const xmlChar *)faultfactor);
-       if (!faultfactor)
-               soup_soap_message_set_null (msg);
-
-       soup_soap_message_end_element (msg);
-}
-
-/**
- * soup_soap_message_end_fault:
- * @msg: the #SoupSoapMessage.
- *
- * Closes the current SOAP Fault element.
- */
-void
-soup_soap_message_end_fault (SoupSoapMessage *msg)
-{
-       soup_soap_message_end_element (msg);
-}
-
-/**
- * soup_soap_message_start_fault_detail:
- * @msg: the #SoupSoapMessage.
- *
- * Start the faultdetail child element of the current SOAP Fault
- * element. The faultdetail element allows arbitrary data to be sent
- * in a returned fault.
- **/
-void
-soup_soap_message_start_fault_detail (SoupSoapMessage *msg)
-{
-       SoupSoapMessagePrivate *priv;
-
-       g_return_if_fail (SOUP_IS_SOAP_MESSAGE (msg));
-       priv = msg->priv;
-
-       priv->last_node = xmlNewChild (priv->last_node,
-                                      priv->soap_ns,
-                                      (const xmlChar *)"detail",
-                                      NULL);
-}
-
-/**
- * soup_soap_message_end_fault_detail:
- * @msg: the #SoupSoapMessage.
- *
- * Closes the current SOAP faultdetail element.
- */
-void
-soup_soap_message_end_fault_detail (SoupSoapMessage *msg)
-{
-       soup_soap_message_end_element (msg);
-}
-
-/**
- * soup_soap_message_start_header:
- * @msg: the #SoupSoapMessage.
- *
- * Creates a new SOAP Header element. You can call
- * soup_soap_message_start_header_element() after this to add a new
- * header child element. SOAP Header elements allow out-of-band data
- * to be transferred while not interfering with the message body.
- *
- * This should be called after soup_soap_message_start_envelope() and
- * before soup_soap_message_start_body().
- */
-void
-soup_soap_message_start_header (SoupSoapMessage *msg)
-{
-       SoupSoapMessagePrivate *priv;
-
-       g_return_if_fail (SOUP_IS_SOAP_MESSAGE (msg));
-       priv = msg->priv;
-
-       priv->last_node = xmlNewChild (priv->last_node, priv->soap_ns,
-                                      (const xmlChar *)"Header", NULL);
-}
-
-/**
- * soup_soap_message_end_header:
- * @msg: the #SoupSoapMessage.
- *
- * Closes the current SOAP Header element.
- */
-void
-soup_soap_message_end_header (SoupSoapMessage *msg)
-{
-       soup_soap_message_end_element (msg);
-}
-
-/**
- * soup_soap_message_start_header_element:
- * @msg: the #SoupSoapMessage.
- * @name: name of the header element
- * @must_understand: whether the recipient must understand the header in order
- * to proceed with processing the message
- * @actor_uri: the URI which represents the destination actor for this header.
- * @prefix: the namespace prefix
- * @ns_uri: the namespace URI
- *
- * Starts a new SOAP arbitrary header element.
- */
-void
-soup_soap_message_start_header_element (SoupSoapMessage *msg,
-                                       const gchar *name,
-                                       gboolean must_understand,
-                                       const gchar *actor_uri,
-                                       const gchar *prefix,
-                                       const gchar *ns_uri)
-{
-       SoupSoapMessagePrivate *priv;
-
-       g_return_if_fail (SOUP_IS_SOAP_MESSAGE (msg));
-       priv = msg->priv;
-
-       soup_soap_message_start_element (msg, name, prefix, ns_uri);
-       if (actor_uri)
-               xmlNewNsProp (priv->last_node, priv->soap_ns, (const xmlChar *)"actorUri", (const xmlChar *)actor_uri);
-       if (must_understand)
-               xmlNewNsProp (priv->last_node, priv->soap_ns, (const xmlChar *)"mustUnderstand", (const xmlChar *)"1");
-}
-
-/**
- * soup_soap_message_end_header_element:
- * @msg: the #SoupSoapMessage.
- *
- * Closes the current SOAP header element.
- */
-void
-soup_soap_message_end_header_element (SoupSoapMessage *msg)
-{
-       soup_soap_message_end_element (msg);
-}
-
-/**
- * soup_soap_message_write_int:
- * @msg: the #SoupSoapMessage.
- * @i: the integer value to write.
- *
- * Writes the stringified value of @i as the current element's content.
- */
-void
-soup_soap_message_write_int (SoupSoapMessage *msg, glong i)
-{
-       gchar *str = g_strdup_printf ("%ld", i);
-       soup_soap_message_write_string (msg, str);
-       g_free (str);
-}
-
-/**
- * soup_soap_message_write_double:
- * @msg: the #SoupSoapMessage.
- * @d: the double value to write.
- *
- * Writes the stringified value of @d as the current element's content.
- */
-void
-soup_soap_message_write_double (SoupSoapMessage *msg, gdouble d)
-{
-       gchar *str = g_strdup_printf ("%f", d);
-       soup_soap_message_write_string (msg, str);
-       g_free (str);
-}
-
-/**
- * soup_soap_message_write_base64:
- * @msg: the #SoupSoapMessage
- * @string: the binary data buffer to encode
- * @len: the length of data to encode
- *
- * Writes the Base-64 encoded value of @string as the current
- * element's content.
- **/
-void
-soup_soap_message_write_base64 (SoupSoapMessage *msg, const gchar *string, gint len)
-{
-       gchar *str = g_base64_encode ((const guchar *)string, len);
-       soup_soap_message_write_string (msg, str);
-       g_free (str);
-}
-
-/**
- * soup_soap_message_write_time:
- * @msg: the #SoupSoapMessage.
- * @timeval: pointer to a time_t to encode
- *
- * Writes the stringified value of @timeval as the current element's
- * content.
- **/
-void
-soup_soap_message_write_time (SoupSoapMessage *msg, const time_t *timeval)
-{
-       gchar *str = g_strchomp (ctime (timeval));
-       soup_soap_message_write_string (msg, str);
-}
-
-/**
- * soup_soap_message_write_string:
- * @msg: the #SoupSoapMessage.
- * @string: string to write.
- *
- * Writes the @string as the current element's content.
- */
-void
-soup_soap_message_write_string (SoupSoapMessage *msg, const gchar *string)
-{
-       SoupSoapMessagePrivate *priv;
-
-       g_return_if_fail (SOUP_IS_SOAP_MESSAGE (msg));
-       priv = msg->priv;
-
-       xmlNodeAddContent (priv->last_node, (const xmlChar *)string);
-}
-
-/**
- * soup_soap_message_write_buffer:
- * @msg: the #SoupSoapMessage.
- * @buffer: the string data buffer to write.
- * @len: length of @buffer.
- *
- * Writes the string buffer pointed to by @buffer as the current
- * element's content.
- */
-void
-soup_soap_message_write_buffer (SoupSoapMessage *msg, const gchar *buffer, gint len)
-{
-       SoupSoapMessagePrivate *priv;
-
-       g_return_if_fail (SOUP_IS_SOAP_MESSAGE (msg));
-       priv = msg->priv;
-
-       xmlNodeAddContentLen (priv->last_node, (const xmlChar *)buffer, len);
-}
-
-/**
- * soup_soap_message_set_element_type:
- * @msg: the #SoupSoapMessage.
- * @xsi_type: the type name for the element.
- *
- * Sets the current element's XML schema xsi:type attribute, which
- * specifies the element's type name.
- */
-void
-soup_soap_message_set_element_type (SoupSoapMessage *msg, const gchar *xsi_type)
-{
-       SoupSoapMessagePrivate *priv;
-
-       g_return_if_fail (SOUP_IS_SOAP_MESSAGE (msg));
-       priv = msg->priv;
-
-       xmlNewNsProp (priv->last_node, priv->xsi_ns, (const xmlChar *)"type", (const xmlChar *)xsi_type);
-}
-
-/**
- * soup_soap_message_set_null:
- * @msg: the #SoupSoapMessage.
- *
- * Sets the current element's XML Schema xsi:null attribute.
- */
-void
-soup_soap_message_set_null (SoupSoapMessage *msg)
-{
-       SoupSoapMessagePrivate *priv;
-
-       g_return_if_fail (SOUP_IS_SOAP_MESSAGE (msg));
-       priv = msg->priv;
-
-       xmlNewNsProp (priv->last_node, priv->xsi_ns, (const xmlChar *)"null", (const xmlChar *)"1");
-}
-
-/**
- * soup_soap_message_add_attribute:
- * @msg: the #SoupSoapMessage.
- * @name: name of the attribute
- * @value: value of the attribute
- * @prefix: the namespace prefix
- * @ns_uri: the namespace URI
- *
- * Adds an XML attribute to the current element.
- */
-void
-soup_soap_message_add_attribute (SoupSoapMessage *msg,
-                                const gchar *name,
-                                const gchar *value,
-                                const gchar *prefix,
-                                const gchar *ns_uri)
-{
-       SoupSoapMessagePrivate *priv;
-
-       g_return_if_fail (SOUP_IS_SOAP_MESSAGE (msg));
-       priv = msg->priv;
-
-       xmlNewNsProp (priv->last_node,
-                     fetch_ns (msg, prefix, ns_uri),
-                     (const xmlChar *)name, (const xmlChar *)value);
-}
-
-/**
- * soup_soap_message_add_namespace:
- * @msg: the #SoupSoapMessage.
- * @prefix: the namespace prefix
- * @ns_uri: the namespace URI, or NULL for empty namespace
- *
- * Adds a new XML namespace to the current element.
- */
-void
-soup_soap_message_add_namespace (SoupSoapMessage *msg, const gchar *prefix, const gchar *ns_uri)
-{
-       SoupSoapMessagePrivate *priv;
-
-       g_return_if_fail (SOUP_IS_SOAP_MESSAGE (msg));
-       priv = msg->priv;
-
-       xmlNewNs (priv->last_node, (const xmlChar *)(ns_uri ? ns_uri : ""), (const xmlChar *)prefix);
-}
-
-/**
- * soup_soap_message_set_default_namespace:
- * @msg: the #SoupSoapMessage.
- * @ns_uri: the namespace URI.
- *
- * Sets the default namespace to the URI specified in @ns_uri. The
- * default namespace becomes the namespace all non-explicitly
- * namespaced child elements fall into.
- */
-void
-soup_soap_message_set_default_namespace (SoupSoapMessage *msg, const gchar *ns_uri)
-{
-       g_return_if_fail (SOUP_IS_SOAP_MESSAGE (msg));
-
-       soup_soap_message_add_namespace (msg, NULL, ns_uri);
-}
-
-/**
- * soup_soap_message_set_encoding_style:
- * @msg: the #SoupSoapMessage.
- * @enc_style: the new encodingStyle value
- *
- * Sets the encodingStyle attribute on the current element to the
- * value of @enc_style.
- */
-void
-soup_soap_message_set_encoding_style (SoupSoapMessage *msg, const gchar *enc_style)
-{
-       SoupSoapMessagePrivate *priv;
-
-       g_return_if_fail (SOUP_IS_SOAP_MESSAGE (msg));
-       priv = msg->priv;
-
-       xmlNewNsProp (priv->last_node, priv->soap_ns, (const xmlChar *)"encodingStyle", (const xmlChar *)enc_style);
-}
-
-/**
- * soup_soap_message_reset:
- * @msg: the #SoupSoapMessage.
- *
- * Resets the internal XML representation of the SOAP message.
- */
-void
-soup_soap_message_reset (SoupSoapMessage *msg)
-{
-       SoupSoapMessagePrivate *priv;
-
-       g_return_if_fail (SOUP_IS_SOAP_MESSAGE (msg));
-       priv = msg->priv;
-
-       xmlFreeDoc (priv->doc);
-       priv->doc = xmlNewDoc ((const xmlChar *)"1.0");
-       priv->last_node = NULL;
-
-       g_free (priv->action);
-       priv->action = NULL;
-       priv->body_started = FALSE;
-
-       if (priv->env_uri)
-               xmlFree (priv->env_uri);
-       priv->env_uri = NULL;
-
-       if (priv->env_prefix)
-               xmlFree (priv->env_prefix);
-       priv->env_prefix = NULL;
-}
-
-/**
- * soup_soap_message_persist:
- * @msg: the #SoupSoapMessage.
- *
- * Writes the serialized XML tree to the #SoupMessage's buffer.
- */
-void
-soup_soap_message_persist (SoupSoapMessage *msg)
-{
-       SoupSoapMessagePrivate *priv;
-       xmlChar *body;
-       gint len;
-
-       g_return_if_fail (SOUP_IS_SOAP_MESSAGE (msg));
-       priv = msg->priv;
-
-       xmlDocDumpMemory (priv->doc, &body, &len);
-
-       /* serialize to SoupMessage class */
-       soup_message_set_request (SOUP_MESSAGE (msg), "text/xml",
-                                 SOUP_MEMORY_TAKE, (gchar *)body, len);
-}
-
-/**
- * soup_soap_message_get_namespace_prefix:
- * @msg: the #SoupSoapMessage.
- * @ns_uri: the namespace URI.
- *
- * Returns the namespace prefix for @ns_uri (or an empty string if
- * @ns_uri is set to the default namespace)
- *
- * Returns: The namespace prefix, or %NULL if no namespace exists
- * for the URI given.
- */
-const gchar *
-soup_soap_message_get_namespace_prefix (SoupSoapMessage *msg, const gchar *ns_uri)
-{
-       SoupSoapMessagePrivate *priv;
-       xmlNsPtr ns = NULL;
-
-       g_return_val_if_fail (SOUP_IS_SOAP_MESSAGE (msg), NULL);
-       priv = msg->priv;
-       g_return_val_if_fail (ns_uri != NULL, NULL);
-
-       ns = xmlSearchNsByHref (priv->doc, priv->last_node, (const xmlChar *)ns_uri);
-       if (ns) {
-               if (ns->prefix)
-                       return (const gchar *)ns->prefix;
-               else
-                       return "";
-       }
-
-       return NULL;
-}
-
-/**
- * soup_soap_message_get_xml_doc:
- * @msg: the #SoupSoapMessage.
- *
- * Returns the internal XML representation tree of the
- * #SoupSoapMessage pointed to by @msg.
- *
- * Returns: the #xmlDocPtr representing the SOAP message.
- */
-xmlDocPtr
-soup_soap_message_get_xml_doc (SoupSoapMessage *msg)
-{
-       SoupSoapMessagePrivate *priv;
-
-       g_return_val_if_fail (SOUP_IS_SOAP_MESSAGE (msg), NULL);
-       priv = msg->priv;
-
-       return priv->doc;
-}
-
-/**
- * soup_soap_message_parse_response:
- * @msg: the #SoupSoapMessage.
- *
- * Parses the response returned by the server.
- *
- * Returns: a #SoupSoapResponse representing the response from
- * the server, or %NULL if there was an error.
- */
-SoupSoapResponse *
-soup_soap_message_parse_response (SoupSoapMessage *msg)
-{
-       g_return_val_if_fail (SOUP_IS_SOAP_MESSAGE (msg), NULL);
-
-       return soup_soap_response_new_from_string (SOUP_MESSAGE (msg)->response_body->data);
-}
diff --git a/servers/groupwise/soup-soap-message.h b/servers/groupwise/soup-soap-message.h
deleted file mode 100644 (file)
index 07e09a2..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- */
-
-#ifndef SOUP_SOAP_MESSAGE_H
-#define SOUP_SOAP_MESSAGE_H 1
-
-#include <time.h>
-#include <libxml/tree.h>
-#include <libsoup/soup-message.h>
-#include "soup-soap-response.h"
-
-G_BEGIN_DECLS
-
-#define SOUP_TYPE_SOAP_MESSAGE            (soup_soap_message_get_type ())
-#define SOUP_SOAP_MESSAGE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_SOAP_MESSAGE, SoupSoapMessage))
-#define SOUP_SOAP_MESSAGE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_SOAP_MESSAGE, SoupSoapMessageClass))
-#define SOUP_IS_SOAP_MESSAGE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SOUP_TYPE_SOAP_MESSAGE))
-#define SOUP_IS_SOAP_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SOUP_TYPE_SOAP_MESSAGE))
-#define SOUP_SOAP_MESSAGE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_SOAP_MESSAGE, SoupSoapMessageClass))
-
-typedef struct _SoupSoapMessagePrivate SoupSoapMessagePrivate;
-
-typedef struct {
-       SoupMessage parent;
-
-       SoupSoapMessagePrivate *priv;
-} SoupSoapMessage;
-
-typedef struct {
-       SoupMessageClass parent_class;
-} SoupSoapMessageClass;
-
-GType             soup_soap_message_get_type (void);
-
-SoupSoapMessage  *soup_soap_message_new (const gchar *method, const gchar *uri_string,
-                                        gboolean standalone, const gchar *xml_encoding,
-                                        const gchar *env_prefix, const gchar *env_uri);
-SoupSoapMessage  *soup_soap_message_new_from_uri (const gchar *method, SoupURI *uri,
-                                                 gboolean standalone, const gchar *xml_encoding,
-                                                 const gchar *env_prefix, const gchar *env_uri);
-
-void              soup_soap_message_start_envelope (SoupSoapMessage *msg);
-void              soup_soap_message_end_envelope (SoupSoapMessage *msg);
-void              soup_soap_message_start_body (SoupSoapMessage *msg);
-void              soup_soap_message_end_body (SoupSoapMessage *msg);
-void              soup_soap_message_start_element (SoupSoapMessage *msg,
-                                                  const gchar *name,
-                                                  const gchar *prefix,
-                                                  const gchar *ns_uri);
-void              soup_soap_message_end_element (SoupSoapMessage *msg);
-void              soup_soap_message_start_fault (SoupSoapMessage *msg,
-                                                const gchar *faultcode,
-                                                const gchar *faultstring,
-                                                const gchar *faultfactor);
-void              soup_soap_message_end_fault (SoupSoapMessage *msg);
-void              soup_soap_message_start_fault_detail (SoupSoapMessage *msg);
-void              soup_soap_message_end_fault_detail (SoupSoapMessage *msg);
-void              soup_soap_message_start_header (SoupSoapMessage *msg);
-void              soup_soap_message_end_header (SoupSoapMessage *msg);
-void              soup_soap_message_start_header_element (SoupSoapMessage *msg,
-                                                         const gchar *name,
-                                                         gboolean must_understand,
-                                                         const gchar *actor_uri,
-                                                         const gchar *prefix,
-                                                         const gchar *ns_uri);
-void              soup_soap_message_end_header_element (SoupSoapMessage *msg);
-void              soup_soap_message_write_int (SoupSoapMessage *msg, glong i);
-void              soup_soap_message_write_double (SoupSoapMessage *msg, gdouble d);
-void              soup_soap_message_write_base64 (SoupSoapMessage *msg, const gchar *string, gint len);
-void              soup_soap_message_write_time (SoupSoapMessage *msg, const time_t *timeval);
-void              soup_soap_message_write_string (SoupSoapMessage *msg, const gchar *string);
-void              soup_soap_message_write_buffer (SoupSoapMessage *msg, const gchar *buffer, gint len);
-void              soup_soap_message_set_element_type (SoupSoapMessage *msg, const gchar *xsi_type);
-void              soup_soap_message_set_null (SoupSoapMessage *msg);
-void              soup_soap_message_add_attribute (SoupSoapMessage *msg,
-                                                  const gchar *name,
-                                                  const gchar *value,
-                                                  const gchar *prefix,
-                                                  const gchar *ns_uri);
-void              soup_soap_message_add_namespace (SoupSoapMessage *msg,
-                                                  const gchar *prefix,
-                                                  const gchar *ns_uri);
-void              soup_soap_message_set_default_namespace (SoupSoapMessage *msg,
-                                                          const gchar *ns_uri);
-void              soup_soap_message_set_encoding_style (SoupSoapMessage *msg, const gchar *enc_style);
-void              soup_soap_message_reset (SoupSoapMessage *msg);
-void              soup_soap_message_persist (SoupSoapMessage *msg);
-
-const gchar       *soup_soap_message_get_namespace_prefix (SoupSoapMessage *msg, const gchar *ns_uri);
-
-xmlDocPtr         soup_soap_message_get_xml_doc (SoupSoapMessage *msg);
-
-SoupSoapResponse *soup_soap_message_parse_response (SoupSoapMessage *msg);
-
-G_END_DECLS
-
-#endif
diff --git a/servers/groupwise/soup-soap-response.c b/servers/groupwise/soup-soap-response.c
deleted file mode 100644 (file)
index 9c3cdcc..0000000
+++ /dev/null
@@ -1,577 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <libxml/tree.h>
-#include <libsoup/soup.h>
-#include "soup-soap-response.h"
-
-G_DEFINE_TYPE (SoupSoapResponse, soup_soap_response, G_TYPE_OBJECT)
-
-struct _SoupSoapResponsePrivate {
-       /* the XML document */
-       xmlDocPtr xmldoc;
-       xmlNodePtr xml_root;
-       xmlNodePtr xml_body;
-       xmlNodePtr xml_method;
-       xmlNodePtr soap_fault;
-       GList *parameters;
-};
-
-static xmlNode *soup_xml_real_node (xmlNode *node);
-
-static void
-finalize (GObject *object)
-{
-       SoupSoapResponsePrivate *priv = SOUP_SOAP_RESPONSE (object)->priv;
-
-       if (priv->xmldoc)
-               xmlFreeDoc (priv->xmldoc);
-       if (priv->parameters != NULL)
-               g_list_free (priv->parameters);
-
-       G_OBJECT_CLASS (soup_soap_response_parent_class)->finalize (object);
-}
-
-static void
-soup_soap_response_class_init (SoupSoapResponseClass *soup_soap_response_class)
-{
-       GObjectClass *object_class = G_OBJECT_CLASS (soup_soap_response_class);
-
-       g_type_class_add_private (soup_soap_response_class, sizeof (SoupSoapResponsePrivate));
-
-       object_class->finalize = finalize;
-}
-
-static void
-soup_soap_response_init (SoupSoapResponse *response)
-{
-       response->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               response, SOUP_TYPE_SOAP_RESPONSE, SoupSoapResponsePrivate);
-       response->priv->xmldoc = xmlNewDoc ((const xmlChar *)"1.0");
-}
-
-/**
- * soup_soap_response_new:
- *
- * Create a new empty #SoupSoapResponse object, which can be modified
- * with the accessor functions provided with this class.
- *
- * Returns: the new #SoupSoapResponse (or %NULL if there was an
- * error).
- */
-SoupSoapResponse *
-soup_soap_response_new (void)
-{
-       SoupSoapResponse *response;
-
-       response = g_object_new (SOUP_TYPE_SOAP_RESPONSE, NULL);
-       return response;
-}
-
-/**
- * soup_soap_response_new_from_string:
- * @xmlstr: the XML string to parse.
- *
- * Create a new #SoupSoapResponse object from the XML string contained
- * in @xmlstr.
- *
- * Returns: the new #SoupSoapResponse (or %NULL if there was an
- * error).
- */
-SoupSoapResponse *
-soup_soap_response_new_from_string (const gchar *xmlstr)
-{
-       SoupSoapResponse *response;
-
-       g_return_val_if_fail (xmlstr != NULL, NULL);
-
-       response = g_object_new (SOUP_TYPE_SOAP_RESPONSE, NULL);
-       if (!soup_soap_response_from_string (response, xmlstr)) {
-               g_object_unref (response);
-               return NULL;
-       }
-
-       return response;
-}
-
-static void
-parse_parameters (SoupSoapResponsePrivate *priv, xmlNodePtr xml_method)
-{
-       xmlNodePtr tmp;
-
-       for (tmp = soup_xml_real_node (xml_method->children);
-            tmp != NULL;
-            tmp = soup_xml_real_node (tmp->next)) {
-               if (!strcmp ((const gchar *)tmp->name, "Fault")) {
-                       priv->soap_fault = tmp;
-                       continue;
-               } else {
-                       /* regular parameters */
-                       priv->parameters = g_list_append (priv->parameters, tmp);
-               }
-       }
-}
-
-/**
- * soup_soap_response_from_string:
- * @response: the #SoupSoapResponse object.
- * @xmlstr: XML string to parse.
- *
- * Parses the string contained in @xmlstr and sets all properties from
- * it in the @response object.
- *
- * Returns: %TRUE if successful, %FALSE otherwise.
- */
-gboolean
-soup_soap_response_from_string (SoupSoapResponse *response, const gchar *xmlstr)
-{
-       SoupSoapResponsePrivate *priv;
-       xmlDocPtr old_doc = NULL;
-       xmlNodePtr xml_root, xml_body, xml_method = NULL;
-
-       g_return_val_if_fail (SOUP_IS_SOAP_RESPONSE (response), FALSE);
-       priv = response->priv;
-       g_return_val_if_fail (xmlstr != NULL, FALSE);
-
-       /* clear the previous contents */
-       if (priv->xmldoc)
-               old_doc = priv->xmldoc;
-
-       /* parse the string */
-       priv->xmldoc = xmlParseMemory (xmlstr, strlen (xmlstr));
-       if (!priv->xmldoc) {
-               priv->xmldoc = old_doc;
-               return FALSE;
-       }
-
-       xml_root = xmlDocGetRootElement (priv->xmldoc);
-       if (!xml_root) {
-               xmlFreeDoc (priv->xmldoc);
-               priv->xmldoc = old_doc;
-               return FALSE;
-       }
-
-       if (strcmp ((const gchar *)xml_root->name, "Envelope") != 0) {
-               xmlFreeDoc (priv->xmldoc);
-               priv->xmldoc = old_doc;
-               return FALSE;
-       }
-
-       xml_body = soup_xml_real_node (xml_root->children);
-       if (xml_body != NULL) {
-               if (strcmp ((const gchar *)xml_body->name, "Header") == 0)
-                       xml_body = soup_xml_real_node (xml_body->next);
-               if (strcmp ((const gchar *)xml_body->name, "Body") != 0) {
-                       xmlFreeDoc (priv->xmldoc);
-                       priv->xmldoc = old_doc;
-                       return FALSE;
-               }
-
-               xml_method = soup_xml_real_node (xml_body->children);
-
-               /* read all parameters */
-               if (xml_method)
-                       parse_parameters (priv, xml_method);
-       }
-
-       xmlFreeDoc (old_doc);
-
-       priv->xml_root = xml_root;
-       priv->xml_body = xml_body;
-       priv->xml_method = xml_method;
-
-       return TRUE;
-}
-
-/**
- * soup_soap_response_get_method_name:
- * @response: the #SoupSoapResponse object.
- *
- * Gets the method name from the SOAP response.
- *
- * Returns: the method name.
- */
-const gchar *
-soup_soap_response_get_method_name (SoupSoapResponse *response)
-{
-       SoupSoapResponsePrivate *priv;
-
-       g_return_val_if_fail (SOUP_IS_SOAP_RESPONSE (response), NULL);
-       priv = response->priv;
-       g_return_val_if_fail (priv->xml_method != NULL, NULL);
-
-       return (const gchar *) priv->xml_method->name;
-}
-
-/**
- * soup_soap_response_set_method_name:
- * @response: the #SoupSoapResponse object.
- * @method_name: the method name to set.
- *
- * Sets the method name on the given #SoupSoapResponse.
- */
-void
-soup_soap_response_set_method_name (SoupSoapResponse *response, const gchar *method_name)
-{
-       SoupSoapResponsePrivate *priv;
-
-       g_return_if_fail (SOUP_IS_SOAP_RESPONSE (response));
-       priv = response->priv;
-       g_return_if_fail (priv->xml_method != NULL);
-       g_return_if_fail (method_name != NULL);
-
-       xmlNodeSetName (priv->xml_method, (const xmlChar *)method_name);
-}
-
-/**
- * soup_soap_parameter_get_name:
- * @param: the parameter
- *
- * Returns the parameter name.
- *
- * Returns: the parameter name.
- */
-const gchar *
-soup_soap_parameter_get_name (SoupSoapParameter *param)
-{
-       g_return_val_if_fail (param != NULL, NULL);
-
-       return (const gchar *) param->name;
-}
-
-/**
- * soup_soap_parameter_get_int_value:
- * @param: the parameter
- *
- * Returns the parameter's (integer) value.
- *
- * Returns: the parameter value as an integer
- */
-gint
-soup_soap_parameter_get_int_value (SoupSoapParameter *param)
-{
-       gint i;
-       xmlChar *s;
-       g_return_val_if_fail (param != NULL, -1);
-
-       s = xmlNodeGetContent (param);
-       if (s) {
-               i = atoi ((gchar *)s);
-               xmlFree (s);
-
-               return i;
-       }
-
-       return -1;
-}
-
-/**
- * soup_soap_parameter_get_string_value:
- * @param: the parameter
- *
- * Returns the parameter's value.
- *
- * Returns: the parameter value as a string, which must be freed
- * by the caller.
- */
-gchar *
-soup_soap_parameter_get_string_value (SoupSoapParameter *param)
-{
-       xmlChar *xml_s;
-       gchar *s;
-       g_return_val_if_fail (param != NULL, NULL);
-
-       xml_s = xmlNodeGetContent (param);
-       s = g_strdup ((gchar *)xml_s);
-       xmlFree (xml_s);
-
-       return s;
-}
-
-/**
- * soup_soap_parameter_get_first_child:
- * @param: A #SoupSoapParameter.
- *
- * Gets the first child of the given #SoupSoapParameter. This is used
- * for compound data types, which can contain several parameters
- * themselves.
- *
- * Returns: the first child or %NULL if there are no children.
- */
-SoupSoapParameter *
-soup_soap_parameter_get_first_child (SoupSoapParameter *param)
-{
-       g_return_val_if_fail (param != NULL, NULL);
-
-       return soup_xml_real_node (param->children);
-}
-
-/**
- * soup_soap_parameter_get_first_child_by_name:
- * @param: A #SoupSoapParameter.
- * @name: The name of the child parameter to look for.
- *
- * Gets the first child of the given #SoupSoapParameter whose name is
- * @name.
- *
- * Returns: the first child with the given name or %NULL if there
- * are no children.
- */
-SoupSoapParameter *
-soup_soap_parameter_get_first_child_by_name (SoupSoapParameter *param, const gchar *name)
-{
-       SoupSoapParameter *tmp;
-
-       g_return_val_if_fail (param != NULL, NULL);
-       g_return_val_if_fail (name != NULL, NULL);
-
-       for (tmp = soup_soap_parameter_get_first_child (param);
-            tmp != NULL;
-            tmp = soup_soap_parameter_get_next_child (tmp)) {
-               if (!strcmp (name, (const gchar *)tmp->name))
-                       return tmp;
-       }
-
-       return NULL;
-}
-
-/**
- * soup_soap_parameter_get_next_child:
- * @param: A #SoupSoapParameter.
- *
- * Gets the next sibling of the given #SoupSoapParameter. This is used
- * for compound data types, which can contain several parameters
- * themselves.
- *
- * FIXME: the name of this method is wrong
- *
- * Returns: the next sibling, or %NULL if there are no more
- * siblings.
- */
-SoupSoapParameter *
-soup_soap_parameter_get_next_child (SoupSoapParameter *param)
-{
-       g_return_val_if_fail (param != NULL, NULL);
-
-       return soup_xml_real_node (param->next);
-}
-
-/**
- * soup_soap_parameter_get_next_child_by_name:
- * @param: A #SoupSoapParameter.
- * @name: The name of the sibling parameter to look for.
- *
- * Gets the next sibling of the given #SoupSoapParameter whose name is
- * @name.
- *
- * FIXME: the name of this method is wrong
- *
- * Returns: the next sibling with the given name, or %NULL
- */
-SoupSoapParameter *
-soup_soap_parameter_get_next_child_by_name (SoupSoapParameter *param,
-                                           const gchar *name)
-{
-       SoupSoapParameter *tmp;
-
-       g_return_val_if_fail (param != NULL, NULL);
-       g_return_val_if_fail (name != NULL, NULL);
-
-       for (tmp = soup_soap_parameter_get_next_child (param);
-            tmp != NULL;
-            tmp = soup_soap_parameter_get_next_child (tmp)) {
-               if (!strcmp (name, (const gchar *)tmp->name))
-                       return tmp;
-       }
-
-       return NULL;
-}
-
-/**
- * soup_soap_parameter_get_property:
- * @param: the parameter
- * @prop_name: Name of the property to retrieve.
- *
- * Returns the named property of @param.
- *
- * Returns: the property, which must be freed by the caller.
- */
-gchar *
-soup_soap_parameter_get_property (SoupSoapParameter *param, const gchar *prop_name)
-{
-       xmlChar *xml_s;
-       gchar *s;
-
-       g_return_val_if_fail (param != NULL, NULL);
-       g_return_val_if_fail (prop_name != NULL, NULL);
-
-       xml_s = xmlGetProp (param, (const xmlChar *)prop_name);
-       s = g_strdup ((gchar *)xml_s);
-       xmlFree (xml_s);
-
-       return s;
-}
-
-/**
- * soup_soap_response_get_parameters:
- * @response: the #SoupSoapResponse object.
- *
- * Returns the list of parameters received in the SOAP response.
- *
- * Returns: a list of #SoupSoapParameter
- */
-const GList *
-soup_soap_response_get_parameters (SoupSoapResponse *response)
-{
-       SoupSoapResponsePrivate *priv;
-
-       g_return_val_if_fail (SOUP_IS_SOAP_RESPONSE (response), NULL);
-       priv = response->priv;
-
-       return (const GList *) priv->parameters;
-}
-
-/**
- * soup_soap_response_get_first_parameter:
- * @response: the #SoupSoapResponse object.
- *
- * Retrieves the first parameter contained in the SOAP response.
- *
- * Returns: a #SoupSoapParameter representing the first
- * parameter, or %NULL if there are no parameters.
- */
-SoupSoapParameter *
-soup_soap_response_get_first_parameter (SoupSoapResponse *response)
-{
-       SoupSoapResponsePrivate *priv;
-
-       g_return_val_if_fail (SOUP_IS_SOAP_RESPONSE (response), NULL);
-       priv = response->priv;
-
-       return priv->parameters ? priv->parameters->data : NULL;
-}
-
-/**
- * soup_soap_response_get_first_parameter_by_name:
- * @response: the #SoupSoapResponse object.
- * @name: the name of the parameter to look for.
- *
- * Retrieves the first parameter contained in the SOAP response whose
- * name is @name.
- *
- * Returns: a #SoupSoapParameter representing the first parameter
- * with the given name, or %NULL.
- */
-SoupSoapParameter *
-soup_soap_response_get_first_parameter_by_name (SoupSoapResponse *response,
-                                               const gchar *name)
-{
-       SoupSoapResponsePrivate *priv;
-       GList *l;
-
-       g_return_val_if_fail (SOUP_IS_SOAP_RESPONSE (response), NULL);
-       priv = response->priv;
-       g_return_val_if_fail (name != NULL, NULL);
-
-       for (l = priv->parameters; l != NULL; l = l->next) {
-               SoupSoapParameter *param = (SoupSoapParameter *) l->data;
-
-               if (!strcmp (name, (const gchar *)param->name))
-                       return param;
-       }
-
-       return NULL;
-}
-
-/**
- * soup_soap_response_get_next_parameter:
- * @response: the #SoupSoapResponse object.
- * @from: the parameter to start from.
- *
- * Retrieves the parameter following @from in the #SoupSoapResponse
- * object.
- *
- * Returns: a #SoupSoapParameter representing the parameter.
- */
-SoupSoapParameter *
-soup_soap_response_get_next_parameter (SoupSoapResponse *response,
-                                      SoupSoapParameter *from)
-{
-       SoupSoapResponsePrivate *priv;
-       GList *l;
-
-       g_return_val_if_fail (SOUP_IS_SOAP_RESPONSE (response), NULL);
-       priv = response->priv;
-       g_return_val_if_fail (from != NULL, NULL);
-
-       l = g_list_find (priv->parameters, (gconstpointer) from);
-       if (!l)
-               return NULL;
-
-       return l->next ? (SoupSoapParameter *) l->next->data : NULL;
-}
-
-/**
- * soup_soap_response_get_next_parameter_by_name:
- * @response: the #SoupSoapResponse object.
- * @from: the parameter to start from.
- * @name: the name of the parameter to look for.
- *
- * Retrieves the first parameter following @from in the
- * #SoupSoapResponse object whose name matches @name.
- *
- * Returns: a #SoupSoapParameter representing the parameter.
- */
-SoupSoapParameter *
-soup_soap_response_get_next_parameter_by_name (SoupSoapResponse *response,
-                                              SoupSoapParameter *from,
-                                              const gchar *name)
-{
-       SoupSoapParameter *param;
-
-       g_return_val_if_fail (SOUP_IS_SOAP_RESPONSE (response), NULL);
-       g_return_val_if_fail (from != NULL, NULL);
-       g_return_val_if_fail (name != NULL, NULL);
-
-       param = soup_soap_response_get_next_parameter (response, from);
-       while (param) {
-               const gchar *param_name = soup_soap_parameter_get_name (param);
-
-               if (param_name) {
-                       if (!strcmp (name, param_name))
-                               return param;
-               }
-
-               param = soup_soap_response_get_next_parameter (response, param);
-       }
-
-       return NULL;
-}
-
-static xmlNode *
-soup_xml_real_node (xmlNode *node)
-{
-       while (node && (node->type == XML_COMMENT_NODE ||
-                       xmlIsBlankNode (node)))
-               node = node->next;
-       return node;
-}
-
-gint
-soup_soap_response_dump_response (SoupSoapResponse *response, FILE *buffer)
-{
-       xmlChar *xmlbuff;
-       gint buffersize, ret;
-
-       SoupSoapResponsePrivate *priv = response->priv;
-       xmlDocDumpFormatMemory (priv->xmldoc, &xmlbuff, &buffersize, 1);
-
-       ret = fputs ((gchar *) xmlbuff, buffer);
-       xmlFree (xmlbuff);
-
-       return ret;
-}
diff --git a/servers/groupwise/soup-soap-response.h b/servers/groupwise/soup-soap-response.h
deleted file mode 100644 (file)
index a444f5a..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- */
-
-#ifndef SOUP_SOAP_RESPONSE_H
-#define SOUP_SOAP_RESPONSE_H
-
-#include <glib-object.h>
-#include <libxml/tree.h>
-
-G_BEGIN_DECLS
-
-#define SOUP_TYPE_SOAP_RESPONSE            (soup_soap_response_get_type ())
-#define SOUP_SOAP_RESPONSE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_SOAP_RESPONSE, SoupSoapResponse))
-#define SOUP_SOAP_RESPONSE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_SOAP_RESPONSE, SoupSoapResponseClass))
-#define SOUP_IS_SOAP_RESPONSE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SOUP_TYPE_SOAP_RESPONSE))
-#define SOUP_IS_SOAP_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SOUP_TYPE_SOAP_RESPONSE))
-#define SOUP_SOAP_RESPONSE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_SOAP_RESPONSE, SoupSoapResponseClass))
-
-typedef struct _SoupSoapResponsePrivate SoupSoapResponsePrivate;
-
-typedef struct {
-       GObject parent;
-
-       SoupSoapResponsePrivate *priv;
-} SoupSoapResponse;
-
-typedef struct {
-       GObjectClass parent_class;
-} SoupSoapResponseClass;
-
-GType             soup_soap_response_get_type (void);
-
-SoupSoapResponse *soup_soap_response_new (void);
-SoupSoapResponse *soup_soap_response_new_from_string (const gchar *xmlstr);
-
-gboolean          soup_soap_response_from_string (SoupSoapResponse *response, const gchar *xmlstr);
-
-const gchar       *soup_soap_response_get_method_name (SoupSoapResponse *response);
-void              soup_soap_response_set_method_name (SoupSoapResponse *response,
-                                                     const gchar *method_name);
-
-typedef xmlNode SoupSoapParameter;
-
-const gchar        *soup_soap_parameter_get_name (SoupSoapParameter *param);
-gint                soup_soap_parameter_get_int_value (SoupSoapParameter *param);
-gchar              *soup_soap_parameter_get_string_value (SoupSoapParameter *param);
-SoupSoapParameter *soup_soap_parameter_get_first_child (SoupSoapParameter *param);
-SoupSoapParameter *soup_soap_parameter_get_first_child_by_name (SoupSoapParameter *param,
-                                                               const gchar *name);
-SoupSoapParameter *soup_soap_parameter_get_next_child (SoupSoapParameter *param);
-SoupSoapParameter *soup_soap_parameter_get_next_child_by_name (SoupSoapParameter *param,
-                                                              const gchar *name);
-gchar              *soup_soap_parameter_get_property (SoupSoapParameter *param, const gchar *prop_name);
-
-const GList       *soup_soap_response_get_parameters (SoupSoapResponse *response);
-SoupSoapParameter *soup_soap_response_get_first_parameter (SoupSoapResponse *response);
-SoupSoapParameter *soup_soap_response_get_first_parameter_by_name (SoupSoapResponse *response,
-                                                                  const gchar *name);
-SoupSoapParameter *soup_soap_response_get_next_parameter (SoupSoapResponse *response,
-                                                         SoupSoapParameter *from);
-SoupSoapParameter *soup_soap_response_get_next_parameter_by_name (SoupSoapResponse *response,
-                                                                 SoupSoapParameter *from,
-                                                                 const gchar *name);
-
-gint soup_soap_response_dump_response (SoupSoapResponse *response, FILE *buffer);
-
-G_END_DECLS
-
-#endif