From: helge Date: Tue, 9 Nov 2004 14:21:22 +0000 (+0000) Subject: implemented getMail X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d6820f98d0b47b6621adf0382bbd6780c0a9dd2e;p=scalable-opengroupware.org implemented getMail git-svn-id: http://svn.opengroupware.org/SOGo/trunk@447 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/SoObjects/Mailer/ChangeLog b/SOGo/SoObjects/Mailer/ChangeLog index 76e29240..1d7f9be3 100644 --- a/SOGo/SoObjects/Mailer/ChangeLog +++ b/SOGo/SoObjects/Mailer/ChangeLog @@ -1,3 +1,12 @@ +2004-11-09 Helge Hess + + * SOGoMailBaseObject.m, SOGoMailManager.m, SOGoMailConnectionEntry.m: + added cache flush operations for getmail (v0.9.49) + +2004-11-08 Helge Hess + + * SOGoMailManager.m: improved a log message (v0.9.48) + 2004-10-30 Helge Hess * v0.9.47 diff --git a/SOGo/SoObjects/Mailer/SOGoMailBaseObject.h b/SOGo/SoObjects/Mailer/SOGoMailBaseObject.h index 1ca8d15e..4be1129d 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailBaseObject.h +++ b/SOGo/SoObjects/Mailer/SOGoMailBaseObject.h @@ -55,6 +55,8 @@ - (NSString *)imap4FolderName; - (NGImap4Client *)imap4Client; +- (void)flushMailCaches; + /* UI navigation */ - (NSArray *)treeNavigationNodes; diff --git a/SOGo/SoObjects/Mailer/SOGoMailBaseObject.m b/SOGo/SoObjects/Mailer/SOGoMailBaseObject.m index a6b8f631..37a3a555 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailBaseObject.m +++ b/SOGo/SoObjects/Mailer/SOGoMailBaseObject.m @@ -140,6 +140,10 @@ static BOOL debugTree = NO; password:[self imap4Password]]; } +- (void)flushMailCaches { + [[self mailManager] flushCachesForURL:[self imap4URL]]; +} + /* UI navigation */ - (NSString *)treeNavigationLinkAtDepth:(int)_depth { diff --git a/SOGo/SoObjects/Mailer/SOGoMailConnectionEntry.h b/SOGo/SoObjects/Mailer/SOGoMailConnectionEntry.h index c8fd0f39..4b8a9017 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailConnectionEntry.h +++ b/SOGo/SoObjects/Mailer/SOGoMailConnectionEntry.h @@ -64,6 +64,8 @@ - (void)cacheUIDs:(NSArray *)_uids forURL:(NSURL *)_url qualifier:(id)_q sortOrdering:(id)_so; +- (void)flushMailCaches; + @end #endif /* __SOGo_SOGoMailConnectionEntry_H__ */ diff --git a/SOGo/SoObjects/Mailer/SOGoMailConnectionEntry.m b/SOGo/SoObjects/Mailer/SOGoMailConnectionEntry.m index 1ea7e948..9875bd9d 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailConnectionEntry.m +++ b/SOGo/SoObjects/Mailer/SOGoMailConnectionEntry.m @@ -99,4 +99,10 @@ ASSIGNCOPY(self->cachedUIDs, _uids); } +- (void)flushMailCaches { + ASSIGNCOPY(self->uidSortOrdering, nil); + ASSIGNCOPY(self->uidFolderURL, nil); + ASSIGNCOPY(self->cachedUIDs, nil); +} + @end /* SOGoMailConnectionEntry */ diff --git a/SOGo/SoObjects/Mailer/SOGoMailManager.h b/SOGo/SoObjects/Mailer/SOGoMailManager.h index 8395caa2..4c5acedf 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailManager.h +++ b/SOGo/SoObjects/Mailer/SOGoMailManager.h @@ -46,6 +46,7 @@ /* client object */ - (NGImap4Client *)imap4ClientForURL:(NSURL *)_url password:(NSString *)_pwd; +- (void)flushCachesForURL:(NSURL *)_url; /* folder hierarchy */ diff --git a/SOGo/SoObjects/Mailer/SOGoMailManager.m b/SOGo/SoObjects/Mailer/SOGoMailManager.m index 82e5ecd9..0234180a 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailManager.m +++ b/SOGo/SoObjects/Mailer/SOGoMailManager.m @@ -47,7 +47,8 @@ static NSString *imap4Separator = nil; imap4Separator = [[ud stringForKey:@"SOGoIMAP4StringSeparator"] copy]; if ([imap4Separator length] == 0) imap4Separator = @"/"; - NSLog(@"Note: using '%@' as the IMAP4 folder separator.", imap4Separator); + NSLog(@"Note(SOGoMailManager): using '%@' as the IMAP4 folder separator.", + imap4Separator); } + (id)defaultMailManager { @@ -197,6 +198,16 @@ static NSString *imap4Separator = nil; return client; } +- (void)flushCachesForURL:(NSURL *)_url { + SOGoMailConnectionEntry *entry; + + if ((entry = [self entryForURL:_url]) == nil) /* nothing cached */ + return; + + [entry flushFolderHierarchyCache]; + [entry flushMailCaches]; +} + /* folder hierarchy */ - (NSArray *)_getDirectChildren:(NSArray *)_array folderName:(NSString *)_fn { @@ -564,7 +575,7 @@ static NSString *imap4Separator = nil; return [NSException exceptionWithHTTPStatus:500 /* server error */ reason:[result valueForKey:@"reason"]]; } - + [entry flushFolderHierarchyCache]; // [self debugWithFormat:@"created mailbox: %@: %@", newPath, result]; return nil; diff --git a/SOGo/SoObjects/Mailer/Version b/SOGo/SoObjects/Mailer/Version index 89add11f..e3b5ed09 100644 --- a/SOGo/SoObjects/Mailer/Version +++ b/SOGo/SoObjects/Mailer/Version @@ -1,6 +1,6 @@ # Version file -SUBMINOR_VERSION:=46 +SUBMINOR_VERSION:=49 # v0.9.44 requires NGMime v4.3.194 # v0.9.41 requires NGMime v4.3.190 diff --git a/SOGo/UI/Mailer/ChangeLog b/SOGo/UI/Mailer/ChangeLog index 743d3e07..cb81e431 100644 --- a/SOGo/UI/Mailer/ChangeLog +++ b/SOGo/UI/Mailer/ChangeLog @@ -1,3 +1,7 @@ +2004-11-09 Helge Hess + + * UIxMailListView.m: flush mail caches in the getMail action (v0.9.58) + 2004-10-29 Helge Hess * UIxMailEditor.m: reenabled deletion of temporary mail files (v0.9.57) diff --git a/SOGo/UI/Mailer/UIxMailListView.m b/SOGo/UI/Mailer/UIxMailListView.m index dfd8d395..afc2e659 100644 --- a/SOGo/UI/Mailer/UIxMailListView.m +++ b/SOGo/UI/Mailer/UIxMailListView.m @@ -20,9 +20,15 @@ */ // $Id$ - #include +/* + UIxMailListView + + This component represent a list of mails and is attached to an SOGoMailFolder + object. +*/ + @interface UIxMailListView : UIxComponent { NSArray *sortedUIDs; /* we always need to retrieve all anyway! */ @@ -361,6 +367,20 @@ static int attachmentFlagSize = 8096; - (id)getMailAction { // TODO: we might want to flush the caches? + id client; + + if ((client = [self clientObject]) == nil) { + return [NSException exceptionWithHTTPStatus:404 /* Not Found */ + reason:@"did not find mail folder"]; + } + + if (![client respondsToSelector:@selector(flushMailCaches)]) { + return [NSException exceptionWithHTTPStatus:500 /* Server Error */ + reason: + @"invalid client object (does not support flush)"]; + } + + [client flushMailCaches]; return [self redirectToLocation:@"view"]; } diff --git a/SOGo/UI/Mailer/Version b/SOGo/UI/Mailer/Version index 120c434f..6b08a245 100644 --- a/SOGo/UI/Mailer/Version +++ b/SOGo/UI/Mailer/Version @@ -1,6 +1,6 @@ # $Id$ -SUBMINOR_VERSION:=57 +SUBMINOR_VERSION:=58 # v0.9.50 requires NGMime v4.3.190 # v0.9.43 requires NGObjWeb v4.3.73