:type 'boolean
:group 'spam)
+(defcustom spam-process-ham-in-nonham-groups nil
+ "Whether ham should be processed in non-ham groups."
+ :type 'boolean
+ :group 'spam)
+
+(defcustom spam-process-ham-in-spam-groups nil
+ "Whether ham should be processed in spam groups."
+ :type 'boolean
+ :group 'spam)
+
(defcustom spam-mark-only-unseen-as-spam t
"Whether only unseen articles should be marked as spam in spam
groups. When nil, all unread articles in a spam group are marked as
:type 'string
:group 'spam)
+;;; TODO: deprecate this variable, it's confusing since it's a list of strings, not regular expressions
(defcustom spam-junk-mailgroups (cons spam-split-group '("mail.junk" "poste.pourriel"))
"Mailgroups with spam contents.
All unmarked article in such group receive the spam mark on group entry."
(gnus-message 5 "Marking spam as expired without moving it")
(spam-mark-spam-as-expired-and-move-routine nil)
- (when (spam-group-ham-contents-p gnus-newsgroup-name)
+ (when (or (spam-group-ham-contents-p gnus-newsgroup-name)
+ (and (spam-group-spam-contents-p gnus-newsgroup-name)
+ spam-process-ham-in-spam-groups)
+ spam-process-ham-in-nonham-groups)
(when (spam-group-ham-processor-whitelist-p gnus-newsgroup-name)
(gnus-message 5 "Registering ham with the whitelist")
(spam-whitelist-register-routine))
(save-excursion
(set-buffer
(find-file-noselect file))
- (unless (search-forward (regexp-quote address))
+ (goto-char (point-min))
+ (unless (re-search-forward (regexp-quote address) nil t)
(goto-char (point-max))
(unless (bobp)
(insert "\n"))
(while (not (eobp))
(setq address (buffer-substring (point) (spam-point-at-eol)))
(forward-line 1)
+ ;; insert the e-mail address if detected, otherwise the raw data
(unless (zerop (length address))
- (setq address (regexp-quote address))
- (while (string-match "\\\\\\*" address)
- (setq address (replace-match ".*" t t address)))
- (push address contents))))
+ (let ((pure-address (cadr (gnus-extract-address-components address))))
+ (push (or pure-address address) contents)))))
(nreverse contents))))
(defun spam-from-listed-p (cache)
(let ((from (message-fetch-field "from"))
found)
(while cache
- (when (string-match (pop cache) from)
- (setq found t
- cache nil)))
+ (let ((address (pop cache)))
+ (unless (zerop (length address)) ; 0 for a nil address too
+ (setq address (regexp-quote address))
+ ;; fix regexp-quote's treatment of user-intended regexes
+ (while (string-match "\\\\\\*" address)
+ (setq address (replace-match ".*" t t address))))
+ (when (and address (string-match address from))
+ (setq found t
+ cache nil))))
found))
(defun spam-blacklist-register-routine ()
(let ((score (or (spam-check-bogofilter-headers t)
(spam-check-bogofilter t))))
(message "Spamicity score %s" score)
- (or score "0"))))
+ (or score "0"))
+ (gnus-summary-show-article)))
(defun spam-check-bogofilter (&optional score)
"Check the Bogofilter backend for the classification of this message"