Function: gnus-cloud-download-data

gnus-cloud-download-data is a byte-compiled function defined in gnus-cloud.el.gz.

Signature

(gnus-cloud-download-data &optional UPDATE SEQUENCE-OVERRIDE)

Documentation

Download the Gnus Cloud data and install it if UPDATE is t.

When SEQUENCE-OVERRIDE is given, start at that sequence number instead of gnus-cloud-sequence.

When UPDATE is t, returns the result of calling gnus-cloud-update-all. Otherwise, returns the Gnus Cloud data chunks.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-cloud.el.gz
(defun gnus-cloud-download-data (&optional update sequence-override)
  "Download the Gnus Cloud data and install it if UPDATE is t.
When SEQUENCE-OVERRIDE is given, start at that sequence number
instead of `gnus-cloud-sequence'.

When UPDATE is t, returns the result of calling `gnus-cloud-update-all'.
Otherwise, returns the Gnus Cloud data chunks."
  (let ((articles nil)
	(highest-sequence-seen gnus-cloud-sequence)
        chunks)
    (dolist (header (gnus-cloud-available-chunks))
      (let ((this-sequence (gnus-cloud-chunk-sequence (mail-header-subject header))))
	(when (> this-sequence (or sequence-override gnus-cloud-sequence -1))

	  (if (string-match (format "storage-method: %s" gnus-cloud-storage-method)
			    (mail-header-subject header))
	      (progn
		(push (mail-header-number header) articles)
		(setq highest-sequence-seen (max highest-sequence-seen this-sequence)))
	    (gnus-message 1 "Skipping article %s because it didn't match the Gnus Cloud method %s: %s"
			  (mail-header-number header)
			  gnus-cloud-storage-method
			  (mail-header-subject header))))))
    (when articles
      (nnimap-request-articles (nreverse articles) gnus-cloud-group-name)
      (with-current-buffer nntp-server-buffer
        (goto-char (point-min))
        (while (re-search-forward "^Gnus-Cloud-Version " nil t)
          (beginning-of-line)
          (push (gnus-cloud-parse-chunk) chunks)
          (forward-line 1))))
    (if update
        (prog1 (mapcar #'gnus-cloud-update-all chunks)
	  (setq gnus-cloud-sequence highest-sequence-seen))
      chunks)))