* elmo.el (elmo-folder-move-messages): Bind
authorteranisi <teranisi>
Sun, 10 Jun 2001 12:38:25 +0000 (12:38 +0000)
committerteranisi <teranisi>
Sun, 10 Jun 2001 12:38:25 +0000 (12:38 +0000)
elmo-inhibit-display-retrieval-progress as t while moving messages.

* elmo-vars.el (elmo-display-retrieval-progress-threshold):
New variable.
(elmo-inhibit-display-retrieval-progress): Ditto.

* elmo-pop3.el (elmo-pop3-process-filter): Use elmo-display-progress
for retrieval progress;
Don't display progress when total buffer size is smaller than
elmo-display-retrieval-progress-threshold.
(elmo-message-fetch-plugged): Don't display progress when
elmo-inhibit-display-retrieval-progress is non-nil.

* elmo-imap4.el (elmo-imap4-find-next-line): Use elmo-display-progress
for retrieval progress;
Don't display progress when literal size is smaller than
elmo-display-retrieval-progress-threshold.
(elmo-imap4-message-fetch): Don't display progress when
elmo-inhibit-display-retrieval-progress is non-nil.

elmo/ChangeLog
elmo/elmo-imap4.el
elmo/elmo-pop3.el
elmo/elmo-vars.el
elmo/elmo.el

index d57a9e1..50698ff 100644 (file)
@@ -1,3 +1,26 @@
+2001-06-10  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo.el (elmo-folder-move-messages): Bind
+       elmo-inhibit-display-retrieval-progress as t while moving messages.
+
+       * elmo-vars.el (elmo-display-retrieval-progress-threshold):
+       New variable.
+       (elmo-inhibit-display-retrieval-progress): Ditto.
+
+       * elmo-pop3.el (elmo-pop3-process-filter): Use elmo-display-progress
+       for retrieval progress;
+       Don't display progress when total buffer size is smaller than
+       elmo-display-retrieval-progress-threshold.
+       (elmo-message-fetch-plugged): Don't display progress when
+       elmo-inhibit-display-retrieval-progress is non-nil.
+
+       * elmo-imap4.el (elmo-imap4-find-next-line): Use elmo-display-progress
+       for retrieval progress;
+       Don't display progress when literal size is smaller than
+       elmo-display-retrieval-progress-threshold.
+       (elmo-imap4-message-fetch): Don't display progress when
+       elmo-inhibit-display-retrieval-progress is non-nil.
+
 2001-06-07  Yuuichi Teranishi  <teranisi@gohome.org>
 
        * elmo-imap4.el (elmo-imap4-display-literal-progress): New variable.
index afa580f..c62d1a7 100644 (file)
@@ -1142,10 +1142,16 @@ Return nil if no complete line has arrived."
     (if (match-string 1)
        (if (< (point-max) (+ (point) (string-to-number (match-string 1))))
            (progn
-             (if elmo-imap4-display-literal-progress
-                 (message "Retrieving...(%d/%d bytes)"
+             (if (and elmo-imap4-display-literal-progress
+                      (> (string-to-number (match-string 1))
+                         elmo-display-retrieval-progress-threshold))
+                 (elmo-display-progress
+                  'elmo-display-retrieval-progress
+                  (format "Retrieving (%d/%d bytes)..."
                           (- (point-max) (point))
-                          (string-to-number (match-string 1))))
+                          (string-to-number (match-string 1)))
+                  (floor (* (/ (float (- (point-max) (point)))
+                               (string-to-number (match-string 1))) 100))))
              nil)
          (goto-char (+ (point) (string-to-number (match-string 1))))
          (elmo-imap4-find-next-line))
@@ -2455,7 +2461,8 @@ If optional argument REMOVE is non-nil, remove FLAG."
     (with-current-buffer (elmo-network-session-buffer session)
       (setq elmo-imap4-fetch-callback nil)
       (setq elmo-imap4-fetch-callback-data nil))
-    (setq elmo-imap4-display-literal-progress t)
+    (unless elmo-inhibit-display-retrieval-progress
+      (setq elmo-imap4-display-literal-progress t))
     (unwind-protect
        (setq response
              (elmo-imap4-send-command-wait session
@@ -2468,7 +2475,11 @@ If optional argument REMOVE is non-nil, remove FLAG."
                                             (or section "")
                                             )))
       (setq elmo-imap4-display-literal-progress nil))
-    (message "Retrieving...done.")
+    (unless elmo-inhibit-display-retrieval-progress
+      (elmo-display-progress 'elmo-imap4-display-literal-progress
+                            ""
+                            100)  ; remove progress bar.
+      (message "Retrieving...done."))
     (if (setq response (elmo-imap4-response-bodydetail-text
                        (elmo-imap4-response-value-all
                         response 'fetch)))
index 0a2e6cb..c0a95f9 100644 (file)
@@ -237,9 +237,16 @@ set as non-nil.")
     (set-buffer (process-buffer process))
     (goto-char (point-max))
     (insert output)
-    (if elmo-pop3-total-size
-       (message "Retrieving...(%d/%d bytes)." 
-                (buffer-size) elmo-pop3-total-size))))
+    (if (and elmo-pop3-total-size
+            (> elmo-pop3-total-size 
+               elmo-display-retrieval-progress-threshold))
+       (elmo-display-progress
+        'elmo-display-retrieval-progress
+        (format "Retrieving (%d/%d bytes)..."
+                (buffer-size)
+                elmo-pop3-total-size)
+        (floor (* (/ (float (buffer-size))
+                     elmo-pop3-total-size) 100))))))
 
 (defun elmo-pop3-auth-user (session)
   (let ((process (elmo-network-session-process-internal session)))
@@ -849,8 +856,11 @@ set as non-nil.")
       (when number
        (elmo-pop3-send-command process
                                (format "retr %s" number))
-       (setq elmo-pop3-total-size size)
-       (message "Retrieving...")
+       (unless elmo-inhibit-display-retrieval-progress
+         (setq elmo-pop3-total-size size)
+         (elmo-display-progress
+          'elmo-pop3-display-retrieval-progress
+          (format "Retrieving (0/%d bytes)..." elmo-pop3-total-size)))
        (unwind-protect
            (progn
              (when (null (setq response (elmo-pop3-read-response
@@ -858,7 +868,8 @@ set as non-nil.")
                (error "Fetching message failed"))
              (setq response (elmo-pop3-read-body process outbuf)))
          (setq elmo-pop3-total-size nil))
-       (message "Retrieving...done.")
+       (unless elmo-inhibit-display-retrieval-progress
+         (message "Retrieving...done."))
        (set-buffer outbuf)
        (goto-char (point-min))
        (while (re-search-forward "^\\." nil t)
index 78e9b89..cb4d666 100644 (file)
@@ -246,6 +246,12 @@ Arguments for this function are NAME, BUFFER, HOST and SERVICE.")
 (defvar elmo-inhibit-number-mapping nil
   "Global switch to inhibit number mapping (e.g. Inhibit UIDL on POP3).")
 
+(defvar elmo-display-retrieval-progress-threshold 30000
+  "*Don't display progress if the message size is smaller than this value.")
+
+(defvar elmo-inhibit-display-retrieval-progress nil
+  "Global switch to inhibit display progress of each message's retrieval.")
+
 (defvar elmo-dop-queue nil
   "Global variable for storing disconnected operation queues.")
 
index 746ace3..0ceebdd 100644 (file)
@@ -886,6 +886,7 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).")
                                             save-unread)
   (save-excursion
     (let* ((messages msgs)
+          (elmo-inhibit-display-retrieval-progress t)
           (len (length msgs))
           (all-msg-num (or all len))
           (done-msg-num (or done 0))