]> code.delx.au - gnu-emacs/blobdiff - lisp/net/imap.el
Merge from origin/emacs-25
[gnu-emacs] / lisp / net / imap.el
index cc89f475bba2462ecf495e0265a810073d269240..e5a14d75dee27103258188a6de00eb6e3b997c69 100644 (file)
@@ -1,6 +1,6 @@
 ;;; imap.el --- imap library
 
-;; Copyright (C) 1998-2015 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2016 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <simon@josefsson.org>
 ;; Keywords: mail
@@ -747,13 +747,19 @@ sure of changing the value of `foo'."
                    :capability-command "1 CAPABILITY\r\n"
                    :always-query-capabilities t
                    :end-of-command "\r\n"
-                   :success " OK "
+                   :success "^1 OK "
                    :starttls-function
-                   (lambda (capabilities)
-                     (when (string-match-p "STARTTLS" capabilities)
-                       "1 STARTTLS\r\n"))))
-         (done (and process
-                    (memq (process-status process) '(open run)))))
+                   #'(lambda (capabilities)
+                       (when (string-match-p "STARTTLS" capabilities)
+                         "1 STARTTLS\r\n"))))
+         done)
+    (when process
+      (imap-log buffer)
+      (when (memq (process-status process) '(open run))
+        (setq done process)
+        (with-current-buffer buffer
+          (goto-char (point-min))
+          (imap-parse-greeting))))
     (message "imap: Connecting with STARTTLS...%s" (if done "done" "failed"))
     done))