summaryrefslogtreecommitdiffstats
path: root/common/mailpreprocessor.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-10-31 23:32:22 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-10-31 23:32:22 +0100
commit18f04f0ea8da9c635742571eb0de01d12d856e9f (patch)
tree8eecb63f864d5e846cf9bf49c3c8bc4bc3593b76 /common/mailpreprocessor.cpp
parent1d245e28c9b1b18a45097a72bc4ff166c59c37ba (diff)
downloadsink-18f04f0ea8da9c635742571eb0de01d12d856e9f.tar.gz
sink-18f04f0ea8da9c635742571eb0de01d12d856e9f.zip
Got the sender to work
Diffstat (limited to 'common/mailpreprocessor.cpp')
-rw-r--r--common/mailpreprocessor.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/common/mailpreprocessor.cpp b/common/mailpreprocessor.cpp
index 17a2f4f..45f5def 100644
--- a/common/mailpreprocessor.cpp
+++ b/common/mailpreprocessor.cpp
@@ -81,11 +81,17 @@ struct MimeMessageReader {
81 qint64 mappedSize; 81 qint64 mappedSize;
82}; 82};
83 83
84static Sink::ApplicationDomain::Mail::Contact getContact(const KMime::Headers::From *header)
85{
86 const auto name = header->displayNames().isEmpty() ? QString() : header->displayNames().first();
87 const auto address = header->addresses().isEmpty() ? QString() : header->addresses().first();
88 return Sink::ApplicationDomain::Mail::Contact{name, address};
89}
90
84static void updatedIndexedProperties(Sink::ApplicationDomain::Mail &mail, KMime::Message::Ptr msg) 91static void updatedIndexedProperties(Sink::ApplicationDomain::Mail &mail, KMime::Message::Ptr msg)
85{ 92{
86 mail.setExtractedSubject(msg->subject(true)->asUnicodeString()); 93 mail.setExtractedSubject(msg->subject(true)->asUnicodeString());
87 /* mail.setExtractedSender(msg->from(true)->asUnicodeString()); */ 94 mail.setExtractedSender(getContact(msg->from(true)));
88 /* mail.setExtractedSenderName(msg->from(true)->asUnicodeString()); */
89 mail.setExtractedDate(msg->date(true)->dateTime()); 95 mail.setExtractedDate(msg->date(true)->dateTime());
90 96
91 //The rest should never change, unless we didn't have the headers available initially. 97 //The rest should never change, unless we didn't have the headers available initially.