Function: spam-filelist-register-routine

spam-filelist-register-routine is a byte-compiled function defined in spam.el.gz.

Signature

(spam-filelist-register-routine ARTICLES BLACKLIST &optional UNREGISTER)

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/spam.el.gz
(defun spam-filelist-register-routine (articles blacklist &optional unregister)
  (let ((de-symbol (if blacklist 'spam-use-whitelist 'spam-use-blacklist))
        (declassification (if blacklist 'ham 'spam))
        (enter-function
         (if blacklist 'spam-enter-blacklist 'spam-enter-whitelist))
        (remove-function
         (if blacklist 'spam-enter-whitelist 'spam-enter-blacklist))
        addresses unregister-list article-unregister-list) ;; from
    (dolist (article articles)
      (let ((from (spam-fetch-field-from-fast article))
            (id (spam-fetch-field-message-id-fast article))
            sender-ignored)
        (when (stringp from)
          (dolist (ignore-regex spam-blacklist-ignored-regexes)
            (when (and (not sender-ignored)
                       (stringp ignore-regex)
                       (string-match ignore-regex from))
              (setq sender-ignored t)))
          ;; remember the messages we need to unregister, unless remove is set
          (when (and
                 (null unregister)
                 (spam-log-unregistration-needed-p
                  id 'process declassification de-symbol))
            (push article article-unregister-list)
            (push from unregister-list))
          (unless sender-ignored
            (push from addresses)))))

    (if unregister
        (funcall enter-function addresses t) ; unregister all these addresses
      ;; else, register normally and unregister what we need to
      (funcall remove-function unregister-list t)
      (dolist (article article-unregister-list)
        (spam-log-undo-registration
         (spam-fetch-field-message-id-fast article)
         'process
         declassification
         de-symbol))
      (funcall enter-function addresses nil))))