From: teranisi Date: Wed, 6 Jun 2001 03:14:28 +0000 (+0000) Subject: (elmo-pop3-process-filter): Show retrieve progress (rewrite). X-Git-Tag: wl-2_6-root~15 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b9b627f0b494a8295b17a2e36ceec78a835efe1;p=elisp%2Fwanderlust.git (elmo-pop3-process-filter): Show retrieve progress (rewrite). (elmo-pop3-total-size): New variable. (elmo-pop3-read-msg): Bind elmo-pop3-total-size while fetching. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index e36c7b4..d2f1db6 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,6 +1,8 @@ 2001-06-06 Yuuichi Teranishi * elmo-pop3.el (elmo-pop3-process-filter): Show retrieve progress. + (elmo-pop3-total-size): New variable. + (elmo-pop3-read-msg): Bind elmo-pop3-total-size while fetching. 2001-03-27 Kenichi OKADA diff --git a/elmo/elmo-pop3.el b/elmo/elmo-pop3.el index 55a1f5d..ffcf838 100644 --- a/elmo/elmo-pop3.el +++ b/elmo/elmo-pop3.el @@ -43,6 +43,8 @@ (defvar elmo-pop3-exists-exactly t) (defvar sasl-mechanism-alist) +(defvar elmo-pop3-total-size nil) + (luna-define-class elmo-pop3-session (elmo-network-session)) ;; buffer-local @@ -138,7 +140,9 @@ (set-buffer (process-buffer process)) (goto-char (point-max)) (insert output) - (message "Retrieving...(%d bytes)." (buffer-size)))) + (if elmo-pop3-total-size + (message "Retrieving...(%d/%d bytes)." + (buffer-size) elmo-pop3-total-size)))) (defun elmo-pop3-auth-user (session) (let ((process (elmo-network-session-process-internal session))) @@ -698,18 +702,24 @@ (elmo-msgdb-expand-path spec))))) (process (elmo-network-session-process-internal (elmo-pop3-get-session spec))) - response errmsg msg) + size response errmsg msg) (with-current-buffer (process-buffer process) (if loc-alist (setq number (elmo-pop3-uidl-to-number (cdr (assq number loc-alist))))) + (setq size (string-to-number + (elmo-pop3-number-to-size number))) (when number (elmo-pop3-send-command process (format "retr %s" number)) - (when (null (setq response (elmo-pop3-read-response - process t))) - (error "Fetching message failed")) - (setq response (elmo-pop3-read-body process outbuf)) + (setq elmo-pop3-total-size size) + (unwind-protect + (progn + (when (null (setq response (elmo-pop3-read-response + process t))) + (error "Fetching message failed")) + (setq response (elmo-pop3-read-body process outbuf))) + (setq elmo-pop3-total-size nil)) (set-buffer outbuf) (goto-char (point-min)) (while (re-search-forward "^\\." nil t)