diff lisp/gnus/pop3.el @ 91204:53108e6cea98

Merge from emacs--devo--0 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-294
author Miles Bader <miles@gnu.org>
date Thu, 06 Dec 2007 09:51:45 +0000
parents 880960b70474 166a6141ae98
children 2fcaae6177a5
line wrap: on
line diff
--- a/lisp/gnus/pop3.el	Thu Dec 06 07:36:30 2007 +0000
+++ b/lisp/gnus/pop3.el	Thu Dec 06 09:51:45 2007 +0000
@@ -36,6 +36,7 @@
 ;;; Code:
 
 (require 'mail-utils)
+(defvar parse-time-months)
 
 (defgroup pop3 nil
   "Post Office Protocol."
@@ -241,16 +242,23 @@
 					      mailhost port)))
 		(when process
 		  ;; There's a load of info printed that needs deleting.
-		  (while (when (memq (process-status process) '(open run))
-			   (pop3-accept-process-output process)
-			   (goto-char (point-max))
-			   (forward-line -1)
-			   (if (looking-at "\\+OK")
-			       (progn
-				 (delete-region (point-min) (point))
-				 nil)
+		  (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"))))
+			     (error "POP SSL connexion failed")))))
 		  process)))
 	     ((eq pop3-stream-type 'starttls)
 	      ;; gnutls-cli, openssl don't accept service names
@@ -327,8 +335,6 @@
       (forward-char)))
   (set-marker end nil))
 
-(eval-when-compile (defvar parse-time-months))
-
 ;; Copied from message-make-date.
 (defun pop3-make-date (&optional now)
   "Make a valid date header.