MCPcopy Create free account
hub / github.com/MailCore/mailcore2 / htmlForAbstractMessage

Function htmlForAbstractMessage

src/core/renderer/MCHTMLRenderer.cpp:186–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184}
185
186static String * htmlForAbstractMessage(String * folder, AbstractMessage * message,
187 HTMLRendererIMAPCallback * imapDataCallback,
188 HTMLRendererRFC822Callback * rfc822DataCallback,
189 HTMLRendererTemplateCallback * htmlCallback,
190 Array * attachments,
191 Array * relatedAttachments)
192{
193 AbstractPart * mainPart = NULL;
194
195 if (htmlCallback == NULL) {
196 htmlCallback = new DefaultTemplateCallback();
197 ((DefaultTemplateCallback *) htmlCallback)->autorelease();
198 }
199
200 if (message->className()->isEqual(MCSTR("mailcore::IMAPMessage"))) {
201 mainPart = ((IMAPMessage *) message)->mainPart();
202 }
203 else if (message->className()->isEqual(MCSTR("mailcore::MessageParser"))) {
204 mainPart = ((MessageParser *) message)->mainPart();
205 }
206 if (mainPart == NULL) {
207 // needs a mainPart.
208 return NULL;
209 }
210
211 MCAssert(mainPart != NULL);
212
213 htmlRendererContext context;
214 context.imapDataCallback = imapDataCallback;
215 context.rfc822DataCallback = rfc822DataCallback;
216 context.htmlCallback = htmlCallback;
217 context.relatedAttachments = NULL;
218 context.attachments = NULL;
219 context.firstRendered = 0;
220 context.folder = folder;
221 context.state = RENDER_STATE_NONE;
222
223 context.hasMixedTextAndAttachments = false;
224 context.pass = 0;
225 context.firstAttachment = false;
226 context.hasTextPart = false;
227
228 htmlForAbstractPart(mainPart, &context);
229
230 context.relatedAttachments = relatedAttachments;
231 context.attachments = attachments;
232 context.hasMixedTextAndAttachments = (context.state == RENDER_STATE_HAD_ATTACHMENT_THEN_TEXT);
233 context.pass = 1;
234 context.firstAttachment = false;
235 context.hasTextPart = false;
236
237 htmlCallback->setMixedTextAndAttachmentsModeEnabled(context.hasMixedTextAndAttachments);
238
239 String * content = htmlForAbstractPart(mainPart, &context);
240 if (content == NULL)
241 return NULL;
242
243 content = htmlCallback->filterHTMLForMessage(content);

Callers 5

htmlForRFC822MessageMethod · 0.85
htmlForIMAPMessageMethod · 0.85
attachmentsForMessageMethod · 0.85

Calls 14

htmlForAbstractPartFunction · 0.85
renderTemplateFunction · 0.85
classNameMethod · 0.80
setObjectForKeyMethod · 0.80
releaseMethod · 0.80
filterHTMLForMessageMethod · 0.65
templateForMainHeaderMethod · 0.65
templateForMessageMethod · 0.65
autoreleaseMethod · 0.45
isEqualMethod · 0.45

Tested by

no test coverage detected