Skip to content

Commit

Permalink
[qmf] Correctly handle multipart/signed parts
Browse files Browse the repository at this point in the history
multipart/signed parts can be the top level part having any other valid
containers inside as per RFC1847.
  • Loading branch information
Valério Valério committed Mar 6, 2015
1 parent eed9fc0 commit a8f6fda
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions qmf/src/libraries/qmfclient/qmailmessage.cpp
Expand Up @@ -1047,6 +1047,9 @@ namespace findBody
case QMailMessagePart::MultipartNone:
return inMultipartNone(part, ctx);

case QMailMessagePart::MultipartMixed:
return inMultipartMixed(part, ctx);

case QMailMessagePart::MultipartAlternative:
return inMultipartAlternative(part, ctx);

Expand Down Expand Up @@ -1150,9 +1153,12 @@ namespace findAttachments
if (found) {
found->clear();
}
if (container.multipartType() == QMailMessagePart::MultipartMixed)
if (container.multipartType() == QMailMessagePart::MultipartMixed) {
inMultipartMixed(container, found, hasAttachments);

}
if (container.multipartType() == QMailMessagePart::MultipartSigned) {
inMultipartSigned(container, found, hasAttachments);
}
// In any case, the default strategy wins, even if there are no attachments
return true;
}
Expand Down Expand Up @@ -1208,6 +1214,24 @@ namespace findAttachments
}
}
}

void inMultipartSigned(const QMailMessagePartContainer &container,
Locations* found,
bool* hasAttachments) const
{
for (uint i = 0; i < container.partCount(); i++) {
const QMailMessagePart &part = container.partAt(i);
switch (part.multipartType()) {
case QMailMessagePart::MultipartNone:
inMultipartNone(part, found, hasAttachments);
break;
default:
// Default to handling as MultipartMixed
inMultipartMixed(part, found, hasAttachments);
break;
}
}
}
};

class TnefAttachmentFindStrategy : public AttachmentFindStrategy
Expand Down

0 comments on commit a8f6fda

Please sign in to comment.