File indexing completed on 2024-06-23 05:19:20

0001 /*
0002    SPDX-FileCopyrightText: 2016 Sandro Knauß <sknauss@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "multipartmixed.h"
0008 
0009 #include "messagepart.h"
0010 #include "objecttreeparser.h"
0011 
0012 #include <KMime/Content>
0013 
0014 using namespace MimeTreeParser;
0015 
0016 const MultiPartMixedBodyPartFormatter *MultiPartMixedBodyPartFormatter::self;
0017 
0018 const Interface::BodyPartFormatter *MultiPartMixedBodyPartFormatter::create()
0019 {
0020     if (!self) {
0021         self = new MultiPartMixedBodyPartFormatter();
0022     }
0023     return self;
0024 }
0025 
0026 MessagePart::Ptr MultiPartMixedBodyPartFormatter::process(Interface::BodyPart &part) const
0027 {
0028     if (part.content()->contents().isEmpty()) {
0029         return {};
0030     }
0031 
0032     // normal treatment of the parts in the mp/mixed container
0033     MimeMessagePart::Ptr mp(new MimeMessagePart(part.objectTreeParser(), part.content()->contents().at(0), false));
0034     return mp;
0035 }