VMIME_TEST_LIST_END static const vmime::string getStructure(vmime::ref <vmime::bodyPart> part) { vmime::ref <vmime::body> bdy = part->getBody(); vmime::string res = part->getBody()->getContentType().generate(); if (bdy->getPartCount() == 0) return res; res += "["; for (size_t i = 0 ; i < bdy->getPartCount() ; ++i) { vmime::ref <vmime::bodyPart> subPart = bdy->getPartAt(i); if (i != 0) res += ","; res += getStructure(subPart); } return res + "]"; }
static const vmime::string extractBodyContents(vmime::ref <const vmime::bodyPart> part) { vmime::ref <const vmime::contentHandler> cth = part->getBody()->getContents(); vmime::string data; vmime::utility::outputStreamStringAdapter os(data); cth->extract(os); return data; }