Bug 69860 - output of pipe through sometimes not used
Summary: output of pipe through sometimes not used
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: SVN (3.5 branch)
Platform: Compiled Sources Linux
: NOR major
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-08 15:04 UTC by Andreas Gungl
Modified: 2007-09-14 12:17 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Gungl 2003-12-08 15:04:08 UTC
Version:           cvs head (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc (GCC) 3.3 20030226 (prerelease) (SuSE Linux) 
OS:          Linux

When I pipe messages through a filter, then the message is not replaced by the output of the filter process.
I verified this using "spamc | tee /home/gungl/output.msg" instead of "spamc" only and while the file contains the spammassassin header and info, the message inside KMail remains unchanged.
The error might be related to #67078, but I'm not really sure.
Comment 1 Ingo Klöcker 2003-12-08 15:57:23 UTC
Hmm, I'm pretty sure that my spam filter still works. Please double check that spamc exits with no non-zero return code.

Does it work if you manually apply filters (as in #67078)?

It would be cool if you could debug this yourself, Andreas.
Comment 2 Andreas Gungl 2003-12-08 16:23:35 UTC
Subject: Re:  pipe through output not used

Am Monday 08 December 2003 15:57 schrieb Ingo KlXcker:
> ------- Hmm, I'm pretty sure that my spam filter still works. Please
> double check that spamc exits with no non-zero return code.
Checked.

> Does it work if you manually apply filters (as in #67078)?
No.

> It would be cool if you could debug this yourself, Andreas.
At home I'll update to current CVS, recompile a lot, and see if I can solve 
the problem.

Comment 3 Andreas Gungl 2003-12-08 21:07:43 UTC
The problem is, that the effect (output of pipe through not written back to the message) depends on the message itself. I have some messages where the problem is reproducable. One characteristic detail is that the message is a multipart/alternative message structure with an empty first part of type text/plain (us-ascii / 8 bit).
Comment 4 Juergen Spitzmueller 2003-12-12 16:51:06 UTC
Just for the record: I have exactly the same problem with kmail piping through "bogofilter -rpe" (KDE-3.2beta2). Not a single spam mail has been detected yet. KMail on KDE 3.1.4 works fine.
Comment 5 Andreas Gungl 2003-12-12 22:04:22 UTC
The problem is independent from the message structure. The output is only applied when that message gets moved after the "pipe through" action.

This means for the spamassassin case, that the output is applied when you move the message to e.g. a spam filter. But it's not applied  when the move is not done because the filter criterion of that move filter doesn't match. However, that (move) filter seems to work on the output from the Pipe Through action in any case.
Comment 6 Ingo Klöcker 2003-12-22 19:16:10 UTC
Subject: kdepim/kmail

CVS commit by kloecker: 

Fix bug 69860 (output of pipe through sometimes not used). This also fixes
ad hoc filters. Based on patch by Andreas Gungl. Reviewed by Don.

CCMAIL: 69860-fixed@bugs.kde.org


  M +13 -3     kmfiltermgr.cpp   1.61


--- kdepim/kmail/kmfiltermgr.cpp  #1.60:1.61
@@ -1,2 +1,3 @@
+// -*- mode: C++; c-file-style: "gnu" -*-
 // kmfiltermgr.cpp
 
@@ -146,7 +147,16 @@ int KMFilterMgr::moveMessage(KMMessage *
 void KMFilterMgr::endFiltering(KMMsgBase *msgBase) const
 {
-  if (msgBase->parent() && 
-      (msgBase->parent() == MessageProperty::filterFolder( msgBase )))
-    msgBase->parent()->take( msgBase->parent()->find( msgBase ) );
+  KMFolder *parent = msgBase->parent();
+  if ( parent ) {
+    if ( parent == MessageProperty::filterFolder( msgBase ) ) {
+      parent->take( parent->find( msgBase ) );
+    }
+    else if ( ! MessageProperty::filterFolder( msgBase ) ) {
+      int index = parent->find( msgBase );
+      KMMessage *msg = parent->getMsg( index );
+      parent->take( index );
+      parent->addMsg( msg );
+    }
+  }
   MessageProperty::setFiltering( msgBase, false );
 }