From: helge Date: Mon, 31 Jan 2005 01:18:23 +0000 (+0000) Subject: more bulkfetch reorgs X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a2e9a44bfc92fa03fc0dc78226d81ddb680393f8;p=scalable-opengroupware.org more bulkfetch reorgs git-svn-id: http://svn.opengroupware.org/SOGo/trunk@515 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/SoObjects/Mailer/ChangeLog b/SOGo/SoObjects/Mailer/ChangeLog index 2adaa8fc..d1c11d8a 100644 --- a/SOGo/SoObjects/Mailer/ChangeLog +++ b/SOGo/SoObjects/Mailer/ChangeLog @@ -1,5 +1,7 @@ 2005-01-31 Helge Hess + * SOGoMailObject.m: moved more bulk fetching to SoObject (v0.9.64) + * SOGoMailObject.m: moved in plain/text bulk fetch method from mail viewer (since it is general purpose) (v0.9.63) diff --git a/SOGo/SoObjects/Mailer/SOGoMailObject.h b/SOGo/SoObjects/Mailer/SOGoMailObject.h index f497c5fd..148a5a8e 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailObject.h +++ b/SOGo/SoObjects/Mailer/SOGoMailObject.h @@ -37,7 +37,7 @@ would address the MIME part 1.2.3 of the mail 12345 in the folder INBOX. */ -@class NSData, NSString, NSArray, NSCalendarDate, NSException; +@class NSData, NSString, NSArray, NSCalendarDate, NSException, NSDictionary; @class NGImap4Envelope, NGImap4EnvelopeAddress; @interface SOGoMailObject : SOGoMailBaseObject @@ -71,6 +71,7 @@ /* bulk fetching of plain/text content */ - (NSArray *)plainTextContentFetchKeys; +- (NSDictionary *)fetchPlainTextParts; /* flags */ diff --git a/SOGo/SoObjects/Mailer/SOGoMailObject.m b/SOGo/SoObjects/Mailer/SOGoMailObject.m index 310f0917..0935ed30 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailObject.m +++ b/SOGo/SoObjects/Mailer/SOGoMailObject.m @@ -365,6 +365,48 @@ static BOOL debugBodyStructure = NO; return ma; } +- (NSDictionary *)fetchPlainTextParts { + NSMutableDictionary *flatContents; + unsigned i, count; + NSArray *keys; + id result; + + keys = [self plainTextContentFetchKeys]; + [self debugWithFormat:@"fetch keys: %@", keys]; + + result = [self fetchParts:keys]; + result = [result valueForKey:@"RawResponse"]; // hackish + result = [result objectForKey:@"fetch"]; // Note: -valueForKey: doesn't work! + + count = [keys count]; + flatContents = [NSMutableDictionary dictionaryWithCapacity:count]; + for (i = 0; i < count; i++) { + NSString *key; + NSData *data; + + key = [keys objectAtIndex:i]; + data = [[result objectForKey:key] objectForKey:@"data"]; + + if (![data isNotNull]) { + [self debugWithFormat:@"got no data fork key: %@", key]; + continue; + } + + if ([key isEqualToString:@"body[text]"]) + key = @""; // see key collector + else if ([key hasPrefix:@"body["]) { + NSRange r; + + key = [key substringFromIndex:5]; + r = [key rangeOfString:@"]"]; + if (r.length > 0) + key = [key substringToIndex:r.location]; + } + [flatContents setObject:data forKey:key]; + } + return flatContents; +} + /* flags */ - (NSException *)addFlags:(id)_flags { diff --git a/SOGo/SoObjects/Mailer/Version b/SOGo/SoObjects/Mailer/Version index 33634eae..4d027ef1 100644 --- a/SOGo/SoObjects/Mailer/Version +++ b/SOGo/SoObjects/Mailer/Version @@ -1,6 +1,6 @@ # Version file -SUBMINOR_VERSION:=63 +SUBMINOR_VERSION:=64 # v0.9.55 requires NGExtensions v4.5.136 # v0.9.44 requires libNGMime v4.3.194 diff --git a/SOGo/UI/Mailer/ChangeLog b/SOGo/UI/Mailer/ChangeLog index 96c31d01..2a11a029 100644 --- a/SOGo/UI/Mailer/ChangeLog +++ b/SOGo/UI/Mailer/ChangeLog @@ -1,5 +1,8 @@ 2005-01-31 Helge Hess + * UIxMailView.m, UIxMailRenderingContext.m: moved more bulk fetching + to SoObject (v0.9.86) + * UIxMailView.m: moved plain/text bulkfetch method to SoObjects/Mailer, since its general purpose (v0.9.85) diff --git a/SOGo/UI/Mailer/UIxMailRenderingContext.m b/SOGo/UI/Mailer/UIxMailRenderingContext.m index 758b4992..4f466319 100644 --- a/SOGo/UI/Mailer/UIxMailRenderingContext.m +++ b/SOGo/UI/Mailer/UIxMailRenderingContext.m @@ -20,12 +20,9 @@ */ #include "UIxMailRenderingContext.h" +#include #include "common.h" -@interface WOComponent(Viewer) -- (NSDictionary *)fetchFlatContents; -@end - @implementation UIxMailRenderingContext - (id)initWithViewer:(WOComponent *)_viewer context:(WOContext *)_ctx { @@ -67,7 +64,8 @@ if (self->flatContents != nil) return [self->flatContents isNotNull] ? self->flatContents : nil; - self->flatContents = [[self->viewer fetchFlatContents] retain]; + self->flatContents = + [[[self->viewer clientObject] fetchPlainTextParts] retain]; [self debugWithFormat:@"CON: %@", self->flatContents]; return self->flatContents; } diff --git a/SOGo/UI/Mailer/UIxMailView.m b/SOGo/UI/Mailer/UIxMailView.m index 2540560f..45198e22 100644 --- a/SOGo/UI/Mailer/UIxMailView.m +++ b/SOGo/UI/Mailer/UIxMailView.m @@ -97,50 +97,6 @@ return [[[self clientObject] ccEnvelopeAddresses] count] > 0 ? YES : NO; } -/* process body structure */ - -- (NSDictionary *)fetchFlatContents { - NSMutableDictionary *flatContents; - unsigned i, count; - NSArray *keys; - id result; - - keys = [[self clientObject] plainTextContentFetchKeys]; - [self debugWithFormat:@"fetch keys: %@", keys]; - - result = [[self clientObject] fetchParts:keys]; - result = [result valueForKey:@"RawResponse"]; // hackish - result = [result objectForKey:@"fetch"]; // Note: -valueForKey: doesn't work! - - count = [keys count]; - flatContents = [NSMutableDictionary dictionaryWithCapacity:count]; - for (i = 0; i < count; i++) { - NSString *key; - NSData *data; - - key = [keys objectAtIndex:i]; - data = [[result objectForKey:key] objectForKey:@"data"]; - - if (![data isNotNull]) { - [self debugWithFormat:@"got no data fork key: %@", key]; - continue; - } - - if ([key isEqualToString:@"body[text]"]) - key = @""; // see key collector - else if ([key hasPrefix:@"body["]) { - NSRange r; - - key = [key substringFromIndex:5]; - r = [key rangeOfString:@"]"]; - if (r.length > 0) - key = [key substringToIndex:r.location]; - } - [flatContents setObject:data forKey:key]; - } - return flatContents; -} - /* viewers */ - (id)contentViewerComponent { @@ -159,11 +115,6 @@ return [NSException exceptionWithHTTPStatus:404 /* Not Found */ reason:@"did not find specified message!"]; } -#if 0 - [self logWithFormat:@"FETCH BODY PARTS: %@", - [[self clientObject] plainTextContentFetchKeys]]; - [self logWithFormat:@"CORE: %@", [self fetchFlatContents]]; -#endif return self; } diff --git a/SOGo/UI/Mailer/Version b/SOGo/UI/Mailer/Version index 986ed409..22c1ab47 100644 --- a/SOGo/UI/Mailer/Version +++ b/SOGo/UI/Mailer/Version @@ -1,7 +1,8 @@ # version file -SUBMINOR_VERSION:=85 +SUBMINOR_VERSION:=86 +# v0.9.86 requires SoObjects/Mailer v0.9.64 # v0.9.85 requires SoObjects/Mailer v0.9.63 # v0.9.84 requires libNGMime v4.5.209 # v0.9.81 requires SoObjects/Sieve v0.9.5 diff --git a/SOGo/UI/Mailer/product.plist b/SOGo/UI/Mailer/product.plist index 1a124161..1b9774ce 100644 --- a/SOGo/UI/Mailer/product.plist +++ b/SOGo/UI/Mailer/product.plist @@ -168,12 +168,12 @@ cssClass = "tbicon_compose"; label = "Write"; }, ), ( // second group -///* TODO: enable when implemented +/* TODO: enable when implemented { link = "reply"; cssClass = "tbicon_reply"; label = "Reply"; }, { link = "replyall"; cssClass = "tbicon_replyall"; label = "Reply All"; }, -//*/ +*/ { link = "forward"; cssClass = "tbicon_forward"; label = "Forward"; }, ),