Fixed bug when fetching structure.
This commit is contained in:
parent
11d4f2689e
commit
98204ed846
@ -78,6 +78,8 @@ public:
|
|||||||
const int getBodyParsedOffset() const { return (m_bodyParsedOffset); }
|
const int getBodyParsedOffset() const { return (m_bodyParsedOffset); }
|
||||||
const int getBodyParsedLength() const { return (m_bodyParsedLength); }
|
const int getBodyParsedLength() const { return (m_bodyParsedLength); }
|
||||||
|
|
||||||
|
void initStructure(const bodyPart& part);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
ref <maildirStructure> m_structure;
|
ref <maildirStructure> m_structure;
|
||||||
@ -111,15 +113,21 @@ public:
|
|||||||
|
|
||||||
maildirStructure(weak_ref <maildirPart> parent, const bodyPart& part)
|
maildirStructure(weak_ref <maildirPart> parent, const bodyPart& part)
|
||||||
{
|
{
|
||||||
m_parts.push_back(vmime::create <maildirPart>(parent, 0, part));
|
vmime::ref <maildirPart> mpart = vmime::create <maildirPart>(parent, 0, part);
|
||||||
|
mpart->initStructure(part);
|
||||||
|
|
||||||
|
m_parts.push_back(mpart);
|
||||||
}
|
}
|
||||||
|
|
||||||
maildirStructure(weak_ref <maildirPart> parent, const std::vector <ref <const vmime::bodyPart> >& list)
|
maildirStructure(weak_ref <maildirPart> parent, const std::vector <ref <const vmime::bodyPart> >& list)
|
||||||
{
|
{
|
||||||
int number = 0;
|
|
||||||
|
|
||||||
for (unsigned int i = 0 ; i < list.size() ; ++i)
|
for (unsigned int i = 0 ; i < list.size() ; ++i)
|
||||||
m_parts.push_back(vmime::create <maildirPart>(parent, number, *list[i]));
|
{
|
||||||
|
vmime::ref <maildirPart> mpart = vmime::create <maildirPart>(parent, i, *list[i]);
|
||||||
|
mpart->initStructure(*list[i]);
|
||||||
|
|
||||||
|
m_parts.push_back(mpart);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -159,15 +167,6 @@ ref <maildirStructure> maildirStructure::m_emptyStructure = vmime::create <maild
|
|||||||
maildirPart::maildirPart(weak_ref <maildirPart> parent, const int number, const bodyPart& part)
|
maildirPart::maildirPart(weak_ref <maildirPart> parent, const int number, const bodyPart& part)
|
||||||
: m_parent(parent), m_header(NULL), m_number(number)
|
: m_parent(parent), m_header(NULL), m_number(number)
|
||||||
{
|
{
|
||||||
if (part.getBody()->getPartList().size() == 0)
|
|
||||||
m_structure = NULL;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_structure = vmime::create <maildirStructure>
|
|
||||||
(thisWeakRef().dynamicCast <maildirPart>(),
|
|
||||||
part.getBody()->getPartList());
|
|
||||||
}
|
|
||||||
|
|
||||||
m_headerParsedOffset = part.getHeader()->getParsedOffset();
|
m_headerParsedOffset = part.getHeader()->getParsedOffset();
|
||||||
m_headerParsedLength = part.getHeader()->getParsedLength();
|
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 <maildirStructure>
|
||||||
|
(thisWeakRef().dynamicCast <maildirPart>(),
|
||||||
|
part.getBody()->getPartList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ref <const structure> maildirPart::getStructure() const
|
ref <const structure> maildirPart::getStructure() const
|
||||||
{
|
{
|
||||||
if (m_structure != NULL)
|
if (m_structure != NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user