| 246 | } |
| 247 | |
| 248 | IMAPMultipart * 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 | |
| 293 | HashMap * IMAPPart::serializable() |
| 294 | { |
nothing calls this directly
no test coverage detected