* tls.el (tls-process-connection-type): Doc fix.
authorSimon Josefsson <jas@extundo.com>
Sat, 20 Sep 2003 16:20:05 +0000 (16:20 +0000)
committerSimon Josefsson <jas@extundo.com>
Sat, 20 Sep 2003 16:20:05 +0000 (16:20 +0000)
* imap.el (imap-starttls-open): Rewrite, should support both old
starttls.el and new starttls.el that uses GNUTLS.

lisp/ChangeLog
lisp/imap.el
lisp/tls.el

index 1215807..6281e38 100644 (file)
@@ -1,8 +1,9 @@
 2003-09-20  Simon Josefsson  <jas@extundo.com>
 
-       * imap.el (imap-starttls-open): Erase buffer and disable process
-       filter before invoking STARTTLS negotiation, to support new
-       starttls.el that uses GNUTLS.
+       * tls.el (tls-process-connection-type): Doc fix.
+
+       * imap.el (imap-starttls-open): Rewrite, should support both old
+       starttls.el and new starttls.el that uses GNUTLS.
 
 2003-09-18  Katsumi Yamaoka  <yamaoka@jpl.org>
 
index b84ec0d..c8e5ede 100644 (file)
@@ -757,33 +757,30 @@ sure of changing the value of `foo'."
     (when process
       (while (and (memq (process-status process) '(open run))
                  (set-buffer buffer) ;; XXX "blue moon" nntp.el bug
-                 (goto-char (point-min))
+                 (goto-char (point-max))
+                 (forward-line -1)
                  (not (imap-parse-greeting)))
        (accept-process-output process 1)
        (sit-for 1))
+      (setq imap-client-eol "\n")
+      (imap-send-command "STARTTLS")
+      (while (and (memq (process-status process) '(open run))
+                 (set-buffer buffer) ;; XXX "blue moon" nntp.el bug
+                 (goto-char (point-max))
+                 (forward-line -1)
+                 (not (re-search-forward "[0-9]+ OK.*\r?\n" nil t)))
+       (accept-process-output process 1)
+       (sit-for 1))
       (and imap-log
           (with-current-buffer (get-buffer-create imap-log-buffer)
             (buffer-disable-undo)
             (goto-char (point-max))
             (insert-buffer-substring buffer)))
-      (let ((imap-process process))
-       (unwind-protect
-           (progn
-             (set-process-filter imap-process 'imap-arrival-filter)
-             (erase-buffer)
-             (when (and (eq imap-stream 'starttls)
-                        (imap-ok-p (imap-send-command-wait "STARTTLS")))
-               (set-process-filter imap-process nil)
-               (starttls-negotiate imap-process)))
-         (set-process-filter imap-process nil)))
+      (message "imap: STARTTLS info: %s" (starttls-negotiate process))
       (when (memq (process-status process) '(open run))
        (setq done process)))
-    (if done
-       (progn
-         (message "imap: Connecting with STARTTLS...done")
-         done)
-      (message "imap: Connecting with STARTTLS...failed")
-      nil)))
+    (message "imap: Connecting with STARTTLS...%s" (if done "done" "failed"))
+    done))
 
 ;; Server functions; authenticator stuff:
 
index 7027077..af05ff2 100644 (file)
@@ -66,7 +66,7 @@ after successful negotiation."
   :group 'tls)
 
 (defcustom tls-process-connection-type nil
-  "*Value for `process-connection-type' to use when starting process."
+  "*Value for `process-connection-type' to use when starting TLS process."
   :type 'boolean
   :group 'tls)