From 69d1b3ddf729e395999d54254dee8b7b0de43869 Mon Sep 17 00:00:00 2001 From: helge Date: Mon, 31 Jan 2005 00:48:13 +0000 Subject: [PATCH] fixed support for embedded message/rfc822 attachments (properly handle body-parts) git-svn-id: http://svn.opengroupware.org/SOGo/trunk@512 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/UI/Mailer/ChangeLog | 18 +++ SOGo/UI/Mailer/GNUmakefile | 2 + SOGo/UI/Mailer/README | 3 + SOGo/UI/Mailer/UIxEnvelopeAddressFormatter.m | 4 +- SOGo/UI/Mailer/UIxMailPartLinkViewer.m | 4 - SOGo/UI/Mailer/UIxMailPartLinkViewer.wox | 4 +- SOGo/UI/Mailer/UIxMailPartMessageViewer.m | 156 +++++++++++++++++++ SOGo/UI/Mailer/UIxMailPartMessageViewer.wox | 77 +++++++++ SOGo/UI/Mailer/UIxMailPartViewer.m | 3 +- SOGo/UI/Mailer/UIxMailRenderingContext.h | 1 + SOGo/UI/Mailer/UIxMailRenderingContext.m | 22 ++- SOGo/UI/Mailer/UIxMailView.m | 30 ++++ SOGo/UI/Mailer/UIxMailView.wox | 9 +- SOGo/UI/Mailer/Version | 3 +- 14 files changed, 316 insertions(+), 20 deletions(-) create mode 100644 SOGo/UI/Mailer/UIxMailPartMessageViewer.m create mode 100644 SOGo/UI/Mailer/UIxMailPartMessageViewer.wox diff --git a/SOGo/UI/Mailer/ChangeLog b/SOGo/UI/Mailer/ChangeLog index 8c594df0..0288835c 100644 --- a/SOGo/UI/Mailer/ChangeLog +++ b/SOGo/UI/Mailer/ChangeLog @@ -1,4 +1,22 @@ +2005-01-31 Helge Hess + + * v0.9.84 + + * UIxMailView.m: properly recurse into message/rfc822 bodies for flat + content fetches + + * UIxMailView.m, UIxMailPartMessageViewer.m: added links for email + addresses (currently mailto://) + 2005-01-30 Helge Hess + + * v0.9.83 + + * UIxMailRenderingContext.m: activate UIxMailPartMessageViewer for + message/rfc822 contents + + * added a UIxMailPartMessageViewer for displaying embedded (eg + forwarded) MIME messages * v0.9.82 diff --git a/SOGo/UI/Mailer/GNUmakefile b/SOGo/UI/Mailer/GNUmakefile index c9154123..cf6481f1 100644 --- a/SOGo/UI/Mailer/GNUmakefile +++ b/SOGo/UI/Mailer/GNUmakefile @@ -42,6 +42,7 @@ MailerUI_OBJC_FILES += \ UIxMailPartLinkViewer.m \ UIxMailPartMixedViewer.m \ UIxMailPartAlternativeViewer.m \ + UIxMailPartMessageViewer.m \ \ UIxFilterList.m \ UIxSieveEditor.m \ @@ -75,6 +76,7 @@ MailerUI_RESOURCE_FILES += \ UIxMailPartImageViewer.wox \ UIxMailPartLinkViewer.wox \ UIxMailPartAlternativeViewer.wox\ + UIxMailPartMessageViewer.wox \ \ UIxFilterList.wox \ UIxSieveEditor.wox \ diff --git a/SOGo/UI/Mailer/README b/SOGo/UI/Mailer/README index 01404aed..96ab0eef 100644 --- a/SOGo/UI/Mailer/README +++ b/SOGo/UI/Mailer/README @@ -39,6 +39,9 @@ Bodystructures Multiparts: multipart/MIXED, multipart/SIGNED +Feature: we fetch all plain/text bodies in a single run by traversing the + body structure. + Sample Bodystructure (GPG): ---snip--- { diff --git a/SOGo/UI/Mailer/UIxEnvelopeAddressFormatter.m b/SOGo/UI/Mailer/UIxEnvelopeAddressFormatter.m index 4a949646..b12ae817 100644 --- a/SOGo/UI/Mailer/UIxEnvelopeAddressFormatter.m +++ b/SOGo/UI/Mailer/UIxEnvelopeAddressFormatter.m @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 SKYRIX Software AG + Copyright (C) 2004-2005 SKYRIX Software AG This file is part of OpenGroupware.org. @@ -114,7 +114,7 @@ static Class StrClass = Nil; if ([_address isKindOfClass:[NSArray class]]) return [self stringForArray:_address]; - + [self debugWithFormat: @"NOTE: unexpected object for envelope formatter: %@<%@>", _address, NSStringFromClass([_address class])]; diff --git a/SOGo/UI/Mailer/UIxMailPartLinkViewer.m b/SOGo/UI/Mailer/UIxMailPartLinkViewer.m index 16574e1b..41d95c32 100644 --- a/SOGo/UI/Mailer/UIxMailPartLinkViewer.m +++ b/SOGo/UI/Mailer/UIxMailPartLinkViewer.m @@ -51,10 +51,6 @@ @implementation UIxMailPartLinkViewer -- (void)dealloc { - [super dealloc]; -} - /* URLs */ - (NSString *)pathToAttachment { diff --git a/SOGo/UI/Mailer/UIxMailPartLinkViewer.wox b/SOGo/UI/Mailer/UIxMailPartLinkViewer.wox index 6d1b89cd..72528b40 100644 --- a/SOGo/UI/Mailer/UIxMailPartLinkViewer.wox +++ b/SOGo/UI/Mailer/UIxMailPartLinkViewer.wox @@ -15,8 +15,10 @@ : - + + + + + + + + + + + + + + + + + + + + + + + + + +
: + + +
: + + + +
: + +
: + + + + + +
: + + + + +
+
+
+ +
+ +
+ + + + diff --git a/SOGo/UI/Mailer/UIxMailPartViewer.m b/SOGo/UI/Mailer/UIxMailPartViewer.m index 07fc1b34..c753854a 100644 --- a/SOGo/UI/Mailer/UIxMailPartViewer.m +++ b/SOGo/UI/Mailer/UIxMailPartViewer.m @@ -108,7 +108,8 @@ NSData *content; if ((content = [self decodedFlatContent]) == nil) { - [self errorWithFormat:@"got no text content: %@", [self partPath]]; + [self errorWithFormat:@"got no text content: %@", + [[self partPath] componentsJoinedByString:@"."]]; return nil; } diff --git a/SOGo/UI/Mailer/UIxMailRenderingContext.h b/SOGo/UI/Mailer/UIxMailRenderingContext.h index e58aeec7..227622c9 100644 --- a/SOGo/UI/Mailer/UIxMailRenderingContext.h +++ b/SOGo/UI/Mailer/UIxMailRenderingContext.h @@ -44,6 +44,7 @@ WOComponent *textViewer; WOComponent *imageViewer; WOComponent *linkViewer; + WOComponent *messageViewer; } - (id)initWithViewer:(WOComponent *)_viewer context:(WOContext *)_ctx; diff --git a/SOGo/UI/Mailer/UIxMailRenderingContext.m b/SOGo/UI/Mailer/UIxMailRenderingContext.m index 3885512a..758b4992 100644 --- a/SOGo/UI/Mailer/UIxMailRenderingContext.m +++ b/SOGo/UI/Mailer/UIxMailRenderingContext.m @@ -41,10 +41,11 @@ - (void)dealloc { [self->alternativeViewer release]; - [self->mixedViewer release]; - [self->textViewer release]; - [self->imageViewer release]; - [self->linkViewer release]; + [self->mixedViewer release]; + [self->textViewer release]; + [self->imageViewer release]; + [self->linkViewer release]; + [self->messageViewer release]; [super dealloc]; } @@ -57,6 +58,7 @@ [self->textViewer release]; self->textViewer = nil; [self->imageViewer release]; self->imageViewer = nil; [self->linkViewer release]; self->linkViewer = nil; + [self->messageViewer release]; self->messageViewer = nil; } /* fetching */ @@ -119,6 +121,14 @@ return self->linkViewer; } +- (WOComponent *)messageViewer { + if (self->messageViewer == nil) { + self->messageViewer = + [[self->viewer pageWithName:@"UIxMailPartMessageViewer"] retain]; + } + return self->messageViewer; +} + - (WOComponent *)viewerForBodyInfo:(id)_info { NSString *mt, *st; @@ -141,9 +151,11 @@ } else if ([mt isEqualToString:@"image"]) return [self imageViewer]; + else if ([mt isEqualToString:@"message"] && [st isEqualToString:@"rfc822"]) + return [self messageViewer]; else if ([mt isEqualToString:@"application"]) { /* - octed-stream (generate download link?) + octet-stream (generate download link?, autodetect type?) pgp-viewer */ } diff --git a/SOGo/UI/Mailer/UIxMailView.m b/SOGo/UI/Mailer/UIxMailView.m index 204419f7..ec6754fd 100644 --- a/SOGo/UI/Mailer/UIxMailView.m +++ b/SOGo/UI/Mailer/UIxMailView.m @@ -34,6 +34,7 @@ #include "WOContext+UIxMailer.h" #include #include +#include #include "common.h" @implementation UIxMailView @@ -71,6 +72,21 @@ return s; } +/* links (DUP to UIxMailPartViewer!) */ + +- (NSString *)linkToEnvelopeAddress:(NGImap4EnvelopeAddress *)_address { + // TODO: make some web-link, eg open a new compose panel? + return [@"mailto:" stringByAppendingString:[_address baseEMail]]; +} + +- (NSString *)fromLink { + return [self linkToEnvelopeAddress: + [[self clientObject] fromEnvelopeAddress]]; +} +- (NSString *)currentAddressLink { + return [self linkToEnvelopeAddress:[self currentAddress]]; +} + /* fetching */ - (id)message { @@ -98,6 +114,7 @@ NSArray *parts; unsigned i, count; BOOL fetchPart; + id body; fetchPart = [self shouldFetchPartOfType:[_info valueForKey:@"type"] subtype:[_info valueForKey:@"subtype"]]; @@ -133,6 +150,19 @@ [self addRequiredKeysOfStructure:childInfo path:sp toArray:_keys]; } + + /* check body */ + + if ((body = [_info objectForKey:@"body"]) != nil) { + NSString *sp; + + sp = [[body valueForKey:@"type"] lowercaseString]; + if ([sp isEqualToString:@"multipart"]) + sp = _p; + else + sp = [_p length] > 0 ? [_p stringByAppendingString:@".1"] : @"1"; + [self addRequiredKeysOfStructure:body path:sp toArray:_keys]; + } } - (NSArray *)contentFetchKeys { diff --git a/SOGo/UI/Mailer/UIxMailView.wox b/SOGo/UI/Mailer/UIxMailView.wox index 80514f10..bcd92b1d 100644 --- a/SOGo/UI/Mailer/UIxMailView.wox +++ b/SOGo/UI/Mailer/UIxMailView.wox @@ -25,8 +25,7 @@ : - - + @@ -46,10 +45,9 @@ : - - + @@ -59,10 +57,9 @@ : - - +
diff --git a/SOGo/UI/Mailer/Version b/SOGo/UI/Mailer/Version index 06f04de4..73d914ae 100644 --- a/SOGo/UI/Mailer/Version +++ b/SOGo/UI/Mailer/Version @@ -1,7 +1,8 @@ # version file -SUBMINOR_VERSION:=82 +SUBMINOR_VERSION:=84 +# v0.9.84 requires libNGMime v4.5.209 # v0.9.81 requires SoObjects/Sieve v0.9.5 # v0.9.80 requires SoObjects/Mailer v0.9.59 # v0.9.78 requires SoObjects/Mailer v0.9.58 -- 2.39.5