Function: nnimap-retrieve-group-data-early

nnimap-retrieve-group-data-early is a byte-compiled function defined in nnimap.el.gz.

Signature

(nnimap-retrieve-group-data-early SERVER INFOS)

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nnimap.el.gz
(deffoo nnimap-retrieve-group-data-early (server infos)
  (when (and (nnimap-change-group nil server)
	     infos)
    (with-current-buffer (nnimap-buffer)
      (erase-buffer)
      (setf (nnimap-group nnimap-object) nil)
      (setf (nnimap-initial-resync nnimap-object) 0)
      (let ((qresyncp (nnimap-capability "QRESYNC"))
	    params sequences active uidvalidity modseq group
	    unexist)
	;; Go through the infos and gather the data needed to know
	;; what and how to request the data.
	(dolist (info infos)
	  (setq params (gnus-info-params info)
		group (gnus-group-real-name (gnus-info-group info))
		active (cdr (assq 'active params))
		unexist (assq 'unexist (gnus-info-marks info))
		uidvalidity (cdr (assq 'uidvalidity params))
		modseq (cdr (assq 'modseq params)))
	  (setf (nnimap-examined nnimap-object) group)
	  (if (and qresyncp
		   uidvalidity
		   active
		   modseq
		   unexist)
	      (push
	       (list (nnimap-send-command "EXAMINE %S (%s (%s %s))"
					  (nnimap-group-to-imap group)
					  (nnimap-quirk "QRESYNC")
					  uidvalidity modseq)
		     'qresync
		     nil group 'qresync)
	       sequences)
	    (let ((command
		   (if uidvalidity
		       "EXAMINE"
		     ;; If we don't have a UIDVALIDITY, then this is
		     ;; the first time we've seen the group, so we
		     ;; have to do a SELECT (which is slower than an
		     ;; examine), but will tell us whether the group
		     ;; is read-only or not.
		     "SELECT"))
		  start)
	      (if (and active uidvalidity unexist)
		  ;; Fetch the last 100 flags.
		  (setq start (max 1 (- (cdr active) 100)))
                (incf (nnimap-initial-resync nnimap-object))
		(setq start 1))
	      (push (list (nnimap-send-command "%s %S" command
					       (nnimap-group-to-imap group))
			  (nnimap-send-command "UID FETCH %d:* FLAGS" start)
			  start group command)
		    sequences))))
	sequences))))