Function: nnimap-update-qresync-info

nnimap-update-qresync-info is a byte-compiled function defined in nnimap.el.gz.

Signature

(nnimap-update-qresync-info INFO EXISTING VANISHED FLAGS)

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nnimap.el.gz
(defun nnimap-update-qresync-info (info existing vanished flags)
  ;; Add all the vanished articles to the list of read articles.
  (setf (gnus-info-read info)
        (range-add-list
         (range-add-list
          (range-concat (gnus-info-read info) vanished)
	  (cdr (assq '%Flagged flags)))
	 (cdr (assq '%Seen flags))))
  (let ((marks (gnus-info-marks info)))
    (dolist (type (cdr nnimap-mark-alist))
      (let ((ticks (assoc (car type) marks))
	    (new-marks
	     (cdr (or (assoc (caddr type) flags) ; %Flagged
		      (assoc (intern (cadr type) obarray) flags)
		      (assoc (cadr type) flags))))) ; "\Flagged"
	(when new-marks
	  (setq marks (delq ticks marks))
	  (pop ticks)
	  ;; Add the new marks we got.
	  (setq ticks (range-add-list ticks new-marks))
	  ;; Remove the marks from messages that don't have them.
	  (setq ticks (range-remove
		       ticks
		       (gnus-compress-sequence
			(gnus-sorted-complement existing new-marks))))
	  (when ticks
	    (push (cons (car type) ticks) marks))
	  (gnus-info-set-marks info marks t))))
    ;; Add vanished to the list of unexisting articles.
    (when vanished
      (let* ((old-unexists (assq 'unexist marks))
	     (unexists (range-concat (cdr old-unexists) vanished)))
	(if old-unexists
	    (setcdr old-unexists unexists)
	  (push (cons 'unexist unexists) marks)))
      (gnus-info-set-marks info marks t))))