Function: spam-group-processor-p

spam-group-processor-p is a byte-compiled function defined in spam.el.gz.

Signature

(spam-group-processor-p GROUP BACKEND &optional CLASSIFICATION)

Documentation

Checks if GROUP has a BACKEND with CLASSIFICATION registered.

In the case of mover backends, checks the setting of spam-summary-exit-behavior in addition to the set values for the group.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/spam.el.gz
(defun spam-group-processor-p (group backend &optional classification)
  "Checks if GROUP has a BACKEND with CLASSIFICATION registered.
In the case of mover backends, checks the setting of
`spam-summary-exit-behavior' in addition to the set values for the group."
  (if (and (stringp group)
           (symbolp backend))
      (let ((parameters (nth 0 (gnus-parameter-spam-process group)))
            found)
        ;; now search for the parameter
        (dolist (parameter parameters)
          (when (and (null found)
                     (listp parameter)
                     (eq classification (nth 0 parameter))
                     (eq backend (nth 1 parameter)))
            (setq found t)))

        ;; now, if the parameter was not found, do the
        ;; spam-summary-exit-behavior-logic for mover backends
        (unless found
          (when (spam-backend-mover-p backend)
            (setq
             found
             (cond
              ((eq spam-summary-exit-behavior 'move-all) t)
              ((eq spam-summary-exit-behavior 'move-none) nil)
              ((eq spam-summary-exit-behavior 'default)
               (or (eq classification 'spam) ;move spam out of all groups
                   ;; move ham out of spam groups
                   (and (eq classification 'ham)
                        (spam-group-spam-contents-p group))))
              (t (gnus-error 5 "Unknown spam-summary-exit-behavior: %s"
                             spam-summary-exit-behavior))))))

        found)
    nil))