Gnus development mailing list
 help / color / mirror / Atom feed
From: Ted Zlatanov <tzz@lifelogs.com>
To: ding@gnus.org
Subject: Re: SPAM in spam group is processed into that exact same group
Date: Tue, 26 Oct 2010 11:26:54 -0500	[thread overview]
Message-ID: <874oc8zzqp.fsf@lifelogs.com> (raw)
In-Reply-To: <878w1lxwnm.fsf@thinkpad.tsdh.de>

[-- Attachment #1: Type: text/plain, Size: 945 bytes --]

On Tue, 26 Oct 2010 09:04:13 +0200 Tassilo Horn <tassilo@member.fsf.org> wrote: 

>> I think the logic should be:
>> 
>> 1) when (and (eq classification 'spam)
>> (spam-group-spam-contents-p gnus-newsgroup-name)
>> (spam-group-spam-contents-p target))
>> -> message "Sorry, can't move spam from spam group A to spam group B"

TH> Sounds right.  classification is the classification of the message,
TH> right?

>> 2) when (and (eq classification 'ham)
>> (spam-group-ham-contents-p gnus-newsgroup-name)
>> (spam-group-ham-contents-p target))
>> -> message "Sorry, can't move ham from ham group A to ham group B"

TH> Yes.

>> 3) any other case, operate normally and actually do the moves

TH> Yes.

Yes.  OK, so... untested patch follows.  It should be pretty obvious.

I have to use the test function instead of directly checking the
classification of the group, hence the slightly awkward repetition of
the test for spam and ham testing.

Ted


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: nosamegroup.spam.patch --]
[-- Type: text/x-diff, Size: 1681 bytes --]

diff --git a/lisp/spam.el b/lisp/spam.el
index 097299f..5f11fad 100644
--- a/lisp/spam.el
+++ b/lisp/spam.el
@@ -1432,7 +1432,7 @@ addition to the set values for the group."
 	 (gnus-check-backend-function
 	  'request-move-article gnus-newsgroup-name))
 	(respool-method (gnus-find-method-for-group gnus-newsgroup-name))
-	article mark deletep respool)
+	article mark deletep respool invalid-move-destination)
 
     (when (member 'respool groups)
       (setq respool t)			; boolean for later
@@ -1440,7 +1440,31 @@ addition to the set values for the group."
 
     ;; now do the actual move
     (dolist (group groups)
-      (when (and articles (stringp group))
+
+      (setq invalid-move-destination
+            (or
+             (and
+              (eq classification 'spam)
+              (spam-group-spam-contents-p gnus-newsgroup-name)
+              (spam-group-spam-contents-p group)
+              (gnus-message
+               3
+               "Sorry, can't move spam from spam group %s to spam group %s"
+               gnus-newsgroup-name
+               group))
+             (and
+              (eq classification 'ham)
+              (spam-group-ham-contents-p gnus-newsgroup-name)
+              (spam-group-ham-contents-p group)
+              (gnus-message
+               3
+               "Sorry, can't move ham from ham group %s to ham group %s"
+               gnus-newsgroup-name
+               group))))
+
+      (when (and articles
+                 (stringp group)
+                 (not invalid-move-destination))
 
 	;; first, mark the article with the process mark and, if needed,
 	;; the unread or expired mark (for ham and spam respectively)

  reply	other threads:[~2010-10-26 16:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-21 18:38 Tassilo Horn
2010-10-24  9:55 ` Tassilo Horn
2010-10-25 18:53   ` Ted Zlatanov
2010-10-25 20:05     ` Tassilo Horn
2010-10-25 20:23       ` Ted Zlatanov
2010-10-26  7:04         ` Tassilo Horn
2010-10-26 16:26           ` Ted Zlatanov [this message]
2010-10-26 17:38             ` Tassilo Horn
2010-10-26 18:47               ` Ted Zlatanov
2010-10-26 21:04                 ` Tassilo Horn
2010-10-27 17:37                   ` Ted Zlatanov
2010-11-03 16:39                     ` Tassilo Horn
2010-11-04  8:16                       ` Tassilo Horn
2010-11-04 20:18                         ` Lars Magne Ingebrigtsen
2010-11-05  8:59                           ` Tassilo Horn
2010-11-30 16:58                       ` Tassilo Horn
2010-11-30 18:36                         ` Tassilo Horn
2010-12-05 12:33                         ` Lars Magne Ingebrigtsen
2010-12-05 18:13                           ` Tassilo Horn
2010-12-05 18:37                             ` Lars Magne Ingebrigtsen
2010-12-14 22:32                               ` 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=874oc8zzqp.fsf@lifelogs.com \
    --to=tzz@lifelogs.com \
    --cc=ding@gnus.org \
    /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).