diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-10-31 23:32:22 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-10-31 23:32:22 +0100 |
commit | 18f04f0ea8da9c635742571eb0de01d12d856e9f (patch) | |
tree | 8eecb63f864d5e846cf9bf49c3c8bc4bc3593b76 | |
parent | 1d245e28c9b1b18a45097a72bc4ff166c59c37ba (diff) | |
download | sink-18f04f0ea8da9c635742571eb0de01d12d856e9f.tar.gz sink-18f04f0ea8da9c635742571eb0de01d12d856e9f.zip |
Got the sender to work
-rw-r--r-- | common/domain/applicationdomaintype.h | 8 | ||||
-rw-r--r-- | common/mailpreprocessor.cpp | 10 |
2 files changed, 12 insertions, 6 deletions
diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h index b377db9..d2b4d83 100644 --- a/common/domain/applicationdomaintype.h +++ b/common/domain/applicationdomaintype.h | |||
@@ -278,10 +278,10 @@ struct SINK_EXPORT Mail : public Entity { | |||
278 | 278 | ||
279 | SINK_ENTITY(Mail); | 279 | SINK_ENTITY(Mail); |
280 | SINK_PROPERTY(QString, Uid, uid); | 280 | SINK_PROPERTY(QString, Uid, uid); |
281 | SINK_PROPERTY(Contact, Sender, sender); | 281 | SINK_EXTRACTED_PROPERTY(Contact, Sender, sender); |
282 | SINK_PROPERTY(QList<Contact>, To, to); | 282 | SINK_EXTRACTED_PROPERTY(QList<Contact>, To, to); |
283 | SINK_PROPERTY(QList<Contact>, Cc, cc); | 283 | SINK_EXTRACTED_PROPERTY(QList<Contact>, Cc, cc); |
284 | SINK_PROPERTY(QList<Contact>, Bcc, bcc); | 284 | SINK_EXTRACTED_PROPERTY(QList<Contact>, Bcc, bcc); |
285 | SINK_EXTRACTED_PROPERTY(QString, Subject, subject); | 285 | SINK_EXTRACTED_PROPERTY(QString, Subject, subject); |
286 | SINK_EXTRACTED_PROPERTY(QDateTime, Date, date); | 286 | SINK_EXTRACTED_PROPERTY(QDateTime, Date, date); |
287 | SINK_PROPERTY(bool, Unread, unread); | 287 | SINK_PROPERTY(bool, Unread, unread); |
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 | ||
84 | static 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 | |||
84 | static void updatedIndexedProperties(Sink::ApplicationDomain::Mail &mail, KMime::Message::Ptr msg) | 91 | static 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. |