summaryrefslogtreecommitdiffstats
path: root/framework/src/domain/mime
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/domain/mime')
-rw-r--r--framework/src/domain/mime/mailtemplates.cpp6
-rw-r--r--framework/src/domain/mime/mailtemplates.h2
-rw-r--r--framework/src/domain/mime/tests/mailtemplatetest.cpp21
3 files changed, 23 insertions, 6 deletions
diff --git a/framework/src/domain/mime/mailtemplates.cpp b/framework/src/domain/mime/mailtemplates.cpp
index 7bfcf38e..79275bda 100644
--- a/framework/src/domain/mime/mailtemplates.cpp
+++ b/framework/src/domain/mime/mailtemplates.cpp
@@ -795,16 +795,12 @@ static Recipients getRecipients(const KMime::Message::Ptr &origMsg, const KMime:
795 return {toList, ccList}; 795 return {toList, ccList};
796} 796}
797 797
798void MailTemplates::reply(const KMime::Message::Ptr &origMsg, const std::function<void(const KMime::Message::Ptr &result)> &callback) 798void MailTemplates::reply(const KMime::Message::Ptr &origMsg, const std::function<void(const KMime::Message::Ptr &result)> &callback, const KMime::Types::AddrSpecList &me)
799{ 799{
800 //FIXME 800 //FIXME
801 const bool alwaysPlain = true; 801 const bool alwaysPlain = true;
802 KMime::Message::Ptr msg(new KMime::Message); 802 KMime::Message::Ptr msg(new KMime::Message);
803 //FIXME
804 //Personal email addresses, required to detect the case where we reply to a message we have sent ourselves
805 KMime::Types::AddrSpecList me;
806 803
807 // const uint originalIdentity = identityUoid(origMsg);
808 initHeader(msg); 804 initHeader(msg);
809 805
810 msg->contentType()->setCharset("utf-8"); 806 msg->contentType()->setCharset("utf-8");
diff --git a/framework/src/domain/mime/mailtemplates.h b/framework/src/domain/mime/mailtemplates.h
index a8a4b606..edcc982a 100644
--- a/framework/src/domain/mime/mailtemplates.h
+++ b/framework/src/domain/mime/mailtemplates.h
@@ -34,7 +34,7 @@ struct Attachment {
34 34
35namespace MailTemplates 35namespace MailTemplates
36{ 36{
37 void reply(const KMime::Message::Ptr &origMsg, const std::function<void(const KMime::Message::Ptr &result)> &callback); 37 void reply(const KMime::Message::Ptr &origMsg, const std::function<void(const KMime::Message::Ptr &result)> &callback, const KMime::Types::AddrSpecList &me = {});
38 QString plaintextContent(const KMime::Message::Ptr &origMsg); 38 QString plaintextContent(const KMime::Message::Ptr &origMsg);
39 KMime::Message::Ptr createMessage(KMime::Message::Ptr existingMessage, const QStringList &to, const QStringList &cc, const QStringList &bcc, const KMime::Types::Mailbox &from, const QString &subject, const QString &body, const QList<Attachment> &attachments, const std::vector<GpgME::Key> &signingKeys = {}); 39 KMime::Message::Ptr createMessage(KMime::Message::Ptr existingMessage, const QStringList &to, const QStringList &cc, const QStringList &bcc, const KMime::Types::Mailbox &from, const QString &subject, const QString &body, const QList<Attachment> &attachments, const std::vector<GpgME::Key> &signingKeys = {});
40}; 40};
diff --git a/framework/src/domain/mime/tests/mailtemplatetest.cpp b/framework/src/domain/mime/tests/mailtemplatetest.cpp
index 51c5e243..098c34bc 100644
--- a/framework/src/domain/mime/tests/mailtemplatetest.cpp
+++ b/framework/src/domain/mime/tests/mailtemplatetest.cpp
@@ -181,6 +181,27 @@ private slots:
181 QCOMPARE(result->cc()->addresses(), l); 181 QCOMPARE(result->cc()->addresses(), l);
182 } 182 }
183 183
184 void testMultiRecipientReplyFilteringMe()
185 {
186 KMime::Types::AddrSpecList me;
187 KMime::Types::Mailbox mb;
188 mb.setAddress("release-team@kde.org");
189 me << mb.addrSpec();
190
191 auto msg = readMail("multirecipients.mbox");
192 KMime::Message::Ptr result;
193 MailTemplates::reply(msg, [&] (const KMime::Message::Ptr &r) {
194 result = r;
195 }, me);
196 QTRY_VERIFY(result);
197 auto content = removeFirstLine(result->body());
198 QVERIFY(!content.isEmpty());
199 QCOMPARE(unquote(content), QLatin1String("test"));
200 QCOMPARE(result->to()->addresses(), {{"konqi@example.org"}});
201 auto l = QVector<QByteArray>{{"kde-devel@kde.org"}};
202 QCOMPARE(result->cc()->addresses(), l);
203 }
204
184 void testCreatePlainMail() 205 void testCreatePlainMail()
185 { 206 {
186 QStringList to = {{"to@example.org"}}; 207 QStringList to = {{"to@example.org"}};