(elmo-pop3-process-filter): Show retrieve progress (rewrite).
authorteranisi <teranisi>
Wed, 6 Jun 2001 03:14:28 +0000 (03:14 +0000)
committerteranisi <teranisi>
Wed, 6 Jun 2001 03:14:28 +0000 (03:14 +0000)
(elmo-pop3-total-size): New variable.
(elmo-pop3-read-msg): Bind elmo-pop3-total-size while fetching.

elmo/ChangeLog
elmo/elmo-pop3.el

index e36c7b4..d2f1db6 100644 (file)
@@ -1,6 +1,8 @@
 2001-06-06  Yuuichi Teranishi  <teranisi@gohome.org>
 
        * 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  <okada@opaopa.org>
 
index 55a1f5d..ffcf838 100644 (file)
@@ -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
     (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)))
                           (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)