summaryrefslogtreecommitdiff
path: root/lisp/gnus/pop3.el
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen <larsi@gnus.org>2011-09-26 21:59:47 +0000
committerKatsumi Yamaoka <yamaoka@jpl.org>2011-09-26 21:59:47 +0000
commit2146e25680a961dbeca560622945b50e56800a4a (patch)
tree85ed1df09a7d8b60b925f64dfa86ac3337c5f12b /lisp/gnus/pop3.el
parent6d69f077f1c4fac9c4562df816d7b711334d14c2 (diff)
downloademacs-2146e25680a961dbeca560622945b50e56800a4a.tar.gz
Merge changes made in Gnus trunk.
nnimap.el (nnimap-wait-for-response): Message less (bug#9540). nnheader.el (nnheader-message-maybe): New function. shr.el (shr-tag-table): Render totally broken tables better. mml.el (mml-generate-mime-1): Don't alter the contents if we're computing the boundary. pop3.el (pop3-number-of-responses): Removed. (pop3-wait-for-messages): Rewrite to take linear time instead of exponential time.
Diffstat (limited to 'lisp/gnus/pop3.el')
-rw-r--r--lisp/gnus/pop3.el41
1 files changed, 22 insertions, 19 deletions
diff --git a/lisp/gnus/pop3.el b/lisp/gnus/pop3.el
index 8fd5382a181..ee3e6582e80 100644
--- a/lisp/gnus/pop3.el
+++ b/lisp/gnus/pop3.el
@@ -167,17 +167,30 @@ Use streaming commands."
(defun pop3-send-streaming-command (process command count total-size)
(erase-buffer)
- (let ((i 1))
+ (let ((i 1)
+ (start-point (point-min))
+ (waited-for 0))
(while (>= count i)
(process-send-string process (format "%s %d\r\n" command i))
;; Only do 100 messages at a time to avoid pipe stalls.
(when (zerop (% i pop3-stream-length))
- (pop3-wait-for-messages process i total-size))
- (incf i)))
- (pop3-wait-for-messages process count total-size))
-
-(defun pop3-wait-for-messages (process count total-size)
- (while (< (pop3-number-of-responses total-size) count)
+ (setq start-point
+ (pop3-wait-for-messages process pop3-stream-length
+ total-size start-point))
+ (incf waited-for pop3-stream-length))
+ (incf i))
+ (pop3-wait-for-messages process (- count waited-for)
+ total-size start-point)))
+
+(defun pop3-wait-for-messages (process count total-size start-point)
+ (while (> count 0)
+ (goto-char start-point)
+ (while (or (and (re-search-forward "^\\+OK" nil t)
+ (or (not total-size)
+ (re-search-forward "^\\.\r?\n" nil t)))
+ (re-search-forward "^-ERR " nil t))
+ (decf count)
+ (setq start-point (point)))
(unless (memq (process-status process) '(open run))
(error "pop3 process died"))
(when total-size
@@ -185,7 +198,8 @@ Use streaming commands."
(truncate (/ (buffer-size) 1000))
(truncate (* (/ (* (buffer-size) 1.0)
total-size) 100))))
- (pop3-accept-process-output process)))
+ (pop3-accept-process-output process))
+ start-point)
(defun pop3-write-to-file (file)
(let ((pop-buffer (current-buffer))
@@ -219,17 +233,6 @@ Use streaming commands."
(delete-char 1))
(write-region (point-min) (point-max) file nil 'nomesg)))))
-(defun pop3-number-of-responses (endp)
- (let ((responses 0))
- (save-excursion
- (goto-char (point-min))
- (while (or (and (re-search-forward "^\\+OK" nil t)
- (or (not endp)
- (re-search-forward "^\\.\r?\n" nil t)))
- (re-search-forward "^-ERR " nil t))
- (incf responses)))
- responses))
-
(defun pop3-logon (process)
(let ((pop3-password pop3-password))
;; for debugging only