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

Method attachmentWithIMAPBodyMultipart

src/core/imap/MCIMAPPart.cpp:248–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246}
247
248IMAPMultipart * IMAPPart::attachmentWithIMAPBodyMultipart(struct mailimap_body_type_mpart * body_mpart,
249 String * partID)
250{
251 clistiter * cur;
252 IMAPMultipart * attachment;
253 unsigned int count;
254 Array * attachments;
255
256 attachments = new Array();
257
258 count = 1;
259 for(cur = clist_begin(body_mpart->bd_list) ; cur != NULL ; cur = clist_next(cur)) {
260 struct mailimap_body * body;
261 AbstractPart * subResult;
262 String * nextPartID;
263
264 if (partID == NULL) {
265 nextPartID = String::stringWithUTF8Format("%u", count);
266 }
267 else {
268 nextPartID = partID->stringByAppendingUTF8Format(".%u", count);
269 }
270 body = (struct mailimap_body *) clist_content(cur);
271 subResult = attachmentWithIMAPBodyInternal(body, nextPartID);
272 attachments->addObject(subResult);
273
274 count ++;
275 }
276
277 attachment = new IMAPMultipart();
278 attachment->setPartID(partID);
279 if (strcasecmp(body_mpart->bd_media_subtype, "alternative") == 0) {
280 attachment->setPartType(PartTypeMultipartAlternative);
281 }
282 else if (strcasecmp(body_mpart->bd_media_subtype, "related") == 0) {
283 attachment->setPartType(PartTypeMultipartRelated);
284 }
285 attachment->setMimeType(String::stringWithUTF8Format("multipart/%s", body_mpart->bd_media_subtype));
286 attachment->setParts(attachments);
287
288 attachments->release();
289
290 return (IMAPMultipart *) attachment->autorelease();
291}
292
293HashMap * IMAPPart::serializable()
294{

Callers

nothing calls this directly

Calls 8

releaseMethod · 0.80
addObjectMethod · 0.45
setPartIDMethod · 0.45
setPartTypeMethod · 0.45
setMimeTypeMethod · 0.45
setPartsMethod · 0.45
autoreleaseMethod · 0.45

Tested by

no test coverage detected