summaryrefslogtreecommitdiffstats
path: root/kmail/kmsearchpattern.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-01 00:37:02 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-01 00:37:02 +0000
commitcc29364f06178f8f6b457384f2ec37a042bd9d43 (patch)
tree7c77a3184c698bbf9d98cef09fb1ba8124daceba /kmail/kmsearchpattern.cpp
parent4f6c584bacc8c3c694228f36ada3de77a76614a6 (diff)
downloadtdepim-cc29364f06178f8f6b457384f2ec37a042bd9d43.tar.gz
tdepim-cc29364f06178f8f6b457384f2ec37a042bd9d43.zip
* Massive set of changes to bring in all fixes and enhancements from the Enterprise PIM branch
* Ensured that the Trinity changes were applied on top of those enhancements, and any redundancy removed * Added journal read support to the CalDAV resource * Fixed CalDAV resource to use events URL for tasks and journals when separate URL checkbox unchecked git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1170461 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmail/kmsearchpattern.cpp')
-rw-r--r--kmail/kmsearchpattern.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/kmail/kmsearchpattern.cpp b/kmail/kmsearchpattern.cpp
index bec476ef6..3d97a2b31 100644
--- a/kmail/kmsearchpattern.cpp
+++ b/kmail/kmsearchpattern.cpp
@@ -27,6 +27,8 @@ using KMail::FilterLog;
#include <mimelib/string.h>
#include <mimelib/boyermor.h>
+#include <mimelib/field.h>
+#include <mimelib/headers.h>
#include <assert.h>
@@ -58,7 +60,8 @@ static struct _statusNames statusNames[] = {
{ "To Do", KMMsgStatusTodo },
{ "Spam", KMMsgStatusSpam },
{ "Ham", KMMsgStatusHam },
- { "Has Attachment", KMMsgStatusHasAttach }
+ { "Has Attachment", KMMsgStatusHasAttach },
+ { "Invitation", KMMsgStatusHasInvitation }
};
static const int numStatusNames = sizeof statusNames / sizeof ( struct _statusNames );
@@ -280,7 +283,7 @@ bool KMSearchRuleString::matches( const DwString & aStr, KMMessage & msg,
start += headerLen;
size_t stop = aStr.find( '\n', start );
char ch = '\0';
- while ( stop != DwString::npos && ( ch = aStr.at( stop + 1 ) ) == ' ' || ch == '\t' )
+ while ( stop != DwString::npos && ( ( ch = aStr.at( stop + 1 ) ) == ' ' || ch == '\t' ) )
stop = aStr.find( '\n', stop + 1 );
const int len = stop == DwString::npos ? aStr.length() - start : stop - start ;
const TQCString codedValue( aStr.data() + start, len + 1 );
@@ -333,7 +336,19 @@ bool KMSearchRuleString::matches( const KMMessage * msg ) const
bool logContents = true;
if( field() == "<message>" ) {
- msgContents = msg->asString();
+
+ // When searching in the complete message, we can't simply use msg->asString() here,
+ // as that wouldn't decode the body. Therefore we use the decoded body and all decoded
+ // header fields and add all to the one big search string.
+ msgContents += msg->bodyToUnicode();
+ const DwHeaders& headers = msg->headers();
+ const DwField * dwField = headers.FirstField();
+ while( dwField != 0 ) {
+ const char * const fieldName = dwField->FieldNameStr().c_str();
+ const TQString fieldValue = msg->headerFields( fieldName ).join( " " );
+ msgContents += " " + fieldValue;
+ dwField = dwField->Next();
+ }
logContents = false;
} else if ( field() == "<body>" ) {
msgContents = msg->bodyToUnicode();