summaryrefslogtreecommitdiff
path: root/lisp/gnus/nnimap.el
diff options
context:
space:
mode:
authorGnus developers <ding@gnus.org>2011-01-25 23:51:40 +0000
committerKatsumi Yamaoka <yamaoka@jpl.org>2011-01-25 23:51:40 +0000
commit008cad902f3434dc8c490dd0488ae93df4f16d9c (patch)
treeec9c6c6a60efbb66ceef6b2f21a4e174d2185807 /lisp/gnus/nnimap.el
parent7e6e2304f863f898e812b53f03b83f16e7f798c4 (diff)
downloademacs-008cad902f3434dc8c490dd0488ae93df4f16d9c.tar.gz
Merge changes made in Gnus trunk.
mm-view.el (mm-display-shell-script-inline): Fix typo in docstring. (mm-display-javascript-inline): New function. mm-decode.el (mm-inline-media-tests): Add application/javascript viewing function. nnimap.el (nnimap-open-connection-1): Store the actual stream type used. (nnimap-login): Prefer plain LOGIN if it's enabled (since it requires fewer round trips than CRAM-MD5, and it's less likely to be buggy), and we're using an encrypted connection. proto-stream.el: Alter the interface functions to also return the actual stream type used: network or tls.
Diffstat (limited to 'lisp/gnus/nnimap.el')
-rw-r--r--lisp/gnus/nnimap.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index dccdb968270..6f7383062db 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -124,7 +124,7 @@ textual parts.")
(defstruct nnimap
group process commands capabilities select-result newlinep server
- last-command-time greeting examined)
+ last-command-time greeting examined stream-type)
(defvar nnimap-object nil)
@@ -350,7 +350,7 @@ textual parts.")
login-result credentials)
(when nnimap-server-port
(setq ports (append ports (list nnimap-server-port))))
- (destructuring-bind (stream greeting capabilities)
+ (destructuring-bind (stream greeting capabilities stream-type)
(open-protocol-stream
"*nnimap*" (current-buffer) nnimap-address (car (last ports))
:type nnimap-stream
@@ -362,6 +362,7 @@ textual parts.")
(when (gnus-string-match-p "STARTTLS" capabilities)
"1 STARTTLS\r\n")))
(setf (nnimap-process nnimap-object) stream)
+ (setf (nnimap-stream-type nnimap-object) stream-type)
(if (not stream)
(progn
(nnheader-report 'nnimap "Unable to contact %s:%s via %s"
@@ -411,6 +412,12 @@ textual parts.")
(defun nnimap-login (user password)
(cond
+ ;; Prefer plain LOGIN if it's enabled (since it requires fewer
+ ;; round trips than CRAM-MD5, and it's less likely to be buggy),
+ ;; and we're using an encrypted connection.
+ ((and (not (nnimap-capability "LOGINDISABLED"))
+ (eq (nnimap-stream-type nnimap-object) 'tls))
+ (nnimap-command "LOGIN %S %S" user password))
((nnimap-capability "AUTH=CRAM-MD5")
(erase-buffer)
(let ((sequence (nnimap-send-command "AUTHENTICATE CRAM-MD5"))