From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/73613 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.gnus.general Subject: Re: SPAM in spam group is processed into that exact same group Date: Tue, 26 Oct 2010 11:26:54 -0500 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <874oc8zzqp.fsf@lifelogs.com> References: <87ocan4cis.fsf@thinkpad.tsdh.de> <87tykbj4of.fsf@thinkpad.tsdh.de> <87iq0q3xzx.fsf@lifelogs.com> <87tykaf37y.fsf@thinkpad.tsdh.de> <87fwvu2f9m.fsf@lifelogs.com> <878w1lxwnm.fsf@thinkpad.tsdh.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1288110498 6221 80.91.229.12 (26 Oct 2010 16:28:18 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 26 Oct 2010 16:28:18 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M21982@lists.math.uh.edu Tue Oct 26 18:28:17 2010 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PAmNl-0005cB-0v for ding-account@gmane.org; Tue, 26 Oct 2010 18:28:17 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1PAmMl-00067q-UR; Tue, 26 Oct 2010 11:27:15 -0500 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1PAmMj-00067Z-Hw for ding@lists.math.uh.edu; Tue, 26 Oct 2010 11:27:13 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1PAmMi-0002Mb-2W for ding@lists.math.uh.edu; Tue, 26 Oct 2010 11:27:13 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]) by quimby.gnus.org with esmtp (Exim 3.36 #1 (Debian)) id 1PAmMg-0001rw-00 for ; Tue, 26 Oct 2010 18:27:10 +0200 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PAmMd-000528-B6 for ding@gnus.org; Tue, 26 Oct 2010 18:27:07 +0200 Original-Received: from 38.98.147.130 ([38.98.147.130]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 26 Oct 2010 18:27:07 +0200 Original-Received: from tzz by 38.98.147.130 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 26 Oct 2010 18:27:07 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 87 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 38.98.147.130 X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6;d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:MERbRgN7hwOm2xh0Sikoq4dSg+A= X-Spam-Score: -0.7 (/) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:73613 Archived-At: --=-=-= Content-Type: text/plain On Tue, 26 Oct 2010 09:04:13 +0200 Tassilo Horn 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 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=nosamegroup.spam.patch 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) --=-=-=--