(fix) inline images sent from SOGo webmail are not displayed in Mozilla Thunderbird (#3271)

pull/110/head
Ludovic Marcotte 2015-10-23 14:34:19 -04:00
parent a55d5c95b5
commit 987700cd87
2 changed files with 25 additions and 6 deletions

1
NEWS
View File

@ -15,6 +15,7 @@ Bug fixes
- don't escape quoted strings during versit generation
- we now return all cards when we receive an empty addressbook-query REPORT
- avoid crash when replying to a mail with no recipients (#3359)
- inline images sent from SOGo webmail are not displayed in Mozilla Thunderbird (#3271)
2.3.2 (2015-09-16)
------------------

View File

@ -181,6 +181,7 @@ static NSString *headerKeys[] = {@"subject", @"to", @"cc", @"bcc",
static NGMimeType *MultiMixedType = nil;
static NGMimeType *MultiAlternativeType = nil;
static NGMimeType *MultiRelatedType = nil;
static NSString *userAgent = nil;
+ (void) initialize
@ -191,6 +192,9 @@ static NSString *userAgent = nil;
MultiAlternativeType = [NGMimeType mimeType: @"multipart" subType: @"alternative"];
[MultiAlternativeType retain];
MultiRelatedType = [NGMimeType mimeType: @"multipart" subType: @"related"];
[MultiRelatedType retain];
userAgent = [NSString stringWithFormat: @"SOGoMail %@",
SOGoVersion];
[userAgent retain];
@ -1677,16 +1681,20 @@ static NSString *userAgent = nil;
NGMimeMessage *message;
NGMutableHashMap *map;
NSString *newText;
BOOL has_inline_images;
message = nil;
has_inline_images = NO;
bodyParts = [NSMutableArray array];
if (_extractImages)
{
newText = [text htmlByExtractingImages: bodyParts];
if ([bodyParts count])
[self setText: newText];
{
[self setText: newText];
has_inline_images = YES;
}
}
map = [self mimeHeaderMapWithHeaders: _headers
@ -1703,10 +1711,20 @@ static NSString *userAgent = nil;
/* no attachments */
message = [self mimeMessageForContentWithHeaderMap: map];
else
/* attachments, create multipart/mixed */
message = [self mimeMultiPartMessageWithHeaderMap: map
andBodyParts: bodyParts];
//[self debugWithFormat: @"message: %@", message];
{
// attachments, create multipart/mixed or multipart/related if
// we have inline image to avoid Thunderbird bug #61815 (https://bugzilla.mozilla.org/show_bug.cgi?id=61815)
if (has_inline_images)
{
[map removeAllObjectsForKey: @"content-type"];
[map addObject: MultiRelatedType forKey: @"content-type"];
}
message = [self mimeMultiPartMessageWithHeaderMap: map
andBodyParts: bodyParts];
//[self debugWithFormat: @"message: %@", message];
}
}
return message;