summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Krause <[email protected]>2015-08-29 10:34:20 +0200
committerVolker Krause <[email protected]>2015-08-29 10:34:20 +0200
commit71b86c59a644b9f65bdf2466c2a9c0e29913d858 (patch)
tree2fa57db9ee0e6487dc3c89387f59f85c0a5dd032
parent9e1efe4ca9dfa73f92129de599672167940dcc39 (diff)
Use hasAttachment() rather than extracting all attachments just for this.
Only walks through the mime tree to the first attachment, and does not need any allocations.
-rw-r--r--mailcommon/search/searchrule/searchrulestring.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/mailcommon/search/searchrule/searchrulestring.cpp b/mailcommon/search/searchrule/searchrulestring.cpp
index a38b891..42bd95c 100644
--- a/mailcommon/search/searchrule/searchrulestring.cpp
+++ b/mailcommon/search/searchrule/searchrulestring.cpp
@@ -166,9 +166,9 @@ bool SearchRuleString::matches(const Akonadi::Item &item) const
// these two functions need the kmmessage therefore they don't call matchesInternal
if (function() == FuncHasAttachment) {
- return (!msg->attachments().isEmpty());
+ return KMime::hasAttachment(msg.data());
} else if (function() == FuncHasNoAttachment) {
- return (msg->attachments().isEmpty());
+ return !KMime::hasAttachment(msg.data());
}
bool rc = matchesInternal(msgContents);