2004-05-24 Teodor Zlatanov <tzz@lifelogs.com>
+ * spam.el (spam-list-of-processors): use nil for nonexistent processors
+ (spam-group-processor-p): fixed function so it works properly
+ (spam-group-processor-multiple-p)
+ (spam-group-spam-processor-report-gmane-p)
+ (spam-group-spam-processor-report-resend-p)
+ (spam-group-spam-processor-bogofilter-p)
+ (spam-group-spam-processor-blacklist-p)
+ (spam-group-spam-processor-ifile-p)
+ (spam-group-ham-processor-ifile-p)
+ (spam-group-spam-processor-spamoracle-p)
+ (spam-group-spam-processor-crm114-p)
+ (spam-group-ham-processor-bogofilter-p)
+ (spam-group-spam-processor-stat-p)
+ (spam-group-ham-processor-stat-p)
+ (spam-group-ham-processor-whitelist-p)
+ (spam-group-ham-processor-BBDB-p)
+ (spam-group-ham-processor-spamoracle-p)
+ (spam-group-ham-processor-copy-p): functions removed with some
+ prejudice against unneeded code
+ (spam-report-articles-resend)
+ (spam-report-resend-register-routine): allow the group/topic
+ spam-resend-to value to override spam-report-resend-to
+ (spam-summary-prepare-exit): invoke spam-group-processor-p
+ properly now
+
+ * spam-report.el (spam-report-resend-to, spam-report-resend):
+ start with resend-to set to nil, and then ask the user if
+ necessary. From Daniel Pittman <daniel@rimspace.net>.
+
+ * gnus.el (spam-resend-to): new group/topic parameter
+ (spam-process): move the OBSOLETE processors to the end of the
+ choices.
+
* spam-report.el (spam-report-resend): spam-report-resend takes a
list of articles, not separate article numbers. From Daniel
Pittman <daniel@rimspace.net>.
"The spam classification (spam, ham, or neither) of this group.
When a spam group is entered, all unread articles are marked as spam.")
+ (gnus-define-group-parameter
+ spam-resend-to
+ :type list
+ :function-document
+ "The address to get spam resent (through spam-report-resend)."
+ :variable gnus-spam-resend-to
+ :variable-default nil
+ :variable-document
+ "The address to get spam resent (through spam-report-resend)."
+ :variable-group spam
+ :variable-type '(repeat
+ (list :tag "Group address for resending spam"
+ (regexp :tag "Group")
+ (string :tag "E-mail address for resending spam (requires the spam-use-resend exit processor)")))
+ :parameter-type 'string :tag "E-mail address for resending spam (requires the spam-use-resend exit processor)"
+ :parameter-document
+ "The address to get spam resent (through spam-report-resend).")
+
(defvar gnus-group-spam-exit-processor-ifile "ifile"
"OBSOLETE: The ifile summary exit spam processor.")
:value nil
(list :tag "Spam Summary Exit Processor Choices"
(set
- (variable-item gnus-group-spam-exit-processor-ifile)
- (variable-item gnus-group-spam-exit-processor-stat)
- (variable-item gnus-group-spam-exit-processor-bogofilter)
- (variable-item gnus-group-spam-exit-processor-blacklist)
- (variable-item gnus-group-spam-exit-processor-spamoracle)
- (variable-item gnus-group-spam-exit-processor-report-gmane)
- (variable-item gnus-group-ham-exit-processor-bogofilter)
- (variable-item gnus-group-ham-exit-processor-ifile)
- (variable-item gnus-group-ham-exit-processor-stat)
- (variable-item gnus-group-ham-exit-processor-whitelist)
- (variable-item gnus-group-ham-exit-processor-BBDB)
- (variable-item gnus-group-ham-exit-processor-spamoracle)
- (variable-item gnus-group-ham-exit-processor-copy)
(const :tag "Spam: Bogofilter" (spam spam-use-bogofilter))
(const :tag "Spam: Blacklist" (spam spam-use-blacklist))
(const :tag "Spam: Bsfilter" (spam spam-use-bsfilter))
(const :tag "Ham: Spam-stat" (ham spam-use-stat))
(const :tag "Ham: SpamAssassin" (ham spam-use-spamassassin))
(const :tag "Ham: CRM114" (ham spam-use-crm114))
- (const :tag "Ham: Whitelist" (ham spam-use-whitelist)))))
+ (const :tag "Ham: Whitelist" (ham spam-use-whitelist))
+ (variable-item gnus-group-spam-exit-processor-ifile)
+ (variable-item gnus-group-spam-exit-processor-stat)
+ (variable-item gnus-group-spam-exit-processor-bogofilter)
+ (variable-item gnus-group-spam-exit-processor-blacklist)
+ (variable-item gnus-group-spam-exit-processor-spamoracle)
+ (variable-item gnus-group-spam-exit-processor-report-gmane)
+ (variable-item gnus-group-ham-exit-processor-bogofilter)
+ (variable-item gnus-group-ham-exit-processor-ifile)
+ (variable-item gnus-group-ham-exit-processor-stat)
+ (variable-item gnus-group-ham-exit-processor-whitelist)
+ (variable-item gnus-group-ham-exit-processor-BBDB)
+ (variable-item gnus-group-ham-exit-processor-spamoracle)
+ (variable-item gnus-group-ham-exit-processor-copy))))
:function-document
"Which spam or ham processors will be applied when the summary is exited."
:variable gnus-spam-process-newsgroups
(regexp :tag "Group Regexp")
(set
:tag "Spam/Ham Summary Exit Processor"
- (variable-item gnus-group-spam-exit-processor-ifile)
- (variable-item gnus-group-spam-exit-processor-stat)
- (variable-item gnus-group-spam-exit-processor-bogofilter)
- (variable-item gnus-group-spam-exit-processor-blacklist)
- (variable-item gnus-group-spam-exit-processor-spamoracle)
- (variable-item gnus-group-spam-exit-processor-report-gmane)
- (variable-item gnus-group-ham-exit-processor-bogofilter)
- (variable-item gnus-group-ham-exit-processor-ifile)
- (variable-item gnus-group-ham-exit-processor-stat)
- (variable-item gnus-group-ham-exit-processor-whitelist)
- (variable-item gnus-group-ham-exit-processor-BBDB)
- (variable-item gnus-group-ham-exit-processor-spamoracle)
- (variable-item gnus-group-ham-exit-processor-copy)
(const :tag "Spam: Bogofilter" (spam spam-use-bogofilter))
(const :tag "Spam: Blacklist" (spam spam-use-blacklist))
(const :tag "Spam: Bsfilter" (spam spam-use-bsfilter))
(const :tag "Ham: Spam Oracle" (ham spam-use-spamoracle))
(const :tag "Ham: SpamAssassin" (ham spam-use-spamassassin))
(const :tag "Ham: CRM114" (ham spam-use-crm114))
- (const :tag "Ham: Whitelist" (ham spam-use-whitelist)))))
+ (const :tag "Ham: Whitelist" (ham spam-use-whitelist))
+ (variable-item gnus-group-spam-exit-processor-ifile)
+ (variable-item gnus-group-spam-exit-processor-stat)
+ (variable-item gnus-group-spam-exit-processor-bogofilter)
+ (variable-item gnus-group-spam-exit-processor-blacklist)
+ (variable-item gnus-group-spam-exit-processor-spamoracle)
+ (variable-item gnus-group-spam-exit-processor-report-gmane)
+ (variable-item gnus-group-ham-exit-processor-bogofilter)
+ (variable-item gnus-group-ham-exit-processor-ifile)
+ (variable-item gnus-group-ham-exit-processor-stat)
+ (variable-item gnus-group-ham-exit-processor-whitelist)
+ (variable-item gnus-group-ham-exit-processor-BBDB)
+ (variable-item gnus-group-ham-exit-processor-spamoracle)
+ (variable-item gnus-group-ham-exit-processor-copy))))
:parameter-document
"Which spam or ham processors will be applied when the summary is exited.")
: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."
+(defcustom spam-report-resend-to nil
+ "Email address that spam articles are resent to when reporting.
+If not set, the user will be prompted to enter a value which will be
+saved for future use."
:type 'string
:group 'spam-report)
(gnus-message 6
"Reporting spam article %d to <%s>..."
article spam-report-resend-to)
+ (unless spam-report-resend-to
+ (customize-set-variable
+ spam-report-resend-to
+ (read-from-minibuffer "email address to resend SPAM 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.
(gnus-message 3 "Could not find X-Report-Spam in article %d..."
article)))))))
+
(defun spam-report-url-ping (host report)
"Ping a host through HTTP, addressing a specific GET resource using
the function specified by `spam-report-url-ping-function'."
nil))
(defvar spam-list-of-processors
- ;; note the CRM114, 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)
+ ;; note the nil processors are not defined in gnus.el
+ '((nil spam spam-use-gmane)
+ (nil 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)
(gnus-group-spam-exit-processor-ifile spam spam-use-ifile)
(gnus-group-spam-exit-processor-stat spam spam-use-stat)
(gnus-group-spam-exit-processor-spamoracle spam spam-use-spamoracle)
- (gnus-group-spam-exit-processor-crm114 spam spam-use-crm114)
+ (nil spam spam-use-crm114)
(gnus-group-spam-exit-processor-spamassassin spam spam-use-spamassassin)
(gnus-group-ham-exit-processor-ifile ham spam-use-ifile)
(gnus-group-ham-exit-processor-bogofilter ham spam-use-bogofilter)
(gnus-group-ham-exit-processor-copy ham spam-use-ham-copy)
(gnus-group-ham-exit-processor-spamassassin ham spam-use-spamassassin)
(gnus-group-ham-exit-processor-spamoracle ham spam-use-spamoracle)
- (gnus-group-ham-exit-processor-crm114 ham spam-use-crm114))
+ (nil ham spam-use-crm114))
"The `spam-list-of-processors' list.
-This list contains pairs associating a ham/spam exit processor
-variable with a classification and a spam-use-* variable.")
-
-(defun spam-group-processor-p (group processor)
+This list contains pairs associating the obsolete ham/spam exit
+processor variables with a classification and a spam-use-*
+variable. When the processor variable is nil, just the
+classification and spam-use-* check variable are used.")
+
+(defun spam-group-processor-p (group check &optional classification)
+ "Checks if GROUP has a CHECK with CLASSIFICATION registered.
+Also accepts the obsolete processors, which can be found in
+gnus.el and in spam-list-of-processors."
(if (and (stringp group)
- (symbolp processor))
- (or (member processor (nth 0 (gnus-parameter-spam-process group)))
- (spam-group-processor-multiple-p
- group
- (cdr-safe (assoc processor spam-list-of-processors))))
+ (symbolp check))
+ (let ((old-style (assq check spam-list-of-processors))
+ (parameters (nth 0 (gnus-parameter-spam-process group)))
+ found)
+ (if old-style ; old-style processor
+ (spam-group-processor-p group (nth 2 old-style) (nth 1 old-style))
+ ;; now search for the parameter
+ (dolist (parameter parameters)
+ (when (and (null found)
+ (listp parameter)
+ (eq classification (nth 0 parameter))
+ (eq check (nth 1 parameter)))
+ (setq found t)))
+ found))
nil))
-(defun spam-group-processor-multiple-p (group processor-info)
- (let* ((classification (nth 0 processor-info))
- (check (nth 1 processor-info))
- (parameters (nth 0 (gnus-parameter-spam-process group)))
- found)
- (dolist (parameter parameters)
- (when (and (null found)
- (listp parameter)
- (eq classification (nth 0 parameter))
- (eq check (nth 1 parameter)))
- (setq found t)))
- found))
-
-(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))
-
-(defun spam-group-spam-processor-blacklist-p (group)
- (spam-group-processor-p group 'gnus-group-spam-exit-processor-blacklist))
-
-(defun spam-group-spam-processor-ifile-p (group)
- (spam-group-processor-p group 'gnus-group-spam-exit-processor-ifile))
-
-(defun spam-group-ham-processor-ifile-p (group)
- (spam-group-processor-p group 'gnus-group-ham-exit-processor-ifile))
-
-(defun spam-group-spam-processor-spamoracle-p (group)
- (spam-group-processor-p group 'gnus-group-spam-exit-processor-spamoracle))
-
-(defun spam-group-spam-processor-crm114-p (group)
- (spam-group-processor-p group 'gnus-group-spam-exit-processor-crm114))
-
-(defun spam-group-ham-processor-bogofilter-p (group)
- (spam-group-processor-p group 'gnus-group-ham-exit-processor-bogofilter))
-
-(defun spam-group-spam-processor-stat-p (group)
- (spam-group-processor-p group 'gnus-group-spam-exit-processor-stat))
-
-(defun spam-group-ham-processor-stat-p (group)
- (spam-group-processor-p group 'gnus-group-ham-exit-processor-stat))
-
-(defun spam-group-ham-processor-whitelist-p (group)
- (spam-group-processor-p group 'gnus-group-ham-exit-processor-whitelist))
-
-(defun spam-group-ham-processor-BBDB-p (group)
- (spam-group-processor-p group 'gnus-group-ham-exit-processor-BBDB))
-
-(defun spam-group-ham-processor-copy-p (group)
- (spam-group-processor-p group 'gnus-group-ham-exit-processor-copy))
-
-(defun spam-group-ham-processor-spamoracle-p (group)
- (spam-group-processor-p group 'gnus-group-ham-exit-processor-spamoracle))
-
-(defun spam-group-ham-processor-crm114-p (group)
- (spam-group-processor-p group 'gnus-group-ham-exit-processor-crm114))
-
(defun spam-report-articles-gmane (n)
"Report the current message as spam via Gmane.
Respects the process/prefix convention."
Respects the process/prefix convention. Also see
`spam-report-resend-to'."
(interactive "P")
- (let ((articles (gnus-summary-work-articles n)))
+ (let ((spam-report-resend-to
+ (gnus-parameter-spam-resend-to gnus-newsgroup-name))
+ (articles (gnus-summary-work-articles n)))
(spam-report-resend articles)
(dolist (article articles)
(gnus-summary-remove-process-mark article))))
(classification (nth 1 processor-param))
(check (nth 2 processor-param)))
(when (and (eq 'spam classification)
- (spam-group-processor-p gnus-newsgroup-name processor))
+ (spam-group-processor-p gnus-newsgroup-name check classification))
(spam-register-routine classification check))))
(unless (and spam-move-spam-nonspam-groups-only
(classification (nth 1 processor-param))
(check (nth 2 processor-param)))
(when (and (eq 'ham classification)
- (spam-group-processor-p gnus-newsgroup-name processor))
+ (spam-group-processor-p gnus-newsgroup-name check classification))
(spam-register-routine classification check)))))
- (when (spam-group-ham-processor-copy-p gnus-newsgroup-name)
+ (when (spam-group-processor-p gnus-newsgroup-name 'ham 'spam-use-ham-copy)
(let ((num
(spam-ham-copy-routine
(gnus-parameter-ham-process-destination gnus-newsgroup-name))))
(apply 'spam-report-gmane articles)))
(defun spam-report-resend-register-routine (articles)
- (spam-report-resend articles))
+ (let ((spam-report-resend-to (gnus-parameter-spam-resend-to gnus-newsgroup-name)))
+ (spam-report-resend articles)))
\f
;;;; Bogofilter