Spelling fixes.
[bpt/emacs.git] / lisp / gnus / nntp.el
index 727d9b4..f4b8ce6 100644 (file)
@@ -261,6 +261,8 @@ See `nnml-marks-is-evil' for more information.")
                                          (const :format "" "password")
                                          (string :format "Password: %v")))))))
 
+(make-obsolete 'nntp-authinfo-file nil "Emacs 24.1")
+
 \f
 
 (defvoo nntp-connection-timeout nil
@@ -338,10 +340,8 @@ backend doesn't catch this error.")
   "Record the command STRING."
   (with-current-buffer (get-buffer-create "*nntp-log*")
     (goto-char (point-max))
-    (let ((time (current-time)))
-      (insert (format-time-string "%Y%m%dT%H%M%S" time)
-             "." (format "%03d" (/ (nth 2 time) 1000))
-             " " nntp-address " " string "\n"))))
+    (insert (format-time-string "%Y%m%dT%H%M%S.%3N")
+           " " nntp-address " " string "\n")))
 
 (defun nntp-report (&rest args)
   "Report an error from the nntp backend.  The first string in ARGS
@@ -432,6 +432,9 @@ be restored and the command retried."
 
 (defun nntp-kill-buffer (buffer)
   (when (buffer-name buffer)
+    (let ((process (get-buffer-process buffer)))
+      (when process
+       (delete-process process)))
     (kill-buffer buffer)
     (nnheader-init-server-buffer)))
 
@@ -662,7 +665,7 @@ command whose response triggered the error."
                                                   (process-buffer -process))))
                               ;; When I an able to identify the
                               ;; connection to the server AND I've
-                              ;; received NO reponse for
+                              ;; received NO response for
                               ;; nntp-connection-timeout seconds.
                               (when (and -buffer (eq 0 (buffer-size -buffer)))
                                 ;; Close the connection.  Take no
@@ -1227,17 +1230,20 @@ If SEND-IF-FORCE, only send authinfo to the server if the
   (require 'netrc)
   (let* ((list (netrc-parse nntp-authinfo-file))
         (alist (netrc-machine list nntp-address "nntp"))
-        (force (or (netrc-get alist "force") nntp-authinfo-force))
          (auth-info
           (nth 0 (auth-source-search :max 1
                                      ;; TODO: allow the virtual server name too
                                      :host nntp-address
                                      :port '("119" "nntp"))))
          (auth-user (plist-get auth-info :user))
+         (auth-force (plist-get auth-info :force))
          (auth-passwd (plist-get auth-info :secret))
          (auth-passwd (if (functionp auth-passwd)
                           (funcall auth-passwd)
                         auth-passwd))
+        (force (or (netrc-get alist "force")
+                    nntp-authinfo-force
+                    auth-force))
         (user (or
                ;; this is preferred to netrc-*
                auth-user
@@ -1362,6 +1368,12 @@ password contained in '~/.nntp-authinfo'."
       (nntp-kill-buffer pbuffer))
     (when (and (buffer-name pbuffer)
               process)
+      (when (and (fboundp 'set-network-process-option) ;; Unavailable in XEmacs.
+                (fboundp 'process-type) ;; Emacs 22 doesn't provide it.
+                 (eq (process-type process) 'network))
+        ;; Use TCP-keepalive so that connections that pass through a NAT router
+        ;; don't hang when left idle.
+        (set-network-process-option process :keepalive t))
       (gnus-set-process-query-on-exit-flag process nil)
       (if (and (nntp-wait-for process "^2.*\n" buffer nil t)
               (memq (process-status process) '(open run)))
@@ -1669,7 +1681,7 @@ password contained in '~/.nntp-authinfo'."
         ;; for the first available article.  Obviously, a client can
         ;; use that entry to avoid making unnecessary requests.  The
         ;; only problem is for a client that assumes that the response
-        ;; will always be within the requested ranage.  For such a
+        ;; will always be within the requested range.  For such a
         ;; client, we can get N copies of the same entry (one for each
         ;; XOVER command sent to the server).