From 8b9b627f0b494a8295b17a2e36ceec78a835efe1 Mon Sep 17 00:00:00 2001 From: teranisi Date: Wed, 6 Jun 2001 03:14:28 +0000 Subject: [PATCH] (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. --- elmo/ChangeLog | 2 ++ elmo/elmo-pop3.el | 22 ++++++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) 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) -- 1.7.10.4