Commit cdb98072 authored by Sandro Knauß's avatar Sandro Knauß
Browse files

MimeTreeParser: Add tests for protected header mails.

parent b7a354ea
......@@ -38,6 +38,7 @@ endmacro ()
add_mimetreeparser_crypto_unittest(attachmenttest.cpp)
add_mimetreeparser_crypto_unittest(basicobjecttreeparsertest.cpp)
add_mimetreeparser_crypto_unittest(protectedheaderstest.cpp)
add_mimetreeparser_unittest(bodypartformatterbasefactorytest.cpp)
add_mimetreeparser_unittest(nodehelpertest.cpp)
add_mimetreeparser_class_unittest(cryptohelpertest.cpp "../src/cryptohelper.cpp")
......@@ -300,25 +300,7 @@ void ObjectTreeParserTest::testHtmlContent()
QCOMPARE(otp.htmlContent(), output);
}
void ObjectTreeParserTest::testMemoryHole()
{
const QString fileName = QStringLiteral("openpgp-encrypted-memoryhole.mbox");
KMime::Message::Ptr originalMessage = readAndParseMail(fileName);
NodeHelper nodeHelper;
SimpleObjectTreeSource testSource;
ObjectTreeParser otp(&testSource, &nodeHelper);
testSource.setDecryptMessage(true);
otp.parseObjectTree(originalMessage.data());
QCOMPARE(nodeHelper.mailHeaderAsBase("from", originalMessage.data())->asUnicodeString(), QStringLiteral("you@example.com"));
QCOMPARE(nodeHelper.mailHeaderAsBase("to", originalMessage.data())->asUnicodeString(), QStringLiteral("me@example.com"));
QCOMPARE(nodeHelper.mailHeaderAsBase("subject", originalMessage.data())->asUnicodeString(), QStringLiteral("hidden subject"));
QCOMPARE(nodeHelper.mailHeaderAsBase("cc", originalMessage.data())->asUnicodeString(), QStringLiteral("cc@example.com"));
QCOMPARE(nodeHelper.mailHeaderAsBase("message-id", originalMessage.data())->asUnicodeString(), QStringLiteral("<myhiddenreference@me>"));
QCOMPARE(nodeHelper.mailHeaderAsBase("references", originalMessage.data())->asUnicodeString(), QStringLiteral("<hiddenreference@hidden>"));
QCOMPARE(nodeHelper.mailHeaderAsBase("in-reply-to", originalMessage.data())->asUnicodeString(), QStringLiteral("<hiddenreference@hidden>"));
QCOMPARE(nodeHelper.dateHeader(originalMessage.data()), QDateTime(QDate(2018, 1, 2), QTime(3, 4, 5)));
}
void ObjectTreeParserTest::testRenderedTree_data()
{
......
......@@ -27,7 +27,6 @@ private Q_SLOTS:
void testAsync();
void testHtmlContent_data();
void testHtmlContent();
void testMemoryHole();
void testRenderedTree();
void testRenderedTree_data();
void testParsePlainMessage();
......
From test@kolab.org Wed, 08 Sep 2010 17:02:52 +0200
From: OpenPGP Test <test@kolab.org>
To: test@kolab.org
Subject: OpenPGP encrypted
Date: Wed, 08 Sep 2010 17:02:52 +0200
User-Agent: KMail/4.6 pre (Linux/2.6.34-rc2-2-default; KDE/4.5.60; x86_64; ; )
MIME-Version: 1.0
Content-Type: multipart/encrypted; boundary="nextPart1357031.ppLHckZtsp"; protocol="application/pgp-encrypted"
Content-Transfer-Encoding: 7Bit
--nextPart1357031.ppLHckZtsp
Content-Type: application/pgp-encrypted
Content-Disposition: attachment
Version: 1
--nextPart1357031.ppLHckZtsp
Content-Type: application/octet-stream
Content-Disposition: inline; filename="msg.asc"
-----BEGIN PGP MESSAGE-----
hIwDGJlthTT7oq0BBACKUsOJs8Uls4ZR1FgAMVFAQHPL17Lun4a+QAc0vm95ICaA
zP80SvNprnOP4OfEbFdd+6j0j4MOR6X/5Rced4JbK3Q+5z7j0MtQZjnpXZPmyIA6
ybkXL5omELPW4r9BHKHpnor3FnCoDd7aJTABR8R0OoBkBy6PjE16fmiBoJG0RNLp
AQ94XBOBwB0NjvxhB8AnNWADgThx31HNnixcYs0SeQZxSAw9w4+Da/aGs1JGbeX7
blh5lEVM55E5yHjoInBzhm5ahrDvG1x4ST6Z+FgSRhUXkzK9xVnBOh/De2m8nyYE
FFOJ5JU0wzS9ShJWCP3rpy4Se7hnwJSTj+dOieJNpiDeJyXWMRrm61Ip+8xmyxUk
euXlyVFC/kHrsyHq+SgqOS2T1NLm2fpY1is/jN56UaiEaPlNG5i2ZQVzH7rZWDWv
+rL0mOtBJHqtisMcWSITkuGGYVwRcBx6we9VUYv1AXo5dcHvfZUN4FfA1p3suoof
dObn5JuxTyR7GD/wPlvtZ/0VMx2pRGNVkiqXbCa2074YCkRqVYpT00nCuGZ/4tlU
fusYV3iMSFc9oXfObP0PRzmiV48/EGWAwaXkYlTuH9iLZDBnfYVOIWhcX4SHzVHv
MpWm9gFPVb8NYKcnkIWSCiwHRTB7lkImJ463NlStAzu5mHnnbYW8fqItRU90U+Yk
NpZEpONGcOdCD2qEarr/MmrsBnNLZ+/7VPoIFYxIpaao7X9cPLaxidlUEM1Ir7CI
JBUTeIfoz7YtcmWbIJHt8XjBdaioDmI1mhdy0OyLIbyr3jwum3DiWplw7QOo3mDG
ksvnmQbDKjQaAn9OpIbYtpkJD19zJWz2MtWqm83BxjnAY0xjZLrlJlA6xzWvazKe
gzzkkV0Y9cmdxlPcypseWsD7IZun01vJd1GudzAdH7Bi30MKHjK5KendNRGxvIE4
4ZY9xmuhty3p5GXxurs1lI7h96kvHorW1KiAyRUMbeBrhv2yU5XUIlu8JvzN/nPw
DsDXYg/duH9ZDrnNzlopaxOaV3gmb47lh9UVrtsdSUmpCdfUkjvUDaMPAvpyxHOz
D6T/TQOUUM68vcZRFPeYMD0toPqRNz2HDtFXOtj8h+GIOHwubXL+eHhC9Kl20Dx0
PLow6Gtp9wFv4HKwSuVYiUl4XvxRe+TvSj6v6oheSDR+1mduf76GV76tF5QxLiZK
5J11IRB3yrT6e5GEYHzyxlN+vDRLXCMy43u9NXh5GdCtNe3l1A==
=XZOv
-----END PGP MESSAGE-----
--nextPart1357031.ppLHckZtsp--
<?xml version="1.0" encoding="UTF8"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<div style="position: relative; word-wrap: break-word">
<a name="att"/>
<div id="attachmentDiv">
<table cellspacing="1" cellpadding="1" class="encr">
<tr class="encrH">
<td dir="ltr">
<div class="enc-simple">Encrypted message<a href="kmail:showEncryptionDetails" style="display:block;float:right;">Show Details</a></div>
</td>
</tr>
<tr class="encrB">
<td>
<div style="position: relative; word-wrap: break-word">
<a name="att"/>
<div id="attachmentDiv">
<table cellspacing="1" cellpadding="1" class="signOkKeyOk">
<tr class="signOkKeyOkH">
<td dir="ltr">
<table cellspacing="0" cellpadding="0" width="100%">
<tr>
<td>Signed by <a href="mailto:test@kolab.org">test@kolab.org</a>.</td>
<td align="right">
<a href="kmail:showSignatureDetails">Show Details</a>
</td>
</tr>
</table>
</td>
</tr>
<tr class="signOkKeyOkB">
<td>
<a name="att1"/>
<div id="attachmentDiv1">
<div class="noquote">
<div dir="ltr">very secret mesage</div>
</div>
</div>
</td>
</tr>
<tr class="signOkKeyOkH">
<td dir="ltr">End of signed message</td>
</tr>
</table>
</div>
</div>
</td>
</tr>
<tr class="encrH">
<td dir="ltr">End of encrypted message</td>
</tr>
</table>
</div>
</div>
</body>
</html>
* MimeTreeParser::MessagePartList
* MimeTreeParser::EncryptedMessagePart
* MimeTreeParser::SignedMessagePart
* MimeTreeParser::TextMessagePart
* MimeTreeParser::MessagePart
From test@kolab.org Wed, 08 Sep 2010 17:02:52 +0200
From: OpenPGP Test <test@kolab.org>
To: test@kolab.org
Subject: OpenPGP signed
Date: Wed, 08 Sep 2010 17:02:52 +0200
User-Agent: KMail/4.6 pre (Linux/2.6.34-rc2-2-default; KDE/4.5.60; x86_64; ; )
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="SIGNED"; micalg="pgp-sha1"; protocol="application/pgp-signature"
Content-Transfer-Encoding: 7Bit
--SIGNED
Content-Type: text/plain; charset="us-ascii", protected-headers="v1"
Subject: hidden subject
Date: Wed, 02 Jan 2018 03:04:05 +0000
References: <hiddenreference@hidden>
In-Reply-To: <hiddenreference@hidden>
Message-ID: <myhiddenreference@me>
From: you@example.com
To: me@example.com
Cc: cc@example.com
very secret mesage
--SIGNED
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part.
Content-Transfer-Encoding: 7Bit
-----BEGIN PGP SIGNATURE-----
iQEzBAEBCgAdFiEEG6Mjkys/qoJhMseejZhgxY8kbeYFAmAPDvoACgkQjZhgxY8k
beZ8ewf+NLCiosbRxR7cweULOdvGq1eml6y8tTWtlxqLZiB1qX0hy873W5Ka0tyh
PhW6jfk+cTi/R0NG7zqGhoAxfmZ788FnZdeXwy7affaz1yk9SiIoimgAy2kqLBF3
B7CNNRxy5n0waKx+tTRiBnZ2IasgNeJ3QmbBEXdry8u/WAtl+BcyY2o16DcvINgY
6Ux/xBo+O/bLy90f1Hq3eD4Q94gKWaZa96qECvfMQ4w6ZFlaQEqe/ZJ4heEmL5Fm
E3MFzsjTyhrq8fJz7wTU9GEvGtGMKFgSABr+Iyth0ZU6oSO4YbKZAVPa7eMul54H
Er7i2b7cyOaTZhNYMaOsTt73pyHZuA==
=hvIe
-----END PGP SIGNATURE-----
--SIGNED--
<?xml version="1.0" encoding="UTF8"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<div style="position: relative; word-wrap: break-word">
<a name="att"/>
<div id="attachmentDiv">
<table cellspacing="1" cellpadding="1" class="signOkKeyOk">
<tr class="signOkKeyOkH">
<td dir="ltr">
<table cellspacing="0" cellpadding="0" width="100%">
<tr>
<td>Signed by <a href="mailto:test@kolab.org">test@kolab.org</a>.</td>
<td align="right">
<a href="kmail:showSignatureDetails">Show Details</a>
</td>
</tr>
</table>
</td>
</tr>
<tr class="signOkKeyOkB">
<td>
<a name="att1"/>
<div id="attachmentDiv1">
<div class="noquote">
<div dir="ltr">very secret mesage</div>
</div>
</div>
</td>
</tr>
<tr class="signOkKeyOkH">
<td dir="ltr">End of signed message</td>
</tr>
</table>
</div>
</div>
</body>
</html>
* MimeTreeParser::MessagePartList
* MimeTreeParser::SignedMessagePart
* MimeTreeParser::TextMessagePart
* MimeTreeParser::MessagePart
/*
SPDX-FileCopyrightText: 2021 Sandro Knauß <sknauss@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "protectedheaderstest.h"
#include "setupenv.h"
#include "util.h"
#include <MimeTreeParser/NodeHelper>
#include <MimeTreeParser/MessagePart>
#include <MimeTreeParser/ObjectTreeParser>
#include <MimeTreeParser/SimpleObjectTreeSource>
#include <QTest>
using namespace MimeTreeParser;
QTEST_MAIN(ProtectedHeadersTest)
void ProtectedHeadersTest::initTestCase()
{
Test::setupEnv();
qputenv("TZ", "GMT");
}
void ProtectedHeadersTest::testMailHeaderAsBase_data()
{
QTest::addColumn<QString>("mailFileName");
QTest::newRow("encrypted") << QStringLiteral("openpgp-encrypted-protected-headers.mbox");
QTest::newRow("signed") << QStringLiteral("openpgp-signed-protected-headers.mbox");
QTest::newRow("encrypted+signed") << QStringLiteral("openpgp-encrypted+signed-protected-headers.mbox");
}
void ProtectedHeadersTest::testMailHeaderAsBase()
{
QFETCH(QString, mailFileName);
auto originalMessage = readAndParseMail(mailFileName);
NodeHelper nodeHelper;
SimpleObjectTreeSource testSource;
ObjectTreeParser otp(&testSource, &nodeHelper);
testSource.setDecryptMessage(true);
otp.parseObjectTree(originalMessage.data());
// test overwrite
QCOMPARE(nodeHelper.mailHeaderAsBase("from", originalMessage.data())->asUnicodeString(), QStringLiteral("you@example.com"));
QCOMPARE(nodeHelper.mailHeaderAsBase("to", originalMessage.data())->asUnicodeString(), QStringLiteral("me@example.com"));
QCOMPARE(nodeHelper.mailHeaderAsBase("subject", originalMessage.data())->asUnicodeString(), QStringLiteral("hidden subject"));
QCOMPARE(nodeHelper.mailHeaderAsBase("cc", originalMessage.data())->asUnicodeString(), QStringLiteral("cc@example.com"));
QCOMPARE(nodeHelper.dateHeader(originalMessage.data()), QDateTime(QDate(2018, 1, 2), QTime(3, 4, 5)));
// test protected only headers
QCOMPARE(nodeHelper.mailHeaderAsBase("message-id", originalMessage.data())->asUnicodeString(), QStringLiteral("<myhiddenreference@me>"));
QCOMPARE(nodeHelper.mailHeaderAsBase("references", originalMessage.data())->asUnicodeString(), QStringLiteral("<hiddenreference@hidden>"));
QCOMPARE(nodeHelper.mailHeaderAsBase("in-reply-to", originalMessage.data())->asUnicodeString(), QStringLiteral("<hiddenreference@hidden>"));
// test non-existing headers
QCOMPARE(nodeHelper.mailHeaderAsBase("invalid", originalMessage.data()), nullptr);
// test envelope headers
QCOMPARE(nodeHelper.mailHeaderAsBase("user-agent", originalMessage.data())->asUnicodeString(), QStringLiteral("KMail/4.6 pre (Linux/2.6.34-rc2-2-default; KDE/4.5.60; x86_64; ; )"));
}
void ProtectedHeadersTest::testHeaders_data()
{
QTest::addColumn<QString>("mailFileName");
QTest::newRow("encrypted") << QStringLiteral("openpgp-encrypted-protected-headers.mbox");
QTest::newRow("signed") << QStringLiteral("openpgp-signed-protected-headers.mbox");
QTest::newRow("encrypted+signed") << QStringLiteral("openpgp-encrypted+signed-protected-headers.mbox");
}
void ProtectedHeadersTest::testHeaders()
{
QFETCH(QString, mailFileName);
auto originalMessage = readAndParseMail(mailFileName);
NodeHelper nodeHelper;
SimpleObjectTreeSource testSource;
ObjectTreeParser otp(&testSource, &nodeHelper);
testSource.setDecryptMessage(true);
otp.parseObjectTree(originalMessage.data());
// test overwrite
QCOMPARE(nodeHelper.headers("from", originalMessage.data()).size(), 1);
QCOMPARE(nodeHelper.headers("from", originalMessage.data())[0]->asUnicodeString(), QStringLiteral("you@example.com"));
QCOMPARE(nodeHelper.headers("to", originalMessage.data()).size(), 1);
QCOMPARE(nodeHelper.headers("to", originalMessage.data())[0]->asUnicodeString(), QStringLiteral("me@example.com"));
QCOMPARE(nodeHelper.headers("subject", originalMessage.data()).size(), 1);
QCOMPARE(nodeHelper.headers("subject", originalMessage.data())[0]->asUnicodeString(), QStringLiteral("hidden subject"));
QCOMPARE(nodeHelper.headers("cc", originalMessage.data()).size(), 1);
QCOMPARE(nodeHelper.headers("cc", originalMessage.data())[0]->asUnicodeString(), QStringLiteral("cc@example.com"));
QCOMPARE(nodeHelper.headers("date", originalMessage.data()).size(), 1);
QCOMPARE(nodeHelper.dateHeader(originalMessage.data()), QDateTime(QDate(2018, 1, 2), QTime(3, 4, 5)));
// test protected only headers
QCOMPARE(nodeHelper.headers("message-id", originalMessage.data()).size(), 1);
QCOMPARE(nodeHelper.headers("message-id", originalMessage.data())[0]->asUnicodeString(), QStringLiteral("<myhiddenreference@me>"));
QCOMPARE(nodeHelper.headers("references", originalMessage.data()).size(), 1);
QCOMPARE(nodeHelper.headers("references", originalMessage.data())[0]->asUnicodeString(), QStringLiteral("<hiddenreference@hidden>"));
QCOMPARE(nodeHelper.headers("in-reply-to", originalMessage.data()).size(), 1);
QCOMPARE(nodeHelper.headers("in-reply-to", originalMessage.data())[0]->asUnicodeString(), QStringLiteral("<hiddenreference@hidden>"));
// test non-existing headers
QCOMPARE(nodeHelper.headers("invalid", originalMessage.data()).isEmpty(), true);
// test envelope headers
QCOMPARE(nodeHelper.headers("user-agent", originalMessage.data()).size(), 1);
QCOMPARE(nodeHelper.headers("user-agent", originalMessage.data())[0]->asUnicodeString(), QStringLiteral("KMail/4.6 pre (Linux/2.6.34-rc2-2-default; KDE/4.5.60; x86_64; ; )"));
}
void ProtectedHeadersTest::testMailHeaderAsAddresslist_data()
{
QTest::addColumn<QString>("mailFileName");
QTest::newRow("encrypted") << QStringLiteral("openpgp-encrypted-protected-headers.mbox");
QTest::newRow("signed") << QStringLiteral("openpgp-signed-protected-headers.mbox");
QTest::newRow("encrypted+signed") << QStringLiteral("openpgp-encrypted+signed-protected-headers.mbox");
}
void ProtectedHeadersTest::testMailHeaderAsAddresslist()
{
QFETCH(QString, mailFileName);
auto originalMessage = readAndParseMail(mailFileName);
NodeHelper nodeHelper;
SimpleObjectTreeSource testSource;
ObjectTreeParser otp(&testSource, &nodeHelper);
testSource.setDecryptMessage(true);
otp.parseObjectTree(originalMessage.data());
// test overwrite
QCOMPARE(nodeHelper.mailHeaderAsAddressList("from", originalMessage.data())->displayNames(), QStringList() << QStringLiteral("you@example.com"));
QVERIFY(nodeHelper.mailHeaderAsAddressList("subject", originalMessage.data()));
// test protected only headers
QCOMPARE(nodeHelper.mailHeaderAsAddressList("message-id", originalMessage.data())->displayNames(), QStringList() << QStringLiteral("myhiddenreference@me"));
// test non-existing headers
QCOMPARE(nodeHelper.mailHeaderAsAddressList("invalid", originalMessage.data()), nullptr);
// test envelope headers
QVERIFY(nodeHelper.mailHeaderAsAddressList("user-agent", originalMessage.data()));
}
void ProtectedHeadersTest::testhasMailHeader_data()
{
QTest::addColumn<QString>("mailFileName");
QTest::newRow("encrypted") << QStringLiteral("openpgp-encrypted-protected-headers.mbox");
QTest::newRow("signed") << QStringLiteral("openpgp-signed-protected-headers.mbox");
QTest::newRow("encrypted+signed") << QStringLiteral("openpgp-encrypted+signed-protected-headers.mbox");
}
void ProtectedHeadersTest::testhasMailHeader()
{
QFETCH(QString, mailFileName);
auto originalMessage = readAndParseMail(mailFileName);
NodeHelper nodeHelper;
SimpleObjectTreeSource testSource;
ObjectTreeParser otp(&testSource, &nodeHelper);
testSource.setDecryptMessage(true);
otp.parseObjectTree(originalMessage.data());
// test overwrite
QCOMPARE(nodeHelper.hasMailHeader("from", originalMessage.data()), true);
// test protected only headers
QCOMPARE(nodeHelper.hasMailHeader("message-id", originalMessage.data()), true);
// test non-existing headers
QCOMPARE(nodeHelper.hasMailHeader("invalid", originalMessage.data()), false);
// test envelope headers
QCOMPARE(nodeHelper.hasMailHeader("user-agent", originalMessage.data()), true);
}
void ProtectedHeadersTest::testMessagePartsOfMailHeader_data()
{
QTest::addColumn<QString>("mailFileName");
QTest::addColumn<QStringList>("messagePartVector");
QStringList encryptedPart, signedPart;
encryptedPart << QStringLiteral("MimeTreeParser::EncryptedMessagePart");
signedPart << QStringLiteral("MimeTreeParser::SignedMessagePart");
QTest::newRow("encrypted") << QStringLiteral("openpgp-encrypted-protected-headers.mbox") << encryptedPart;
QTest::newRow("signed") << QStringLiteral("openpgp-signed-protected-headers.mbox") << signedPart;
QTest::newRow("encrypted+signed") << QStringLiteral("openpgp-encrypted+signed-protected-headers.mbox") << encryptedPart;
}
void ProtectedHeadersTest::testMessagePartsOfMailHeader()
{
QFETCH(QString, mailFileName);
QFETCH(QStringList, messagePartVector);
auto originalMessage = readAndParseMail(mailFileName);
NodeHelper nodeHelper;
SimpleObjectTreeSource testSource;
ObjectTreeParser otp(&testSource, &nodeHelper);
testSource.setDecryptMessage(true);
otp.parseObjectTree(originalMessage.data());
// test overwrite
{
QStringList actual;
for(const auto mp: nodeHelper.messagePartsOfMailHeader("from", originalMessage.data())) {
actual << QString::fromLatin1(mp->metaObject()->className());
}
QCOMPARE(actual, messagePartVector);
}
// test protected only headers
{
QStringList actual;
for(const auto mp: nodeHelper.messagePartsOfMailHeader("message-id", originalMessage.data())) {
actual << QString::fromLatin1(mp->metaObject()->className());
}
QCOMPARE(actual, messagePartVector);
}
// test non-existing headers
{
QStringList actual;
for(const auto mp: nodeHelper.messagePartsOfMailHeader("invalid", originalMessage.data())) {
actual << QString::fromLatin1(mp->metaObject()->className());
}
QCOMPARE(actual, QStringList());
}
// test envelope headers
{
QStringList actual;
for(const auto mp: nodeHelper.messagePartsOfMailHeader("user-agent", originalMessage.data())) {
actual << QString::fromLatin1(mp->metaObject()->className());
}
QCOMPARE(actual, QStringList());
}
}
/*
SPDX-FileCopyrightText: 2021 Sandro Knauß <sknauss@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#ifndef MIMETREEPARSER_TESTS_PROTECTEDHEADERSTEST_H
#define MIMETREEPARSER_TESTS_PROTECTEDHEADERSTEST_H
#include <QObject>
class ProtectedHeadersTest : public QObject
{
Q_OBJECT
private Q_SLOTS:
void initTestCase();
void testMailHeaderAsBase_data();
void testMailHeaderAsBase();
void testHeaders_data();
void testHeaders();
void testMailHeaderAsAddresslist_data();
void testMailHeaderAsAddresslist();
void testhasMailHeader_data();
void testhasMailHeader();
void testMessagePartsOfMailHeader_data();
void testMessagePartsOfMailHeader();
};
#endif // MIMETREEPARSER_TESTS_PROTECTEDHEADERSTEST_H
......@@ -537,10 +537,12 @@ KMime::Headers::Base const *NodeHelper::mailHeaderAsBase(const char *header, con
QSharedPointer<KMime::Headers::Generics::AddressList> NodeHelper::mailHeaderAsAddressList(const char *header, const KMime::Content *message) const
{
QSharedPointer<KMime::Headers::Generics::AddressList> addressList(new KMime::Headers::Generics::AddressList());
const auto hrd = mailHeaderAsBase(header, message);
const QByteArray &data = hrd->as7BitString(false);
addressList->from7BitString(data);
if(!hrd) {
return nullptr;
}
QSharedPointer<KMime::Headers::Generics::AddressList> addressList(new KMime::Headers::Generics::AddressList());
addressList->from7BitString(hrd->as7BitString(false));
return addressList;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment