Synch to Oort Gnus.
[elisp/gnus.git-] / lisp / nntp.el
index 0c735f5..6fabd71 100644 (file)
@@ -284,9 +284,15 @@ noticing asynchronous data.")
 (defvar nntp-async-timer nil)
 (defvar nntp-async-process-list nil)
 
+(defvar nntp-ssl-program 
+  "openssl s_client -quiet -ssl3 -connect %s:%p"
+"A string containing commands for SSL connections.
+Within a string, %s is replaced with the server address and %p with
+port number on server.  The program should accept IMAP commands on
+stdin and return responses to stdout.")
+
 (eval-and-compile
-  (autoload 'mail-source-read-passwd "mail-source")
-  (autoload 'open-ssl-stream "ssl"))
+  (autoload 'mail-source-read-passwd "mail-source"))
 
 \f
 
@@ -1213,7 +1219,16 @@ password contained in '~/.nntp-authinfo'."
    "nntpd" buffer nntp-address nntp-port-number))
 
 (defun nntp-open-ssl-stream (buffer)
-  (let ((proc (open-ssl-stream "nntpd" buffer nntp-address nntp-port-number)))
+  (let* ((process-connection-type nil)
+        (proc (as-binary-process
+               (start-process "nntpd" buffer
+                              shell-file-name
+                              shell-command-switch
+                              (format-spec nntp-ssl-program
+                                           (format-spec-make
+                                            ?s nntp-address
+                                            ?p nntp-port-number))))))
+    (process-kill-without-query proc)
     (save-excursion
       (set-buffer buffer)
       (nntp-wait-for-string "^\r*20[01]")
@@ -1345,7 +1360,7 @@ password contained in '~/.nntp-authinfo'."
   (save-excursion
     (set-buffer (or (nntp-find-connection-buffer nntp-server-buffer)
                    nntp-server-buffer))
-    (let ((len (/ (point-max) 1024))
+    (let ((len (/ (buffer-size) 1024))
          message-log-max)
       (unless (< len 10)
        (setq nntp-have-messaged t)
@@ -1793,7 +1808,8 @@ Please refer to the following variables to customize the connection:
        proc)
     (and nntp-pre-command
         (push nntp-pre-command command))
-    (setq proc (apply 'start-process "nntpd" buffer command))
+    (setq proc (as-binary-process
+               (apply 'start-process "nntpd" buffer command)))
     (save-excursion
       (set-buffer buffer)
       (nntp-wait-for-string "^\r*20[01]")
@@ -1866,7 +1882,8 @@ Please refer to the following variables to customize the connection:
          (case-fold-search t)
          proc)
       (and nntp-pre-command (push nntp-pre-command command))
-      (setq proc (apply 'start-process "nntpd" buffer command))
+      (setq proc (as-binary-process
+                 (apply 'start-process "nntpd" buffer command)))
       (when (memq (process-status proc) '(open run))
        (nntp-wait-for-string "^r?telnet")
        (process-send-string proc "set escape \^X\n")