Gnus development mailing list
 help / color / mirror / Atom feed
From: Daniel Pittman <daniel@rimspace.net>
Subject: spam.el calls spam registration routines even if no spam marked articles exist.
Date: Thu, 27 May 2004 17:48:18 +1000	[thread overview]
Message-ID: <8765ainwe5.fsf@enki.rimspace.net> (raw)

One of the things that bemused me when dealing with spam.el was that it
calls the spam registration routine for the selected group even if there
are no spam articles in that group.

The attached patch avoids calling down into the underlying registration
routine unless there is actually something to do.

This check should, in fact, probably move up higher in the process, but
that is much more major surgery on the code.

     Daniel

Index: spam.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/spam.el,v
retrieving revision 7.44
diff -u -u -r7.44 spam.el
--- spam.el	26 May 2004 16:38:07 -0000	7.44
+++ spam.el	27 May 2004 07:46:06 -0000
@@ -1472,21 +1473,22 @@
 			    gnus-newsgroup-articles
 			    classification)))
 	;; process them
-	(gnus-message 5 "%s %d %s articles as %s using backend %s"
-		      (if unregister "Unregistering" "Registering")
-		      (length articles)
-		      (if specific-articles "specific" "")
-		      (symbol-name classification)
-		      (symbol-name check))
-	(funcall run-function articles)
-	;; now log all the registrations (or undo them, depending on unregister)
-	(dolist (article articles)
-	  (funcall log-function
-		   (spam-fetch-field-message-id-fast article)
-		   'process
-		   classification
-		   check
-		   gnus-newsgroup-name))))))
+        (when (> (length articles) 0)
+          (gnus-message 5 "%s %d %s articles as %s using backend %s"
+                        (if unregister "Unregistering" "Registering")
+                        (length articles)
+                        (if specific-articles "specific" "")
+                        (symbol-name classification)
+                        (symbol-name check))
+          (funcall run-function articles)
+          ;; now log all the registrations (or undo them, depending on unregister)
+          (dolist (article articles)
+            (funcall log-function
+                     (spam-fetch-field-message-id-fast article)
+                     'process
+                     classification
+                     check
+                     gnus-newsgroup-name)))))))
 
 ;;; log a ham- or spam-processor invocation to the registry
 (defun spam-log-processing-to-registry (id type classification check group)

-- 
The problem with defending the purity of the English language is that English
is about as pure as a cribhouse whore. We don't just borrow words; on
occasion, English has pursued other languages down alleyways to beat them
unconscious and rifle their pockets for new vocabulary.
        -- James D. Nicoll




             reply	other threads:[~2004-05-27  7:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-27  7:48 Daniel Pittman [this message]
2004-05-27 11:26 ` spam.el calls spam registration routines even if no spam marked Reiner Steib
2004-05-27 14:30   ` Ted Zlatanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8765ainwe5.fsf@enki.rimspace.net \
    --to=daniel@rimspace.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).