Function: rsf-check-field
rsf-check-field is a byte-compiled function defined in
rmail-spam-filter.el.gz.
Signature
(rsf-check-field FIELD-SYMBOL MESSAGE-DATA DEFINITION RESULT)
Documentation
Check if a message appears to be spam.
FIELD-SYMBOL is one of the possible keys of a rsf-definitions-alist
rule; e.g. from, to. MESSAGE-DATA is a string giving the value of
FIELD-SYMBOL in the current message. DEFINITION is the element of
rsf-definitions-alist currently being checked.
RESULT is a cons of the form (MAYBE-SPAM . IS-SPAM). If the car is nil, or if the entry for FIELD-SYMBOL in this DEFINITION is absent or the empty string, this function does nothing.
Otherwise, if MESSAGE-DATA is non-nil and the entry matches it, the cdr is set to t. Else, the car is set to nil.
Source Code
;; Defined in /usr/src/emacs/lisp/mail/rmail-spam-filter.el.gz
;; the advantage over the automatic filter definitions is the AND conjunction
;; of in-one-definition-elements
(defun rsf-check-field (field-symbol message-data definition result)
"Check if a message appears to be spam.
FIELD-SYMBOL is one of the possible keys of a `rsf-definitions-alist'
rule; e.g. from, to. MESSAGE-DATA is a string giving the value of
FIELD-SYMBOL in the current message. DEFINITION is the element of
`rsf-definitions-alist' currently being checked.
RESULT is a cons of the form (MAYBE-SPAM . IS-SPAM). If the car
is nil, or if the entry for FIELD-SYMBOL in this DEFINITION is
absent or the empty string, this function does nothing.
Otherwise, if MESSAGE-DATA is non-nil and the entry matches it,
the cdr is set to t. Else, the car is set to nil."
(let ((definition-field (cdr (assoc field-symbol definition))))
;; Only in this case can maybe-spam change from t to nil.
(if (and (car result) (> (length definition-field) 0))
;; If FIELD-SYMBOL field appears in the message, and also in
;; spam definition list, this is potentially a spam.
(if (and message-data
(string-match definition-field message-data))
;; If we do not get a contradiction from another field, this is spam
(setcdr result t)
;; The message data contradicts the specification, this is not spam.
;; Note that the total absence of a header specified in the
;; rule means this cannot be spam.
(setcar result nil)))))