comparison lisp/gnus/mail-source.el @ 110195:48695a2e29d9

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.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Sun, 05 Sep 2010 01:08:22 +0000
parents 821c596efa5f
children 727cc5d69397
comparison
equal deleted inserted replaced
110194:1acd79f80f50 110195:48695a2e29d9
32 (require 'format-spec) 32 (require 'format-spec)
33 (eval-when-compile 33 (eval-when-compile
34 (require 'cl) 34 (require 'cl)
35 (require 'imap)) 35 (require 'imap))
36 (autoload 'auth-source-user-or-password "auth-source") 36 (autoload 'auth-source-user-or-password "auth-source")
37 (autoload 'pop3-movemail "pop3") 37 (autoload 'pop3-streaming-movemail "pop3")
38 (autoload 'pop3-get-message-count "pop3") 38 (autoload 'pop3-get-message-count "pop3")
39 (autoload 'nnheader-cancel-timer "nnheader") 39 (autoload 'nnheader-cancel-timer "nnheader")
40 (require 'mm-util) 40 (require 'mm-util)
41 (require 'message) ;; for `message-directory' 41 (require 'message) ;; for `message-directory'
42 42
622 (when (file-exists-p mail-source-crash-box) 622 (when (file-exists-p mail-source-crash-box)
623 (delete-file mail-source-crash-box)) 623 (delete-file mail-source-crash-box))
624 0) 624 0)
625 (funcall callback mail-source-crash-box info))) 625 (funcall callback mail-source-crash-box info)))
626 626
627 (defvar mail-source-incoming-last-checked-time nil)
628
627 (defun mail-source-delete-crash-box () 629 (defun mail-source-delete-crash-box ()
628 (when (file-exists-p mail-source-crash-box) 630 (when (file-exists-p mail-source-crash-box)
629 ;; Delete or move the incoming mail out of the way. 631 ;; Delete or move the incoming mail out of the way.
630 (if (eq mail-source-delete-incoming t) 632 (if (eq mail-source-delete-incoming t)
631 (delete-file mail-source-crash-box) 633 (delete-file mail-source-crash-box)
634 ;; Don't check for old incoming files more than once per day to
635 ;; save a lot of file accesses.
636 (when (or (null mail-source-incoming-last-checked-time)
637 (> (time-to-seconds
638 (time-since mail-source-incoming-last-checked-time))
639 (* 24 60 60)))
640 (setq mail-source-incoming-last-checked-time (current-time)))
632 (let ((incoming 641 (let ((incoming
633 (mm-make-temp-file 642 (mm-make-temp-file
634 (expand-file-name 643 (expand-file-name
635 mail-source-incoming-file-prefix 644 mail-source-incoming-file-prefix
636 mail-source-directory)))) 645 mail-source-directory))))
823 (pop3-port port) 832 (pop3-port port)
824 (pop3-authentication-scheme 833 (pop3-authentication-scheme
825 (if (eq authentication 'apop) 'apop 'pass)) 834 (if (eq authentication 'apop) 'apop 'pass))
826 (pop3-stream-type stream)) 835 (pop3-stream-type stream))
827 (if (or debug-on-quit debug-on-error) 836 (if (or debug-on-quit debug-on-error)
828 (save-excursion (pop3-movemail mail-source-crash-box)) 837 (save-excursion (pop3-streaming-movemail
838 mail-source-crash-box))
829 (condition-case err 839 (condition-case err
830 (save-excursion (pop3-movemail mail-source-crash-box)) 840 (save-excursion (pop3-streaming-movemail
841 mail-source-crash-box))
831 (error 842 (error
832 ;; We nix out the password in case the error 843 ;; We nix out the password in case the error
833 ;; was because of a wrong password being given. 844 ;; was because of a wrong password being given.
834 (setq mail-source-password-cache 845 (setq mail-source-password-cache
835 (delq (assoc from mail-source-password-cache) 846 (delq (assoc from mail-source-password-cache)