X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fspam.el;h=17f487f2af00ab44e03b92f85cb3891e3e23557c;hb=9b741e050b400987d68ff761c6cc3276c932839c;hp=e2e4d932633c8e856044099cedd29e5416ff6f2a;hpb=659948d3378210d332f1dd2826cbf51c66541caa;p=elisp%2Fgnus.git- diff --git a/lisp/spam.el b/lisp/spam.el index e2e4d93..17f487f 100644 --- a/lisp/spam.el +++ b/lisp/spam.el @@ -61,16 +61,21 @@ "When spam files are kept.") (defvar spam-whitelist (expand-file-name "whitelist" spam-directory) - "The location of the whitelist.") - + "The location of the whitelist. +The file format is one regular expression per line. +The regular expression is matched against the address.") + (defvar spam-blacklist (expand-file-name "blacklist" spam-directory) - "The location of the whitelist.") + "The location of the blacklist. +The file format is one regular expression per line. +The regular expression is matched against the address.") (defvar spam-whitelist-cache nil) (defvar spam-blacklist-cache nil) (defun spam-enter-whitelist (address &optional blacklist) - "Enter ADDRESS into the whitelist." + "Enter ADDRESS into the whitelist. +Optional arg BLACKLIST, if non-nil, means to enter in the blacklist instead." (interactive "sAddress: ") (let ((file (if blacklist spam-blacklist spam-whitelist))) (unless (file-exists-p (file-name-directory file)) @@ -84,6 +89,16 @@ (insert address "\n") (save-buffer)))) +(defun spam-enter-blacklist (address) + "Enter ADDRESS into the blacklist." + (interactive "sAddress: ") + (spam-enter-whitelist address t)) + +(eval-and-compile + (defalias 'spam-point-at-eol (if (fboundp 'point-at-eol) + 'point-at-eol + 'line-end-position))) + (defun spam-parse-whitelist (&optional blacklist) (let ((file (if blacklist spam-blacklist spam-whitelist)) contents address) @@ -91,7 +106,7 @@ (with-temp-buffer (insert-file-contents file) (while (not (eobp)) - (setq address (buffer-substring (point) (point-at-eol))) + (setq address (buffer-substring (point) (spam-point-at-eol))) (forward-line 1) (unless (zerop (length address)) (setq address (regexp-quote address))