[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kmail-devel
Subject:    [Bug 94577] JJ: Remove spamassassin markup from non-Spam messages
From:       Till Adam <adam () kde ! org>
Date:       2006-02-02 20:17:23
Message-ID: 20060202201723.29890.qmail () ktown ! kde ! org
[Download RAW message or body]

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=94577         




------- Additional Comments From adam kde org  2006-02-02 21:17 -------
SVN commit 505000 by tilladam:

Commit patch by Jan Callewaert <jan.callewaert gmail com> (with slight
modifications to make it compile against 4.0) which makes the 'mark as
ham' action run spamassassin -d to remove SA's verbose headers. Thanks,
Jan.

Andreas, did you want this in branch as well?
CCMAIL: agungl kde org
CCMAIL: 94577 bugs kde org


 M  +20 -8     antispamwizard.cpp  
 M  +8 -4      antispamwizard.h  
 M  +6 -0      kmail.antispamrc  


--- trunk/KDE/kdepim/kmail/antispamwizard.cpp #504999:505000
 @ -421,7 +421,17  @
         classHamFilterActions->append( classHamFilterAction );
       }
     }
-    KMSearchPattern* classHamFilterPattern = classHamFilter->pattern();
+    for ( QList<SpamToolConfig>::iterator it = mToolList.begin();
+          it != mToolList.end(); ++it ) {
+      if ( mInfoPage->isProgramSelected( (*it).getVisibleName() )
+          && (*it).useBayesFilter() && !(*it).isDetectionOnly() )
+      {
+        KMFilterAction* classHamFilterAction = dict.value( "filter app" )->create();
+        classHamFilterAction->argsFromString( (*it).getNoSpamCmd() );
+        classHamFilterActions->append( classHamFilterAction );
+      }
+    }
+	KMSearchPattern* classHamFilterPattern = classHamFilter->pattern();
     if ( replaceExistingFilters )
       classHamFilterPattern->setName( i18n( "Classify as NOT spam" ) );
     else
 @ -654,15 +664,15  @
 AntiSpamWizard::SpamToolConfig::SpamToolConfig( QString toolId,
       int configVersion, int prio, QString name, QString exec,
       QString url, QString filter, QString detection, QString spam, QString ham,
-      QString header, QString pattern, QString pattern2, QString serverPattern,
-      bool detectionOnly, bool regExp, bool bayesFilter, bool tristateDetection,
-      WizardMode type )
+	  QString noSpam, QString header, QString pattern, QString pattern2,
+	  QString serverPattern, bool detectionOnly, bool regExp, bool bayesFilter,
+	  bool tristateDetection, WizardMode type )
   : mId( toolId ), mVersion( configVersion ), mPrio( prio ),
     mVisibleName( name ), mExecutable( exec ), mWhatsThisText( url ),
     mFilterName( filter ), mDetectCmd( detection ), mSpamCmd( spam ),
-    mHamCmd( ham ), mDetectionHeader( header ), mDetectionPattern( pattern ),
-    mDetectionPattern2( pattern2 ), mServerPattern( serverPattern ),
-    mDetectionOnly( detectionOnly ),
+    mHamCmd( ham ), mNoSpamCmd( noSpam ), mDetectionHeader( header ),
+	mDetectionPattern( pattern ), mDetectionPattern2( pattern2 ),
+	mServerPattern( serverPattern ), mDetectionOnly( detectionOnly ),
     mUseRegExp( regExp ), mSupportsBayesFilter( bayesFilter ),
     mSupportsUnsure( tristateDetection ), mType( type )
 {
 @ -748,6 +758,7  @
   QString detectCmd = configGroup.readEntry( "PipeCmdDetect" );
   QString spamCmd = configGroup.readEntry( "ExecCmdSpam" );
   QString hamCmd = configGroup.readEntry( "ExecCmdHam" );
+  QString noSpamCmd = configGroup.readEntry( "PipeCmdNoSpam" );
   QString header = configGroup.readEntry( "DetectionHeader" );
   QString pattern = configGroup.readEntry( "DetectionPattern" );
   QString pattern2 = configGroup.readEntry( "DetectionPattern2" );
 @ -757,7 +768,7  @
   bool supportsBayes = configGroup.readEntry( "SupportsBayes", false );
   bool supportsUnsure = configGroup.readEntry( "SupportsUnsure", false );
   return SpamToolConfig( id, version, prio, name, executable, url,
-                         filterName, detectCmd, spamCmd, hamCmd,
+                         filterName, detectCmd, spamCmd, hamCmd, noSpamCmd,
                          header, pattern, pattern2, serverPattern,
                          detectionOnly, useRegExp,
                          supportsBayes, supportsUnsure, mMode );
 @ -772,6 +783,7  @
                         "spamassassin -L",
                         "sa-learn -L --spam --no-rebuild --single",
                         "sa-learn -L --ham --no-rebuild --single",
+						"spamassassin -d",
                         "X-Spam-Flag", "yes", "", "",
                         false, false, true, false, AntiSpam );
 }
--- trunk/KDE/kdepim/kmail/antispamwizard.h #504999:505000
 @ -91,7 +91,8  @
     PipeCmdDetect=spamassassin -L
     ExecCmdSpam=sa-learn --spam --no-rebuild --single
     ExecCmdHam=sa-learn --ham --no-rebuild --single
-    DetectionHeader=X-Spam-Flag
+    PipeCmdNoSpam=spamassassin -d
+	DetectionHeader=X-Spam-Flag
     DetectionPattern=yes
     DetectionPattern2=
     DetectionOnly=0
 @ -139,8 +140,8  @
           SpamToolConfig( QString toolId, int configVersion, int prio,
                         QString name, QString exec, QString url, QString filter,
                         QString detection, QString spam, QString ham,
-                        QString header, QString pattern, QString pattern2,
-                        QString serverPattern,
+						QString noSpam, QString header, QString pattern,
+						QString pattern2, QString serverPattern,
                         bool detectionOnly, bool regExp, bool bayesFilter, 
                         bool tristateDetection, WizardMode type );
 
 @ -154,6 +155,7  @
           QString getDetectCmd() const { return mDetectCmd; }
           QString getSpamCmd() const { return mSpamCmd; }
           QString getHamCmd() const { return mHamCmd; }
+		  QString getNoSpamCmd() const { return mNoSpamCmd; }
           QString getDetectionHeader() const { return mDetectionHeader; }
           QString getDetectionPattern() const { return mDetectionPattern; }
           QString getDetectionPattern2() const { return mDetectionPattern2; }
 @ -190,7 +192,9  @
           QString mSpamCmd;
           // pipe through cmd to let the tool learn a ham message
           QString mHamCmd;
-          // by which header are messages marked as spam
+          // pipe through cmd to let the tool delete the spam markup
+          QString mNoSpamCmd;
+		  // by which header are messages marked as spam
           QString mDetectionHeader;
           // what header pattern is used to mark spam messages
           QString mDetectionPattern;
--- trunk/KDE/kdepim/kmail/kmail.antispamrc #504999:505000
 @ -12,6 +12,7  @
 PipeCmdDetect=spamassassin -L
 ExecCmdSpam=sa-learn -L --spam --no-rebuild --single
 ExecCmdHam=sa-learn -L --ham --no-rebuild --single
+PipeCmdNoSpam=spamassassin -d
 DetectionHeader=X-Spam-Flag
 DetectionPattern=yes
 DetectionPattern2=
 @ -36,6 +37,7  @
 PipeCmdDetect=bogofilter -p -e -u
 ExecCmdSpam=bogofilter -N -s
 ExecCmdHam=bogofilter -S -n
+PipeCmdNoSpam=
 DetectionHeader=X-Bogosity
 DetectionPattern=(yes)|(spam\b)
 DetectionPattern2=
 @ -60,6 +62,7  @
 PipeCmdDetect=$HOME/.annoyance-filter/annoyance-filter --fread \
$HOME/.annoyance-filter/FastDict.bin --phrasemin 1 --phrasemax 2 --transcript - \
--test -  ExecCmdSpam=$HOME/.annoyance-filter/annoyance-filter --read \
$HOME/.annoyance-filter/Dict.bin --phrasemin 1 --phrasemax 2 --junk - --prune --write \
$HOME/.annoyance-filter/Dict.bin --fwrite $HOME/.annoyance-filter/FastDict.bin  \
ExecCmdHam=$HOME/.annoyance-filter/annoyance-filter --read \
$HOME/.annoyance-filter/Dict.bin --phrasemin 1 --phrasemax 2 --mail - --prune --write \
$HOME/.annoyance-filter/Dict.bin --fwrite $HOME/.annoyance-filter/FastDict.bin \
+PipeCmdNoSpam=  DetectionHeader=X-Annoyance-Filter-Classification
 DetectionPattern=Junk
 DetectionPattern2=
 @ -79,6 +82,7  @
 PipeCmdDetect=
 ExecCmdSpam=
 ExecCmdHam=
+PipeCmdNoSpam=
 DetectionHeader=X-GMX-Antispam
 DetectionPattern=^[2345]
 DetectionPattern2=
 @ -126,6 +130,7  @
 PipeCmdDetect=spamc
 ExecCmdSpam=sa-learn -L --spam --no-rebuild --single
 ExecCmdHam=sa-learn -L --ham --no-rebuild --single
+PipeCmdNoSpam=spamassassin -d
 DetectionHeader=X-Spam-Flag
 DetectionPattern=yes
 DetectionPattern2=
 @ -150,6 +155,7  @
 PipeCmdDetect=spamassassin -L
 ExecCmdSpam=sa-learn -L --spam --no-sync
 ExecCmdHam=sa-learn -L --ham --no-sync
+PipeCmdNoSpam=spamassassin -d
 DetectionHeader=X-Spam-Flag
 DetectionPattern=yes
 DetectionPattern2=
_______________________________________________
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