Function: nnmail-cache-insert

nnmail-cache-insert is a byte-compiled function defined in nnmail.el.gz.

Signature

(nnmail-cache-insert ID GRP &optional SUBJECT SENDER)

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nnmail.el.gz
(defun nnmail-cache-insert (id grp &optional subject sender)
  (when (stringp id)
    ;; this will handle cases like `B r' where the group is nil
    (let ((grp (or grp gnus-newsgroup-name "UNKNOWN")))
      (run-hook-with-args 'nnmail-spool-hook
			  id grp subject sender))
    (when nnmail-treat-duplicates
      ;; Store some information about the group this message is written
      ;; to.  This is passed in as the grp argument -- all locations this
      ;; has been called from have been checked and the group is available.
      ;; The only ambiguous case is nnmail-check-duplication which will only
      ;; pass the first (of possibly >1) group which matches. -Josh
      (unless (gnus-buffer-live-p nnmail-cache-buffer)
	(nnmail-cache-open))
      (with-current-buffer nnmail-cache-buffer
	(goto-char (point-max))
	(if (and grp (not (string= "" grp))
		 (gnus-methods-equal-p gnus-command-method
				       (nnmail-cache-primary-mail-backend)))
	    (let ((regexp (if (consp nnmail-cache-ignore-groups)
			      (mapconcat #'identity nnmail-cache-ignore-groups
					 "\\|")
			    nnmail-cache-ignore-groups)))
	      (unless (and regexp (string-match regexp grp))
		(insert id "\t" grp "\n")))
	  (insert id "\n"))))))