+2003-06-23 Teodor Zlatanov <tzz@lifelogs.com>
+
+ * spam.el (spam-from-listed-p, spam-parse-list): use
+ ietf-drums-parse-addresses to extract the address portion of the
+ whitelist/blacklist file if it looks like an address can be found
+
2003-06-23 Didier Verna <didier@xemacs.org>
* gnus-ems.el (gnus-put-image): New argument CATEGORY. Add it as a
;; executable-find is not autoloaded in Emacs 20
(autoload 'executable-find "executable"))
+;; autoload ietf-drums-parse-addresses
+(eval-and-compile
+ (autoload 'ietf-drums-parse-addresses "ietf-drums"))
+
;; autoload query-dig
(eval-and-compile
(autoload 'query-dig "dig"))
(while (not (eobp))
(setq address (buffer-substring (point) (spam-point-at-eol)))
(forward-line 1)
- (unless (zerop (length address))
- (setq address (regexp-quote address))
- (while (string-match "\\\\\\*" address)
- (setq address (replace-match ".*" t t address)))
- (push address contents))))
+ ;; insert the e-mail address if detected, otherwise the raw data
+ (let ((pure-address (car (ietf-drums-parse-addresses 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 ()