--Boundary-00=_E7WQAiTjBIyBg4w Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 --Boundary-00=_E7WQAiTjBIyBg4w Content-Type: text/x-diff; charset="us-ascii"; name="filteringaction.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="filteringaction.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; } --Boundary-00=_E7WQAiTjBIyBg4w Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ KMail developers mailing list KMail-devel@kde.org https://mail.kde.org/mailman/listinfo/kmail-devel --Boundary-00=_E7WQAiTjBIyBg4w--