summaryrefslogtreecommitdiff
path: root/lisp/gnus/pop3.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/gnus/pop3.el')
-rw-r--r--lisp/gnus/pop3.el28
1 files changed, 17 insertions, 11 deletions
diff --git a/lisp/gnus/pop3.el b/lisp/gnus/pop3.el
index c8e309d8c14..d152c2480ad 100644
--- a/lisp/gnus/pop3.el
+++ b/lisp/gnus/pop3.el
@@ -36,6 +36,7 @@
;;; Code:
(require 'mail-utils)
+(defvar parse-time-months)
(defgroup pop3 nil
"Post Office Protocol."
@@ -241,16 +242,23 @@ Returns the process associated with the connection."
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 @@ Return the response string if optional second argument is non-nil."
(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.