Function: gnus-registry-handle-action

gnus-registry-handle-action is an autoloaded and byte-compiled function defined in gnus-registry.el.gz.

Signature

(gnus-registry-handle-action ID FROM TO SUBJECT SENDER &optional RECIPIENTS)

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-registry.el.gz
(defun gnus-registry-handle-action (id from to subject sender
                                       &optional recipients)
  (gnus-message
   10
   "gnus-registry-handle-action %S" (list id from to subject sender recipients))
  (let ((db gnus-registry-db)
        ;; if the group is ignored, set the destination to nil (same as delete)
        (to (if (gnus-registry-ignore-group-p to) nil to))
        ;; Only retrieve an existing entry, don't create a new one.
        (entry (gnus-registry-get-or-make-entry id t))
        (subject (gnus-string-remove-all-properties
                  (gnus-registry-simplify-subject subject)))
        (sender (gnus-string-remove-all-properties sender)))

    ;; this could be done by calling `gnus-registry-set-id-key'
    ;; several times but it's better to bunch the transactions
    ;; together

    (when entry
      (registry-delete db (list id) nil)
      (when from
	(setq entry (cons (delete from (assoc 'group entry))
                          (assq-delete-all 'group entry))))
      ;; Only keep the entry if the message is going to a new group, or
      ;; it's still in some previous group.
      (when (or to (alist-get 'group entry))
	(dolist (kv `((group ,to)
                      (sender ,sender)
                      (recipient ,@recipients)
                      (subject ,subject)))
	  (when (cadr kv)
            (let ((new (or (assq (car kv) entry)
			   (list (car kv)))))
              (dolist (toadd (cdr kv))
		(unless (member toadd new)
		  (setq new (append new (list toadd)))))
              (setq entry (cons new
				(assq-delete-all (car kv) entry))))))
	(gnus-message 10 "Gnus registry: new entry for %s is %S"
                      id
                      entry)
	(gnus-registry-insert db id entry)))))