From 0070dc9b4f244587c24471e20b22a0447706cc07 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Wed, 21 Nov 2007 15:04:24 +0000 Subject: [PATCH] Monotone-Parent: b5051834282e52ed3ada41a862242574f4f3016d Monotone-Revision: e9584ae6fb22159a5f2cace0641d3a58c6816280 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-11-21T15:04:24 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 10 ++++++++++ SoObjects/Mailer/SOGoMailBodyPart.m | 9 +++------ SoObjects/Mailer/SOGoMailObject.m | 16 ++++++++++------ UI/MailPartViewers/UIxMailRenderingContext.m | 10 +++++++--- 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2f24b0ec7..51f5bc233 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-11-21 Wolfgang Sourdeau + + * SoObjects/Mailer/SOGoMailObject.m ([SOGoMailObject + -lookupImap4BodyPartKey:inContext:]): return a correct body part + when "0" is requested, taking its mime-type into account. + + * UI/MailPartViewers/UIxMailRenderingContext.m + ([UIxMailRenderingContext -flatContentForPartPath:_partPath]): + return content for part "0", which would be the message body. + 2007-11-20 Wolfgang Sourdeau * UI/MailPartViewers/UIxMailPartHTMLViewer.m diff --git a/SoObjects/Mailer/SOGoMailBodyPart.m b/SoObjects/Mailer/SOGoMailBodyPart.m index e770fa92c..fd4ebf41d 100644 --- a/SoObjects/Mailer/SOGoMailBodyPart.m +++ b/SoObjects/Mailer/SOGoMailBodyPart.m @@ -368,14 +368,11 @@ static BOOL debugOn = NO; classString = @"SOGoMessageMailBodyPart"; else { - NSLog (@"unhandled mime type: '%@'", mimeType); - classString = nil; + classString = @"SOGoMailBodyPart"; +// NSLog (@"unhandled mime type: '%@'", mimeType); } - if (classString) - klazz = NSClassFromString (classString); - else - klazz = [SOGoMailBodyPart class]; + klazz = NSClassFromString (classString); return klazz; } diff --git a/SoObjects/Mailer/SOGoMailObject.m b/SoObjects/Mailer/SOGoMailObject.m index c2a5bd0e4..9abd01951 100644 --- a/SoObjects/Mailer/SOGoMailObject.m +++ b/SoObjects/Mailer/SOGoMailObject.m @@ -756,22 +756,26 @@ static BOOL debugSoParts = NO; /* 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) + if ([parts count] == 0 && ![_key intValue]) + partDesc = [self bodyStructure]; + else { - return [SOGoMailBodyPart objectWithName: @"1" inContainer: self]; + part = [_key intValue] - 1; + if (part > -1 && part < [parts count]) + partDesc = [parts objectAtIndex: part]; + else + partDesc = nil; } - part = [_key intValue] - 1; - if (part > -1 && part < [parts count]) + if (partDesc) { - partDesc = [parts objectAtIndex: part]; mimeType = [[partDesc keysWithFormat: @"%{type}/%{subtype}"] lowercaseString]; clazz = [SOGoMailBodyPart bodyPartClassForMimeType: mimeType inContext: _ctx]; } else clazz = Nil; - + return [clazz objectWithName:_key inContainer: self]; } diff --git a/UI/MailPartViewers/UIxMailRenderingContext.m b/UI/MailPartViewers/UIxMailRenderingContext.m index 11d289f39..74494f4d2 100644 --- a/UI/MailPartViewers/UIxMailRenderingContext.m +++ b/UI/MailPartViewers/UIxMailRenderingContext.m @@ -117,10 +117,14 @@ static BOOL showNamedTextAttachmentsInline = NO; - (NSData *) flatContentForPartPath: (NSArray *) _partPath { NSString *pid; - - pid = _partPath ? [_partPath componentsJoinedByString:@"."] : @""; + NSData *content; - return [[self flatContents] objectForKey:pid]; + pid = _partPath ? [_partPath componentsJoinedByString: @"."] : @""; + content = [[self flatContents] objectForKey: pid]; + if (!content && ![pid intValue]) + content = [flatContents objectForKey: @""]; + + return content; } /* viewer components */