diff --git a/ChangeLog b/ChangeLog index 1f711462f..c08a92df7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2007-11-18 Ludovic Marcotte + + * SoObjects/Mailer/SOGoMailBodyPart.m + SoObjects/Mailer/SOGoMailObject.m + UI/MailPartViewers/UIxMailPartViewer.m + Added support of messages containing non-textual + content and no parts. + + * UI/MailerUI/UIxMailView.m + SoObjects/Mailer/SOGoMailObject.m + UI/Templates/MailerUI/UIxMailView.wox + Added support for the Reply-To header upon + message display. + 2007-11-18 Wolfgang Sourdeau * UI/Scheduler/UIxTaskEditor.m ([UIxTaskEditor -saveAction]): diff --git a/SoObjects/Mailer/SOGoMailBodyPart.m b/SoObjects/Mailer/SOGoMailBodyPart.m index 808291277..e770fa92c 100644 --- a/SoObjects/Mailer/SOGoMailBodyPart.m +++ b/SoObjects/Mailer/SOGoMailBodyPart.m @@ -179,17 +179,25 @@ static BOOL debugOn = NO; if (data == nil) return nil; /* check for content encodings */ - - if ((enc = [[self partInfo] valueForKey:@"encoding"]) != nil) { - enc = [enc uppercaseString]; - - if ([enc isEqualToString:@"BASE64"]) - data = [data dataByDecodingBase64]; - else if ([enc isEqualToString:@"7BIT"]) - ; /* keep data as is */ // TODO: do we need to change encodings? - else - [self errorWithFormat:@"unsupported encoding: %@", enc]; - } + enc = [[self partInfo] valueForKey: @"encoding"]; + + /* if we haven't found one, check out the main message's encoding + as we could be trying to fetch the message's content as a part */ + if (!enc) + enc = [[[[self mailObject] fetchCoreInfos] valueForKey: @"body"] + valueForKey: @"encoding"]; + + if (enc) + { + enc = [enc uppercaseString]; + + if ([enc isEqualToString:@"BASE64"]) + data = [data dataByDecodingBase64]; + else if ([enc isEqualToString:@"7BIT"]) + ; /* keep data as is */ // TODO: do we need to change encodings? + else + [self errorWithFormat:@"unsupported encoding: %@", enc]; + } return data; } diff --git a/SoObjects/Mailer/SOGoMailObject.m b/SoObjects/Mailer/SOGoMailObject.m index 4c44bd993..ae9cf8388 100644 --- a/SoObjects/Mailer/SOGoMailObject.m +++ b/SoObjects/Mailer/SOGoMailObject.m @@ -296,6 +296,11 @@ static BOOL debugSoParts = NO; return [[self envelope] cc]; } +- (NSArray *) replyToEnvelopeAddresses +{ + return [[self envelope] replyTo]; +} + - (NSData *) mailHeaderData { return [[self fetchCoreInfos] valueForKey: @"header"]; @@ -460,6 +465,7 @@ static BOOL debugSoParts = NO; { if ([content isKindOfClass: [NSData class]]) { +#warning we ignore the charset here? s = [[NSString alloc] initWithData: content encoding: NSISOLatin1StringEncoding]; if (s) @@ -747,6 +753,14 @@ static BOOL debugSoParts = NO; NSString *mimeType; parts = [[self bodyStructure] objectForKey: @"parts"]; + + /* We don't have parts here but we're trying to download the message's + content that could be an image/jpeg, as an example */ + if ([parts count] == 0) + { + return [SOGoMailBodyPart objectWithName: @"1" inContainer: self]; + } + part = [_key intValue] - 1; if (part > -1 && part < [parts count]) { diff --git a/UI/MailPartViewers/UIxMailPartViewer.m b/UI/MailPartViewers/UIxMailPartViewer.m index 78a8fc8ed..a8a78fa13 100644 --- a/UI/MailPartViewers/UIxMailPartViewer.m +++ b/UI/MailPartViewers/UIxMailPartViewer.m @@ -312,9 +312,16 @@ if (![url hasSuffix: @"/"]) url = [url stringByAppendingString: @"/"]; - /* mail relative path to body-part */ - - /* eg this was nil for a draft containing an HTML message */ + /* if we get a message with an image/* or applicatio/* + Content-Type, we must generate a 'fake' part since our + decoded mail won't have any. Also see SOGoMailBodyPart: -fetchBLOB + and SOGoMailObject: -lookupImap4BodyPartKey: inContext for + other workarounds */ + if (!partPath || [partPath count] == 0) + partPath = [NSArray arrayWithObject: @"0"]; + + /* mail relative path to body-part + eg this was nil for a draft containing an HTML message */ if ([(n = [partPath componentsJoinedByString:@"/"]) isNotNull]) url = [url stringByAppendingString:n]; diff --git a/UI/MailerUI/UIxMailView.m b/UI/MailerUI/UIxMailView.m index 986b26749..56c88a9d6 100644 --- a/UI/MailerUI/UIxMailView.m +++ b/UI/MailerUI/UIxMailView.m @@ -131,6 +131,11 @@ static NSString *mailETag = nil; return [[[self clientObject] ccEnvelopeAddresses] count] > 0 ? YES : NO; } +- (BOOL) hasReplyTo +{ + return [[[self clientObject] replyToEnvelopeAddresses] count] > 0 ? YES : NO; +} + /* viewers */ - (id) contentViewerComponent diff --git a/UI/Templates/MailerUI/UIxMailView.wox b/UI/Templates/MailerUI/UIxMailView.wox index de0d65267..a91268aea 100644 --- a/UI/Templates/MailerUI/UIxMailView.wox +++ b/UI/Templates/MailerUI/UIxMailView.wox @@ -66,6 +66,20 @@ + + + : + + + + + + +