Gnus development mailing list
 help / color / mirror / Atom feed
* spam.el calls spam registration routines even if no spam marked articles exist.
@ 2004-05-27  7:48 Daniel Pittman
  2004-05-27 11:26 ` spam.el calls spam registration routines even if no spam marked Reiner Steib
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Pittman @ 2004-05-27  7:48 UTC (permalink / 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




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: spam.el calls spam registration routines even if no spam marked
  2004-05-27  7:48 spam.el calls spam registration routines even if no spam marked articles exist Daniel Pittman
@ 2004-05-27 11:26 ` Reiner Steib
  2004-05-27 14:30   ` Ted Zlatanov
  0 siblings, 1 reply; 3+ messages in thread
From: Reiner Steib @ 2004-05-27 11:26 UTC (permalink / raw)


On Thu, May 27 2004, Daniel Pittman wrote:

> 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.

I have a (probably similar) uncommitted patch here.

Before I install it, I have some questions related to this issue:

- Is it intented that `spam.el' sometimes talks about "messages" and
  sometimes about "articles"?  If not, I think we should use always
  use "articles".

- Should we care for singular/plural?

  "1 spam messages are marked as expired and moved to nil" :-/

  Should we just write "1 spam message(s) marked" or use some
  conditional?

- "and moved to nil"?  This happens in Gmane groups for me.  If groups
  is nil, we should drop this part of the sentence.

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo--- PGP key available via WWW   http://rsteib.home.pages.de/




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: spam.el calls spam registration routines even if no spam marked
  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
  0 siblings, 0 replies; 3+ messages in thread
From: Ted Zlatanov @ 2004-05-27 14:30 UTC (permalink / raw)


On Thu, 27 May 2004, 4.uce.03.r.s@nurfuerspam.de wrote:

> - Is it intented that `spam.el' sometimes talks about "messages" and
>   sometimes about "articles"?  If not, I think we should use always
>   use "articles".

It is unintended, and I'm OK with standardizing.

> - Should we care for singular/plural?
> 
>   "1 spam messages are marked as expired and moved to nil" :-/
> 
>   Should we just write "1 spam message(s) marked" or use some
>   conditional?

I like "message(s)."

> - "and moved to nil"?  This happens in Gmane groups for me.  If groups is nil,
> 	we should drop this part of the sentence.

Will be fixed in CVS.

Ted



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-05-27 14:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-27  7:48 spam.el calls spam registration routines even if no spam marked articles exist Daniel Pittman
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

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).