2005-01-31 Helge Hess <helge.hess@opengroupware.org>
+ * 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)
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
/* bulk fetching of plain/text content */
- (NSArray *)plainTextContentFetchKeys;
+- (NSDictionary *)fetchPlainTextParts;
/* flags */
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 {
# Version file
-SUBMINOR_VERSION:=63
+SUBMINOR_VERSION:=64
# v0.9.55 requires NGExtensions v4.5.136
# v0.9.44 requires libNGMime v4.3.194
2005-01-31 Helge Hess <helge.hess@opengroupware.org>
+ * 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)
*/
#include "UIxMailRenderingContext.h"
+#include <SoObjects/Mailer/SOGoMailObject.h>
#include "common.h"
-@interface WOComponent(Viewer)
-- (NSDictionary *)fetchFlatContents;
-@end
-
@implementation UIxMailRenderingContext
- (id)initWithViewer:(WOComponent *)_viewer context:(WOContext *)_ctx {
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;
}
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 {
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;
}
# 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
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"; },
),