(fix) cleanups
parent
496b402d17
commit
72273bf454
|
@ -45,38 +45,49 @@
|
||||||
|
|
||||||
- (id) renderedPart
|
- (id) renderedPart
|
||||||
{
|
{
|
||||||
|
NSData *certificate;
|
||||||
id info, viewer;
|
id info, viewer;
|
||||||
|
|
||||||
NSData *encryptedData;
|
certificate = [[[self clientObject] mailAccountFolder] certificate];
|
||||||
|
|
||||||
#if 1
|
if (certificate)
|
||||||
NSData *pkcs12Data = [NSData dataWithContentsOfFile: @"/home/sogo/dropbucket/lmarcotte@inverse.ca.p12"];
|
{
|
||||||
[pkcs12Data convertPKCS12ToPEMUsingPassword: @"831af13d97576d74d574628c1d0e5abe"];
|
NSData *decryptedData, *encryptedData;
|
||||||
#endif
|
|
||||||
|
|
||||||
|
encryptedData = [[self clientObject] content];
|
||||||
|
decryptedData = [encryptedData decryptUsingCertificate: certificate];
|
||||||
|
|
||||||
encryptedData = [[self clientObject] content];
|
if (decryptedData)
|
||||||
[encryptedData writeToFile: @"/tmp/received.encrypted" atomically: 1];
|
{
|
||||||
|
NGMimeMessageParser *parser;
|
||||||
|
id part;
|
||||||
|
|
||||||
//NSData *pem = [NSData dataWithContentsOfFile: @"/home/sogo/dropbucket/lmarcotte@inverse.ca.pem"];
|
parser = [[NGMimeMessageParser alloc] init];
|
||||||
NSData *pem = [NSData dataWithContentsOfFile: @"/tmp/foofoo.newpem"];
|
part = [[parser parsePartFromData: decryptedData] retain];
|
||||||
NSData *decryptedData = [encryptedData decryptUsingCertificate: pem];
|
|
||||||
|
|
||||||
NGMimeMessageParser *parser = [[NGMimeMessageParser alloc] init];
|
info = [NSDictionary dictionaryWithObjectsAndKeys: [[part contentType] type], @"type",
|
||||||
id part = [[parser parsePartFromData: decryptedData] retain];
|
[[part contentType] subType], @"subtype", nil];
|
||||||
|
viewer = [[[self context] mailRenderingContext] viewerForBodyInfo: info];
|
||||||
|
[viewer setBodyInfo: info];
|
||||||
|
[viewer setFlatContent: decryptedData];
|
||||||
|
[viewer setDecodedContent: [part body]];
|
||||||
|
|
||||||
info = [NSDictionary dictionaryWithObjectsAndKeys: [[part contentType] type], @"type",
|
return [NSDictionary dictionaryWithObjectsAndKeys:
|
||||||
[[part contentType] subType], @"subtype", nil];
|
[self className], @"type",
|
||||||
|
[NSArray arrayWithObject: [viewer renderedPart]], @"content",
|
||||||
|
nil];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Decryption failed, let's return the master viewer
|
||||||
|
// FIXME - does not work for now.
|
||||||
|
info = [NSDictionary dictionaryWithObjectsAndKeys: @"multipart", @"type",
|
||||||
|
@"mixed", @"subtype", nil];
|
||||||
|
[self setFlatContent: nil];
|
||||||
viewer = [[[self context] mailRenderingContext] viewerForBodyInfo: info];
|
viewer = [[[self context] mailRenderingContext] viewerForBodyInfo: info];
|
||||||
[viewer setBodyInfo: info];
|
[viewer setBodyInfo: info];
|
||||||
[viewer setFlatContent: decryptedData];
|
|
||||||
[viewer setDecodedContent: [part body]];
|
|
||||||
|
|
||||||
return [NSDictionary dictionaryWithObjectsAndKeys:
|
return [viewer renderedPart];
|
||||||
[self className], @"type",
|
|
||||||
[NSArray arrayWithObject: [viewer renderedPart]], @"content",
|
|
||||||
nil];
|
|
||||||
//return [viewer renderedPart];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end /* UIxMailPartAlternativeViewer */
|
@end /* UIxMailPartAlternativeViewer */
|
||||||
|
|
Loading…
Reference in New Issue