Monotone-Parent: f41b9f8e61926cdfbebea33229cefdf60f2fdbcb

Monotone-Revision: fb65b0d0f170c30fcadecf001ad33a8fc79e9e89

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-01-15T12:19:36
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2010-01-15 12:19:36 +00:00
parent 2b0cc9a6e5
commit bd6edc2243
1 changed files with 33 additions and 11 deletions

View File

@ -1345,20 +1345,23 @@ Index: sope-mime/NGImap4/NGImap4Connection.m
if (![[result valueForKey:@"result"] boolValue]) { if (![[result valueForKey:@"result"] boolValue]) {
return [self errorForResult:result return [self errorForResult:result
text:@"Failed to change flags of IMAP4 message"]; text:@"Failed to change flags of IMAP4 message"];
@@ -737,20 +770,21 @@ @@ -737,34 +770,42 @@
- (BOOL)doesMailboxExistAtURL:(NSURL *)_url { - (BOOL)doesMailboxExistAtURL:(NSURL *)_url {
NSString *folderName; NSString *folderName;
+ NSArray *caches; + NSArray *caches;
id result; id result;
+ int count, max; + int count, max;
+ BOOL found;
+ found = NO;
+
/* check in hierarchy cache */ /* check in hierarchy cache */
- -
- if ((result = [self cachedHierarchyResults]) != nil) { - if ((result = [self cachedHierarchyResults]) != nil) {
+ caches = [self->subfolders allValues]; + caches = [self->subfolders allValues];
+ max = [caches count]; + max = [caches count];
+ for (count = 0; count < max; count++) { + for (count = 0; !found && count < max; count++) {
NSString *p; NSString *p;
- -
- result = [(NSDictionary *)result objectForKey:@"list"]; - result = [(NSDictionary *)result objectForKey:@"list"];
@ -1372,25 +1375,36 @@ Index: sope-mime/NGImap4/NGImap4Connection.m
-#endif -#endif
if ([p hasSuffix:@"/"]) if ([p hasSuffix:@"/"])
p = [p substringToIndex:[p length]-1]; p = [p substringToIndex:[p length]-1];
return ([(NSDictionary *)result objectForKey:p] != nil) ? YES : NO; - return ([(NSDictionary *)result objectForKey:p] != nil) ? YES : NO;
@@ -760,11 +794,11 @@ + found = ([(NSDictionary *)result objectForKey:p] != nil);
// TODO: we should probably just fetch the whole hierarchy? }
+
+ if (!found) {
+ /* check using IMAP4 select */
+ // TODO: we should probably just fetch the whole hierarchy?
folderName = [self imap4FolderNameForURL:_url]; - /* check using IMAP4 select */
- // TODO: we should probably just fetch the whole hierarchy?
-
- folderName = [self imap4FolderNameForURL:_url];
- result = [[self client] select:folderName]; - result = [[self client] select:folderName];
- if (![[result valueForKey:@"result"] boolValue]) - if (![[result valueForKey:@"result"] boolValue])
- return NO; - return NO;
- -
- return YES; - return YES;
+ folderName = [self imap4FolderNameForURL:_url];
+ +
+ result = [self->client status: folderName + result = [self->client status: folderName
+ flags: [NSArray arrayWithObject: @"UIDVALIDITY"]]; + flags: [NSArray arrayWithObject: @"UIDVALIDITY"]];
+ +
+ return ([[result valueForKey: @"result"] boolValue]); + found =([[result valueForKey: @"result"] boolValue]);
+ }
+
+ return found;
} }
- (id)infoForMailboxAtURL:(NSURL *)_url { - (id)infoForMailboxAtURL:(NSURL *)_url {
@@ -789,7 +823,8 @@ @@ -789,7 +830,8 @@
/* construct path */ /* construct path */
newPath = [self imap4FolderNameForURL:_url]; newPath = [self imap4FolderNameForURL:_url];
@ -2399,7 +2413,15 @@ Index: sope-mime/NGImap4/ChangeLog
=================================================================== ===================================================================
--- sope-mime/NGImap4/ChangeLog (revision 1664) --- sope-mime/NGImap4/ChangeLog (revision 1664)
+++ sope-mime/NGImap4/ChangeLog (working copy) +++ sope-mime/NGImap4/ChangeLog (working copy)
@@ -1,3 +1,99 @@ @@ -1,3 +1,107 @@
+2010-01-15 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * NGImap4Connection.m (-doesMailboxExistAtURL:): sometimes an
+ entry is present in the subfolders cache. When it is the case, the
+ method was returning at the end of the first iteration even though
+ the mailbox was never found. We need to continue and then proceed
+ to the "status" check whether the cache is populated or not.
+
+2010-01-14 Wolfgang Sourdeau <wsourdeau@inverse.ca> +2010-01-14 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+ +
+ * NGImap4Connection.m (-doesMailboxExistAtURL:): mailbox paths can + * NGImap4Connection.m (-doesMailboxExistAtURL:): mailbox paths can