From 2d65b75b56c43f105ff7982864f0fa7cab2a0f83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20J=2E=20Hern=C3=A1ndez=20Blasco?= Date: Tue, 5 May 2015 10:46:53 +0200 Subject: [PATCH] oc-mail: Flush IMAP hierarchy cache to update Outlook folders This fixes two scenarios: * An IMAP subfolder has updated its hierarchy when it is asked to be synchronised * An IMAP root folder is created on Outlook when you logon. OpenChange changes are required to be refreshed on synchronisation. --- OpenChange/MAPIStoreMailContext.m | 3 +++ OpenChange/MAPIStoreMailFolder.m | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/OpenChange/MAPIStoreMailContext.m b/OpenChange/MAPIStoreMailContext.m index 87493ff09..f7a62fcd8 100644 --- a/OpenChange/MAPIStoreMailContext.m +++ b/OpenChange/MAPIStoreMailContext.m @@ -146,6 +146,9 @@ MakeDisplayFolderName (NSString *folderName) DLIST_ADD_END (firstContext, context, void); } + /* FIXME: Flush any cache before retrieving the hierarchy */ + [accountFolder flushMailCaches]; + secondaryFolders = [[accountFolder toManyRelationshipKeysWithNamespaces: NO] mutableCopy]; [secondaryFolders autorelease]; diff --git a/OpenChange/MAPIStoreMailFolder.m b/OpenChange/MAPIStoreMailFolder.m index d2036454a..0e98b4af4 100644 --- a/OpenChange/MAPIStoreMailFolder.m +++ b/OpenChange/MAPIStoreMailFolder.m @@ -368,6 +368,11 @@ static Class SOGoMailFolderK, MAPIStoreMailFolderK, MAPIStoreOutboxFolderK; if (sortOrderings) [self errorWithFormat: @"sort orderings are not used for folders"]; + /* FIXME: Flush any cache before retrieving the hierarchy, this + slows things down but it is safer */ + if (!qualifier) + [sogoObject flushMailCaches]; + subfolderKeys = [[sogoObject toManyRelationshipKeys] mutableCopy]; [subfolderKeys autorelease];