EString Message::body() const { EString r; ContentType *ct = header()->contentType(); if ( ct && ct->type() == "multipart" ) { appendMultipart( r ); } else { // XXX: Is this the right place to restore this linkage? Bodypart * firstChild = children()->first(); if ( firstChild ) { firstChild->setHeader( header() ); appendAnyPart( r, firstChild, ct ); } } return r; }
EString Bodypart::asText( bool avoidUtf8 ) const { EString r; Codec *c = 0; ContentType *ct = header()->contentType(); if ( ct && !ct->parameter( "charset" ).isEmpty() ) c = Codec::byName( ct->parameter( "charset" ) ); if ( !c ) c = new AsciiCodec; if ( !children()->isEmpty() ) appendMultipart( r, avoidUtf8 ); else if ( !header()->contentType() || header()->contentType()->type() == "text" ) r = c->fromUnicode( text() ); else r = d->data.e64( 72 ); return r; }