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

Method attachmentWithIMAPBody1PartBasic

src/core/imap/MCIMAPPart.cpp:201–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199}
200
201IMAPPart * IMAPPart::attachmentWithIMAPBody1PartBasic(struct mailimap_body_type_basic * basic,
202 struct mailimap_body_ext_1part * extension)
203{
204 IMAPPart * attachment;
205 String * mimeType;
206
207 attachment = new IMAPPart();
208 attachment->importIMAPFields(basic->bd_fields, extension);
209
210 mimeType = NULL;
211 switch (basic->bd_media_basic->med_type) {
212 case MAILIMAP_MEDIA_BASIC_APPLICATION:
213 mimeType = String::stringWithUTF8Format("application/%s", basic->bd_media_basic->med_subtype);
214 break;
215 case MAILIMAP_MEDIA_BASIC_AUDIO:
216 mimeType = String::stringWithUTF8Format("audio/%s", basic->bd_media_basic->med_subtype);
217 break;
218 case MAILIMAP_MEDIA_BASIC_IMAGE:
219 mimeType = String::stringWithUTF8Format("image/%s", basic->bd_media_basic->med_subtype);
220 break;
221 case MAILIMAP_MEDIA_BASIC_MESSAGE:
222 mimeType = String::stringWithUTF8Format("message/%s", basic->bd_media_basic->med_subtype);
223 break;
224 case MAILIMAP_MEDIA_BASIC_VIDEO:
225 mimeType = String::stringWithUTF8Format("video/%s", basic->bd_media_basic->med_subtype);
226 break;
227 case MAILIMAP_MEDIA_BASIC_OTHER:
228 mimeType = String::stringWithUTF8Format("%s/%s", basic->bd_media_basic->med_basic_type, basic->bd_media_basic->med_subtype);
229 break;
230 }
231 attachment->setMimeType(mimeType);
232
233 return (IMAPPart *) attachment->autorelease();
234}
235
236IMAPPart * IMAPPart::attachmentWithIMAPBody1PartText(struct mailimap_body_type_text * text,
237 struct mailimap_body_ext_1part * extension)

Callers

nothing calls this directly

Calls 3

importIMAPFieldsMethod · 0.45
setMimeTypeMethod · 0.45
autoreleaseMethod · 0.45

Tested by

no test coverage detected