mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-03-24 23:52:43 +00:00
(fix) properly handle subparts compilation for message/rfc822 message parts
This commit is contained in:
@@ -31,6 +31,8 @@
|
||||
#import <UI/MailerUI/WOContext+UIxMailer.h>
|
||||
#import "UIxMailRenderingContext.h"
|
||||
|
||||
#import <Foundation/NSDictionary.h>
|
||||
|
||||
#import "UIxMailPartViewer.h"
|
||||
|
||||
/*
|
||||
@@ -205,4 +207,48 @@
|
||||
return [@"mailto:" stringByAppendingString:[_address baseEMail]];
|
||||
}
|
||||
|
||||
- (id) renderedPart
|
||||
{
|
||||
id info, viewer;
|
||||
NSArray *parts;
|
||||
NSMutableArray *renderedParts;
|
||||
NSUInteger i, max;
|
||||
|
||||
parts = [[self contentInfo] objectForKey: @"parts"];
|
||||
renderedParts = [NSMutableArray array];
|
||||
max = [parts count];
|
||||
|
||||
// Might get a multipart/*
|
||||
if (max)
|
||||
{
|
||||
for (i = 0; i < max; i++)
|
||||
{
|
||||
info = [parts objectAtIndex: i];
|
||||
viewer = [[[self context] mailRenderingContext] viewerForBodyInfo: info];
|
||||
[viewer setBodyInfo: info];
|
||||
[viewer setPartPath: [[self contentPartPath] arrayByAddingObject: [NSString stringWithFormat: @"%d", i+1]]];
|
||||
[renderedParts addObject: [viewer renderedPart]];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
info = [self contentInfo];
|
||||
viewer = [[[self context] mailRenderingContext] viewerForBodyInfo: info];
|
||||
[viewer setBodyInfo: info];
|
||||
[viewer setPartPath: [self contentPartPath]];
|
||||
[renderedParts addObject: [viewer renderedPart]];
|
||||
}
|
||||
|
||||
// We inject the output of our UIxMailPartMessageViewer template
|
||||
// in order to pretty-format the parts following it.
|
||||
info = [NSDictionary dictionaryWithObjectsAndKeys: @"text/plain", @"contentType", @"UIxMailPartTextViewer", @"type",
|
||||
[[self generateResponse] contentAsString], @"content", nil];
|
||||
[renderedParts insertObject: info atIndex: 0];
|
||||
|
||||
return [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[self className], @"type",
|
||||
renderedParts, @"content",
|
||||
nil];
|
||||
}
|
||||
|
||||
@end /* UIxMailPartMessageViewer */
|
||||
|
||||
Reference in New Issue
Block a user