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

List:       kmail-devel
Subject:    [Bug 128060] Bsfilter for Anti-Spam Wizard and Spam Status Header
From:       Andreas Gungl <a.gungl () gmx ! de>
Date:       2006-06-28 7:16:47
Message-ID: 20060628071647.31323.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=128060         
a.gungl gmx de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From a.gungl gmx de  2006-06-28 09:16 -------
SVN commit 555658 by gungl:

- anti-spam wizard support for BsFilter (from Yuya Nishihara <yuya at tcha dot org>)
- anti-spam wizard support for DSpam (from Kovid Goyal <kovid theory caltech edu>)
- better feedback during filtering, msg count is visible in the statusbar

FEATURE: 115287
FEATURE: 128060
GUI:



 M  +46 -3     kmail.antispamrc  
 M  +10 -5     kmcommands.cpp  
 M  +15 -8     kmheaders.cpp  


--- branches/KDE/3.5/kdepim/kmail/kmail.antispamrc #555657:555658
 @ -1,5 +1,5  @
 [General]
-tools=8
+tools=10
 
 [Spamtool #1]
 Ident=spamassassin
 @ -71,7 +71,7  @
 [Spamtool #4]
 Ident=gmx-antispam
 Version=1
-Priority=60
+Priority=71
 VisibleName=GMX Spam Filter
 Executable=echo
 URL=http://www.gmx.net/de/produkte/virenschutz/index.html
 @ -142,7 +142,7  @
 [Spamtool #8]
 Ident=spamassassin
 Version=1
-Priority=40
+Priority=41
 VisibleName=SpamAssassin 3.x (Perl)
 Executable=spamassassin -V | grep "SpamAssassin version 3"
 URL=http://spamassassin.org
 @ -162,3 +162,46  @
 ScoreType=Adjusted
 ScoreValueRegexp=(?:hits|score)=([\d\.-]+)\s
 ScoreThresholdRegexp=required=([\d\.-]+)\s
+
+[Spamtool #9]
+Ident=bsfilter
+Version=1
+Priority=55
+VisibleName=Bsfilter
+Executable=bsfilter --help > /dev/null
+URL=http://bsfilter.org/
+PipeFilterName=Bsfilter Check
+PipeCmdDetect=bsfilter --pipe --insert-flag --insert-probability
+ExecCmdSpam=bsfilter --add-spam --update
+ExecCmdHam=bsfilter --add-clean --update
+DetectionHeader=X-Spam-Flag
+DetectionPattern=Yes
+DetectionPattern2=
+DetectionOnly=0
+UseRegExp=0
+SupportsBayes=1
+SupportsUnsure=0
+ScoreName=Bsfilter
+ScoreHeader=X-Spam-Probability
+ScoreType=Decimal
+ScoreValueRegexp=(.+)
+ScoreThresholdRegexp=
+
+[Spamtool #10]
+Ident=dspam
+Version=1
+Priority=70
+VisibleName=DSpam 3.x
+URL=http://dspam.nuclearelephant.org
+HeadersOnly=yes
+DetectionHeader=X-DSPAM-Result
+DetectionPattern=Spam
+DetectionOnly=0
+UseRegExp=0
+ScoreName=DSpam
+SupportsUnsure=0
+ScoreHeader=X-DSPAM-Probability
+ConfidenceHeader=X-DSPAM-Confidence
+ScoreType=Decimal
+ScoreValueRegexp=([\d\.]+)\s*
+ScoreConfidenceRegexp=([\d\.]+)\s*
--- branches/KDE/3.5/kdepim/kmail/kmcommands.cpp #555657:555658
 @ -56,6 +56,7  @
 
 #include <qtextcodec.h>
 #include <qpopupmenu.h>
+#include <qeventloop.h>
 
 #include <libemailfunctions/email.h>
 #include <kdebug.h>
 @ -1472,13 +1473,17  @
     if( msg->parent() )
       kmkernel->filterMgr()->tempOpenFolder(msg->parent());
 
-  int counter = 0;
+  int msgCount = 0;
+  int msgCountToFilter = msgList.count();
   for (KMMessage *msg = msgList.first(); msg; msg = msgList.next()) {
+    int diff = msgCountToFilter - ++msgCount;
+    if ( diff < 10 || !( msgCount % 20 ) ) {
+      QString statusMsg = i18n("Filtering message %1 of %2");
+      statusMsg = statusMsg.arg( msgCount ).arg( msgCountToFilter );
+      KPIM::BroadcastStatus::instance()->setStatusMsg( statusMsg );
+      KApplication::kApplication()->eventLoop()->processEvents( QEventLoop::ExcludeUserInput, 50 );
+    }
     msg->setTransferInProgress(false);
-
-    if ( !( ++counter % 20 ) )
-      KApplication::kApplication()->processEvents( 50 );
-
     int filterResult = kmkernel->filterMgr()->process(msg, mFilter);
     if (filterResult == 2) {
       // something went horribly wrong (out of space?)
--- branches/KDE/3.5/kdepim/kmail/kmheaders.cpp #555657:555658
 @ -37,6 +37,7  @
 #include <kdebug.h>
 
 #include <qbuffer.h>
+#include <qeventloop.h>
 #include <qfile.h>
 #include <qheader.h>
 #include <qptrstack.h>
 @ -1354,10 +1355,16  @
     START_TIMER(filter);
 
     KCursorSaver busy( KBusyPtr::busy() );
-    int counter = 0;
+    int msgCount = 0;
+    int msgCountToFilter = msgList->count();
     for (KMMsgBase* msgBase=msgList->first(); msgBase; msgBase=msgList->next()) {
-      if ( !( ++counter % 20 ) )
-        KApplication::kApplication()->processEvents( 50 );
+      int diff = msgCountToFilter - ++msgCount;
+      if ( diff < 10 || !( msgCount % 20 ) ) {
+        QString statusMsg = i18n("Filtering message %1 of %2");
+        statusMsg = statusMsg.arg( msgCount ).arg( msgCountToFilter );
+        KPIM::BroadcastStatus::instance()->setStatusMsg( statusMsg );
+        KApplication::kApplication()->eventLoop()->processEvents( QEventLoop::ExcludeUserInput, 50 );
+      }
       int idx = msgBase->parent()->find(msgBase);
       assert(idx != -1);
       KMMessage * msg = msgBase->parent()->getMsg(idx);
 @ -1365,12 +1372,12  @
       msg->setTransferInProgress(true);
       if ( !msg->isComplete() )
       {
-	FolderJob *job = mFolder->createJob(msg);
-	connect(job, SIGNAL(messageRetrieved(KMMessage*)),
-		SLOT(slotFilterMsg(KMMessage*)));
-	job->start();
+        FolderJob *job = mFolder->createJob(msg);
+        connect(job, SIGNAL(messageRetrieved(KMMessage*)),
+                     SLOT(slotFilterMsg(KMMessage*)));
+        job->start();
       } else {
-	if (slotFilterMsg(msg) == 2) break;
+        if (slotFilterMsg(msg) == 2) break;
       }
     }
     END_TIMER(filter);
_______________________________________________
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