[evolution-kolab] KolabMailAccess: added API for querying folder type information
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab] KolabMailAccess: added API for querying folder type information
- Date: Mon, 23 Jul 2012 18:23:07 +0000 (UTC)
commit 23072f62fd1bb537ff702febc0df01e7edebf53a
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Mon Jul 23 20:15:19 2012 +0200
KolabMailAccess: added API for querying folder type information
* added an online-mode folder type querying function
* this function is supposed to not rely on cached folder
type information but to query the Kolab server each
time
* the function can be used in the new collection backend
for folder (type) autodiscovery
src/libekolab/kolab-mail-access.c | 96 ++++++++++++++++++++++++++----------
src/libekolab/kolab-mail-access.h | 5 ++
2 files changed, 74 insertions(+), 27 deletions(-)
---
diff --git a/src/libekolab/kolab-mail-access.c b/src/libekolab/kolab-mail-access.c
index 057d221..0281451 100644
--- a/src/libekolab/kolab-mail-access.c
+++ b/src/libekolab/kolab-mail-access.c
@@ -1286,33 +1286,6 @@ mail_access_strans_online_offline (KolabMailAccess *self,
/* get infrastructure into offline operation */
- /* TODO KolabMailSynchronizer needs to sync
- * - KolabMailInfoDb
- * with
- * - KolabMailImapClient (still online) - folders, uids
- * - KolabMailSideCache - folders, uids
- *
- * Action: slurp everything available for offline operation
- * first, then do push SideCache (should be empty,
- * but may contain objects which we were unable to
- * push to the server before, so we try again here)
- * Goal: empty SideCache (exception: objects which could
- * not be pushed onto the server remain in SideCache)
- * Todo: When to drop objects from SideCache which we
- * permanently fail to push onto the server?
- */
-
- ok = mail_access_sync_with_server (self,
- KOLAB_MAIL_ACCESS_OPMODE_ONLINE,
- NULL, /* all folders */
- TRUE, /* full sync */
- cancellable,
- &tmp_err);
- if (! ok) {
- g_propagate_error (err, tmp_err);
- return FALSE;
- }
-
/* get IMAP client into offline mode */
ok = kolab_mail_imap_client_go_offline (priv->client,
cancellable,
@@ -2893,6 +2866,75 @@ kolab_mail_access_query_sources (KolabMailAccess *self,
}
/**
+ * kolab_mail_access_query_folder_types_online:
+ * @self: a #KolabMailAccess instance
+ * @cancellable: a cancellation stack
+ * @err: a #GError object (or NULL)
+ *
+ * Query Kolab folder (type) information directly
+ * from the server without interfering with the
+ * rest of the infrastructure. Does not save the
+ * folder type information into any persistent DB.
+ * This function is needed for querying folder type
+ * information from inside the new collection backend.
+ * The information is needed there in order to display
+ * a list of folders (of a specific Kolab PIM type)
+ * as a result of PIM autodiscovery. The collection
+ * backend does not need the actual payload data, just
+ * the folder metadata, so it can auto-create #ESource
+ * for the cal/book backends. The collection backend
+ * must not interfere with the cal/book SQLiteDB files,
+ * and it needs to be online anyways for autodiscovery
+ * of PIM folders (so we do not need offline capability
+ * there). Once the #ESource files are created, the
+ * cal/book backends will pick up the information and
+ * download payload data from the server into their
+ * local caches.
+ *
+ * You need to be in online operational mode (and
+ * actually have a connection to the server) for this
+ * function to succeed. No synchronization with the
+ * server needs to be done prior to calling this function.
+ *
+ * Returns: a #GList of pointers to newly allocated
+ * #KolabFolderDescriptor objects. Free the
+ * list with kolab_util_folder_descriptor_glist_free()
+ * once you're done using the list. The list
+ * returned may be NULL without that being an
+ * error (check @err separately)
+ *
+ * Since: 3.6
+ *
+ */
+GList*
+kolab_mail_access_query_folder_info_online (KolabMailAccess *self,
+ GCancellable *cancellable,
+ GError **err)
+{
+ KolabMailAccessPrivate *priv = NULL;
+ GList *folders_desc = NULL;
+ GError *tmp_err = NULL;
+
+ g_assert (KOLAB_IS_MAIL_ACCESS (self));
+ /* cancellable may be NULL */
+ g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
+
+ priv = KOLAB_MAIL_ACCESS_PRIVATE (self);
+
+ g_mutex_lock (&(priv->big_lock));
+
+ folders_desc = kolab_mail_imap_client_query_folder_info_online (priv->client,
+ cancellable,
+ &tmp_err);
+ if (tmp_err != NULL)
+ g_propagate_error (err, tmp_err);
+
+ g_mutex_unlock (&(priv->big_lock));
+
+ return folders_desc;
+}
+
+/**
* kolab_mail_access_create_source:
* @self: a #KolabMailAccess instance
* @sourcename: the name of the source to create
diff --git a/src/libekolab/kolab-mail-access.h b/src/libekolab/kolab-mail-access.h
index b984050..9efb3d5 100644
--- a/src/libekolab/kolab-mail-access.h
+++ b/src/libekolab/kolab-mail-access.h
@@ -168,6 +168,11 @@ GList*
kolab_mail_access_query_sources (KolabMailAccess *self,
GError **err);
+GList*
+kolab_mail_access_query_folder_info_online (KolabMailAccess *self,
+ GCancellable *cancellable,
+ GError **err);
+
gboolean
kolab_mail_access_create_source (KolabMailAccess *self,
const gchar *sourcename,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]