[evolution-kolab: 4/13] camel: adapted to new upstream layout and exposed API (pt. 1/2)



commit db1671bae4dbbb6a0a5da536adcab5c9d6f5e983
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Fri May 25 16:42:33 2012 +0200

    camel: adapted to new upstream layout and exposed API (pt. 1/2)
    
    * moved our own extension files from src/camel/providers/imapx
      to src/camel
    * removed src/camel/providers and its subdirectory
      (upstream IMAPX has been moved to libcamel toplevel)
    * adapted own extension files to new layout
    * removed all extension files which will no longer be
      needed in the light of CamelIMAPX* becoming subclassable
      and extensible

 configure.ac                                       |    5 -
 src/camel/Makefile.am                              |   16 +-
 src/camel/camel-imapx-extd-server.c                |  219 ++
 ...-manager-friend.h => camel-imapx-extd-server.h} |   43 +-
 ...lder-defs.h => camel-imapx-extd-store-friend.h} |   24 +-
 .../{providers/imapx => }/camel-imapx-extd-store.c |  631 +++----
 .../{providers/imapx => }/camel-imapx-extd-store.h |   38 +-
 .../imapx => }/camel-imapx-extd-tokens.txt         |    0
 .../{providers/imapx => }/camel-imapx-metadata.c   |    1 -
 .../{providers/imapx => }/camel-imapx-metadata.h   |    2 -
 src/camel/camel-kolab-imapx-conn-manager.c         |  319 ---
 src/camel/camel-kolab-imapx-conn-manager.h         |   87 -
 src/camel/camel-kolab-imapx-folder.c               |  239 --
 src/camel/camel-kolab-imapx-folder.h               |  115 -
 src/camel/camel-kolab-imapx-server.c               |  190 --
 src/camel/camel-kolab-imapx-server.h               |   89 -
 src/camel/providers/Makefile.am                    |   14 -
 src/camel/providers/README                         |   16 -
 src/camel/providers/VERSIONS                       |   14 -
 src/camel/providers/imapx/Makefile.am              |  132 --
 .../imapx/camel-imapx-conn-manager-defs.h          |   78 -
 .../imapx/camel-imapx-conn-manager-friend.h        |   64 -
 .../imapx/camel-imapx-extd-conn-manager.c          |  397 ----
 .../imapx/camel-imapx-extd-conn-manager.h          |  113 -
 .../providers/imapx/camel-imapx-extd-folder.c      |  494 -----
 .../providers/imapx/camel-imapx-extd-folder.h      |   98 -
 .../providers/imapx/camel-imapx-extd-server.c      | 2338 --------------------
 .../providers/imapx/camel-imapx-extd-server.h      |  316 ---
 .../providers/imapx/camel-imapx-folder-friend.h    |   47 -
 .../providers/imapx/camel-imapx-server-defs.h      |  180 --
 .../providers/imapx/camel-imapx-server-friend.h    |  120 -
 src/camel/providers/imapx/test-imapx.c             |   59 -
 32 files changed, 548 insertions(+), 5950 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index be1d109..d4fc2ff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -197,9 +197,6 @@ AC_SUBST(KOLAB_LIB_EKOLABBACKEND)
 KOLAB_LIB_EPLUGIN="\$(top_builddir)/src/eplugin/liborg-gnome-kolab.la"
 AC_SUBST(KOLAB_LIB_EPLUGIN)
 
-KOLAB_LIB_CAMEL_IMAPX="\$(top_builddir)/src/camel/providers/imapx/libcamelimapx.la"
-AC_SUBST(KOLAB_LIB_CAMEL_IMAPX)
-
 KOLAB_LIB_EKOLABCONVEVOLUTION="\$(top_builddir)/src/libekolabconv/main/src/evolution/libekolabconvevolution.la"
 AC_SUBST(KOLAB_LIB_EKOLABCONVEVOLUTION)
 
@@ -250,8 +247,6 @@ src/Makefile
 src/addressbook/Makefile
 src/calendar/Makefile
 src/camel/Makefile
-src/camel/providers/Makefile
-src/camel/providers/imapx/Makefile
 src/eplugin/Makefile
 src/libekolab/Makefile
 src/libekolabconv/Makefile
diff --git a/src/camel/Makefile.am b/src/camel/Makefile.am
index 0d7fb93..8036b93 100644
--- a/src/camel/Makefile.am
+++ b/src/camel/Makefile.am
@@ -1,29 +1,28 @@
 ## Process this file with automake to produce Makefile.in
 
-SUBDIRS = providers
-
 camel_provider_LTLIBRARIES = libcamelkolab.la
 camel_provider_DATA = libcamelkolab.urls
 
 libcamelkolab_la_SOURCES =			\
-	camel-kolab-imapx-conn-manager.c	\
-	camel-kolab-imapx-folder.c		\
+	camel-imapx-extd-server.c		\
+	camel-imapx-extd-store.c		\
+	camel-imapx-metadata.c			\
 	camel-kolab-imapx-metadata-db.c		\
 	camel-kolab-imapx-metadata.c		\
 	camel-kolab-imapx-provider.c		\
-	camel-kolab-imapx-server.c		\
 	camel-kolab-imapx-settings.c		\
 	camel-kolab-imapx-store.c		\
 	camel-kolab-session.c			\
 	camel-kolab-stream.c
 
 noinst_HEADERS =				\
-	camel-kolab-imapx-conn-manager.h	\
-	camel-kolab-imapx-folder.h		\
+	camel-imapx-extd-server.h		\
+	camel-imapx-extd-store.h		\
+	camel-imapx-extd-store-friend.h		\
+	camel-imapx-metadata.h			\
 	camel-kolab-imapx-metadata-db.h		\
 	camel-kolab-imapx-metadata.h		\
 	camel-kolab-imapx-provider.h		\
-	camel-kolab-imapx-server.h		\
 	camel-kolab-imapx-settings.h		\
 	camel-kolab-imapx-store.h		\
 	camel-kolab-session.h			\
@@ -49,7 +48,6 @@ libcamelkolab_la_LIBADD =			\
 	$(GLIB_LIBS)				\
 	$(EDS_LIBS)				\
 	$(NSS_LIBS)				\
-	$(KOLAB_LIB_CAMEL_IMAPX)		\
 	$(KOLAB_LIB_EKOLABUTIL)
 
 EXTRA_DIST = $(camel_provider_DATA)
diff --git a/src/camel/camel-imapx-extd-server.c b/src/camel/camel-imapx-extd-server.c
new file mode 100644
index 0000000..e9f6749
--- /dev/null
+++ b/src/camel/camel-imapx-extd-server.c
@@ -0,0 +1,219 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/***************************************************************************
+ *            camel-imapx-extd-server.c
+ *
+ *  2011-11-28, 20:16:38
+ *  Copyright 2011, Christian Hilberg
+ *  <hilberg unix-ag org>
+ ****************************************************************************/
+
+/*
+ * 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.1 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 main.c; 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 <glib/gi18n.h>
+
+#include "camel-imapx-extd-store.h"
+#include "camel-imapx-extd-store-friend.h"
+#include "camel-imapx-extd-server.h"
+
+/*----------------------------------------------------------------------------*/
+
+/* FIXME
+ *
+ * Capabilities flags need to be made known to
+ * CamelIMAPXServer, so they can be checked for
+ * here. As of E-D-S, the capability flags are
+ * part of the tokenizer (structs)
+ */
+enum {
+	IMAPX_ANNOTATEMORE = 1 << 0, /* FIXME! */
+};
+
+/*----------------------------------------------------------------------------*/
+
+gboolean
+camel_imapx_extd_server_untagged_annotation (CamelIMAPXServer *is,
+                                             GCancellable *cancellable,
+                                             GError **err)
+{
+	CamelIMAPXExtdStore *estore = NULL;
+	CamelImapxMetadata *md = NULL;
+	guint32 capa = 0;
+	GError *tmp_err = NULL;
+	gboolean parse_and_add_ok = FALSE;
+
+	g_assert (CAMEL_IS_IMAPX_SERVER (is));
+	/* cancellable may be NULL */
+	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
+
+	estore = CAMEL_IMAPX_EXTD_STORE (is->store);
+
+	/* capability check */
+	capa = is->cinfo->capa & IMAPX_ANNOTATEMORE;
+	if (! capa) {
+		g_set_error (err,
+		             CAMEL_IMAPX_ERROR,
+		             1, /* FIXME define and add a sensible code here */
+		             _("Got ANNOTATION response but server did not advertise ANNOTATEMORE capability"));
+		return FALSE;
+	}
+
+	md = camel_imapx_extd_store_get_md_table (estore);
+	parse_and_add_ok =
+		camel_imapx_metadata_add_from_server_response (md,
+		                                               is->stream,
+		                                               cancellable,
+		                                               &tmp_err);
+	g_object_unref (md);
+
+	if (! parse_and_add_ok) {
+		g_propagate_error (err, tmp_err);
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+gboolean
+camel_imapx_extd_server_get_metadata (CamelIMAPXServer *is,
+                                      CamelImapxMetadataSpec *spec,
+                                      GCancellable *cancellable,
+                                      GError **err)
+{
+	CamelIMAPXCommand *ic = NULL;
+	CamelIMAPXJob *job = NULL;
+	gchar *cmd = NULL;
+	GError *tmp_err = NULL;
+	gboolean ok = FALSE;
+
+	g_assert (CAMEL_IS_IMAPX_SERVER (is));
+	g_assert (spec != NULL);
+	/* cancellable may be NULL */
+	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
+
+	/* TODO move GETANNOTATION string to -metadata.[hc]
+	 *      (add a function to return proper string depending
+	 *      on protocol type)
+	 */
+	cmd = g_strdup_printf ("GETANNOTATION \"%s\" \"%s\" \"%s\"",
+	                       spec->mailbox_name,
+	                       spec->entry_name,
+	                       spec->attrib_name);
+	ic = camel_imapx_command_new (is,
+	                              "GETANNOTATION",
+	                              NULL,
+	                              cmd);
+	job = camel_imapx_job_new (cancellable);
+	camel_imapx_command_set_job (ic, job);
+	/* TODO set more job details like priority? */
+
+	/* FIXME CamelIMAPXServer needs to expose API for running custom commands */
+	g_warning ("%s()[%u] FIXME CamelIMAPXServer needs to expose API for running custom commands",
+	           __func__, __LINE__);
+#if 0
+	/* run GETANNOTATION command synchronously
+	 * (TODO can we change this to async operation?)
+	 */
+	ok = camel_imapx_server_command_run_sync (is,
+	                                          ic,
+	                                          cancellable,
+	                                          &tmp_err);
+#endif
+	g_free (cmd);
+	camel_imapx_command_done (ic);
+	camel_imapx_command_unref (ic);
+
+	if (! ok) {
+		g_propagate_error (err, tmp_err);
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+gboolean
+camel_imapx_extd_server_set_metadata (CamelIMAPXServer *is,
+                                      CamelImapxMetadata *md,
+                                      GCancellable *cancellable,
+                                      GError **err)
+{
+	CamelIMAPXCommand *ic = NULL;
+	CamelIMAPXJob *job = NULL;
+	GSList *commands = NULL;
+	GSList *cur_cmd = NULL;
+	GError *tmp_err = NULL;
+	gboolean ok = FALSE;
+
+	g_assert (CAMEL_IS_IMAPX_SERVER (is));
+	g_assert (md != NULL);
+	/* cancellable may be NULL */
+	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
+
+	commands = camel_imapx_metadata_new_commandlist (md);
+
+	if (commands == NULL)
+		return TRUE;
+
+	cur_cmd = commands;
+	while (cur_cmd != NULL) {
+		/* TODO move SETANNOTATION string to -metadata.[hc]
+		 *      (add a function to return proper string depending
+		 *      on protocol type)
+		 */
+		ic = camel_imapx_command_new (is,
+		                              "SETANNOTATION",
+		                              NULL,
+		                              (gchar *) cur_cmd->data);
+		job = camel_imapx_job_new (cancellable);
+		camel_imapx_command_set_job (ic, job);
+		/* TODO set more job details like priority? */
+
+		/* FIXME CamelIMAPXServer needs to expose API for running custom commands */
+		g_warning ("%s()[%u] FIXME CamelIMAPXServer needs to expose API for running custom commands",
+		           __func__, __LINE__);
+#if 0
+		/* run SETANNOTATION command synchronously
+		 * (TODO can we change this to async operation?)
+		 */
+		ok = camel_imapx_server_command_run_sync (is,
+		                                          ic,
+		                                          cancellable,
+		                                          &tmp_err);
+#endif
+		camel_imapx_command_done (ic);
+		camel_imapx_command_unref (ic);
+
+		if (! ok) {
+			g_slist_free (commands);
+			g_propagate_error (err, tmp_err);
+			return FALSE;
+		}
+
+		cur_cmd = g_slist_next (cur_cmd);
+	}
+
+	g_slist_free (commands);
+
+	return TRUE;
+}
+
+/*----------------------------------------------------------------------------*/
diff --git a/src/camel/providers/imapx/camel-imapx-extd-conn-manager-friend.h b/src/camel/camel-imapx-extd-server.h
similarity index 54%
rename from src/camel/providers/imapx/camel-imapx-extd-conn-manager-friend.h
rename to src/camel/camel-imapx-extd-server.h
index 45d17a6..c886c34 100644
--- a/src/camel/providers/imapx/camel-imapx-extd-conn-manager-friend.h
+++ b/src/camel/camel-imapx-extd-server.h
@@ -1,8 +1,8 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
 /***************************************************************************
- *            camel-imapx-extd-conn-manager-friend.h
+ *            camel-imapx-extd-server.h
  *
- *  2011-12-20, 15:59:18
+ *  2011-11-28, 20:16:38
  *  Copyright 2011, Christian Hilberg
  *  <hilberg unix-ag org>
  ****************************************************************************/
@@ -25,22 +25,41 @@
 
 /*----------------------------------------------------------------------------*/
 
-#ifndef _CAMEL_IMAPX_EXTD_CONN_MANAGER_FRIEND_H_
-#define _CAMEL_IMAPX_EXTD_CONN_MANAGER_FRIEND_H_
+#ifndef _CAMEL_IMAPX_EXTD_SERVER_H_
+#define _CAMEL_IMAPX_EXTD_SERVER_H_
 
 /*----------------------------------------------------------------------------*/
 
-void
-camel_imapx_extd_conn_manager_conn_shutdown (CamelIMAPXServer *is,
-                                             CamelIMAPXConnManager *con_man);
+#include <glib.h>
+#include <glib-object.h>
+#include <gio/gio.h>
 
-void
-camel_imapx_extd_conn_manager_conn_update_select (CamelIMAPXServer *is,
-                                                  const gchar *selected_folder,
-                                                  CamelIMAPXConnManager *con_man);
+#include <libekolabutil/camel-system-headers.h>
+
+#include "camel-imapx-metadata.h"
+
+/*----------------------------------------------------------------------------*/
+
+gboolean
+camel_imapx_extd_server_untagged_annotation (CamelIMAPXServer *is,
+                                             GCancellable *cancellable,
+                                             GError **err);
+gboolean
+camel_imapx_extd_server_get_metadata (CamelIMAPXServer *self,
+                                      CamelImapxMetadataSpec *spec,
+                                      GCancellable *cancellable,
+                                      GError **err);
+
+gboolean
+camel_imapx_extd_server_set_metadata (CamelIMAPXServer *self,
+                                      CamelImapxMetadata *md,
+                                      GCancellable *cancellable,
+                                      GError **err);
+
+G_END_DECLS
 
 /*----------------------------------------------------------------------------*/
 
-#endif /* _CAMEL_IMAPX_EXTD_CONN_MANAGER_FRIEND_H_ */
+#endif /* CAMEL_IMAPX_EXTD_SERVER_H_ */
 
 /*----------------------------------------------------------------------------*/
diff --git a/src/camel/providers/imapx/camel-imapx-folder-defs.h b/src/camel/camel-imapx-extd-store-friend.h
similarity index 71%
rename from src/camel/providers/imapx/camel-imapx-folder-defs.h
rename to src/camel/camel-imapx-extd-store-friend.h
index 37ad05a..ffd41c0 100644
--- a/src/camel/providers/imapx/camel-imapx-folder-defs.h
+++ b/src/camel/camel-imapx-extd-store-friend.h
@@ -1,8 +1,8 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
 /***************************************************************************
- *            camel-imapx-folder-defs.h
+ *            camel-imapx-extd-store-friend.h
  *
- *  2012-02-02, 18:22:18
+ *  2012-05-24, 18:34:30
  *  Copyright 2012, Christian Hilberg
  *  <hilberg unix-ag org>
  ****************************************************************************/
@@ -23,28 +23,18 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301,  USA
  */
 
-/* This file holds definitions needed by CamelIMAPXExtdFolder,
- * but not exported by its parent class. In order not to mess with
- * upstream code, we (temporarily) dupe the symbols here.
- * Once the *Extd* classes get merged into their upstream counterparts,
- * these dupes can be removed
- */
-
 /*----------------------------------------------------------------------------*/
 
-#ifndef _CAMEL_IMAPX_FOLDER_DEFS_H_
-#define _CAMEL_IMAPX_FOLDER_DEFS_H_
+#ifndef _CAMEL_IMAPX_EXTD_STORE_FRIEND_H_
+#define _CAMEL_IMAPX_EXTD_STORE_FRIEND_H_
 
 /*----------------------------------------------------------------------------*/
 
-/* dupe from camel-imapx-folder.c */
-enum {
-	PROP_0,
-	PROP_APPLY_FILTERS = 0x2501
-};
+CamelImapxMetadata*
+camel_imapx_extd_store_get_md_table (CamelIMAPXExtdStore *self);
 
 /*----------------------------------------------------------------------------*/
 
-#endif /* _CAMEL_IMAPX_FOLDER_DEFS_H_ */
+#endif /* _CAMEL_IMAPX_EXTD_STORE_FRIEND_H_ */
 
 /*----------------------------------------------------------------------------*/
diff --git a/src/camel/providers/imapx/camel-imapx-extd-store.c b/src/camel/camel-imapx-extd-store.c
similarity index 54%
rename from src/camel/providers/imapx/camel-imapx-extd-store.c
rename to src/camel/camel-imapx-extd-store.c
index 266ac86..40126d6 100644
--- a/src/camel/providers/imapx/camel-imapx-extd-store.c
+++ b/src/camel/camel-imapx-extd-store.c
@@ -31,12 +31,6 @@
 
 #include <glib/gi18n-lib.h>
 
-#include <libekolabutil/camel-system-headers.h>
-
-#include "camel-imapx-settings.h"
-#include "camel-imapx-utils.h"
-#include "camel-imapx-extd-conn-manager.h"
-#include "camel-imapx-extd-folder.h"
 #include "camel-imapx-extd-store.h"
 
 /*----------------------------------------------------------------------------*/
@@ -58,6 +52,13 @@ static void imapx_extd_store_subscribable_init (CamelSubscribableInterface *inte
 /* externs */
 extern CamelServiceAuthType camel_imapx_password_authtype;
 
+typedef struct _CamelIMAPXExtdStorePrivate CamelIMAPXExtdStorePrivate;
+struct _CamelIMAPXExtdStorePrivate {
+	CamelImapxMetadata *md; /* raw annotation data (different from CamelKolabImapxMetadata) */
+};
+
+#define CAMEL_IMAPX_EXTD_STORE_PRIVATE(obj)  (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CAMEL_TYPE_IMAPX_EXTD_STORE, CamelIMAPXExtdStorePrivate))
+
 G_DEFINE_TYPE_WITH_CODE (CamelIMAPXExtdStore,
                          camel_imapx_extd_store,
                          CAMEL_TYPE_IMAPX_STORE,
@@ -75,43 +76,74 @@ static void
 camel_imapx_extd_store_init (CamelIMAPXExtdStore *self)
 {
 	CamelIMAPXStore *istore = NULL;
-	CamelIMAPXExtdConnManager *cm = NULL;
+	CamelIMAPXConnManager *cm = NULL;
 
 	g_assert (CAMEL_IS_IMAPX_EXTD_STORE (self));
 
-	/* replace existing connection manager with
-	 * our own extended version. in case we need
-	 * to explicitly reference the *extended*
-	 * version of the connection manager, we will need
-	 * to override the respective parent class functions
-	 */
 	istore = CAMEL_IMAPX_STORE (self);
+
+	/* remove existing conn manager.
+	 * should not normally be necessary
+	 */
 	if (istore->con_man != NULL) {
 		camel_imapx_conn_manager_close_connections (istore->con_man);
 		g_object_unref (istore->con_man);
 	}
-	cm = camel_imapx_extd_conn_manager_new (self);
+
+	/* create conn manager, which will create
+	 * a CamelIMAPXServer for us
+	 */
+	cm = camel_imapx_conn_manager_new (CAMEL_STORE (self));
 	istore->con_man = CAMEL_IMAPX_CONN_MANAGER (cm);
 }
 
 static void
 camel_imapx_extd_store_dispose (GObject *object)
 {
-	CamelIMAPXExtdStore *self = CAMEL_IMAPX_EXTD_STORE (object);
-	CamelIMAPXStore *istore = CAMEL_IMAPX_STORE (self);
+	CamelIMAPXExtdStore *self = NULL;
+	CamelIMAPXStore *istore = NULL;
+	GCancellable *cancellable = NULL;
+	GError *tmp_err = NULL;
+
+	self = CAMEL_IMAPX_EXTD_STORE (object);
+	istore = CAMEL_IMAPX_STORE (self);
 
 	/* disconnect service and unref the connection manager.
 	 * see imapx_store_dispose() in camel-imapx-store.c
 	 */
 	if (istore->con_man != NULL) {
+		cancellable = g_cancellable_new ();
 		camel_service_disconnect_sync (CAMEL_SERVICE (self),
 		                               TRUE,
-		                               NULL);
-		g_object_unref (istore->con_man);
-		istore->con_man = NULL;
+		                               cancellable,
+		                               &tmp_err);
+
 		/* this part will now be skipped
 		 * in the parent's dispose() function
 		 */
+		g_object_unref (istore->con_man);
+		istore->con_man = NULL;
+
+		if (tmp_err != NULL) {
+			g_warning ("%s()[%u]: %s",
+			           __func__, __LINE__, tmp_err->message);
+			g_error_free (tmp_err);
+			tmp_err = NULL;
+		}
+
+		(void)g_cancellable_set_error_if_cancelled (cancellable,
+		                                            &tmp_err);
+		if (tmp_err != NULL) {
+			g_warning ("%s()[%u]: %s",
+			           __func__, __LINE__, tmp_err->message);
+			g_error_free (tmp_err);
+			tmp_err = NULL;
+		}
+
+		/* do we need to do anything else before
+		 * unref()ing here (e.g. reset())?
+		 */
+		g_object_unref (cancellable);
 	}
 
 	G_OBJECT_CLASS (camel_imapx_extd_store_parent_class)->dispose (object);
@@ -128,310 +160,10 @@ camel_imapx_extd_store_finalize (GObject *object)
 /*----------------------------------------------------------------------------*/
 /* internal statics */
 
-static CamelFolder*
-extd_store_get_folder_offline (CamelStore *self,
-                               const gchar *folder_name,
-                               guint32 flags,
-                               GError **err)
-{
-	/* This function is a dupe of get_folder_offline() in CamelIMAPXStore.
-	 * We need to dupe it in order to return a CamelIMAPXExtdFolder
-	 * (disguised as a CamelFolder). Upstream fixes need to be applied
-	 * here, too.
-	 */
-
-	CamelIMAPXExtdStore *myself = CAMEL_IMAPX_EXTD_STORE (self);
-	CamelIMAPXStore *imapx_store = CAMEL_IMAPX_STORE (self);
-	CamelService *service = CAMEL_SERVICE (self);
-	CamelFolder *new_folder = NULL;
-	CamelStoreInfo *si = NULL;
-	const gchar *user_cache_dir = NULL;
-
-	g_assert (folder_name != NULL);
-	g_return_val_if_fail (err == NULL || *err == NULL, NULL);
-
-	user_cache_dir = camel_service_get_user_cache_dir (service);
-
-	si = camel_store_summary_path (CAMEL_STORE_SUMMARY (imapx_store->summary), folder_name);
-	if (si) {
-		gchar *folder_dir, *storage_path;
-
-		/* Note: Although the INBOX is defined to be case-insensitive in the IMAP RFC
-		 * it is still up to the server how to acutally name it in a LIST response. Since
-		 * we stored the name as the server provided it us in the summary we take that name
-		 * to look up the folder.
-		 * But for the on-disk cache we do always capitalize the Inbox no matter what the
-		 * server provided.
-		 */
-		if (!g_ascii_strcasecmp (folder_name, "INBOX"))
-			folder_name = "INBOX";
-
-		storage_path = g_build_filename (user_cache_dir, "folders", NULL);
-		folder_dir = imapx_path_to_physical (storage_path, folder_name);
-		g_free (storage_path);
-
-		new_folder = CAMEL_FOLDER (camel_imapx_extd_folder_new (myself,
-		                                                        folder_dir,
-		                                                        folder_name,
-		                                                        err));
-		g_free (folder_dir);
-		camel_store_summary_info_free (CAMEL_STORE_SUMMARY (imapx_store->summary), si);
-	} else {
-		g_set_error (err,
-		             CAMEL_STORE_ERROR,
-		             CAMEL_STORE_ERROR_NO_FOLDER,
-		             _("No such folder %s"), folder_name);
-	}
-
-	return new_folder;
-}
 
 /*----------------------------------------------------------------------------*/
 /* class functions */
 
-static CamelAuthenticationResult
-imapx_extd_store_authenticate_sync (CamelService *service,
-                                    const gchar *mechanism,
-                                    GCancellable *cancellable,
-                                    GError **err)
-{
-	/* modified dupe of imapx_authenticate_sync() */
-
-	CamelIMAPXStore *istore = NULL;
-	CamelIMAPXServer *server = NULL;
-
-	g_assert (CAMEL_IS_IMAPX_EXTD_STORE (service));
-	/* mechanism may be NULL */
-	/* cancellable may be NULL */
-	g_return_val_if_fail (err == NULL || *err == NULL, CAMEL_AUTHENTICATION_REJECTED);
-
-	istore = CAMEL_IMAPX_STORE (service);
-
-	/* CamelIMAPXConnManager sets this before calling
-	 * camel_imapx_server_connect(), and then clears it
-	 * immediately after, all while holding the recursive
-	 * connection lock (CAMEL_SERVICE_REC_CONNECT_LOCK).
-	 * Otherwise we'd have no way of knowing which server
-	 * is trying to authenticate. */
-	server = istore->authenticating_server;
-
-	g_return_val_if_fail (CAMEL_IS_IMAPX_EXTD_SERVER (server), CAMEL_AUTHENTICATION_REJECTED);
-
-	/* modified */
-	return camel_imapx_extd_server_authenticate (server,
-	                                             mechanism,
-	                                             cancellable,
-	                                             err);
-}
-
-static gboolean
-imapx_extd_store_connect_sync (CamelService *service,
-                               GCancellable *cancellable,
-                               GError **err)
-{
-	CamelIMAPXStore *istore = NULL;
-	CamelIMAPXServer *server = NULL;
-
-	g_assert (CAMEL_IS_SERVICE (service));
-	/* cancellable may be NULL */
-	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
-
-	istore = CAMEL_IMAPX_STORE (service);
-	server = camel_imapx_extd_store_get_server (istore,
-	                                            NULL,
-	                                            cancellable,
-	                                            err);
-	if (server != NULL) {
-		g_object_unref (server);
-		return TRUE;
-	}
-
-	return FALSE;
-}
-
-static GList*
-imapx_extd_store_query_auth_types_sync (CamelService *service,
-                                        GCancellable *cancellable,
-                                        GError **err)
-{
-	/* modified dupe of imapx_query_auth_types_sync() */
-
-	CamelIMAPXExtdStore *estore = NULL;
-	CamelIMAPXExtdServer *eserver = NULL;
-	CamelServiceAuthType *authtype = NULL;
-	GList *sasl_types = NULL;
-	GList *t = NULL;
-	GList *next = NULL;
-	gboolean connected = FALSE;
-
-	g_assert (CAMEL_IS_IMAPX_EXTD_STORE (service));
-	/* cancellable may be NULL */
-	g_return_val_if_fail (err == NULL || *err == NULL, NULL);
-
-	estore = CAMEL_IMAPX_EXTD_STORE (service);
-
-	if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (estore))) {
-		g_set_error (err,
-		             CAMEL_SERVICE_ERROR,
-		             CAMEL_SERVICE_ERROR_UNAVAILABLE,
-		             _("You must be working online to complete this operation"));
-		return NULL;
-	}
-
-	camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
-	eserver = camel_imapx_extd_server_new (estore);
-
-	connected = CAMEL_IMAPX_SERVER (eserver)->stream != NULL;
-	if (!connected)
-		connected = camel_imapx_extd_server_connect_to_server (CAMEL_IMAPX_SERVER (eserver),
-		                                                       cancellable,
-		                                                       err);
-	camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-	if (!connected)
-		return NULL;
-
-	sasl_types = camel_sasl_authtype_list (FALSE);
-	for (t = sasl_types; t; t = next) {
-		authtype = t->data;
-		next = t->next;
-
-		if (!g_hash_table_lookup (CAMEL_IMAPX_SERVER (eserver)->cinfo->auth_types,
-		                          authtype->authproto)) {
-			sasl_types = g_list_remove_link (sasl_types, t);
-			g_list_free_1 (t);
-		}
-	}
-
-	g_object_unref (eserver);
-
-	return g_list_prepend (sasl_types, &camel_imapx_password_authtype);
-}
-
-static gboolean
-imapx_extd_store_can_refresh_folder (CamelStore *self,
-                                     CamelFolderInfo *info,
-                                     GError **err)
-{
-	gboolean can = FALSE;
-
-	g_assert (CAMEL_IS_IMAPX_EXTD_STORE (self));
-	g_assert (info != NULL);
-	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
-
-	can = parent_store_class->can_refresh_folder (self,
-	                                              info,
-	                                              err);
-	return can;
-}
-
-static void
-imapx_extd_store_free_folder_info (CamelStore *self,
-                                   CamelFolderInfo *fi)
-{
-	g_assert (CAMEL_IS_IMAPX_EXTD_STORE (self));
-	parent_store_class->free_folder_info (self, fi);
-}
-
-static CamelFolder*
-imapx_extd_store_get_folder_sync (CamelStore *self,
-                                  const gchar *foldername,
-                                  CamelStoreGetFolderFlags flags,
-                                  GCancellable *cancellable,
-                                  GError **err)
-{
-	CamelFolder *folder = NULL;
-
-	g_assert (CAMEL_IS_IMAPX_EXTD_STORE (self));
-	g_assert (foldername != NULL);
-	(void)cancellable; /* FIXME */
-	g_return_val_if_fail (err == NULL || *err == NULL, NULL);
-
-	folder = extd_store_get_folder_offline (self,
-	                                        foldername,
-	                                        flags,
-	                                        err);
-	if (folder != NULL)
-		g_assert (CAMEL_IS_IMAPX_EXTD_FOLDER (folder));
-
-	return folder;
-}
-
-static CamelFolderInfo*
-imapx_extd_store_get_folder_info_sync (CamelStore *self,
-                                       const gchar *top,
-                                       CamelStoreGetFolderInfoFlags flags,
-                                       GCancellable *cancellable,
-                                       GError **err)
-{
-	CamelFolderInfo *fi = NULL;
-
-	g_assert (CAMEL_IS_IMAPX_EXTD_STORE (self));
-	/* top may be NULL */ /* FIXME correct? */
-	/* cancellable may be NULL */
-	g_return_val_if_fail (err == NULL || *err == NULL, NULL);
-
-	fi = parent_store_class->get_folder_info_sync (self,
-	                                               top,
-	                                               flags,
-	                                               cancellable,
-	                                               err);
-	return fi;
-}
-
-static CamelFolder*
-imapx_extd_store_get_junk_folder_sync (CamelStore *self,
-                                       GCancellable *cancellable,
-                                       GError **err)
-{
-	CamelFolder *folder = NULL;
-
-	g_assert (CAMEL_IS_IMAPX_EXTD_STORE (self));
-	/* cancellable may be NULL */
-	g_return_val_if_fail (err == NULL || *err == NULL, NULL);
-
-	folder = parent_store_class->get_junk_folder_sync (self,
-	                                                   cancellable,
-	                                                   err);
-	/* CamelIMAPXFolder gets the junk folder from
-	 * its parent class, CamelFolder, and does not
-	 * change it to a CamelIMAPXFolder. That means,
-	 * if we really need a CamelIMAPXExtdFolder
-	 * here, we need to clone the CamelFolder into
-	 * a locally created instance
-	 */
-#if 0
-	if (folder != NULL)
-		g_assert (CAMEL_IS_IMAPX_EXTD_FOLDER (folder));
-#endif
-	return folder;
-}
-
-static CamelFolder*
-imapx_extd_store_get_trash_folder_sync (CamelStore *self,
-                                        GCancellable *cancellable,
-                                        GError **err)
-{
-	CamelFolder *folder = NULL;
-
-	g_assert (CAMEL_IS_IMAPX_EXTD_STORE (self));
-	/* cancellable may be NULL */
-	g_return_val_if_fail (err == NULL || *err == NULL, NULL);
-
-	folder = parent_store_class->get_trash_folder_sync (self,
-	                                                    cancellable,
-	                                                    err);
-	/* see imapx_extd_store_get_junk_folder_sync()
-	 * why we do not have a CamelIMAPXExtdFolder
-	 * here
-	 */
-#if 0
-	if (folder != NULL)
-		g_assert (CAMEL_IS_IMAPX_EXTD_FOLDER (folder));
-#endif
-	return folder;
-}
-
 static CamelFolderInfo*
 imapx_extd_store_create_folder_sync (CamelStore *self,
                                      const gchar *parentname,
@@ -452,6 +184,10 @@ imapx_extd_store_create_folder_sync (CamelStore *self,
 	                                             foldername,
 	                                             cancellable,
 	                                             err);
+	/* FIXME set annotation data on server */
+	g_warning ("%s()[%u] FIXME set annotation data on server",
+	           __func__, __LINE__);
+
 	return fi;
 }
 
@@ -473,7 +209,9 @@ imapx_extd_store_delete_folder_sync (CamelStore *self,
 	                                             cancellable,
 	                                             err);
 
-	/* FIXME delete metadata from CamelIMAPXExtdServer */
+	/* FIXME delete annotation data from server */
+	g_warning ("%s()[%u] FIXME delete annotation data from server",
+	           __func__, __LINE__);
 
 	return ok;
 }
@@ -499,7 +237,9 @@ imapx_extd_store_rename_folder_sync (CamelStore *self,
 	                                             cancellable,
 	                                             err);
 
-	/* FIXME update metadata in CamelIMAPXExtdServer */
+	/* FIXME update annotation data on server */
+	g_warning ("%s()[%u] FIXME update annotation data on server",
+	           __func__, __LINE__);
 
 	return ok;
 }
@@ -523,23 +263,6 @@ imapx_extd_store_synchronize_sync (CamelStore *self,
 	return ok;
 }
 
-static gboolean
-imapx_extd_store_noop_sync (CamelStore *self,
-                            GCancellable *cancellable,
-                            GError **err)
-{
-	gboolean ok = FALSE;
-
-	g_assert (CAMEL_IS_IMAPX_EXTD_STORE (self));
-	/* cancellable may be NULL */
-	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
-
-	ok = parent_store_class->noop_sync (self,
-	                                    cancellable,
-	                                    err);
-	return ok;
-}
-
 static CamelIMAPXServer*
 imapx_extd_store_get_server (CamelIMAPXStore *self,
                              const gchar *foldername,
@@ -554,37 +277,153 @@ imapx_extd_store_get_server (CamelIMAPXStore *self,
 	/* cancellable may be NULL */
 	g_return_val_if_fail (err == NULL || *err == NULL, NULL);
 
-	camel_service_lock (CAMEL_SERVICE (self), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
 	server = camel_imapx_conn_manager_get_connection (self->con_man,
 	                                                  foldername,
 	                                                  cancellable,
 	                                                  &tmp_err);
 
-	camel_service_unlock (CAMEL_SERVICE (self), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
 	if (server == NULL) {
 		g_propagate_error (err, tmp_err);
 		return NULL;
 	}
 
-	g_assert (CAMEL_IS_IMAPX_EXTD_SERVER (server));
+	g_assert (CAMEL_IS_IMAPX_SERVER (server));
 
 	return server;
 }
 
-static void
-imapx_extd_store_op_done (CamelIMAPXStore *self,
-                          CamelIMAPXServer *server,
-                          const gchar *foldername)
+static camel_imapx_metadata_proto_t
+imapx_extd_store_metadata_get_proto (CamelIMAPXExtdStore *self)
 {
+	CamelIMAPXExtdStorePrivate *priv = NULL;
+	camel_imapx_metadata_proto_t proto = CAMEL_IMAPX_METADATA_PROTO_INVAL;
+
 	g_assert (CAMEL_IS_IMAPX_EXTD_STORE (self));
-	g_assert (CAMEL_IS_IMAPX_EXTD_SERVER (server));
-	g_assert (foldername != NULL);
 
-	camel_imapx_store_op_done (self,
-	                           server,
-	                           foldername);
+	priv = CAMEL_IMAPX_EXTD_STORE_PRIVATE (self);
+
+	if (priv->md == NULL) {
+		/* TODO implement online folder annotation query
+		 *      in case there is no metadata as yet
+		 *      (decide the protocol here, depending on
+		 *      the IMAP server's untagged response)
+		 */
+		g_warning ("%s: FIXME implement online annotation protocol query",
+		           __func__);
+		return CAMEL_IMAPX_METADATA_PROTO_INVAL; /* FIXME */
+	}
+
+	proto = camel_imapx_metadata_get_proto (priv->md);
+
+	return proto;
+}
+
+static CamelImapxMetadata*
+imapx_extd_store_get_metadata (CamelIMAPXExtdStore *self,
+                               CamelImapxMetadataSpec *spec,
+                               gboolean do_resect,
+                               GCancellable *cancellable,
+                               GError **err)
+{
+	CamelIMAPXExtdStorePrivate *priv = NULL;
+	CamelIMAPXServer *is = NULL;
+	CamelImapxMetadata *md = NULL;
+	GError *tmp_err = NULL;
+	gboolean ok = FALSE;
+
+	g_assert (CAMEL_IS_IMAPX_EXTD_STORE (self));
+	g_assert (spec != NULL);
+	g_assert (spec->mailbox_name != NULL);
+	/* cancellable may be NULL */
+	g_return_val_if_fail (err == NULL || *err == NULL, NULL);
+
+	priv = CAMEL_IMAPX_EXTD_STORE_PRIVATE (self);
+
+	is = imapx_extd_store_get_server (CAMEL_IMAPX_STORE (self),
+	                                  spec->mailbox_name,
+	                                  cancellable,
+	                                  &tmp_err);
+	if (is == NULL) {
+		g_propagate_error (err, tmp_err);
+		return NULL;
+	}
+
+	ok = camel_imapx_extd_server_get_metadata (is,
+	                                           spec,
+	                                           cancellable,
+	                                           &tmp_err);
+	if (! ok) {
+		g_propagate_error (err, tmp_err);
+		return NULL;
+	}
+
+	/* FIXME
+	 *
+	 * we would now need to wait for the IMAP untagged
+	 * response, so the handler function can process it
+	 * and put the result into the metadata hashtables.
+	 *
+	 */
+
+	/* only if do_resect==TRUE we do return the metadata,
+	 * otherwise we only get it from the server and leave
+	 * the result inside this object for later resection
+	 */
+	if (do_resect)
+		md = camel_imapx_metadata_resect (&(priv->md));
+
+	return md;
+}
+
+static gboolean
+imapx_extd_store_set_metadata (CamelIMAPXExtdStore *self,
+                               CamelImapxMetadata *md,
+                               GCancellable *cancellable,
+                               GError **err)
+{
+	/* CamelIMAPXExtdStorePrivate *priv = NULL; */
+	CamelIMAPXServer *is = NULL;
+	GError *tmp_err = NULL;
+	gboolean ok = FALSE;
+
+	g_assert (CAMEL_IS_IMAPX_EXTD_STORE (self));
+	g_assert (md != NULL);
+	/* cancellable may be NULL */
+	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
+
+	/* priv = CAMEL_IMAPX_EXTD_STORE_PRIVATE (self); */
+
+	is = imapx_extd_store_get_server (CAMEL_IMAPX_STORE (self),
+	                                  NULL,
+	                                  cancellable,
+	                                  &tmp_err);
+	if (is == NULL) {
+		g_propagate_error (err, tmp_err);
+		return FALSE;
+	}
+
+	ok = camel_imapx_extd_server_set_metadata (is,
+	                                           md,
+	                                           cancellable,
+	                                           &tmp_err);
+	if (! ok) {
+		g_propagate_error (err, tmp_err);
+		return FALSE;
+	}
+
+	/* TODO should we update local metadata information
+	 *      right away here?
+	 *
+	 *      Pro: This will be needed for supporting
+	 *           non-Kolab IMAP servers anyway (but
+	 *           could be limited to that use case)
+	 *
+	 *      Con: If we read-back the information from
+	 *           the server on need, we can be sure it
+	 *           has previously been successfully set
+	 */
+
+	return TRUE;
 }
 
 /*----------------------------------------------------------------------------*/
@@ -731,40 +570,25 @@ static void
 camel_imapx_extd_store_class_init (CamelIMAPXExtdStoreClass *klass)
 {
 	GObjectClass *object_class = G_OBJECT_CLASS (klass);
-	CamelServiceClass *service_class = CAMEL_SERVICE_CLASS (klass);
 	CamelStoreClass *store_class = CAMEL_STORE_CLASS (klass);
 
 	parent_service_class = CAMEL_SERVICE_CLASS (camel_imapx_extd_store_parent_class);
 	parent_store_class = CAMEL_STORE_CLASS (camel_imapx_extd_store_parent_class);
 
-	/* g_type_class_add_private (klass, sizeof (CamelIMAPXExtdStorePrivate)); */
+	g_type_class_add_private (klass, sizeof (CamelIMAPXExtdStorePrivate));
 
 	object_class->dispose = camel_imapx_extd_store_dispose;
 	object_class->finalize = camel_imapx_extd_store_finalize;
 
-	service_class->settings_type = CAMEL_TYPE_IMAPX_SETTINGS; /* maybe need to get our own here */
-	service_class->get_name = parent_service_class->get_name;
-	service_class->connect_sync = imapx_extd_store_connect_sync;
-	service_class->disconnect_sync = parent_service_class->disconnect_sync;
-	service_class->authenticate_sync = imapx_extd_store_authenticate_sync;
-	service_class->query_auth_types_sync = imapx_extd_store_query_auth_types_sync;
-
-	store_class->hash_folder_name = parent_store_class->hash_folder_name;
-	store_class->compare_folder_name = parent_store_class->compare_folder_name;
-	store_class->can_refresh_folder = imapx_extd_store_can_refresh_folder;
-	store_class->free_folder_info = imapx_extd_store_free_folder_info;
-	store_class->get_folder_sync = imapx_extd_store_get_folder_sync;
-	store_class->get_folder_info_sync = imapx_extd_store_get_folder_info_sync;
-	store_class->get_junk_folder_sync = imapx_extd_store_get_junk_folder_sync;
-	store_class->get_trash_folder_sync = imapx_extd_store_get_trash_folder_sync;
 	store_class->create_folder_sync = imapx_extd_store_create_folder_sync;
 	store_class->delete_folder_sync = imapx_extd_store_delete_folder_sync;
 	store_class->rename_folder_sync = imapx_extd_store_rename_folder_sync;
 	store_class->synchronize_sync = imapx_extd_store_synchronize_sync;
-	store_class->noop_sync = imapx_extd_store_noop_sync;
 
 	klass->get_server = imapx_extd_store_get_server;
-	klass->op_done = imapx_extd_store_op_done;
+	klass->metadata_get_proto = imapx_extd_store_metadata_get_proto;
+	klass->get_metadata = imapx_extd_store_get_metadata;
+	klass->set_metadata = imapx_extd_store_set_metadata;
 }
 
 /*----------------------------------------------------------------------------*/
@@ -789,17 +613,70 @@ camel_imapx_extd_store_get_server (CamelIMAPXStore *self,
 	return server;
 }
 
-void
-camel_imapx_extd_store_op_done (CamelIMAPXStore *self,
-                                CamelIMAPXServer *server,
-                                const gchar *foldername)
+camel_imapx_metadata_proto_t
+camel_imapx_extd_store_metadata_get_proto (CamelIMAPXExtdStore *self)
+{
+	CamelIMAPXExtdStoreClass *klass = NULL;
+
+	g_return_val_if_fail (CAMEL_IS_IMAPX_EXTD_STORE (self), CAMEL_IMAPX_METADATA_PROTO_INVAL);
+
+	klass = CAMEL_IMAPX_EXTD_STORE_GET_CLASS (self);
+	return klass->metadata_get_proto (self);
+}
+
+CamelImapxMetadata*
+camel_imapx_extd_store_get_metadata (CamelIMAPXExtdStore *self,
+                                     CamelImapxMetadataSpec *spec,
+                                     gboolean do_resect,
+                                     GCancellable *cancellable,
+                                     GError **err)
 {
 	CamelIMAPXExtdStoreClass *klass = NULL;
 
-	g_return_if_fail (CAMEL_IS_IMAPX_EXTD_STORE (self));
+	g_return_val_if_fail (CAMEL_IS_IMAPX_EXTD_STORE (self), NULL);
 
 	klass = CAMEL_IMAPX_EXTD_STORE_GET_CLASS (self);
-	klass->op_done (self, server, foldername);
+	return klass->get_metadata (self,
+	                            spec,
+	                            do_resect,
+	                            cancellable,
+	                            err);
+}
+
+gboolean
+camel_imapx_extd_store_set_metadata (CamelIMAPXExtdStore *self,
+                                     CamelImapxMetadata *md,
+                                     GCancellable *cancellable,
+                                     GError **err)
+{
+	CamelIMAPXExtdStoreClass *klass = NULL;
+
+	g_return_val_if_fail (CAMEL_IS_IMAPX_EXTD_STORE (self), FALSE);
+
+	klass = CAMEL_IMAPX_EXTD_STORE_GET_CLASS (self);
+	return klass->set_metadata (self,
+	                            md,
+	                            cancellable,
+	                            err);
+}
+
+/*----------------------------------------------------------------------------*/
+/* "friend" API */
+#include "camel-imapx-extd-store-friend.h"
+
+CamelImapxMetadata*
+camel_imapx_extd_store_get_md_table (CamelIMAPXExtdStore *self)
+{
+	CamelIMAPXExtdStorePrivate *priv = NULL;
+
+	g_assert (CAMEL_IS_IMAPX_EXTD_STORE (self));
+
+	priv = CAMEL_IMAPX_EXTD_STORE_PRIVATE (self);
+
+	/* TODO does this need to be thread-safe? */
+
+	g_object_ref (priv->md);
+	return priv->md;
 }
 
 /*----------------------------------------------------------------------------*/
diff --git a/src/camel/providers/imapx/camel-imapx-extd-store.h b/src/camel/camel-imapx-extd-store.h
similarity index 71%
rename from src/camel/providers/imapx/camel-imapx-extd-store.h
rename to src/camel/camel-imapx-extd-store.h
index 2651c35..c721a25 100644
--- a/src/camel/providers/imapx/camel-imapx-extd-store.h
+++ b/src/camel/camel-imapx-extd-store.h
@@ -34,7 +34,8 @@
 #include <glib-object.h>
 #include <gio/gio.h>
 
-#include "camel-imapx-store.h"
+#include <libekolabutil/camel-system-headers.h>
+
 #include "camel-imapx-extd-server.h"
 
 /*----------------------------------------------------------------------------*/
@@ -75,9 +76,18 @@ struct _CamelIMAPXExtdStoreClass {
 	                                 GCancellable *cancellable,
 	                                 GError **err);
 
-	void (*op_done) (CamelIMAPXStore *self,
-	                 CamelIMAPXServer *server,
-	                 const gchar *foldername);
+	camel_imapx_metadata_proto_t (*metadata_get_proto) (CamelIMAPXExtdStore *self);
+
+	CamelImapxMetadata* (*get_metadata) (CamelIMAPXExtdStore *self,
+	                                     CamelImapxMetadataSpec *spec,
+	                                     gboolean do_resect,
+	                                     GCancellable *cancellable,
+	                                     GError **err);
+
+	gboolean (*set_metadata) (CamelIMAPXExtdStore *self,
+	                          CamelImapxMetadata *md,
+	                          GCancellable *cancellable,
+	                          GError **err);
 };
 
 GType
@@ -88,10 +98,22 @@ camel_imapx_extd_store_get_server (CamelIMAPXStore *self,
                                    const gchar *foldername,
                                    GCancellable *cancellable,
                                    GError **err);
-void
-camel_imapx_extd_store_op_done (CamelIMAPXStore *self,
-                                CamelIMAPXServer *server,
-                                const gchar *foldername);
+
+camel_imapx_metadata_proto_t
+camel_imapx_extd_store_metadata_get_proto (CamelIMAPXExtdStore *self);
+
+CamelImapxMetadata*
+camel_imapx_extd_store_get_metadata (CamelIMAPXExtdStore *self,
+                                     CamelImapxMetadataSpec *spec,
+                                     gboolean do_resect,
+                                     GCancellable *cancellable,
+                                     GError **err);
+
+gboolean
+camel_imapx_extd_store_set_metadata (CamelIMAPXExtdStore *self,
+                                     CamelImapxMetadata *md,
+                                     GCancellable *cancellable,
+                                     GError **err);
 
 G_END_DECLS
 
diff --git a/src/camel/providers/imapx/camel-imapx-extd-tokens.txt b/src/camel/camel-imapx-extd-tokens.txt
similarity index 100%
rename from src/camel/providers/imapx/camel-imapx-extd-tokens.txt
rename to src/camel/camel-imapx-extd-tokens.txt
diff --git a/src/camel/providers/imapx/camel-imapx-metadata.c b/src/camel/camel-imapx-metadata.c
similarity index 99%
rename from src/camel/providers/imapx/camel-imapx-metadata.c
rename to src/camel/camel-imapx-metadata.c
index 6269e6c..52121a0 100644
--- a/src/camel/providers/imapx/camel-imapx-metadata.c
+++ b/src/camel/camel-imapx-metadata.c
@@ -36,7 +36,6 @@
 /* Kolab error reporting */
 #include <libekolabutil/kolab-util-error.h>
 
-#include "camel-imapx-utils.h"
 #include "camel-imapx-metadata.h"
 
 /*----------------------------------------------------------------------------*/
diff --git a/src/camel/providers/imapx/camel-imapx-metadata.h b/src/camel/camel-imapx-metadata.h
similarity index 99%
rename from src/camel/providers/imapx/camel-imapx-metadata.h
rename to src/camel/camel-imapx-metadata.h
index b09d049..0aa5df9 100644
--- a/src/camel/providers/imapx/camel-imapx-metadata.h
+++ b/src/camel/camel-imapx-metadata.h
@@ -36,8 +36,6 @@
 
 #include <libekolabutil/camel-system-headers.h>
 
-#include "camel-imapx-stream.h"
-
 /*----------------------------------------------------------------------------*/
 
 /* ANNOTATEMORE vs. METADATA:



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