Add starttls support.
authorLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Thu, 23 Sep 2010 17:42:39 +0000 (19:42 +0200)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Thu, 23 Sep 2010 17:42:39 +0000 (19:42 +0200)
lisp/ChangeLog
lisp/nnimap.el

index 7080737..0113ef1 100644 (file)
@@ -1,3 +1,8 @@
+2010-09-23  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * nnimap.el (nnimap-stream): Mention starttls.
+       (nnimap-open-connection): Add starttls support.
+
 2010-09-23  Andrew Cohen  <cohen@andy.bu.edu>
 
        * nnir.el (nnir-run-imap): Fix up nnir to work with the new nnimap.
index f927a86..a48ed0c 100644 (file)
@@ -51,7 +51,7 @@ it will default to `imap'.")
 
 (defvoo nnimap-stream 'ssl
   "How nnimap will talk to the IMAP server.
-Values are `ssl', `network' or `shell'.")
+Values are `ssl', `network', `starttls' or `shell'.")
 
 (defvoo nnimap-shell-program (if (boundp 'imap-shell-program)
                                 (if (listp imap-shell-program)
@@ -265,6 +265,11 @@ not done by default on servers that doesn't support that command.")
               "*nnimap*" (current-buffer) nnimap-address
               (or nnimap-server-port "imap"))
              '("imap"))
+            ((eq nnimap-stream 'starttls)
+             (starttls-open-stream
+              "*nnimap*" (current-buffer) nnimap-address
+              (or nnimap-server-port "imap"))
+             '("imap"))
             ((eq nnimap-stream 'ssl)
              (open-tls-stream
               "*nnimap*" (current-buffer) nnimap-address
@@ -281,6 +286,9 @@ not done by default on servers that doesn't support that command.")
                       '(open run)))
        (gnus-set-process-query-on-exit-flag (nnimap-process nnimap-object) nil)
        (when (setq connection-result (nnimap-wait-for-connection))
+         (when (eq nnimap-stream 'starttls)
+           (nnimap-send-command "STARTTLS")
+           (starttls-negotiate (nnimap-process nnimap-object)))
          (unless (equal connection-result "PREAUTH")
            (if (not (setq credentials
                           (if (eq nnimap-authenticator 'anonymous)