Skip to content

Instantly share code, notes, and snippets.

@lukele
Last active March 27, 2017 13:50
Show Gist options
  • Save lukele/2f96d165f0a72b52ddc203c32287b4f2 to your computer and use it in GitHub Desktop.
Save lukele/2f96d165f0a72b52ddc203c32287b4f2 to your computer and use it in GitHub Desktop.
- (id)MAParsedMessage {
// This method is called, when a message is opened from outside the library (an .eml is loaded.)
id messageData = [((MCMessage *)self) messageDataIncludingFromSpace:0x0 newDocumentID:0x0 fetchIfNotAvailable:0x1];
id parsedMessage = nil;
if (messageData) {
MCMimePart *topLevelPart = [[MCMimePart alloc] initWithEncodedData:messageData];
MCMimeBody *body = [MCMimeBody new];
[body setIvar:kMimeBodyMessageKey value:self];
[topLevelPart setIvar:kMimePartAllowPGPProcessingKey value:@(YES)];
[topLevelPart setIvar:@"MimeBody" value:body];
[body setTopLevelPart:topLevelPart];
[(MCMimePart *)topLevelPart parse];
parsedMessage = [body parsedMessage];
}
return parsedMessage;
}
void * -[MCMessage parsedMessage](void * self, void * _cmd) {
r12 = 0x0;
r14 = [[self messageDataIncludingFromSpace:0x0 newDocumentID:0x0 fetchIfNotAvailable:0x1] retain];
if (r14 != 0x0) {
r15 = [[MCMimePart alloc] initWithEncodedData:r14];
rbx = [MCMimeBody new];
[rbx setTopLevelPart:r15];
[r15 parse];
r12 = [[rbx parsedMessage] retain];
[rbx release];
[r15 release];
}
[r14 release];
rax = [r12 autorelease];
return rax;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment