diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-03-06 15:10:05 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-03-06 15:10:05 +0100 |
commit | f03005ccc2cd0f7eea3ad8e7e1c90ed2d8ea3561 (patch) | |
tree | f30ec1b23f2f4db75b209a7e12bf10ef17f3005a /common/mail | |
parent | d7d37fe292a85b5e1b0b34c773a6af039b7849d8 (diff) | |
download | sink-f03005ccc2cd0f7eea3ad8e7e1c90ed2d8ea3561.tar.gz sink-f03005ccc2cd0f7eea3ad8e7e1c90ed2d8ea3561.zip |
Avoid threading messages by thread with empty subject
Diffstat (limited to 'common/mail')
-rw-r--r-- | common/mail/threadindexer.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/common/mail/threadindexer.cpp b/common/mail/threadindexer.cpp index 6f2933c..d91ab5f 100644 --- a/common/mail/threadindexer.cpp +++ b/common/mail/threadindexer.cpp | |||
@@ -101,9 +101,12 @@ void ThreadIndexer::updateThreadingIndex(const QByteArray &identifier, const App | |||
101 | thread = index().secondaryLookup<Mail::MessageId, Mail::ThreadId>(parentMessageId); | 101 | thread = index().secondaryLookup<Mail::MessageId, Mail::ThreadId>(parentMessageId); |
102 | SinkTrace() << "Found parent: " << thread; | 102 | SinkTrace() << "Found parent: " << thread; |
103 | } | 103 | } |
104 | |||
104 | if (thread.isEmpty()) { | 105 | if (thread.isEmpty()) { |
105 | //Try to lookup the thread by subject: | 106 | //Try to lookup the thread by subject if not empty |
106 | thread = index().secondaryLookup<Mail::Subject, Mail::ThreadId>(normalizedSubject); | 107 | if ( !normalizedSubject.isEmpty()) { |
108 | thread = index().secondaryLookup<Mail::Subject, Mail::ThreadId>(normalizedSubject); | ||
109 | } | ||
107 | if (thread.isEmpty()) { | 110 | if (thread.isEmpty()) { |
108 | thread << QUuid::createUuid().toByteArray(); | 111 | thread << QUuid::createUuid().toByteArray(); |
109 | SinkTrace() << "Created a new thread: " << thread; | 112 | SinkTrace() << "Created a new thread: " << thread; |
@@ -121,7 +124,9 @@ void ThreadIndexer::updateThreadingIndex(const QByteArray &identifier, const App | |||
121 | } | 124 | } |
122 | index().index<Mail::MessageId, Mail::ThreadId>(messageId, thread.first(), transaction); | 125 | index().index<Mail::MessageId, Mail::ThreadId>(messageId, thread.first(), transaction); |
123 | index().index<Mail::ThreadId, Mail::MessageId>(thread.first(), messageId, transaction); | 126 | index().index<Mail::ThreadId, Mail::MessageId>(thread.first(), messageId, transaction); |
124 | index().index<Mail::Subject, Mail::ThreadId>(normalizedSubject, thread.first(), transaction); | 127 | if (!normalizedSubject.isEmpty()) { |
128 | index().index<Mail::Subject, Mail::ThreadId>(normalizedSubject, thread.first(), transaction); | ||
129 | } | ||
125 | } | 130 | } |
126 | 131 | ||
127 | 132 | ||