diff --git a/src/net/maildir/maildirMessage.cpp b/src/net/maildir/maildirMessage.cpp index acba0c3a..c8d3f7df 100644 --- a/src/net/maildir/maildirMessage.cpp +++ b/src/net/maildir/maildirMessage.cpp @@ -78,6 +78,8 @@ public: const int getBodyParsedOffset() const { return (m_bodyParsedOffset); } const int getBodyParsedLength() const { return (m_bodyParsedLength); } + void initStructure(const bodyPart& part); + private: ref m_structure; @@ -111,15 +113,21 @@ public: maildirStructure(weak_ref parent, const bodyPart& part) { - m_parts.push_back(vmime::create (parent, 0, part)); + vmime::ref mpart = vmime::create (parent, 0, part); + mpart->initStructure(part); + + m_parts.push_back(mpart); } maildirStructure(weak_ref parent, const std::vector >& list) { - int number = 0; - for (unsigned int i = 0 ; i < list.size() ; ++i) - m_parts.push_back(vmime::create (parent, number, *list[i])); + { + vmime::ref mpart = vmime::create (parent, i, *list[i]); + mpart->initStructure(*list[i]); + + m_parts.push_back(mpart); + } } @@ -159,15 +167,6 @@ ref maildirStructure::m_emptyStructure = vmime::create parent, const int number, const bodyPart& part) : m_parent(parent), m_header(NULL), m_number(number) { - if (part.getBody()->getPartList().size() == 0) - m_structure = NULL; - else - { - m_structure = vmime::create - (thisWeakRef().dynamicCast (), - part.getBody()->getPartList()); - } - m_headerParsedOffset = part.getHeader()->getParsedOffset(); m_headerParsedLength = part.getHeader()->getParsedLength(); @@ -185,6 +184,19 @@ maildirPart::~maildirPart() } +void maildirPart::initStructure(const bodyPart& part) +{ + if (part.getBody()->getPartList().size() == 0) + m_structure = NULL; + else + { + m_structure = vmime::create + (thisWeakRef().dynamicCast (), + part.getBody()->getPartList()); + } +} + + ref maildirPart::getStructure() const { if (m_structure != NULL)