summaryrefslogtreecommitdiff
path: root/lisp/gnus/mail-source.el
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen <larsi@gnus.org>2010-09-05 01:08:22 +0000
committerKatsumi Yamaoka <yamaoka@jpl.org>2010-09-05 01:08:22 +0000
commita2bb410e5853678e32bb8e795b70d18609bb83d0 (patch)
treece8a606afb7e95f3d8c462e340f3881c039f4e68 /lisp/gnus/mail-source.el
parentfb994703be0711372966a1a5251b9b345d18f297 (diff)
downloademacs-a2bb410e5853678e32bb8e795b70d18609bb83d0.tar.gz
gnus-start.el: White space clean up; mail-source.el (mail-source-fetch-pop): Use streaming pop3 retrieval; pop3.el (pop3-streaming-movemail): Respect pop3-leave-mail-on-server; pop3.el (pop3-logon): Fix up unbound variable typo; mail-source.el (mail-source-delete-crash-box): Only check the incoming files for deletion once per day to save a lot of file accesses.
Diffstat (limited to 'lisp/gnus/mail-source.el')
-rw-r--r--lisp/gnus/mail-source.el17
1 files changed, 14 insertions, 3 deletions
diff --git a/lisp/gnus/mail-source.el b/lisp/gnus/mail-source.el
index 08b7a5ebbd2..080433c0d26 100644
--- a/lisp/gnus/mail-source.el
+++ b/lisp/gnus/mail-source.el
@@ -34,7 +34,7 @@
(require 'cl)
(require 'imap))
(autoload 'auth-source-user-or-password "auth-source")
-(autoload 'pop3-movemail "pop3")
+(autoload 'pop3-streaming-movemail "pop3")
(autoload 'pop3-get-message-count "pop3")
(autoload 'nnheader-cancel-timer "nnheader")
(require 'mm-util)
@@ -624,11 +624,20 @@ Deleting old (> %s day(s)) incoming mail file `%s'." diff bfile)
0)
(funcall callback mail-source-crash-box info)))
+(defvar mail-source-incoming-last-checked-time nil)
+
(defun mail-source-delete-crash-box ()
(when (file-exists-p mail-source-crash-box)
;; Delete or move the incoming mail out of the way.
(if (eq mail-source-delete-incoming t)
(delete-file mail-source-crash-box)
+ ;; Don't check for old incoming files more than once per day to
+ ;; save a lot of file accesses.
+ (when (or (null mail-source-incoming-last-checked-time)
+ (> (time-to-seconds
+ (time-since mail-source-incoming-last-checked-time))
+ (* 24 60 60)))
+ (setq mail-source-incoming-last-checked-time (current-time)))
(let ((incoming
(mm-make-temp-file
(expand-file-name
@@ -825,9 +834,11 @@ Deleting old (> %s day(s)) incoming mail file `%s'." diff bfile)
(if (eq authentication 'apop) 'apop 'pass))
(pop3-stream-type stream))
(if (or debug-on-quit debug-on-error)
- (save-excursion (pop3-movemail mail-source-crash-box))
+ (save-excursion (pop3-streaming-movemail
+ mail-source-crash-box))
(condition-case err
- (save-excursion (pop3-movemail mail-source-crash-box))
+ (save-excursion (pop3-streaming-movemail
+ mail-source-crash-box))
(error
;; We nix out the password in case the error
;; was because of a wrong password being given.