From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/57513 Path: main.gmane.org!not-for-mail From: "Ted Zlatanov" Newsgroups: gmane.emacs.gnus.general Subject: Re: Gnus SPAM support, and email based reporting. Date: 18 May 2004 16:08:25 -0400 Organization: =?koi8-r?q?=F4=C5=CF=C4=CF=D2=20=FA=CC=C1=D4=C1=CE=CF=D7?= @ Cienfuegos Sender: ding-owner@lists.math.uh.edu Message-ID: <4nfz9xbirq.fsf@lifelogs.com> References: <87isfy7p6a.fsf@enki.rimspace.net> <1xmm1vhg.fsf@random.localnet.unwireduniverse.com> <4nzn95gwu7.fsf@lifelogs.com> <87lljt2534.fsf@enki.rimspace.net> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1084911948 12425 80.91.224.253 (18 May 2004 20:25:48 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 18 May 2004 20:25:48 +0000 (UTC) Cc: ding@gnus.org Original-X-From: ding-owner+M6053@lists.math.uh.edu Tue May 18 22:25:35 2004 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BQB9b-00068K-00 for ; Tue, 18 May 2004 22:25:35 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1BQB9H-0005sH-00; Tue, 18 May 2004 15:25:15 -0500 Original-Received: from util2.math.uh.edu ([129.7.128.23]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1BQB96-0005s9-00 for ding@lists.math.uh.edu; Tue, 18 May 2004 15:25:04 -0500 Original-Received: from justine.libertine.org ([66.139.78.221] ident=postfix) by util2.math.uh.edu with esmtp (Exim 4.30) id 1BQB92-0003Tw-EG for ding@lists.math.uh.edu; Tue, 18 May 2004 15:25:00 -0500 Original-Received: from mail.bwh.harvard.edu (sysblade0.bwh.harvard.edu [134.174.9.44]) by justine.libertine.org (Postfix) with ESMTP id 5A61B3A0054 for ; Tue, 18 May 2004 15:24:59 -0500 (CDT) Original-Received: (qmail 10022 invoked from network); 18 May 2004 20:19:20 -0000 Envelope-Sender: tzz@lifelogs.com Envelope-Recipients: daniel@rimspace.net, ding@gnus.org, Original-Received: from asimov.bwh.harvard.edu (HELO asimov) ([134.174.9.63]) (envelope-sender ) by mail.bwh.harvard.edu (qmail-ldap-1.03) with SMTP for ; 18 May 2004 20:19:18 -0000 Mail-Followup-To: "Daniel Pittman" , ding@gnus.org Original-To: "Daniel Pittman" 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" In-Reply-To: <87lljt2534.fsf@enki.rimspace.net> (Daniel Pittman's message of "Sat, 15 May 2004 23:27:27 +1000") User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux) Precedence: bulk Xref: main.gmane.org gmane.emacs.gnus.general:57513 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:57513 --=-=-= On Sat, 15 May 2004, daniel@rimspace.net wrote: > Well, having a quick poke around turned up some bits and pieces of code > that I got to do the right thing pretty easily in terms of doing the > resend... Are your FSF papers on file? I don't know how to check. > I had a look at spam.el to see if I could work out how to hook it up to > the actual spam mark stuff and, boy, was that a shock. > > I got lost somewhere around the second or third abstraction around what > really did look like very much the same code. I'm planning to do a major overhaul (version 3 of spam.el, so to speak) where a lot of the unnecessary complexity is at least only done once. Probably by the end of the year. > Ah, well. Hopefully someone who knows the code better can point the way > to getting this registered to process spam messages on exit, and post a > short howto guide that tells me: > > 1. how to get the spam mark code activated spam.el sets up group exit actions that do things with spam articles. You can do your own actions on those articles, there's nothing about spam.el that makes it mandatory for handling the spam-marked articles. > 2. how to get the 'report by resend' code used With spam.el, you just make (spam spam-use-resend) the exit processor of the group. All spam articles will be processed through it. > 3. how to *not* use any of the other features Don't enable any of the spam-use-* variables, INCLUDING spam-use-resend, because spam-use-resend is not a variable, it's only a symbol name. Don't call spam-split in your split rules. Call spam-initialize to load spam.el. That should do it. I'm attaching the patch that sets up a new spam exit processor for this purpose. Please test and get back to me if you are OK with it. The Gmane code, by the way (not the spam-use-gmane-xref spam check, but the (spam spam-use-gmane) spam exit processor) is what spam-report-resend follows as an example. Ted --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=resend.patch ? resend.patch Index: gnus.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/gnus.el,v retrieving revision 7.18 diff -u -r7.18 gnus.el --- gnus.el 12 May 2004 21:00:54 -0000 7.18 +++ gnus.el 18 May 2004 20:13:20 -0000 @@ -1896,6 +1896,7 @@ (const :tag "Spam: Blacklist" (spam spam-use-blacklist)) (const :tag "Spam: Bsfilter" (spam spam-use-bsfilter)) (const :tag "Spam: Gmane Report" (spam spam-use-gmane)) + (const :tag "Spam: Resend Message"(spam spam-use-resend)) (const :tag "Spam: ifile" (spam spam-use-ifile)) (const :tag "Spam: Spam Oracle" (spam spam-use-spamoracle)) (const :tag "Spam: Spam-stat" (spam spam-use-stat)) Index: spam-report.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/spam-report.el,v retrieving revision 7.7 diff -u -r7.7 spam-report.el --- spam-report.el 25 Feb 2004 23:53:49 -0000 7.7 +++ spam-report.el 18 May 2004 20:13:20 -0000 @@ -79,12 +79,36 @@ :type 'file :group 'spam-report) +(defcustom spam-report-resend-to (or + (when (length user-mail-address) + user-mail-address) + "nonexistent-user-please-fix@invalid.domain") + "Email address that spam articles are resent to when reporting." + :type 'string + :group 'spam-report) + (defvar spam-report-url-ping-temp-agent-function nil "Internal variable for `spam-report-agentize' and `spam-report-deagentize'. This variable will store the value of `spam-report-url-ping-function' from before `spam-report-agentize' was run, so that `spam-report-deagentize' can undo that change.") +(defun spam-report-resend (&rest articles) + "Report an article as spam by resending via email." + (dolist (article articles) + (gnus-message 6 + "Reporting spam article %d to <%s>..." + article spam-report-resend-to) + ;; This is ganked from the `gnus-summary-resend-message' function. + ;; It involves rendering the SPAM, which is undesirable, but there does + ;; not seem to be a nicer way to achieve this. + ;; select this particular article + (gnus-summary-select-article nil nil nil article) + ;; resend it to the destination address + (save-excursion + (set-buffer gnus-original-article-buffer) + (message-resend spam-report-resend-to)))) + (defun spam-report-gmane (&rest articles) "Report an article as spam through Gmane" (dolist (article articles) @@ -93,10 +117,11 @@ (string-match spam-report-gmane-regex gnus-newsgroup-name))) (gnus-message 6 "Reporting spam article %d to spam.gmane.org..." article) (if spam-report-gmane-use-article-number - (spam-report-url-ping "spam.gmane.org" - (format "/%s:%d" - (gnus-group-real-name gnus-newsgroup-name) - article)) + (spam-report-url-ping + "spam.gmane.org" + (format "/%s:%d" + (gnus-group-real-name gnus-newsgroup-name) + article)) (with-current-buffer nntp-server-buffer (gnus-request-head article gnus-newsgroup-name) (goto-char (point-min)) Index: spam.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/spam.el,v retrieving revision 7.37 diff -u -r7.37 spam.el --- spam.el 17 May 2004 14:28:21 -0000 7.37 +++ spam.el 18 May 2004 20:13:20 -0000 @@ -55,7 +55,8 @@ ;; autoload spam-report (eval-and-compile - (autoload 'spam-report-gmane "spam-report")) + (autoload 'spam-report-gmane "spam-report") + (autoload 'spam-report-resend "spam-report")) ;; autoload gnus-registry (eval-and-compile @@ -659,7 +660,9 @@ nil)) (defvar spam-list-of-processors + ;; note the resend and gmane processors are not defined in gnus.el '((gnus-group-spam-exit-processor-report-gmane spam spam-use-gmane) + (gnus-group-spam-exit-processor-report-resend spam spam-use-resend) (gnus-group-spam-exit-processor-bogofilter spam spam-use-bogofilter) (gnus-group-spam-exit-processor-bsfilter spam spam-use-bsfilter) (gnus-group-spam-exit-processor-blacklist spam spam-use-blacklist) @@ -705,6 +708,9 @@ (defun spam-group-spam-processor-report-gmane-p (group) (spam-group-processor-p group 'gnus-group-spam-exit-processor-report-gmane)) +(defun spam-group-spam-processor-report-resend-p (group) + (spam-group-processor-p group 'gnus-group-spam-exit-processor-report-resend)) + (defun spam-group-spam-processor-bogofilter-p (group) (spam-group-processor-p group 'gnus-group-spam-exit-processor-bogofilter)) @@ -742,13 +748,23 @@ (spam-group-processor-p group 'gnus-group-ham-exit-processor-spamoracle)) (defun spam-report-articles-gmane (n) - "Report the current message as spam. + "Report the current message as spam via Gmane. Respects the process/prefix convention." (interactive "P") (dolist (article (gnus-summary-work-articles n)) (gnus-summary-remove-process-mark article) (spam-report-gmane article))) +(defun spam-report-articles-resend (n) + "Report the current message as spam by resending it. +Respects the process/prefix convention. Also see +`spam-report-resend-to'." + (interactive "P") + (let ((articles (gnus-summary-work-articles n))) + (spam-report-resend articles) + (dolist (article articles) + (gnus-summary-remove-process-mark article)))) + (defun spam-necessary-extra-headers () "Return the extra headers spam.el thinks are necessary." (let (list) @@ -1323,12 +1339,16 @@ spam-stat-register-spam-routine spam-stat-unregister-ham-routine spam-stat-unregister-spam-routine) - ;; note that spam-use-gmane is not a legitimate check + ;; note that spam-use-gmane and spam-use-resend are not legitimate checks (spam-use-gmane nil spam-report-gmane-register-routine ;; does Gmane support unregistration? nil nil) + (spam-use-resend nil + spam-report-resend-register-routine + nil + nil) (spam-use-spamassassin spam-spamassassin-register-ham-routine spam-spamassassin-register-spam-routine spam-spamassassin-unregister-ham-routine @@ -2055,6 +2075,9 @@ (defun spam-report-gmane-register-routine (articles) (when articles (apply 'spam-report-gmane articles))) + +(defun spam-report-resend-register-routine (articles) + (spam-report-resend articles)) ;;;; Bogofilter --=-=-=--