Function: nnimap-wait-for-response

nnimap-wait-for-response is a byte-compiled function defined in nnimap.el.gz.

Signature

(nnimap-wait-for-response SEQUENCE &optional MESSAGEP)

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nnimap.el.gz
(defun nnimap-wait-for-response (sequence &optional messagep)
  (let ((process (get-buffer-process (current-buffer)))
	openp)
    (condition-case nil
        (progn
	  (goto-char (point-max))
	  (while (and (setq openp (memq (process-status process)
					'(open run)))
		      (progn
			;; Skip past any "*" lines that the server has
			;; output.
			(while (and (not (bobp))
				    (progn
				      (forward-line -1)
				      (looking-at "\\*\\|[0-9]+ OK NOOP"))))
			(not (looking-at (format "%d .*\n" sequence)))))
	    (when messagep
	      (nnheader-message-maybe
	       7 "nnimap read %dk from %s%s" (/ (buffer-size) 1000)
	       nnimap-address
	       (if (not (zerop (nnimap-initial-resync nnimap-object)))
		   (format " (initial sync of %d group%s; please wait)"
			   (nnimap-initial-resync nnimap-object)
			   (if (= (nnimap-initial-resync nnimap-object) 1)
			       ""
			     "s"))
		 "")))
	    (nnheader-accept-process-output process)
	    (goto-char (point-max)))
	  (setf (nnimap-initial-resync nnimap-object) 0)
          openp)
      (quit
       (when debug-on-quit
	 (debug "Quit"))
       ;; The user hit C-g while we were waiting: kill the process, in case
       ;; it's a gnutls-cli process that's stuck (tends to happen a lot behind
       ;; NAT routers).
       (delete-process process)
       nil))))