From 8e6a6950dad2d3949ab3e95d0e32a7abd9812de3 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Wed, 27 Aug 2008 19:59:39 +0000 Subject: [PATCH] Monotone-Parent: 25391f65ab0c40a0befe20a95f03ca78a76d4cfc Monotone-Revision: cf8aaf24a7987c304ec874bef6f30569d338c805 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-08-27T19:59:39 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 6 +++++ SoObjects/Mailer/SOGoMailBodyPart.m | 36 +++++++++++++++++++---------- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index f653f3b10..713323860 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-08-27 Wolfgang Sourdeau + + * SoObjects/Mailer/SOGoMailBodyPart.m ([SOGoMailBodyPart + -lookupImap4BodyPartKey:inContext:]): if the "parts" object is not + found, we try "body"->"parts". + 2008-08-26 Francis Lachapelle * UI/MailerUI/UIxMailMainFrame.m ([composeAction]): build the diff --git a/SoObjects/Mailer/SOGoMailBodyPart.m b/SoObjects/Mailer/SOGoMailBodyPart.m index 0172df20a..eb91cdea8 100644 --- a/SoObjects/Mailer/SOGoMailBodyPart.m +++ b/SoObjects/Mailer/SOGoMailBodyPart.m @@ -87,13 +87,15 @@ static BOOL debugOn = NO; /* hierarchy */ -- (SOGoMailObject *)mailObject { +- (SOGoMailObject *) mailObject +{ return [[self container] mailObject]; } /* IMAP4 */ -- (NSString *)bodyPartName { +- (NSString *) bodyPartName +{ NSString *s; NSRange r; @@ -104,7 +106,8 @@ static BOOL debugOn = NO; return [s substringToIndex:r.location]; } -- (NSArray *)bodyPartPath { +- (NSArray *) bodyPartPath +{ NSMutableArray *p; id obj; @@ -122,7 +125,8 @@ static BOOL debugOn = NO; return pathToPart; } -- (NSString *)bodyPartIdentifier { +- (NSString *) bodyPartIdentifier +{ if (identifier != nil) return [identifier isNotNull] ? identifier : nil; @@ -131,19 +135,23 @@ static BOOL debugOn = NO; return identifier; } -- (NSURL *)imap4URL { +- (NSURL *) imap4URL +{ /* reuse URL of message */ return [[self mailObject] imap4URL]; } /* part info */ -- (id)partInfo { - if (partInfo != nil) - return [partInfo isNotNull] ? partInfo : nil; +- (id) partInfo +{ + if (!partInfo) + { + partInfo + = [[self mailObject] lookupInfoForBodyPart: [self bodyPartPath]]; + [partInfo retain]; + } - partInfo = - [[[self mailObject] lookupInfoForBodyPart:[self bodyPartPath]] retain]; return partInfo; } @@ -157,10 +165,14 @@ static BOOL debugOn = NO; NSArray *subParts; unsigned int nbr; id obj; - NSDictionary *subPart; + NSDictionary *subPart, *infos; nbr = [key intValue]; - subParts = [[self partInfo] objectForKey: @"parts"]; + infos = [self partInfo]; + subParts = [infos objectForKey: @"parts"]; + if (!subParts) + subParts = [[infos objectForKey: @"body"] objectForKey: @"parts"]; + if (nbr > 0 && nbr < ([subParts count] + 1)) { subPart = [subParts objectAtIndex: nbr - 1];