Function: spam-resolve-registrations-routine

spam-resolve-registrations-routine is a byte-compiled function defined in spam.el.gz.

Signature

(spam-resolve-registrations-routine)

Documentation

Go through the backends and register or unregister articles as needed.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/spam.el.gz
;;}}}

;;{{{ registration/unregistration functions

(defun spam-resolve-registrations-routine ()
  "Go through the backends and register or unregister articles as needed."
  (dolist (backend-type '(non-mover mover))
    (dolist (classification (spam-classifications))
      (dolist (backend (spam-backend-list backend-type))
        (let ((rlist (spam-backend-get-article-todo-list
                      backend classification))
              (ulist (spam-backend-get-article-todo-list
                      backend classification t))
              (delcount 0))

          ;; clear the old lists right away
          (spam-backend-put-article-todo-list backend
                                              classification
                                              nil
                                              nil)
          (spam-backend-put-article-todo-list backend
                                              classification
                                              nil
                                              t)

          ;; eliminate duplicates
          (dolist (article (copy-sequence ulist))
            (when (memq article rlist)
              (cl-incf delcount)
              (setq rlist (delq article rlist))
              (setq ulist (delq article ulist))))

          (unless (zerop delcount)
            (gnus-message
             9
             "%d messages did not have to unregister and then register"
             delcount))

          ;; unregister articles
          (unless (zerop (length ulist))
            (let ((num (spam-unregister-routine classification backend ulist)))
              (when (> num 0)
                (gnus-message
                 6
                 "%d %s messages were unregistered by backend %s."
                 num
                 classification
                 backend))))

            ;; register articles
            (unless (zerop (length rlist))
              (let ((num (spam-register-routine classification backend rlist)))
                (when (> num 0)
                  (gnus-message
                   6
                   "%d %s messages were registered by backend %s."
                   num
                   classification
                   backend)))))))))