emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r104069: Merge changes made in Gnus t


From: Katsumi Yamaoka
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r104069: Merge changes made in Gnus trunk.
Date: Sun, 01 May 2011 23:30:18 +0000
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 104069
author: Gnus developers <address@hidden>
committer: Katsumi Yamaoka <address@hidden>
branch nick: trunk
timestamp: Sun 2011-05-01 23:30:18 +0000
message:
  Merge changes made in Gnus trunk.
  
  pop3.el (pop3-open-server): Upgrade opportunistically to STARTTLS.
   (open-tls-stream): Remove superfluous tls/starttls autoloads.
  gnus-sum.el (gnus-summary-next-article): Don't bug out if the summary buffer 
has moved to a different frame.
  nnimap.el (nnimap-request-article): Use nntp-insert-buffer-substring to get 
the conversion from unibyte to multibyte buffers to work on Emacs 22.
  nntp.el (nntp-request-article): Slight clean-up.
modified:
  lisp/gnus/ChangeLog
  lisp/gnus/gnus-sum.el
  lisp/gnus/nnimap.el
  lisp/gnus/nntp.el
  lisp/gnus/pop3.el
=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog       2011-04-30 00:03:19 +0000
+++ b/lisp/gnus/ChangeLog       2011-05-01 23:30:18 +0000
@@ -1,3 +1,21 @@
+2011-05-01  Lars Magne Ingebrigtsen  <address@hidden>
+
+       * pop3.el (pop3-open-server): Upgrade opportunistically to STARTTLS.
+       (open-tls-stream): Remove superfluous tls/starttls autoloads.
+
+2011-05-01  Stefan Monnier  <address@hidden>
+
+       * gnus-sum.el (gnus-summary-next-article): Don't bug out if the summary
+       buffer has moved to a different frame.
+
+2011-05-01  Lars Magne Ingebrigtsen  <address@hidden>
+
+       * nnimap.el (nnimap-request-article): Use nntp-insert-buffer-substring
+       to get the conversion from unibyte to multibyte buffers to work on
+       Emacs 22.
+
+       * nntp.el (nntp-request-article): Slight clean-up.
+
 2011-04-29  Lars Magne Ingebrigtsen  <address@hidden>
 
        * shr.el (shr-strike-through): New face.

=== modified file 'lisp/gnus/gnus-sum.el'
--- a/lisp/gnus/gnus-sum.el     2011-04-23 02:18:10 +0000
+++ b/lisp/gnus/gnus-sum.el     2011-05-01 23:30:18 +0000
@@ -7783,7 +7783,8 @@
          ;; Somehow or other, we may now have selected a different
          ;; window.  Make point go back to the summary buffer.
          (when (eq current-summary (current-buffer))
-           (select-window (get-buffer-window current-summary)))
+            ;; FIXME: This burps when get-buffer-window returns nil.
+           (select-window (get-buffer-window current-summary 0)))
          (gnus-summary-walk-group-buffer
           gnus-newsgroup-name cmd unread backward point))))))))
 

=== modified file 'lisp/gnus/nnimap.el'
--- a/lisp/gnus/nnimap.el       2011-04-22 01:01:32 +0000
+++ b/lisp/gnus/nnimap.el       2011-05-01 23:30:18 +0000
@@ -545,10 +545,9 @@
                  (nnimap-get-whole-article article))
            (let ((buffer (current-buffer)))
              (with-current-buffer (or to-buffer nntp-server-buffer)
-               (erase-buffer)
-               (insert-buffer-substring buffer)
-               (nnheader-ms-strip-cr)
-               (cons group article)))))))))
+               (nntp-insert-buffer-substring buffer)
+               (nnheader-ms-strip-cr)))
+           (cons group article)))))))
 
 (deffoo nnimap-request-head (article &optional group server to-buffer)
   (when (nnimap-possibly-change-group group server)

=== modified file 'lisp/gnus/nntp.el'
--- a/lisp/gnus/nntp.el 2011-04-02 23:41:03 +0000
+++ b/lisp/gnus/nntp.el 2011-05-01 23:30:18 +0000
@@ -1028,16 +1028,15 @@
 
 (deffoo nntp-request-article (article &optional group server buffer command)
   (nntp-with-open-group
-    group server
+      group server
     (when (nntp-send-command-and-decode
            "\r?\n\\.\r?\n" "ARTICLE"
            (if (numberp article) (int-to-string article) article))
-      (if (and buffer
-               (not (equal buffer nntp-server-buffer)))
-          (with-current-buffer nntp-server-buffer
-            (copy-to-buffer buffer (point-min) (point-max))
-            (nntp-find-group-and-number group))
-        (nntp-find-group-and-number group)))))
+      (when (and buffer
+                (not (equal buffer nntp-server-buffer)))
+       (with-current-buffer nntp-server-buffer
+         (copy-to-buffer buffer (point-min) (point-max))))
+      (nntp-find-group-and-number group))))
 
 (deffoo nntp-request-head (article &optional group server)
   (nntp-with-open-group

=== modified file 'lisp/gnus/pop3.el'
--- a/lisp/gnus/pop3.el 2011-01-25 04:08:28 +0000
+++ b/lisp/gnus/pop3.el 2011-05-01 23:30:18 +0000
@@ -33,6 +33,13 @@
 ;;; Code:
 
 (eval-when-compile (require 'cl))
+
+(eval-and-compile
+  ;; In Emacs 24, `open-protocol-stream' is an autoloaded alias for
+  ;; `make-network-stream'.
+  (unless (fboundp 'open-protocol-stream)
+    (require 'proto-stream)))
+
 (require 'mail-utils)
 (defvar parse-time-months)
 
@@ -257,10 +264,6 @@
     (pop3-quit process)
     message-count))
 
-(autoload 'open-tls-stream "tls")
-(autoload 'starttls-open-stream "starttls")
-(autoload 'starttls-negotiate "starttls") ; avoid warning
-
 (defcustom pop3-stream-type nil
   "*Transport security type for POP3 connexions.
 This may be either nil (plain connexion), `ssl' (use an
@@ -286,64 +289,37 @@
 Returns the process associated with the connection."
   (let ((coding-system-for-read 'binary)
        (coding-system-for-write 'binary)
-       process)
+       result)
     (with-current-buffer
         (get-buffer-create (concat " trace of POP session to "
                                    mailhost))
       (erase-buffer)
       (setq pop3-read-point (point-min))
-      (setq process
-           (cond
-            ((or (eq pop3-stream-type 'ssl)
-                 (and (not pop3-stream-type) (member port '(995 "pop3s"))))
-             ;; gnutls-cli, openssl don't accept service names
-             (if (or (equal port "pop3s")
-                     (null port))
-                 (setq port 995))
-             (let ((process (open-tls-stream "POP" (current-buffer)
-                                             mailhost port)))
-               (when process
-                 ;; There's a load of info printed that needs deleting.
-                 (let ((again 't))
-                   ;; repeat until
-                   ;; - either we received the +OK line
-                   ;; - or accept-process-output timed out without getting
-                   ;;   anything
-                   (while (and again
-                               (setq again (memq (process-status process)
-                                                 '(open run))))
-                     (setq again (pop3-accept-process-output process))
-                     (goto-char (point-max))
-                     (forward-line -1)
-                     (cond ((looking-at "\\+OK")
-                            (setq again nil)
-                            (delete-region (point-min) (point)))
-                           ((not again)
-                            (pop3-quit process)
-                            (error "POP SSL connexion failed")))))
-                 process)))
-            ((eq pop3-stream-type 'starttls)
-             ;; gnutls-cli, openssl don't accept service names
-             (if (equal port "pop3")
-                 (setq port 110))
-             ;; Delay STLS until server greeting is read (Bug#7438).
-             (starttls-open-stream "POP" (current-buffer)
-                                   mailhost (or port 110)))
-            (t
-             (open-network-stream "POP" (current-buffer) mailhost port))))
-      (let ((response (pop3-read-response process t)))
-       (setq pop3-timestamp
-             (substring response (or (string-match "<" response) 0)
-                        (+ 1 (or (string-match ">" response) -1)))))
-      (when (eq pop3-stream-type 'starttls)
-       (pop3-send-command process "STLS")
-       (let ((response (pop3-read-response process t)))
-         (if (and response (string-match "+OK" response))
-             (starttls-negotiate process)
-           (pop3-quit process)
-           (error "POP server doesn't support starttls"))))
-      (pop3-set-process-query-on-exit-flag process nil)
-      process)))
+      (setq result
+           (open-protocol-stream
+            "POP" (current-buffer) mailhost port
+            :type (cond
+                   ((or (eq pop3-stream-type 'ssl)
+                        (and (not pop3-stream-type)
+                             (member port '(995 "pop3s"))))
+                    :tls)
+                   (t
+                    (or pop3-stream-type 'network)))
+            :capability-command "CAPA\r\n"
+            :end-of-command "^\\.\r?\n\\|^\\+[A-Z]+ .*\n"
+            :success "^\\+OK.*\n"
+            :return-list t
+            :starttls-function
+            (lambda (capabilities)
+              (and (string-match "\\bSTLS\\b" capabilities)
+                   "STLS\r\n"))))
+      (when result
+       (let ((response (plist-get (cdr result) :greeting)))
+         (setq pop3-timestamp
+               (substring response (or (string-match "<" response) 0)
+                          (+ 1 (or (string-match ">" response) -1)))))
+       (pop3-set-process-query-on-exit-flag (car result) nil)
+       (car result)))))
 
 ;; Support functions
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]