* nntp.el (nntp-send-command-and-decode): Check PROCESS.
authorShengHuo ZHU <zsh@cs.rochester.edu>
Tue, 5 Feb 2002 13:11:41 +0000 (13:11 +0000)
committerShengHuo ZHU <zsh@cs.rochester.edu>
Tue, 5 Feb 2002 13:11:41 +0000 (13:11 +0000)
* nntp.el (nntp-send-command): Ditto.
* nntp.el (nntp-send-command-nodelete): Ditto.

lisp/ChangeLog
lisp/nntp.el

index 54b0fb2..883c7e8 100644 (file)
@@ -1,6 +1,10 @@
-2002-02-04  ShengHuo ZHU  <zsh@cs.rochester.edu>
+2002-02-05  ShengHuo ZHU  <zsh@cs.rochester.edu>
 
        * nntp.el (nntp-send-command-and-decode): Check PROCESS.
+       * nntp.el (nntp-send-command): Ditto.
+       * nntp.el (nntp-send-command-nodelete): Ditto.
+
+2002-02-04  ShengHuo ZHU  <zsh@cs.rochester.edu>
 
        * mm-url.el (mm-url-load-url): New function.
        (mm-url-insert-file-contents): Use it.
index 6c4b226..3e0da85 100644 (file)
@@ -389,42 +389,52 @@ noticing asynchronous data.")
       (set-buffer nntp-server-buffer)
       (erase-buffer)))
   (let* ((command (mapconcat 'identity strings " "))
-        (buffer (process-buffer (nntp-find-connection nntp-server-buffer)))
-        (pos (with-current-buffer buffer (point))))
-    (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
-      (unless wait-for
-       (nntp-accept-response)
-       (save-excursion
-         (set-buffer buffer)
-         (goto-char pos)
-         (if (looking-at (regexp-quote command))
-             (delete-region pos (progn (forward-line 1) (gnus-point-at-bol))))
-         )))
-    ))
+        (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
+         (unless wait-for
+           (nntp-accept-response)
+           (save-excursion
+             (set-buffer buffer)
+             (goto-char pos)
+             (if (looking-at (regexp-quote command))
+                 (delete-region pos (progn (forward-line 1)
+                                           (gnus-point-at-bol))))
+             )))
+      (nnheader-report 'nntp "Couldn't open connection to %s."
+                      nntp-address))))
 
 (defun nntp-send-command-nodelete (wait-for &rest strings)
   "Send STRINGS to server and wait until WAIT-FOR returns."
   (let* ((command (mapconcat 'identity strings " "))
-        (buffer (process-buffer (nntp-find-connection nntp-server-buffer)))
-        (pos (with-current-buffer buffer (point))))
-    (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
-      (unless wait-for
-       (nntp-accept-response)
-       (save-excursion
-         (set-buffer buffer)
-         (goto-char pos)
-         (if (looking-at (regexp-quote command))
-             (delete-region pos (progn (forward-line 1) (gnus-point-at-bol))))
-         )))
-    ))
+        (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
+         (unless wait-for
+           (nntp-accept-response)
+           (save-excursion
+             (set-buffer buffer)
+             (goto-char pos)
+             (if (looking-at (regexp-quote command))
+                 (delete-region pos (progn (forward-line 1)
+                                           (gnus-point-at-bol))))
+             )))
+      (nnheader-report 'nntp "Couldn't open connection to %s."
+                      nntp-address))))
 
 (defun nntp-send-command-and-decode (wait-for &rest strings)
   "Send STRINGS to server and wait until WAIT-FOR returns."