[prev in list] [next in list] [prev in thread] [next in thread]
List: kmail-devel
Subject: [PATCH] Now the adhoc filter for at least file into (havent tested
From: Otto Bruggeman <bruggie () home ! nl>
Date: 2004-02-29 4:47:00
Message-ID: 200402290547.00103.bruggie () home ! nl
[Download RAW message or body]
Hi,
here is probably a too simple patch to make it filter before applying an adhoc
filter action according to the specified filter in the adhoc action. This is
probably too simple and not ready for cvs but i like at least some response
form the devels on this. It works fine with imap folders. it retrieves them
all first but then restores them again after filtering. Please give me some
comments on this on how to improve and if it does not fuck up anything else
which i have not tested or overlooked.
Thanks for this great design that let me add this with only a couple of lines
of code.
Greetings,
Otto
["filteringaction.diff" (text/x-diff)]
Index: kmfilter.h
===================================================================
RCS file: /home/kde/kdepim/kmail/kmfilter.h,v
retrieving revision 1.27
diff -u -3 -p -r1.27 kmfilter.h
--- kmfilter.h 6 Nov 2003 09:25:56 -0000 1.27
+++ kmfilter.h 29 Feb 2004 04:41:03 -0000
@@ -110,6 +110,11 @@ public:
myFilter->pattern()->matches() now. */
KMSearchPattern* pattern() { return &mPattern; }
+ /** Provides a reference to the internal pattern. If you used the
+ @p matches() function before, please convert to using
+ myFilter->pattern()->matches() now. */
+ const KMSearchPattern* pattern() const { return &mPattern; }
+
/** Set whether this filter should be applied on
outbound messages (@p aApply == TRUE) or not.
@see applyOnOutbound applyOnInbound setApplyOnInbound
Index: kmfiltermgr.cpp
===================================================================
RCS file: /home/kde/kdepim/kmail/kmfiltermgr.cpp,v
retrieving revision 1.68
diff -u -3 -p -r1.68 kmfiltermgr.cpp
--- kmfiltermgr.cpp 23 Feb 2004 10:43:50 -0000 1.68
+++ kmfiltermgr.cpp 29 Feb 2004 04:41:03 -0000
@@ -175,15 +175,20 @@ int KMFilterMgr::process( KMMessage * ms
return 1;
bool stopIt = false;
int result = 1;
- if (filter->execActions( msg, stopIt ) == KMFilter::CriticalError)
- return 2;
-
- KMFolder *folder = MessageProperty::filterFolder( msg );
-
- endFiltering( msg );
- if (folder) {
- tempOpenFolder( folder );
- result = folder->moveMsg( msg );
+ if (filter->pattern()->matches( msg )) {
+ if (filter->execActions( msg, stopIt ) == KMFilter::CriticalError)
+ return 2;
+
+ KMFolder *folder = MessageProperty::filterFolder( msg );
+
+ endFiltering( msg );
+ if (folder) {
+ tempOpenFolder( folder );
+ result = folder->moveMsg( msg );
+ }
+ } else {
+ endFiltering( msg );
+ result = 1;
}
return result;
}
_______________________________________________
KMail developers mailing list
KMail-devel@kde.org
https://mail.kde.org/mailman/listinfo/kmail-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic