void TEnclosuresView::AddEnclosuresFromMail(BEmailMessage *mail) { for (int32 i = 0; i < mail->CountComponents(); i++) { BMailComponent *component = mail->GetComponent(i); if (component == mail->Body()) continue; if (component->ComponentType() == B_MAIL_MULTIPART_CONTAINER) recursive_attachment_search(this,dynamic_cast<BMIMEMultipartMailContainer *>(component),mail->Body()); fList->AddItem(new TListItem(component)); } }
static void recursive_attachment_search(TEnclosuresView *us,BMailContainer *mail,BMailComponent *body) { if (mail == NULL) return; for (int32 i = 0; i < mail->CountComponents(); i++) { BMailComponent *component = mail->GetComponent(i); if (component == body) continue; if (component->ComponentType() == B_MAIL_MULTIPART_CONTAINER) recursive_attachment_search(us,dynamic_cast<BMIMEMultipartMailContainer *>(component),body); us->fList->AddItem(new TListItem(component)); } }