Function: nntp-send-command

nntp-send-command is a byte-compiled function defined in nntp.el.gz.

Signature

(nntp-send-command WAIT-FOR &rest STRINGS)

Documentation

Send STRINGS to server and wait until WAIT-FOR returns.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nntp.el.gz
(defun nntp-send-command (wait-for &rest strings)
  "Send STRINGS to server and wait until WAIT-FOR returns."
  (when (not (or nnheader-callback-function
                 nntp-inhibit-output))
    (nntp-erase-buffer nntp-server-buffer))
  (let* ((command (mapconcat #'identity strings " "))
	 (process (nntp-find-connection nntp-server-buffer))
	 (buffer (and process (process-buffer process)))
	 (pos (and buffer (with-current-buffer buffer (point)))))
    (if process
	(prog1
	    (nntp-retrieve-data command
				nntp-address nntp-port-number
				nntp-server-buffer
				wait-for nnheader-callback-function)
	  ;; If nothing to wait for, still remove possibly echo'ed commands.
	  ;; We don't have echoes if `nntp-never-echoes-commands' is non-nil
	  ;; or the value of `nntp-open-connection-function' is in
	  ;; `nntp-open-connection-functions-never-echo-commands', so we
	  ;; skip this in that cases.
	  (unless (or wait-for
		      nntp-never-echoes-commands
		      (memq
		       nntp-open-connection-function
		       nntp-open-connection-functions-never-echo-commands))
	    (nntp-accept-response)
	    (with-current-buffer buffer
	      (goto-char pos)
	      (if (looking-at (regexp-quote command))
		  (delete-region pos (progn (forward-line 1)
					    (point-at-bol)))))))
      (nnheader-report 'nntp "Couldn't open connection to %s."
		       nntp-address))))