[evolution-kolab/ek-wip-porting] CamelIMAPXExtdServer: use virtual functions



commit 587c3807717d94d3b0d582f2980e17e17032ac01
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Thu Jan 12 17:29:54 2012 +0100

    CamelIMAPXExtdServer: use virtual functions
    
    * changed to implement the parent class' API functions
      via GObject virtual functions
    * CamelIMAPXExtdServer is now subclassable
      for Kolab use

 .../providers/imapx/camel-imapx-extd-server.c      |  858 +++++++++++++++++++-
 .../providers/imapx/camel-imapx-extd-server.h      |  207 +++++-
 2 files changed, 1042 insertions(+), 23 deletions(-)
---
diff --git a/src/camel/providers/imapx/camel-imapx-extd-server.c b/src/camel/providers/imapx/camel-imapx-extd-server.c
index cf216c2..abb3d5f 100644
--- a/src/camel/providers/imapx/camel-imapx-extd-server.c
+++ b/src/camel/providers/imapx/camel-imapx-extd-server.c
@@ -29,6 +29,8 @@
 #include <config.h>
 #endif
 
+#include "camel-imapx-extd-folder.h"
+#include "camel-imapx-extd-store.h"
 #include "camel-imapx-extd-server.h"
 
 /*----------------------------------------------------------------------------*/
@@ -43,7 +45,7 @@ struct _CamelIMAPXExtdServerPrivate {
 G_DEFINE_TYPE (CamelIMAPXExtdServer, camel_imapx_extd_server, CAMEL_TYPE_IMAPX_SERVER)
 
 /*----------------------------------------------------------------------------*/
-/* object/class init */
+/* object init */
 
 static void
 camel_imapx_extd_server_init (CamelIMAPXExtdServer *self)
@@ -83,28 +85,420 @@ camel_imapx_extd_server_finalize (GObject *object)
 	self = CAMEL_IMAPX_EXTD_SERVER (object);
 	priv = CAMEL_IMAPX_EXTD_SERVER_PRIVATE (self);
 
-	camel_imapx_metadata_free (priv->md);
+	if (priv->md != NULL)
+		camel_imapx_metadata_free (priv->md);
 
 	G_OBJECT_CLASS (camel_imapx_extd_server_parent_class)->finalize (object);
 }
 
-static void
-camel_imapx_extd_server_class_init (CamelIMAPXExtdServerClass *klass)
+/*----------------------------------------------------------------------------*/
+/* class functions */
+
+static gboolean
+imapx_extd_server_connect (CamelIMAPXExtdServer *self,
+                           GCancellable *cancellable,
+                           GError **err)
 {
-	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+	CamelIMAPXServer *is = NULL;
+	gboolean ok = FALSE;
 
-	g_type_class_add_private (klass, sizeof (CamelIMAPXExtdServerPrivate));
+	g_assert (CAMEL_IS_IMAPX_EXTD_STORE (self));
+	/* cancellable may be NULL */
+	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
 
-	object_class->constructed = camel_imapx_extd_server_constructed;
-	object_class->dispose = camel_imapx_extd_server_dispose;
-	object_class->finalize = camel_imapx_extd_server_finalize;
+	is = CAMEL_IMAPX_SERVER (self);
+	ok = camel_imapx_server_connect (is,
+	                                 cancellable,
+	                                 err);
+	return ok;
 }
 
-/*----------------------------------------------------------------------------*/
-/* API functions */
+static CamelAuthenticationResult
+imapx_extd_server_authenticate (CamelIMAPXExtdServer *self,
+                                const gchar *mechanism,
+                                GCancellable *cancellable,
+                                GError **err)
+{
+	CamelIMAPXServer *is = NULL;
+	CamelAuthenticationResult result = CAMEL_AUTHENTICATION_ERROR;
 
-camel_imapx_metadata_proto_t
-camel_imapx_extd_server_metadata_get_proto (CamelIMAPXExtdServer *self)
+	g_assert (CAMEL_IS_IMAPX_EXTD_SERVER (self));
+	g_assert (mechanism != NULL);
+	/* cancellable may be NULL */
+	g_return_val_if_fail (err == NULL || *err == NULL, CAMEL_AUTHENTICATION_ERROR);
+
+	is = CAMEL_IMAPX_SERVER (self);
+	result = camel_imapx_server_authenticate (is,
+	                                          mechanism,
+	                                          cancellable,
+	                                          err);
+	return result;
+}
+
+static GPtrArray*
+imapx_extd_server_list (CamelIMAPXExtdServer *self,
+                        const gchar *top,
+                        guint32 flags,
+                        const gchar *ext,
+                        GCancellable *cancellable,
+                        GError **err)
+{
+	CamelIMAPXServer *is = NULL;
+	GPtrArray *list = NULL;
+
+	g_assert (CAMEL_IS_IMAPX_EXTD_SERVER (self));
+	g_assert (top != NULL); /* FIXME correct? */
+	g_assert (ext != NULL); /* FIXME correct? */
+	/* cancellable may be NULL */
+	g_return_val_if_fail (err == NULL || *err == NULL, NULL);
+
+	is = CAMEL_IMAPX_SERVER (self);
+	list = camel_imapx_server_list (is,
+	                                top,
+	                                flags,
+	                                ext,
+	                                cancellable,
+	                                err);
+	return list;
+}
+
+static gboolean
+imapx_extd_server_refresh_info (CamelIMAPXExtdServer *self,
+                                CamelIMAPXExtdFolder *folder,
+                                GCancellable *cancellable,
+                                GError **err)
+{
+	CamelIMAPXServer *is = NULL;
+	CamelFolder *cfolder = NULL;
+	gboolean ok = FALSE;
+
+	g_assert (CAMEL_IS_IMAPX_EXTD_SERVER (self));
+	g_assert (CAMEL_IS_IMAPX_EXTD_FOLDER (folder));
+	/* cancellable may be NULL */
+	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
+
+	is = CAMEL_IMAPX_SERVER (self);
+	cfolder = CAMEL_FOLDER (folder);
+
+	ok = camel_imapx_server_refresh_info (is,
+	                                      cfolder,
+	                                      cancellable,
+	                                      err);
+	return ok;
+}
+
+static gboolean
+imapx_extd_server_sync_changes (CamelIMAPXExtdServer *self,
+                                CamelIMAPXExtdFolder *folder,
+                                GCancellable *cancellable,
+                                GError **err)
+{
+	CamelIMAPXServer *is = NULL;
+	CamelFolder *cfolder = NULL;
+	gboolean ok = FALSE;
+
+	g_assert (CAMEL_IS_IMAPX_EXTD_SERVER (self));
+	g_assert (CAMEL_IS_IMAPX_EXTD_FOLDER (folder));
+	/* cancellable may be NULL */
+	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
+
+	is = CAMEL_IMAPX_SERVER (self);
+	cfolder = CAMEL_FOLDER (folder);
+
+	ok = camel_imapx_server_sync_changes (is,
+	                                      cfolder,
+	                                      cancellable,
+	                                      err);
+	return ok;
+}
+
+static gboolean
+imapx_extd_server_expunge (CamelIMAPXExtdServer *self,
+                           CamelIMAPXExtdFolder *folder,
+                           GCancellable *cancellable,
+                           GError **err)
+{
+	CamelIMAPXServer *is = NULL;
+	CamelFolder *cfolder = NULL;
+	gboolean ok = FALSE;
+
+	g_assert (CAMEL_IS_IMAPX_EXTD_SERVER (self));
+	g_assert (CAMEL_IS_IMAPX_EXTD_FOLDER (folder));
+	/* cancellable may be NULL */
+	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
+
+	is = CAMEL_IMAPX_SERVER (self);
+	cfolder = CAMEL_FOLDER (folder);
+
+	ok = camel_imapx_server_expunge (is,
+	                                 cfolder,
+	                                 cancellable,
+	                                 err);
+	return ok;
+}
+
+static gboolean
+imapx_extd_server_noop (CamelIMAPXExtdServer *self,
+                        CamelIMAPXExtdFolder *folder,
+                        GCancellable *cancellable,
+                        GError **err)
+{
+	CamelIMAPXServer *is = NULL;
+	CamelFolder *cfolder = NULL;
+	gboolean ok = FALSE;
+
+	g_assert (CAMEL_IS_IMAPX_EXTD_SERVER (self));
+	g_assert (CAMEL_IS_IMAPX_EXTD_FOLDER (folder));
+	/* cancellable may be NULL */
+	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
+
+	is = CAMEL_IMAPX_SERVER (self);
+	cfolder = CAMEL_FOLDER (folder);
+
+	ok = camel_imapx_server_noop (is,
+	                              cfolder,
+	                              cancellable,
+	                              err);
+	return ok;
+}
+
+static CamelStream*
+imapx_extd_server_get_message (CamelIMAPXExtdServer *self,
+                               CamelIMAPXExtdFolder *folder,
+                               const gchar *uid,
+                               GCancellable *cancellable,
+                               GError **err)
+{
+	CamelIMAPXServer *is = NULL;
+	CamelFolder *cfolder = NULL;
+	CamelStream *stream = NULL;
+
+	g_assert (CAMEL_IS_IMAPX_EXTD_SERVER (self));
+	g_assert (CAMEL_IS_IMAPX_EXTD_FOLDER (folder));
+	g_assert (uid != NULL); /* FIXME correct? */
+	/* cancellable may be NULL */
+	g_return_val_if_fail (err == NULL || *err == NULL, NULL);
+
+	is = CAMEL_IMAPX_SERVER (self);
+	cfolder = CAMEL_FOLDER (folder);
+
+	stream = camel_imapx_server_get_message (is,
+	                                         cfolder,
+	                                         uid,
+	                                         cancellable,
+	                                         err);
+	return stream;
+
+}
+
+static gboolean
+imapx_extd_server_copy_message (CamelIMAPXExtdServer *self,
+                                CamelIMAPXExtdFolder *source,
+                                CamelIMAPXExtdFolder *dest,
+                                GPtrArray *uids,
+                                gboolean delete_originals,
+                                GCancellable *cancellable,
+                                GError **err)
+{
+	CamelIMAPXServer *is = NULL;
+	CamelFolder *csource = NULL;
+	CamelFolder *cdest = NULL;
+	gboolean ok = FALSE;
+
+	g_assert (CAMEL_IS_IMAPX_EXTD_SERVER (self));
+	g_assert (CAMEL_IS_IMAPX_EXTD_FOLDER (source));
+	g_assert (CAMEL_IS_IMAPX_EXTD_FOLDER (dest));
+	g_assert (uids != NULL); /* FIXME correct? */
+	/* cancellable may be NULL */
+	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
+
+	is = CAMEL_IMAPX_SERVER (self);
+	csource = CAMEL_FOLDER (source);
+	cdest = CAMEL_FOLDER (dest);
+
+	ok = camel_imapx_server_copy_message (is,
+	                                      csource,
+	                                      cdest,
+	                                      uids,
+	                                      delete_originals,
+	                                      cancellable,
+	                                      err);
+	return ok;
+}
+
+static gboolean
+imapx_extd_server_append_message (CamelIMAPXExtdServer *self,
+                                  CamelIMAPXExtdFolder *folder,
+                                  CamelMimeMessage *message,
+                                  const CamelMessageInfo *mi,
+                                  GCancellable *cancellable,
+                                  GError **err)
+{
+	CamelIMAPXServer *is = NULL;
+	CamelFolder *cfolder = NULL;
+	gboolean ok = FALSE;
+
+	g_assert (CAMEL_IS_IMAPX_EXTD_SERVER (self));
+	g_assert (CAMEL_IS_IMAPX_EXTD_FOLDER (folder));
+	g_assert (CAMEL_IS_MIME_MESSAGE (message));
+	g_assert (mi != NULL); /* FIXME correct? */
+	/* cancellable may be NULL */
+	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
+
+	is = CAMEL_IMAPX_SERVER (self);
+	cfolder = CAMEL_FOLDER (folder);
+
+	ok = camel_imapx_server_append_message (is,
+	                                        cfolder,
+	                                        message,
+	                                        mi,
+	                                        cancellable,
+	                                        err);
+	return ok;
+}
+
+static gboolean
+imapx_extd_server_sync_message (CamelIMAPXExtdServer *self,
+                                CamelIMAPXExtdFolder *folder,
+                                const gchar *uid,
+                                GCancellable *cancellable,
+                                GError **err)
+{
+	CamelIMAPXServer *is = NULL;
+	CamelFolder *cfolder = NULL;
+	gboolean ok = FALSE;
+
+	g_assert (CAMEL_IS_IMAPX_EXTD_SERVER (self));
+	g_assert (CAMEL_IS_IMAPX_EXTD_FOLDER (folder));
+	g_assert (uid != NULL); /* FIXME correct? */
+	/* cancellable may be NULL */
+	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
+
+	is = CAMEL_IMAPX_SERVER (self);
+	cfolder = CAMEL_FOLDER (folder);
+
+	ok = camel_imapx_server_sync_message (is,
+	                                      cfolder,
+	                                      uid,
+	                                      cancellable,
+	                                      err);
+	return ok;
+}
+
+static gboolean
+imapx_extd_server_manage_subscription (CamelIMAPXExtdServer *self,
+                                       const gchar *foldername,
+                                       gboolean subscribe,
+                                       GCancellable *cancellable,
+                                       GError **err)
+{
+	CamelIMAPXServer *is = NULL;
+	gboolean ok = FALSE;
+
+	g_assert (CAMEL_IS_IMAPX_EXTD_FOLDER (self));
+	g_assert (foldername != NULL); /* FIXME correct? */
+	/* cancellable may be NULL */
+	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
+
+	is = CAMEL_IMAPX_SERVER (self);
+
+	ok = camel_imapx_server_manage_subscription (is,
+	                                             foldername,
+	                                             subscribe,
+	                                             cancellable,
+	                                             err);
+	return ok;
+}
+
+static gboolean
+imapx_extd_server_create_folder (CamelIMAPXExtdServer *self,
+                                 const gchar *foldername,
+                                 GCancellable *cancellable,
+                                 GError **err)
+{
+	CamelIMAPXServer *is = NULL;
+	gboolean ok = FALSE;
+
+	g_assert (CAMEL_IS_IMAPX_EXTD_SERVER (self));
+	g_assert (foldername != NULL);
+	/* cancellable may be NULL */
+	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
+
+	is = CAMEL_IMAPX_SERVER (self);
+
+	ok = camel_imapx_server_create_folder (is,
+	                                       foldername,
+	                                       cancellable,
+	                                       err);
+	return ok;
+}
+
+static gboolean
+imapx_extd_server_delete_folder (CamelIMAPXExtdServer *self,
+                                 const gchar *foldername,
+                                 GCancellable *cancellable,
+                                 GError **err)
+{
+	CamelIMAPXServer *is = NULL;
+	gboolean ok = FALSE;
+
+	g_assert (CAMEL_IS_IMAPX_EXTD_SERVER (self));
+	g_assert (foldername != NULL);
+	/* cancellable may be NULL */
+	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
+
+	is = CAMEL_IMAPX_SERVER (self);
+
+	ok = camel_imapx_server_delete_folder (is,
+	                                       foldername,
+	                                       cancellable,
+	                                       err);
+	return ok;
+}
+
+static gboolean
+imapx_extd_server_rename_folder (CamelIMAPXExtdServer *self,
+                                 const gchar *oldname,
+                                 const gchar *newname,
+                                 GCancellable *cancellable,
+                                 GError **err)
+{
+	CamelIMAPXServer *is = NULL;
+	gboolean ok = FALSE;
+
+	g_assert (CAMEL_IS_IMAPX_EXTD_SERVER (self));
+	g_assert (oldname != NULL);
+	g_assert (newname != NULL);
+	/* cancellable may be NULL */
+	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
+
+	is = CAMEL_IMAPX_SERVER (self);
+
+	ok = camel_imapx_server_rename_folder (is,
+	                                       oldname,
+	                                       newname,
+	                                       cancellable,
+	                                       err);
+	return ok;
+}
+
+static struct _IMAPXJobQueueInfo*
+imapx_extd_server_get_job_queue_info (CamelIMAPXExtdServer *self)
+{
+	CamelIMAPXServer *is = NULL;
+	struct _IMAPXJobQueueInfo *qi = NULL;
+
+	g_assert (CAMEL_IS_IMAPX_EXTD_SERVER (self));
+
+	is = CAMEL_IMAPX_SERVER (self);
+
+	qi = camel_imapx_server_get_job_queue_info (is);
+
+	return qi;
+}
+
+static camel_imapx_metadata_proto_t
+imapx_extd_server_metadata_get_proto (CamelIMAPXExtdServer *self)
 {
 	CamelIMAPXExtdServerPrivate *priv = NULL;
 	camel_imapx_metadata_proto_t proto = CAMEL_IMAPX_METADATA_PROTO_INVAL;
@@ -129,11 +523,11 @@ camel_imapx_extd_server_metadata_get_proto (CamelIMAPXExtdServer *self)
 	return proto;
 }
 
-CamelImapxMetadata*
-camel_imapx_extd_server_get_metadata (CamelIMAPXExtdServer *self,
-                                      CamelImapxMetadataSpec *spec,
-                                      gboolean do_resect,
-                                      GError **err)
+static CamelImapxMetadata*
+imapx_extd_server_get_metadata (CamelIMAPXExtdServer *self,
+                                CamelImapxMetadataSpec *spec,
+                                gboolean do_resect,
+                                GError **err)
 {
 	CamelIMAPXExtdServerPrivate *priv = NULL;
 
@@ -150,10 +544,10 @@ camel_imapx_extd_server_get_metadata (CamelIMAPXExtdServer *self,
 	return NULL;
 }
 
-gboolean
-camel_imapx_extd_server_set_metadata (CamelIMAPXExtdServer *self,
-                                      CamelImapxMetadata *md,
-                                      GError **err)
+static gboolean
+imapx_extd_server_set_metadata (CamelIMAPXExtdServer *self,
+                                CamelImapxMetadata *md,
+                                GError **err)
 {
 	CamelIMAPXExtdServerPrivate *priv = NULL;
 
@@ -170,3 +564,423 @@ camel_imapx_extd_server_set_metadata (CamelIMAPXExtdServer *self,
 }
 
 /*----------------------------------------------------------------------------*/
+/* class init */
+
+static void
+camel_imapx_extd_server_class_init (CamelIMAPXExtdServerClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+	g_type_class_add_private (klass, sizeof (CamelIMAPXExtdServerPrivate));
+
+	object_class->constructed = camel_imapx_extd_server_constructed;
+	object_class->dispose = camel_imapx_extd_server_dispose;
+	object_class->finalize = camel_imapx_extd_server_finalize;
+
+	klass->connect = imapx_extd_server_connect;
+	klass->authenticate = imapx_extd_server_authenticate;
+	klass->list = imapx_extd_server_list;
+	klass->refresh_info = imapx_extd_server_refresh_info;
+	klass->sync_changes = imapx_extd_server_sync_changes;
+	klass->expunge = imapx_extd_server_expunge;
+	klass->noop = imapx_extd_server_noop;
+	klass->get_message = imapx_extd_server_get_message;
+	klass->copy_message = imapx_extd_server_copy_message;
+	klass->append_message = imapx_extd_server_append_message;
+	klass->sync_message = imapx_extd_server_sync_message;
+	klass->manage_subscription = imapx_extd_server_manage_subscription;
+	klass->create_folder = imapx_extd_server_create_folder;
+	klass->delete_folder = imapx_extd_server_delete_folder;
+	klass->rename_folder = imapx_extd_server_rename_folder;
+	klass->get_job_queue_info = imapx_extd_server_get_job_queue_info;
+	klass->metadata_get_proto = imapx_extd_server_metadata_get_proto;
+	klass->get_metadata = imapx_extd_server_get_metadata;
+	klass->set_metadata = imapx_extd_server_set_metadata;
+}
+
+/*----------------------------------------------------------------------------*/
+/* API functions */
+
+CamelIMAPXExtdServer*
+camel_imapx_extd_server_new (CamelIMAPXExtdStore *store)
+{
+	CamelIMAPXExtdServer *self = NULL;
+
+	g_assert (CAMEL_IS_IMAPX_EXTD_STORE (store));
+
+	/* FIXME implement me */
+	g_error ("%s: FIXME implement me", __func__);
+
+	return self;
+}
+
+gboolean
+camel_imapx_extd_server_connect (CamelIMAPXExtdServer *self,
+                                 GCancellable *cancellable,
+                                 GError **err)
+{
+	CamelIMAPXExtdServerClass *klass = NULL;
+	gboolean ok = FALSE;
+
+	g_return_val_if_fail (CAMEL_IS_IMAPX_EXTD_SERVER (self), FALSE);
+
+	klass = CAMEL_IMAPX_EXTD_SERVER_GET_CLASS (self);
+	ok = klass->connect (self,
+	                     cancellable,
+	                     err);
+	return ok;
+}
+
+CamelAuthenticationResult
+camel_imapx_extd_server_authenticate (CamelIMAPXExtdServer *self,
+                                      const gchar *mechanism,
+                                      GCancellable *cancellable,
+                                      GError **err)
+{
+	CamelIMAPXExtdServerClass *klass = NULL;
+	CamelAuthenticationResult result = CAMEL_AUTHENTICATION_ERROR;
+
+	g_return_val_if_fail (CAMEL_IS_IMAPX_EXTD_SERVER (self), CAMEL_AUTHENTICATION_ERROR);
+
+	klass = CAMEL_IMAPX_EXTD_SERVER_GET_CLASS (self);
+	result = klass->authenticate (self,
+	                              mechanism,
+	                              cancellable,
+	                              err);
+	return result;
+}
+
+GPtrArray*
+camel_imapx_extd_server_list (CamelIMAPXExtdServer *self,
+                              const gchar *top,
+                              guint32 flags,
+                              const gchar *ext,
+                              GCancellable *cancellable,
+                              GError **err)
+{
+	CamelIMAPXExtdServerClass *klass = NULL;
+	GPtrArray *list = NULL;
+
+	g_return_val_if_fail (CAMEL_IS_IMAPX_EXTD_SERVER (self), NULL);
+
+	klass = CAMEL_IMAPX_EXTD_SERVER_GET_CLASS (self);
+	list = klass->list (self,
+	                    top,
+	                    flags,
+	                    ext,
+	                    cancellable,
+	                    err);
+	return list;
+}
+
+gboolean
+camel_imapx_extd_server_refresh_info (CamelIMAPXExtdServer *self,
+                                      CamelIMAPXExtdFolder *folder,
+                                      GCancellable *cancellable,
+                                      GError **err)
+{
+	CamelIMAPXExtdServerClass *klass = NULL;
+	gboolean ok = FALSE;
+
+	g_return_val_if_fail (CAMEL_IS_IMAPX_EXTD_SERVER (self), FALSE);
+
+	klass = CAMEL_IMAPX_EXTD_SERVER_GET_CLASS (self);
+	ok = klass->refresh_info (self,
+	                          folder,
+	                          cancellable,
+	                          err);
+	return ok;
+}
+
+gboolean
+camel_imapx_extd_server_sync_changes (CamelIMAPXExtdServer *self,
+                                      CamelIMAPXExtdFolder *folder,
+                                      GCancellable *cancellable,
+                                      GError **err)
+{
+	CamelIMAPXExtdServerClass *klass = NULL;
+	gboolean ok = FALSE;
+
+	g_return_val_if_fail (CAMEL_IS_IMAPX_EXTD_SERVER (self), FALSE);
+
+	klass = CAMEL_IMAPX_EXTD_SERVER_GET_CLASS (self);
+	ok = klass->sync_changes (self,
+	                          folder,
+	                          cancellable,
+	                          err);
+	return ok;
+}
+
+gboolean
+camel_imapx_extd_server_expunge (CamelIMAPXExtdServer *self,
+                                 CamelIMAPXExtdFolder *folder,
+                                 GCancellable *cancellable,
+                                 GError **err)
+{
+	CamelIMAPXExtdServerClass *klass = NULL;
+	gboolean ok = FALSE;
+
+	g_return_val_if_fail (CAMEL_IS_IMAPX_EXTD_SERVER (self), FALSE);
+
+	klass = CAMEL_IMAPX_EXTD_SERVER_GET_CLASS (self);
+	ok = klass->expunge (self,
+	                     folder,
+	                     cancellable,
+	                     err);
+	return ok;
+}
+
+gboolean
+camel_imapx_extd_server_noop (CamelIMAPXExtdServer *self,
+                              CamelIMAPXExtdFolder *folder,
+                              GCancellable *cancellable,
+                              GError **err)
+{
+	CamelIMAPXExtdServerClass *klass = NULL;
+	gboolean ok = FALSE;
+
+	g_return_val_if_fail (CAMEL_IS_IMAPX_EXTD_SERVER (self), FALSE);
+
+	klass = CAMEL_IMAPX_EXTD_SERVER_GET_CLASS (self);
+	ok = klass->noop (self,
+	                  folder,
+	                  cancellable,
+	                  err);
+	return ok;
+}
+
+CamelStream*
+camel_imapx_extd_server_get_message (CamelIMAPXExtdServer *self,
+                                     CamelIMAPXExtdFolder *folder,
+                                     const gchar *uid,
+                                     GCancellable *cancellable,
+                                     GError **err)
+{
+	CamelIMAPXExtdServerClass *klass = NULL;
+	CamelStream *stream = NULL;
+
+	g_return_val_if_fail (CAMEL_IS_IMAPX_EXTD_SERVER (self), NULL);
+
+	klass = CAMEL_IMAPX_EXTD_SERVER_GET_CLASS (self);
+	stream = klass->get_message (self,
+	                             folder,
+	                             uid,
+	                             cancellable,
+	                             err);
+	return stream;
+}
+
+gboolean
+camel_imapx_extd_server_copy_message (CamelIMAPXExtdServer *self,
+                                      CamelIMAPXExtdFolder *source,
+                                      CamelIMAPXExtdFolder *dest,
+                                      GPtrArray *uids,
+                                      gboolean delete_originals,
+                                      GCancellable *cancellable,
+                                      GError **err)
+{
+	CamelIMAPXExtdServerClass *klass = NULL;
+	gboolean ok = FALSE;
+
+	g_return_val_if_fail (CAMEL_IS_IMAPX_EXTD_SERVER (self), FALSE);
+
+	klass = CAMEL_IMAPX_EXTD_SERVER_GET_CLASS (self);
+	ok = klass->copy_message (self,
+	                          source,
+	                          dest,
+	                          uids,
+	                          delete_originals,
+	                          cancellable,
+	                          err);
+	return ok;
+}
+
+gboolean
+camel_imapx_extd_server_append_message (CamelIMAPXExtdServer *self,
+                                        CamelIMAPXExtdFolder *folder,
+                                        CamelMimeMessage *message,
+                                        const CamelMessageInfo *mi,
+                                        GCancellable *cancellable,
+                                        GError **err)
+{
+	CamelIMAPXExtdServerClass *klass = NULL;
+	gboolean ok = FALSE;
+
+	g_return_val_if_fail (CAMEL_IS_IMAPX_EXTD_SERVER (self), FALSE);
+
+	klass = CAMEL_IMAPX_EXTD_SERVER_GET_CLASS (self);
+	ok = klass->append_message (self,
+	                            folder,
+	                            message,
+	                            mi,
+	                            cancellable,
+	                            err);
+	return ok;
+}
+
+
+gboolean
+camel_imapx_extd_server_sync_message (CamelIMAPXExtdServer *self,
+                                      CamelIMAPXExtdFolder *folder,
+                                      const gchar *uid,
+                                      GCancellable *cancellable,
+                                      GError **err)
+{
+	CamelIMAPXExtdServerClass *klass = NULL;
+	gboolean ok = FALSE;
+
+	g_return_val_if_fail (CAMEL_IS_IMAPX_EXTD_SERVER (self), FALSE);
+
+	klass = CAMEL_IMAPX_EXTD_SERVER_GET_CLASS (self);
+	ok = klass->sync_message (self,
+	                          folder,
+	                          uid,
+	                          cancellable,
+	                          err);
+	return ok;
+}
+
+gboolean
+camel_imapx_extd_server_manage_subscription (CamelIMAPXExtdServer *self,
+                                             const gchar *foldername,
+                                             gboolean subscribe,
+                                             GCancellable *cancellable,
+                                             GError **err)
+{
+	CamelIMAPXExtdServerClass *klass = NULL;
+	gboolean ok = FALSE;
+
+	g_return_val_if_fail (CAMEL_IS_IMAPX_EXTD_SERVER (self), FALSE);
+
+	klass = CAMEL_IMAPX_EXTD_SERVER_GET_CLASS (self);
+	ok = klass->manage_subscription (self,
+	                                 foldername,
+	                                 subscribe,
+	                                 cancellable,
+	                                 err);
+	return ok;
+}
+
+gboolean
+camel_imapx_extd_server_create_folder (CamelIMAPXExtdServer *self,
+                                       const gchar *foldername,
+                                       GCancellable *cancellable,
+                                       GError **err)
+{
+	CamelIMAPXExtdServerClass *klass = NULL;
+	gboolean ok = FALSE;
+
+	g_return_val_if_fail (CAMEL_IS_IMAPX_EXTD_SERVER (self), FALSE);
+
+	klass = CAMEL_IMAPX_EXTD_SERVER_GET_CLASS (self);
+	ok = klass->create_folder (self,
+	                           foldername,
+	                           cancellable,
+	                           err);
+	return ok;
+}
+
+gboolean
+camel_imapx_extd_server_delete_folder (CamelIMAPXExtdServer *self,
+                                       const gchar *foldername,
+                                       GCancellable *cancellable,
+                                       GError **err)
+{
+	CamelIMAPXExtdServerClass *klass = NULL;
+	gboolean ok = FALSE;
+
+	g_return_val_if_fail (CAMEL_IS_IMAPX_EXTD_SERVER (self), FALSE);
+
+	klass = CAMEL_IMAPX_EXTD_SERVER_GET_CLASS (self);
+	ok = klass->delete_folder (self,
+	                           foldername,
+	                           cancellable,
+	                           err);
+	return ok;
+}
+
+gboolean
+camel_imapx_extd_server_rename_folder (CamelIMAPXExtdServer *self,
+                                       const gchar *oldname,
+                                       const gchar *newname,
+                                       GCancellable *cancellable,
+                                       GError **err)
+{
+	CamelIMAPXExtdServerClass *klass = NULL;
+	gboolean ok = FALSE;
+
+	g_return_val_if_fail (CAMEL_IS_IMAPX_EXTD_SERVER (self), FALSE);
+
+	klass = CAMEL_IMAPX_EXTD_SERVER_GET_CLASS (self);
+	ok = klass->rename_folder (self,
+	                           oldname,
+	                           newname,
+	                           cancellable,
+	                           err);
+	return ok;
+}
+
+struct _IMAPXJobQueueInfo*
+camel_imapx_extd_server_get_job_queue_info (CamelIMAPXExtdServer *self)
+{
+	CamelIMAPXExtdServerClass *klass = NULL;
+	struct _IMAPXJobQueueInfo *qi = NULL;
+
+	g_return_val_if_fail (CAMEL_IS_IMAPX_EXTD_SERVER (self), NULL);
+
+	klass = CAMEL_IMAPX_EXTD_SERVER_GET_CLASS (self);
+	qi = klass->get_job_queue_info (self);
+
+	return qi;
+}
+
+camel_imapx_metadata_proto_t
+camel_imapx_extd_server_metadata_get_proto (CamelIMAPXExtdServer *self)
+{
+	CamelIMAPXExtdServerClass *klass = NULL;
+	camel_imapx_metadata_proto_t proto = CAMEL_IMAPX_METADATA_PROTO_INVAL;
+
+	g_return_val_if_fail (CAMEL_IS_IMAPX_EXTD_SERVER (self), CAMEL_IMAPX_METADATA_PROTO_INVAL);
+
+	klass = CAMEL_IMAPX_EXTD_SERVER_GET_CLASS (self);
+	proto = klass->metadata_get_proto (self);
+
+	return proto;
+}
+
+CamelImapxMetadata*
+camel_imapx_extd_server_get_metadata (CamelIMAPXExtdServer *self,
+                                      CamelImapxMetadataSpec *spec,
+                                      gboolean do_resect,
+                                      GError **err)
+{
+	CamelIMAPXExtdServerClass *klass = NULL;
+	CamelImapxMetadata *md = NULL;
+
+	g_return_val_if_fail (CAMEL_IS_IMAPX_EXTD_SERVER (self), NULL);
+
+	klass = CAMEL_IMAPX_EXTD_SERVER_GET_CLASS (self);
+	md = klass->get_metadata (self,
+	                          spec,
+	                          do_resect,
+	                          err);
+	return md;
+}
+
+gboolean
+camel_imapx_extd_server_set_metadata (CamelIMAPXExtdServer *self,
+                                      CamelImapxMetadata *md,
+                                      GError **err)
+{
+	CamelIMAPXExtdServerClass *klass = NULL;
+	gboolean ok = FALSE;
+
+	g_return_val_if_fail (CAMEL_IS_IMAPX_EXTD_SERVER (self), FALSE);
+
+	klass = CAMEL_IMAPX_EXTD_SERVER_GET_CLASS (self);
+	ok = klass->set_metadata (self, md, err);
+
+	return ok;
+}
+
+/*----------------------------------------------------------------------------*/
diff --git a/src/camel/providers/imapx/camel-imapx-extd-server.h b/src/camel/providers/imapx/camel-imapx-extd-server.h
index 3b7f824..4c58eb4 100644
--- a/src/camel/providers/imapx/camel-imapx-extd-server.h
+++ b/src/camel/providers/imapx/camel-imapx-extd-server.h
@@ -34,11 +34,14 @@
 #include <glib-object.h>
 #include <gio/gio.h>
 
-#include "camel-imapx-server.h"
 #include "camel-imapx-metadata.h"
+#include "camel-imapx-server.h"
 
 /*----------------------------------------------------------------------------*/
 
+struct _CamelIMAPXExtdStore;
+struct _CamelIMAPXExtdFolder;
+
 /*----------------------------------------------------------------------------*/
 /* Standard GObject macros */
 
@@ -71,11 +74,213 @@ struct _CamelIMAPXExtdServer {
 
 struct _CamelIMAPXExtdServerClass {
 	CamelIMAPXServerClass parent_class;
+
+	gboolean (*connect) (CamelIMAPXExtdServer *self,
+	                     GCancellable *cancellable,
+	                     GError **err);
+
+	CamelAuthenticationResult (*authenticate) (CamelIMAPXExtdServer *self,
+	                                           const gchar *mechanism,
+	                                           GCancellable *cancellable,
+	                                           GError **err);
+
+	GPtrArray* (*list) (CamelIMAPXExtdServer *self,
+	                    const gchar *top,
+	                    guint32 flags,
+	                    const gchar *ext,
+	                    GCancellable *cancellable,
+	                    GError **err);
+
+	gboolean (*refresh_info) (CamelIMAPXExtdServer *self,
+	                          struct _CamelIMAPXExtdFolder *folder,
+	                          GCancellable *cancellable,
+	                          GError **err);
+
+	gboolean (*sync_changes) (CamelIMAPXExtdServer *self,
+	                          struct _CamelIMAPXExtdFolder *folder,
+	                          GCancellable *cancellable,
+	                          GError **err);
+
+	gboolean (*expunge) (CamelIMAPXExtdServer *self,
+	                     struct _CamelIMAPXExtdFolder *folder,
+	                     GCancellable *cancellable,
+	                     GError **err);
+
+	gboolean (*noop) (CamelIMAPXExtdServer *self,
+	                  struct _CamelIMAPXExtdFolder *folder,
+	                  GCancellable *cancellable,
+	                  GError **err);
+
+	CamelStream* (*get_message) (CamelIMAPXExtdServer *self,
+	                             struct _CamelIMAPXExtdFolder *folder,
+	                             const gchar *uid,
+	                             GCancellable *cancellable,
+	                             GError **err);
+
+	gboolean (*copy_message) (CamelIMAPXExtdServer *self,
+	                          struct _CamelIMAPXExtdFolder *source,
+	                          struct _CamelIMAPXExtdFolder *dest,
+	                          GPtrArray *uids,
+	                          gboolean delete_originals,
+	                          GCancellable *cancellable,
+	                          GError **err);
+
+	gboolean (*append_message) (CamelIMAPXExtdServer *self,
+	                            struct _CamelIMAPXExtdFolder *folder,
+	                            CamelMimeMessage *message,
+	                            const CamelMessageInfo *mi,
+	                            GCancellable *cancellable,
+	                            GError **err);
+
+	gboolean (*sync_message) (CamelIMAPXExtdServer *self,
+	                          struct _CamelIMAPXExtdFolder *folder,
+	                          const gchar *uid,
+	                          GCancellable *cancellable,
+	                          GError **err);
+
+	gboolean (*manage_subscription) (CamelIMAPXExtdServer *self,
+	                                 const gchar *foldername,
+	                                 gboolean subscribe,
+	                                 GCancellable *cancellable,
+	                                 GError **err);
+
+	gboolean (*create_folder) (CamelIMAPXExtdServer *self,
+	                           const gchar *foldername,
+	                           GCancellable *cancellable,
+	                           GError **err);
+
+	gboolean (*delete_folder) (CamelIMAPXExtdServer *self,
+	                           const gchar *foldername,
+	                           GCancellable *cancellable,
+	                           GError **err);
+
+	gboolean (*rename_folder) (CamelIMAPXExtdServer *is,
+	                           const gchar *oldname,
+	                           const gchar *newname,
+	                           GCancellable *cancellable,
+	                           GError **err);
+
+	struct _IMAPXJobQueueInfo* (*get_job_queue_info) (CamelIMAPXExtdServer *self);
+
+	camel_imapx_metadata_proto_t (*metadata_get_proto) (CamelIMAPXExtdServer *self);
+
+	CamelImapxMetadata* (*get_metadata) (CamelIMAPXExtdServer *self,
+	                                     CamelImapxMetadataSpec *spec,
+	                                     gboolean do_resect,
+	                                     GError **err);
+
+	gboolean (*set_metadata) (CamelIMAPXExtdServer *self,
+	                          CamelImapxMetadata *md,
+	                          GError **err);
 };
 
 GType
 camel_imapx_extd_server_get_type (void);
 
+CamelIMAPXExtdServer*
+camel_imapx_extd_server_new (struct _CamelIMAPXExtdStore *store);
+
+gboolean
+camel_imapx_extd_server_connect (CamelIMAPXExtdServer *self,
+                                 GCancellable *cancellable,
+                                 GError **err);
+
+CamelAuthenticationResult
+camel_imapx_extd_server_authenticate (CamelIMAPXExtdServer *self,
+                                      const gchar *mechanism,
+                                      GCancellable *cancellable,
+                                      GError **err);
+
+GPtrArray*
+camel_imapx_extd_server_list (CamelIMAPXExtdServer *self,
+                              const gchar *top,
+                              guint32 flags,
+                              const gchar *ext,
+                              GCancellable *cancellable,
+                              GError **err);
+gboolean
+camel_imapx_extd_server_refresh_info (CamelIMAPXExtdServer *self,
+                                      struct _CamelIMAPXExtdFolder *folder,
+                                      GCancellable *cancellable,
+                                      GError **err);
+
+gboolean
+camel_imapx_extd_server_sync_changes (CamelIMAPXExtdServer *self,
+                                      struct _CamelIMAPXExtdFolder *folder,
+                                      GCancellable *cancellable,
+                                      GError **err);
+
+gboolean
+camel_imapx_extd_server_expunge (CamelIMAPXExtdServer *self,
+                                 struct _CamelIMAPXExtdFolder *folder,
+                                 GCancellable *cancellable,
+                                 GError **err);
+
+gboolean
+camel_imapx_extd_server_noop (CamelIMAPXExtdServer *self,
+                              struct _CamelIMAPXExtdFolder *folder,
+                              GCancellable *cancellable,
+                              GError **err);
+
+CamelStream*
+camel_imapx_extd_server_get_message (CamelIMAPXExtdServer *self,
+                                     struct _CamelIMAPXExtdFolder *folder,
+                                     const gchar *uid,
+                                     GCancellable *cancellable,
+                                     GError **err);
+
+gboolean
+camel_imapx_extd_server_copy_message (CamelIMAPXExtdServer *self,
+                                      struct _CamelIMAPXExtdFolder *source,
+                                      struct _CamelIMAPXExtdFolder *dest,
+                                      GPtrArray *uids,
+                                      gboolean delete_originals,
+                                      GCancellable *cancellable,
+                                      GError **err);
+
+gboolean
+camel_imapx_extd_server_append_message (CamelIMAPXExtdServer *self,
+                                        struct _CamelIMAPXExtdFolder *folder,
+                                        CamelMimeMessage *message,
+                                        const CamelMessageInfo *mi,
+                                        GCancellable *cancellable,
+                                        GError **err);
+
+gboolean
+camel_imapx_extd_server_sync_message (CamelIMAPXExtdServer *self,
+                                      struct _CamelIMAPXExtdFolder *folder,
+                                      const gchar *uid,
+                                      GCancellable *cancellable,
+                                      GError **err);
+
+gboolean
+camel_imapx_extd_server_manage_subscription (CamelIMAPXExtdServer *self,
+                                             const gchar *foldername,
+                                             gboolean subscribe,
+                                             GCancellable *cancellable,
+                                             GError **err);
+
+gboolean
+camel_imapx_extd_server_create_folder (CamelIMAPXExtdServer *self,
+                                       const gchar *foldername,
+                                       GCancellable *cancellable,
+                                       GError **err);
+
+gboolean
+camel_imapx_extd_server_delete_folder (CamelIMAPXExtdServer *self,
+                                       const gchar *foldername,
+                                       GCancellable *cancellable,
+                                       GError **err);
+
+gboolean
+camel_imapx_extd_server_rename_folder (CamelIMAPXExtdServer *is,
+                                       const gchar *oldname,
+                                       const gchar *newname,
+                                       GCancellable *cancellable,
+                                       GError **err);
+struct _IMAPXJobQueueInfo*
+camel_imapx_extd_server_get_job_queue_info (CamelIMAPXExtdServer *self);
+
 camel_imapx_metadata_proto_t
 camel_imapx_extd_server_metadata_get_proto (CamelIMAPXExtdServer *self);
 



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