Make `gnus-msg-mail' warn about Gnus not running
[gnus] / lisp / pop3.el
index ee3e658..2533098 100644 (file)
@@ -1,6 +1,6 @@
 ;;; pop3.el --- Post Office Protocol (RFC 1460) interface
 
-;; Copyright (C) 1996-2011 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2012 Free Software Foundation, Inc.
 
 ;; Author: Richard L. Pieri <ratinox@peorth.gweep.net>
 ;; Maintainer: FSF
@@ -194,10 +194,16 @@ Use streaming commands."
     (unless (memq (process-status process) '(open run))
       (error "pop3 process died"))
     (when total-size
-      (message "pop3 retrieved %dKB (%d%%)"
-              (truncate (/ (buffer-size) 1000))
-              (truncate (* (/ (* (buffer-size) 1.0)
-                              total-size) 100))))
+      (let ((size 0))
+       (goto-char (point-min))
+       (while (re-search-forward "^\\+OK.*\n" nil t)
+         (setq size (+ size (- (point))
+                       (if (re-search-forward "^\\.\r?\n" nil 'move)
+                           (match-beginning 0)
+                         (point)))))
+       (message "pop3 retrieved %dKB (%d%%)"
+                (truncate (/ size 1000))
+                (truncate (* (/ (* size 1.0) total-size) 100)))))
     (pop3-accept-process-output process))
   start-point)
 
@@ -270,11 +276,11 @@ Use streaming commands."
     message-count))
 
 (defcustom pop3-stream-type nil
-  "*Transport security type for POP3 connexions.
-This may be either nil (plain connexion), `ssl' (use an
+  "*Transport security type for POP3 connections.
+This may be either nil (plain connection), `ssl' (use an
 SSL/TSL-secured stream) or `starttls' (use the starttls mechanism
 to turn on TLS security after opening the stream).  However, if
-this is nil, `ssl' is assumed for connexions to port
+this is nil, `ssl' is assumed for connections to port
 995 (pop3s)."
   :version "23.1" ;; No Gnus
   :group 'pop3