Function: nntp-async-trigger

nntp-async-trigger is a byte-compiled function defined in nntp.el.gz.

Signature

(nntp-async-trigger PROCESS)

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nntp.el.gz
(defun nntp-async-trigger (process)
  (with-current-buffer (process-buffer process)
    (when nntp-process-callback
      ;; Do we have an error message?
      (goto-char nntp-process-start-point)
      (if (memq (following-char) '(?4 ?5))
          ;; Wants credentials?
          (if (looking-at-p "480")
	      (nntp-handle-authinfo process)
            ;; Report error message.
	    (nntp-snarf-error-message)
	    (nntp-do-callback nil))

        ;; Got what we expect?
	(goto-char (point-max))
	(when (re-search-backward
	       nntp-process-wait-for nntp-process-start-point t)
	  (let ((response (match-string 0)))
	    (with-current-buffer nntp-server-buffer
	      (setq nntp-process-response response)))
	  (nntp-async-stop process)
          ;; Convert it.
          (when (gnus-buffer-live-p nntp-process-to-buffer)
	    (let ((buf (current-buffer))
		  (start nntp-process-start-point)
		  (decode nntp-process-decode))
	      (with-current-buffer nntp-process-to-buffer
		(goto-char (point-max))
		(save-restriction
		  (narrow-to-region (point) (point))
		  (nnheader-insert-buffer-substring buf start)
		  (when decode
		    (nntp-decode-text))))))
          ;; Report it.
	  (goto-char (point-max))
	  (nntp-do-callback
	   (buffer-name (get-buffer nntp-process-to-buffer))))))))