diff options
Diffstat (limited to 'camel/camel-disco-folder.c')
-rw-r--r-- | camel/camel-disco-folder.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/camel/camel-disco-folder.c b/camel/camel-disco-folder.c index a5e7f80ee0..d45a4da850 100644 --- a/camel/camel-disco-folder.c +++ b/camel/camel-disco-folder.c @@ -270,6 +270,8 @@ disco_refresh_info (CamelFolder *folder, CamelException *ex) static void disco_sync (CamelFolder *folder, gboolean expunge, CamelException *ex) { + void (*sync)(CamelFolder *, CamelException *) = NULL; + if (expunge) { disco_expunge (folder, ex); if (camel_exception_is_set (ex)) @@ -280,40 +282,55 @@ disco_sync (CamelFolder *folder, gboolean expunge, CamelException *ex) switch (camel_disco_store_status (CAMEL_DISCO_STORE (folder->parent_store))) { case CAMEL_DISCO_STORE_ONLINE: - CDF_CLASS (folder)->sync_online (folder, ex); + sync = CDF_CLASS (folder)->sync_online; break; case CAMEL_DISCO_STORE_OFFLINE: - CDF_CLASS (folder)->sync_offline (folder, ex); + sync = CDF_CLASS (folder)->sync_offline; break; case CAMEL_DISCO_STORE_RESYNCING: - CDF_CLASS (folder)->sync_resyncing (folder, ex); + sync = CDF_CLASS (folder)->sync_resyncing; break; } + + if (sync) { + sync(folder, ex); + } else { + g_warning("Class '%s' doesn't implement CamelDiscoFolder:sync methods", + ((CamelObject *)folder)->klass->name); + } } static void disco_expunge_uids (CamelFolder *folder, GPtrArray *uids, CamelException *ex) { CamelDiscoStore *disco = CAMEL_DISCO_STORE (folder->parent_store); + void (*expunge_uids)(CamelFolder *, GPtrArray *, CamelException *) = NULL; if (uids->len == 0) return; switch (camel_disco_store_status (disco)) { case CAMEL_DISCO_STORE_ONLINE: - CDF_CLASS (folder)->expunge_uids_online (folder, uids, ex); + expunge_uids = CDF_CLASS (folder)->expunge_uids_online; break; case CAMEL_DISCO_STORE_OFFLINE: - CDF_CLASS (folder)->expunge_uids_offline (folder, uids, ex); + expunge_uids = CDF_CLASS (folder)->expunge_uids_offline; break; case CAMEL_DISCO_STORE_RESYNCING: - CDF_CLASS (folder)->expunge_uids_resyncing (folder, uids, ex); + expunge_uids = CDF_CLASS (folder)->expunge_uids_resyncing; break; } + + if (expunge_uids) { + expunge_uids(folder, uids, ex); + } else { + g_warning("Class '%s' doesn't implement CamelDiscoFolder:expunge_uids methods", + ((CamelObject *)folder)->klass->name); + } } static void |