From c8073c7b3e04dd71eaa91da2a60229eeacf97af1 Mon Sep 17 00:00:00 2001 From: "Graham R. Cobb" Date: Tue, 5 Mar 2013 17:33:11 +0000 Subject: [PATCH] eas-daemon: add eas_connection_forget_folders Add function to reset the folder list and cache and reset the folder sync key to 0. This is necessary when the server has lost sync state and demands we do a FolderSync from scratch. --- eas-daemon/libeas/eas-connection.c | 21 +++++++++++++++++++++ eas-daemon/libeas/eas-connection.h | 3 +++ 2 files changed, 24 insertions(+) diff --git a/eas-daemon/libeas/eas-connection.c b/eas-daemon/libeas/eas-connection.c index 02841fe..1f6f576 100644 --- a/eas-daemon/libeas/eas-connection.c +++ b/eas-daemon/libeas/eas-connection.c @@ -2319,6 +2319,27 @@ eas_connection_get_multipartdata (EasConnection* self, guint partID) } void +eas_connection_forget_folders (EasConnection *self, GError **error) +{ + GFile *file; + + g_key_file_free(self->priv->folders); + self->priv->folders = g_key_file_new (); + if (!self->priv->folders) { + g_set_error (error, + EAS_CONNECTION_ERROR, + EAS_CONNECTION_ERROR_NOTENOUGHMEMORY, + "Could not reset folder list"); + return; + } + g_key_file_set_string (self->priv->folders, "##storedata", "synckey", "0"); + + file = g_file_new_for_path (self->priv->folders_keyfile); + g_file_delete(file, NULL, error); + g_object_unref (file); +} + +void eas_connection_update_folders (void *self, const gchar *ret_sync_key, GSList *added_folders, GSList *updated_folders, GSList *deleted_folders, GError *error) diff --git a/eas-daemon/libeas/eas-connection.h b/eas-daemon/libeas/eas-connection.h index 41ac7ff..e40c54a 100644 --- a/eas-daemon/libeas/eas-connection.h +++ b/eas-daemon/libeas/eas-connection.h @@ -232,6 +232,9 @@ gchar* eas_connection_get_multipartdata (EasConnection* self, guint partID); void +eas_connection_forget_folders (EasConnection *self, GError **error); + +void eas_connection_update_folders (void *self, const gchar *ret_sync_key, GSList *added_folders, GSList *updated_folders, GSList *deleted_folders, GError *error); -- 1.7.10.4