diff options
| author | Gnus developers | 2011-01-25 23:51:40 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2011-01-25 23:51:40 +0000 |
| commit | 008cad902f3434dc8c490dd0488ae93df4f16d9c (patch) | |
| tree | ec9c6c6a60efbb66ceef6b2f21a4e174d2185807 | |
| parent | 7e6e2304f863f898e812b53f03b83f16e7f798c4 (diff) | |
| download | emacs-008cad902f3434dc8c490dd0488ae93df4f16d9c.tar.gz emacs-008cad902f3434dc8c490dd0488ae93df4f16d9c.zip | |
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.
| -rw-r--r-- | lisp/gnus/ChangeLog | 19 | ||||
| -rw-r--r-- | lisp/gnus/mm-decode.el | 1 | ||||
| -rw-r--r-- | lisp/gnus/mm-view.el | 6 | ||||
| -rw-r--r-- | lisp/gnus/nnimap.el | 11 | ||||
| -rw-r--r-- | lisp/gnus/proto-stream.el | 30 |
5 files changed, 51 insertions, 16 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index af4bebdd409..47d08e8609f 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,22 @@ | |||
| 1 | 2011-01-25 Lars Ingebrigtsen <larsi@gnus.org> | ||
| 2 | |||
| 3 | * nnimap.el (nnimap-open-connection-1): Store the actual stream type | ||
| 4 | used. | ||
| 5 | (nnimap-login): Prefer plain LOGIN if it's enabled (since it requires | ||
| 6 | fewer round trips than CRAM-MD5, and it's less likely to be buggy), and | ||
| 7 | we're using an encrypted connection. | ||
| 8 | |||
| 9 | * proto-stream.el: Alter the interface functions to also return the | ||
| 10 | actual stream type used: network or tls. | ||
| 11 | |||
| 12 | 2011-01-25 Julien Danjou <julien@danjou.info> | ||
| 13 | |||
| 14 | * mm-view.el (mm-display-shell-script-inline): Fix typo in docstring. | ||
| 15 | (mm-display-javascript-inline): New function. | ||
| 16 | |||
| 17 | * mm-decode.el (mm-inline-media-tests): Add application/javascript | ||
| 18 | viewing function. | ||
| 19 | |||
| 1 | 2011-01-25 Katsumi Yamaoka <yamaoka@jpl.org> | 20 | 2011-01-25 Katsumi Yamaoka <yamaoka@jpl.org> |
| 2 | 21 | ||
| 3 | * shr.el (shr-expand-newlines): Fix variable name. | 22 | * shr.el (shr-expand-newlines): Fix variable name. |
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el index 019a0e8f66e..d7bc882a844 100644 --- a/lisp/gnus/mm-decode.el +++ b/lisp/gnus/mm-decode.el | |||
| @@ -239,6 +239,7 @@ before the external MIME handler is invoked." | |||
| 239 | ("application/x-shellscript" mm-display-shell-script-inline identity) | 239 | ("application/x-shellscript" mm-display-shell-script-inline identity) |
| 240 | ("application/x-sh" mm-display-shell-script-inline identity) | 240 | ("application/x-sh" mm-display-shell-script-inline identity) |
| 241 | ("text/x-sh" mm-display-shell-script-inline identity) | 241 | ("text/x-sh" mm-display-shell-script-inline identity) |
| 242 | ("application/javascript" mm-display-javascript-inline identity) | ||
| 242 | ("text/dns" mm-display-dns-inline identity) | 243 | ("text/dns" mm-display-dns-inline identity) |
| 243 | ("text/x-org" mm-display-org-inline identity) | 244 | ("text/x-org" mm-display-org-inline identity) |
| 244 | ("text/html" | 245 | ("text/html" |
diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el index e3286b854e4..d63d20239dc 100644 --- a/lisp/gnus/mm-view.el +++ b/lisp/gnus/mm-view.el | |||
| @@ -636,9 +636,13 @@ | |||
| 636 | (mm-display-inline-fontify handle 'org-mode)) | 636 | (mm-display-inline-fontify handle 'org-mode)) |
| 637 | 637 | ||
| 638 | (defun mm-display-shell-script-inline (handle) | 638 | (defun mm-display-shell-script-inline (handle) |
| 639 | "Show an shell script from HANDLE inline." | 639 | "Show a shell script from HANDLE inline." |
| 640 | (mm-display-inline-fontify handle 'shell-script-mode)) | 640 | (mm-display-inline-fontify handle 'shell-script-mode)) |
| 641 | 641 | ||
| 642 | (defun mm-display-javascript-inline (handle) | ||
| 643 | "Show JavsScript code from HANDLE inline." | ||
| 644 | (mm-display-inline-fontify handle 'javascript-mode)) | ||
| 645 | |||
| 642 | ;; id-signedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) | 646 | ;; id-signedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) |
| 643 | ;; us(840) rsadsi(113549) pkcs(1) pkcs7(7) 2 } | 647 | ;; us(840) rsadsi(113549) pkcs(1) pkcs7(7) 2 } |
| 644 | (defvar mm-pkcs7-signed-magic | 648 | (defvar mm-pkcs7-signed-magic |
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.") | |||
| 124 | 124 | ||
| 125 | (defstruct nnimap | 125 | (defstruct nnimap |
| 126 | group process commands capabilities select-result newlinep server | 126 | group process commands capabilities select-result newlinep server |
| 127 | last-command-time greeting examined) | 127 | last-command-time greeting examined stream-type) |
| 128 | 128 | ||
| 129 | (defvar nnimap-object nil) | 129 | (defvar nnimap-object nil) |
| 130 | 130 | ||
| @@ -350,7 +350,7 @@ textual parts.") | |||
| 350 | login-result credentials) | 350 | login-result credentials) |
| 351 | (when nnimap-server-port | 351 | (when nnimap-server-port |
| 352 | (setq ports (append ports (list nnimap-server-port)))) | 352 | (setq ports (append ports (list nnimap-server-port)))) |
| 353 | (destructuring-bind (stream greeting capabilities) | 353 | (destructuring-bind (stream greeting capabilities stream-type) |
| 354 | (open-protocol-stream | 354 | (open-protocol-stream |
| 355 | "*nnimap*" (current-buffer) nnimap-address (car (last ports)) | 355 | "*nnimap*" (current-buffer) nnimap-address (car (last ports)) |
| 356 | :type nnimap-stream | 356 | :type nnimap-stream |
| @@ -362,6 +362,7 @@ textual parts.") | |||
| 362 | (when (gnus-string-match-p "STARTTLS" capabilities) | 362 | (when (gnus-string-match-p "STARTTLS" capabilities) |
| 363 | "1 STARTTLS\r\n"))) | 363 | "1 STARTTLS\r\n"))) |
| 364 | (setf (nnimap-process nnimap-object) stream) | 364 | (setf (nnimap-process nnimap-object) stream) |
| 365 | (setf (nnimap-stream-type nnimap-object) stream-type) | ||
| 365 | (if (not stream) | 366 | (if (not stream) |
| 366 | (progn | 367 | (progn |
| 367 | (nnheader-report 'nnimap "Unable to contact %s:%s via %s" | 368 | (nnheader-report 'nnimap "Unable to contact %s:%s via %s" |
| @@ -411,6 +412,12 @@ textual parts.") | |||
| 411 | 412 | ||
| 412 | (defun nnimap-login (user password) | 413 | (defun nnimap-login (user password) |
| 413 | (cond | 414 | (cond |
| 415 | ;; Prefer plain LOGIN if it's enabled (since it requires fewer | ||
| 416 | ;; round trips than CRAM-MD5, and it's less likely to be buggy), | ||
| 417 | ;; and we're using an encrypted connection. | ||
| 418 | ((and (not (nnimap-capability "LOGINDISABLED")) | ||
| 419 | (eq (nnimap-stream-type nnimap-object) 'tls)) | ||
| 420 | (nnimap-command "LOGIN %S %S" user password)) | ||
| 414 | ((nnimap-capability "AUTH=CRAM-MD5") | 421 | ((nnimap-capability "AUTH=CRAM-MD5") |
| 415 | (erase-buffer) | 422 | (erase-buffer) |
| 416 | (let ((sequence (nnimap-send-command "AUTHENTICATE CRAM-MD5")) | 423 | (let ((sequence (nnimap-send-command "AUTHENTICATE CRAM-MD5")) |
diff --git a/lisp/gnus/proto-stream.el b/lisp/gnus/proto-stream.el index ec0c9ea9b7d..9117ac9f4e3 100644 --- a/lisp/gnus/proto-stream.el +++ b/lisp/gnus/proto-stream.el | |||
| @@ -105,13 +105,15 @@ command to switch on STARTTLS otherwise." | |||
| 105 | (funcall (intern (format "proto-stream-open-%s" type) obarray) | 105 | (funcall (intern (format "proto-stream-open-%s" type) obarray) |
| 106 | name buffer host service parameters))) | 106 | name buffer host service parameters))) |
| 107 | (if (null open-result) | 107 | (if (null open-result) |
| 108 | (list nil nil nil) | 108 | (list nil nil nil type) |
| 109 | (destructuring-bind (stream greeting capabilities) open-result | 109 | (let ((stream (car open-result))) |
| 110 | (list (and stream | 110 | (list (and stream |
| 111 | (memq (process-status stream) | 111 | (memq (process-status stream) |
| 112 | '(open run)) | 112 | '(open run)) |
| 113 | stream) | 113 | stream) |
| 114 | greeting capabilities)))))) | 114 | (nth 1 open-result) |
| 115 | (nth 2 open-result) | ||
| 116 | (nth 3 open-result))))))) | ||
| 115 | 117 | ||
| 116 | (defun proto-stream-open-network-only (name buffer host service parameters) | 118 | (defun proto-stream-open-network-only (name buffer host service parameters) |
| 117 | (let ((start (with-current-buffer buffer (point))) | 119 | (let ((start (with-current-buffer buffer (point))) |
| @@ -119,7 +121,8 @@ command to switch on STARTTLS otherwise." | |||
| 119 | (list stream | 121 | (list stream |
| 120 | (proto-stream-get-response | 122 | (proto-stream-get-response |
| 121 | stream start (proto-stream-eoc parameters)) | 123 | stream start (proto-stream-eoc parameters)) |
| 122 | nil))) | 124 | nil |
| 125 | 'network))) | ||
| 123 | 126 | ||
| 124 | (defun proto-stream-open-network (name buffer host service parameters) | 127 | (defun proto-stream-open-network (name buffer host service parameters) |
| 125 | (let* ((start (with-current-buffer buffer (point))) | 128 | (let* ((start (with-current-buffer buffer (point))) |
| @@ -130,7 +133,7 @@ command to switch on STARTTLS otherwise." | |||
| 130 | (greeting (proto-stream-get-response stream start eoc)) | 133 | (greeting (proto-stream-get-response stream start eoc)) |
| 131 | success) | 134 | success) |
| 132 | (if (not capability-command) | 135 | (if (not capability-command) |
| 133 | (list stream greeting nil) | 136 | (list stream greeting nil 'network) |
| 134 | (let* ((capabilities | 137 | (let* ((capabilities |
| 135 | (proto-stream-command stream capability-command eoc)) | 138 | (proto-stream-command stream capability-command eoc)) |
| 136 | (starttls-command | 139 | (starttls-command |
| @@ -148,7 +151,7 @@ command to switch on STARTTLS otherwise." | |||
| 148 | (delete-process stream) | 151 | (delete-process stream) |
| 149 | nil) | 152 | nil) |
| 150 | ;; Otherwise, just return this plain network connection. | 153 | ;; Otherwise, just return this plain network connection. |
| 151 | (list stream greeting capabilities))) | 154 | (list stream greeting capabilities 'network))) |
| 152 | ;; We have some kind of STARTTLS support, so we try to | 155 | ;; We have some kind of STARTTLS support, so we try to |
| 153 | ;; upgrade the connection opportunistically. | 156 | ;; upgrade the connection opportunistically. |
| 154 | ((or (fboundp 'open-gnutls-stream) | 157 | ((or (fboundp 'open-gnutls-stream) |
| @@ -176,7 +179,7 @@ command to switch on STARTTLS otherwise." | |||
| 176 | (progn | 179 | (progn |
| 177 | (delete-process stream) | 180 | (delete-process stream) |
| 178 | nil) | 181 | nil) |
| 179 | (list stream greeting capabilities))) | 182 | (list stream greeting capabilities 'network))) |
| 180 | ;; The server said it was OK to start doing STARTTLS negotiations. | 183 | ;; The server said it was OK to start doing STARTTLS negotiations. |
| 181 | (if (fboundp 'open-gnutls-stream) | 184 | (if (fboundp 'open-gnutls-stream) |
| 182 | (gnutls-negotiate stream nil) | 185 | (gnutls-negotiate stream nil) |
| @@ -193,7 +196,7 @@ command to switch on STARTTLS otherwise." | |||
| 193 | ;; Re-get the capabilities, since they may have changed | 196 | ;; Re-get the capabilities, since they may have changed |
| 194 | ;; after switching to TLS. | 197 | ;; after switching to TLS. |
| 195 | (list stream greeting | 198 | (list stream greeting |
| 196 | (proto-stream-command stream capability-command eoc)))) | 199 | (proto-stream-command stream capability-command eoc) 'tls))) |
| 197 | ;; We don't have STARTTLS support available, but the caller | 200 | ;; We don't have STARTTLS support available, but the caller |
| 198 | ;; requested a STARTTLS connection, so we give up. | 201 | ;; requested a STARTTLS connection, so we give up. |
| 199 | ((eq (cadr (memq :type parameters)) 'starttls) | 202 | ((eq (cadr (memq :type parameters)) 'starttls) |
| @@ -201,7 +204,7 @@ command to switch on STARTTLS otherwise." | |||
| 201 | nil) | 204 | nil) |
| 202 | ;; Fall back on using a plain network stream. | 205 | ;; Fall back on using a plain network stream. |
| 203 | (t | 206 | (t |
| 204 | (list stream greeting capabilities))))))) | 207 | (list stream greeting capabilities 'network))))))) |
| 205 | 208 | ||
| 206 | (defun proto-stream-command (stream command eoc) | 209 | (defun proto-stream-command (stream command eoc) |
| 207 | (let ((start (with-current-buffer (process-buffer stream) (point-max)))) | 210 | (let ((start (with-current-buffer (process-buffer stream) (point-max)))) |
| @@ -242,7 +245,7 @@ command to switch on STARTTLS otherwise." | |||
| 242 | (when (re-search-forward (proto-stream-eoc parameters) nil t) | 245 | (when (re-search-forward (proto-stream-eoc parameters) nil t) |
| 243 | (goto-char (match-beginning 0)) | 246 | (goto-char (match-beginning 0)) |
| 244 | (delete-region (point-min) (line-beginning-position)))) | 247 | (delete-region (point-min) (line-beginning-position)))) |
| 245 | (proto-stream-capability-open start stream parameters))))) | 248 | (proto-stream-capability-open start stream parameters 'tls))))) |
| 246 | 249 | ||
| 247 | (defun proto-stream-open-shell (name buffer host service parameters) | 250 | (defun proto-stream-open-shell (name buffer host service parameters) |
| 248 | (proto-stream-capability-open | 251 | (proto-stream-capability-open |
| @@ -255,16 +258,17 @@ command to switch on STARTTLS otherwise." | |||
| 255 | (format-spec-make | 258 | (format-spec-make |
| 256 | ?s host | 259 | ?s host |
| 257 | ?p service)))) | 260 | ?p service)))) |
| 258 | parameters)) | 261 | parameters 'network)) |
| 259 | 262 | ||
| 260 | (defun proto-stream-capability-open (start stream parameters) | 263 | (defun proto-stream-capability-open (start stream parameters stream-type) |
| 261 | (let ((capability-command (cadr (memq :capability-command parameters))) | 264 | (let ((capability-command (cadr (memq :capability-command parameters))) |
| 262 | (greeting (proto-stream-get-response | 265 | (greeting (proto-stream-get-response |
| 263 | stream start (proto-stream-eoc parameters)))) | 266 | stream start (proto-stream-eoc parameters)))) |
| 264 | (list stream greeting | 267 | (list stream greeting |
| 265 | (and capability-command | 268 | (and capability-command |
| 266 | (proto-stream-command | 269 | (proto-stream-command |
| 267 | stream capability-command (proto-stream-eoc parameters)))))) | 270 | stream capability-command (proto-stream-eoc parameters))) |
| 271 | stream-type))) | ||
| 268 | 272 | ||
| 269 | (defun proto-stream-eoc (parameters) | 273 | (defun proto-stream-eoc (parameters) |
| 270 | (or (cadr (memq :end-of-command parameters)) | 274 | (or (cadr (memq :end-of-command parameters)) |