From 037a3a136a83ecf4bf5c4d01ca3d396cee6d31ad Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Thu, 14 May 2015 15:58:53 -0400 Subject: [PATCH] (fix) message bodies not shown on some EAS devices (#3173) --- ActiveSync/SOGoMailObject+ActiveSync.m | 27 ++++++++++++++++++-------- NEWS | 1 + 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/ActiveSync/SOGoMailObject+ActiveSync.m b/ActiveSync/SOGoMailObject+ActiveSync.m index 7d74147d8..d3095a966 100644 --- a/ActiveSync/SOGoMailObject+ActiveSync.m +++ b/ActiveSync/SOGoMailObject+ActiveSync.m @@ -219,6 +219,8 @@ struct GlobalObjectId { NSEnumerator *e; NSData *d; + BOOL ignore; + textParts = [self fetchPlainTextParts]; e = [textParts keyEnumerator]; plainKey = nil; @@ -227,15 +229,24 @@ struct GlobalObjectId { while ((key = [e nextObject])) { - // Don't use body parts from nested bodies if not of type multipart/alternative. - e.g. body of type message/rfc822 - // Use only parts of level 0 or 1. - if ([key countOccurrencesOfString: @"."] > 1) - continue; - else if ([key countOccurrencesOfString: @"."] == 1) + // Walk the hierarchy up and check whether parents are of type mulipart - i.e. ignore message/rfc822 + if ([key countOccurrencesOfString: @"."] > 0) { - // Ignore nested parts if the container is not of type multipart/alternative. - part = [self lookupInfoForBodyPart: [[key componentsSeparatedByString: @"."] objectAtIndex:0]]; - if (!([[part valueForKey: @"type"] isEqualToString: @"multipart"] && [[part valueForKey: @"subtype"] isEqualToString: @"alternative"])) + NSMutableArray *a; + + a = [[[key componentsSeparatedByString: @"."] mutableCopy] autorelease]; + ignore = NO; + + while ([a count] > 0) + { + [a removeLastObject]; + part = [self lookupInfoForBodyPart: [a componentsJoinedByString: @"."]]; + + if (![[part valueForKey: @"type"] isEqualToString: @"multipart"]) + ignore = YES; + } + + if (ignore) continue; } diff --git a/NEWS b/NEWS index 4fdabf5d7..f5acf941a 100644 --- a/NEWS +++ b/NEWS @@ -53,6 +53,7 @@ Bug fixes - now correctly handle external invitations using EAS - now correctly handle multiple email addresses in the GAL over EAS (#3102) - now handle very large amount of participants correctly (#3175) + - fix message bodies not shown on some EAS devices (#3173) 2.2.17a (2015-03-15) --------------------