From: "Ted Zlatanov" <tzz@lifelogs.com>
Cc: ding@gnus.org
Subject: Re: Gnus SPAM support, and email based reporting.
Date: 18 May 2004 16:08:25 -0400 [thread overview]
Message-ID: <4nfz9xbirq.fsf@lifelogs.com> (raw)
In-Reply-To: <87lljt2534.fsf@enki.rimspace.net> (Daniel Pittman's message of "Sat, 15 May 2004 23:27:27 +1000")
[-- Attachment #1: Type: text/plain, Size: 1933 bytes --]
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: resend.patch --]
[-- Type: text/x-patch, Size: 6385 bytes --]
? 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))
\f
;;;; Bogofilter
next prev parent reply other threads:[~2004-05-18 20:08 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-17 12:40 Daniel Pittman
2004-04-17 15:20 ` Derrell.Lipman
2004-04-21 15:44 ` Ted Zlatanov
2004-04-22 9:10 ` Steinar Bang
[not found] ` <87fzawgyxq.fsf-1rLz5CwDoL8@public.gmane.org>
2004-04-22 16:23 ` Jochen Küpper
2004-04-22 20:11 ` Ted Zlatanov
[not found] ` <4n1xmfept2.fsf-mIZUurteI1BWk0Htik3J/w@public.gmane.org>
2004-04-22 21:32 ` Jochen Küpper
2004-04-23 16:15 ` Ted Zlatanov
2004-04-22 18:35 ` Ted Zlatanov
2004-04-23 5:34 ` Steinar Bang
2004-04-23 7:45 ` Daniel Pittman
2004-04-23 16:17 ` Ted Zlatanov
2004-05-15 13:27 ` Daniel Pittman
2004-05-18 20:08 ` Ted Zlatanov [this message]
2004-05-24 11:09 ` Daniel Pittman
2004-05-24 11:39 ` Kai Grossjohann
2004-05-24 14:07 ` Daniel Pittman
2004-05-24 14:12 ` Kai Grossjohann
2004-05-26 19:00 ` Michael Schierl
2004-05-24 13:44 ` Ted Zlatanov
2004-05-24 14:18 ` Daniel Pittman
2004-05-24 17:40 ` Ted Zlatanov
2004-05-24 18:07 ` Daniel Pittman
2004-05-24 18:50 ` Ted Zlatanov
2004-05-24 18:52 ` spam.el processor code refactored (was: Gnus SPAM support, and email based reporting.) Ted Zlatanov
[not found] ` <87isfy7p6a.fsf-kiwxAyAbAnkGAYDEi5AF0l6hYfS7NtTn@public.gmane.org>
2004-04-18 22:05 ` Gnus SPAM support, and email based reporting Jochen Küpper
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=4nfz9xbirq.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).