comparison lisp/gnus/mail-source.el @ 31764:54ae1def18cf

Merge from Gnus trunk.
author Dave Love <fx@gnu.org>
date Wed, 20 Sep 2000 11:46:48 +0000
parents 6b20b7e85e3c
children 33d474f4b866
comparison
equal deleted inserted replaced
31763:1d2b57dffb60 31764:54ae1def18cf
31 (autoload 'pop3-get-message-count "pop3")) 31 (autoload 'pop3-get-message-count "pop3"))
32 (require 'format-spec) 32 (require 'format-spec)
33 33
34 (defgroup mail-source nil 34 (defgroup mail-source nil
35 "The mail-fetching library." 35 "The mail-fetching library."
36 :version "21.1"
36 :group 'gnus) 37 :group 'gnus)
37 38
38 (defcustom mail-sources nil 39 (defcustom mail-sources '((file))
39 "*Where the mail backends will look for incoming mail. 40 "*Where the mail backends will look for incoming mail.
40 This variable is a list of mail source specifiers." 41 This variable is a list of mail source specifiers.
42 See Info node `(gnus)Mail Source Specifiers'."
41 :group 'mail-source 43 :group 'mail-source
42 :type 'sexp) 44 ;; This specification should be tidied up, particularly to avoid
45 ;; constant items appearing. (Perhaps there's scope for improvment
46 ;; in the widget code.)
47 :type `(repeat
48 (choice (const :tag "Default spool file" (file))
49 (list :tag "Specified spool file"
50 (const file)
51 (const :value :path)
52 file)
53 (cons :tag "Several files in a directory"
54 (const directory)
55 (choice
56 :tag "Options"
57 (const :tag "None" nil)
58 (repeat
59 (choice
60 (list :inline t :tag "path"
61 (const :value :path) directory)
62 (list :inline t :tag "suffix"
63 (const :value :suffix) string)
64 (list :inline t :tag "predicate"
65 (const :value :predicate) function)
66 (list :inline t :tag "prescript"
67 (const :value :prescript) string)
68 (list :inline t :tag "postscript"
69 (const :value :postscript) string)
70 (list :inline t :tag "plugged"
71 (const :value :plugged) boolean)))))
72 (cons :tag "POP3 server"
73 (const pop)
74 (choice
75 :tag "Options"
76 (const :tag "None" nil)
77 (repeat
78 (choice
79 (list :inline t :tag "server"
80 (const :value :server) string)
81 (list :inline t :tag "port"
82 (const :value :port) (choice number string))
83 (list :inline t :tag "user"
84 (const :value :user) string)
85 (list :inline t :tag "password"
86 (const :value :password) string)
87 (list :inline t :tag "program"
88 (const :value :program) string)
89 (list :inline t :tag "prescript"
90 (const :value :prescript) string)
91 (list :inline t :tag "postscript"
92 (const :value :postscript) string)
93 (list :inline t :tag "function"
94 (const :value :function) function)
95 (list :inline t :tag "authentication"
96 (const :value :authentication)
97 (choice (const password)
98 (const apop)))
99 (list :inline t :tag "plugged"
100 (const :value :plugged) boolean)))))
101 (cons :tag "Maildir (qmail, postfix...)"
102 (const maildir)
103 (choice
104 :tag "Options"
105 (const :tag "None" nil)
106 (repeat
107 (choice
108 (list :inline t :tag "path"
109 (const :value :path) directory)
110 (list :inline t :tag "plugged"
111 (const :value :plugged) boolean)))))
112 (cons :tag "IMAP server"
113 (const imap)
114 (choice
115 :tag "Options"
116 (const :tag "None" nil)
117 (repeat
118 (choice
119 (list :inline t :tag "server"
120 (const :value :server) string)
121 (list :inline t :tag "port"
122 (const :value :port)
123 (choice number string))
124 (list :inline t :tag "user"
125 (const :value :user) string)
126 (list :inline t :tag "password"
127 (const :value :password) string)
128 (list :inline t :tag "stream"
129 (const :value :stream)
130 (choice ,@(progn (require 'imap)
131 (mapcar
132 (lambda (a)
133 (list 'const (car a)))
134 imap-stream-alist))))
135 (list :inline t :tag "authenticator"
136 (const :value :authenticator)
137 (choice ,@(progn (require 'imap)
138 (mapcar
139 (lambda (a)
140 (list 'const (car a)))
141 imap-authenticator-alist))))
142 (list :inline t :tag "mailbox"
143 (const :value :mailbox) string)
144 (list :inline t :tag "predicate"
145 (const :value :predicate) function)
146 (list :inline t :tag "fetchflag"
147 (const :value :fetchflag) string)
148 (list :inline t :tag "dontexpunge"
149 (const :value :dontexpunge) boolean)
150 (list :inline t :tag "plugged"
151 (const :value :plugged) )))))
152 (cons :tag "Webmail server"
153 (const webmail)
154 (choice
155 :tag "Options"
156 (const :tag "None" nil)
157 (repeat
158 (choice
159 (list :inline t :tag "subtype"
160 (const :value :subtype)
161 ;; Should be generated from
162 ;; `webmail-type-definition', but we
163 ;; can't require webmail without W3.
164 (choice (const hotmail) (const yahoo)
165 (const netaddress) (const netscape)
166 (const my-deja)))
167 (list :inline t :tag "user"
168 (const :value :user) string)
169 (list :inline t :tag "password"
170 (const :value :password) string)
171 (list :inline t :tag "dontexpunge"
172 (const :value :dontexpunge) boolean)
173 (list :inline t :tag "plugged"
174 (const :value :plugged) boolean))))))))
43 175
44 (defcustom mail-source-primary-source nil 176 (defcustom mail-source-primary-source nil
45 "*Primary source for incoming mail. 177 "*Primary source for incoming mail.
46 If non-nil, this maildrop will be checked periodically for new mail." 178 If non-nil, this maildrop will be checked periodically for new mail."
47 :group 'mail-source 179 :group 'mail-source
395 (setq mail-source-read-passwd 'ange-ftp-read-passwd))) 527 (setq mail-source-read-passwd 'ange-ftp-read-passwd)))
396 (funcall mail-source-read-passwd prompt))) 528 (funcall mail-source-read-passwd prompt)))
397 529
398 (defun mail-source-fetch-with-program (program) 530 (defun mail-source-fetch-with-program (program)
399 (zerop (call-process shell-file-name nil nil nil 531 (zerop (call-process shell-file-name nil nil nil
400 shell-command-switch program))) 532 shell-command-switch program)))
401 533
402 (defun mail-source-run-script (script spec &optional delay) 534 (defun mail-source-run-script (script spec &optional delay)
403 (when script 535 (when script
404 (if (and (symbolp script) (fboundp script)) 536 (if (and (symbolp script) (fboundp script))
405 (funcall script) 537 (funcall script)
593 (setq mail-source-report-new-mail-timer nil) 725 (setq mail-source-report-new-mail-timer nil)
594 (setq mail-source-report-new-mail-idle-timer nil) 726 (setq mail-source-report-new-mail-idle-timer nil)
595 (if on 727 (if on
596 (progn 728 (progn
597 (require 'time) 729 (require 'time)
730 ;; display-time-mail-function is an Emacs 21 feature.
598 (setq display-time-mail-function #'mail-source-new-mail-p) 731 (setq display-time-mail-function #'mail-source-new-mail-p)
599 ;; Set up the main timer. 732 ;; Set up the main timer.
600 (setq mail-source-report-new-mail-timer 733 (setq mail-source-report-new-mail-timer
601 (run-at-time t (* 60 mail-source-report-new-mail-interval) 734 (run-at-time t (* 60 mail-source-report-new-mail-interval)
602 #'mail-source-start-idle-timer)) 735 #'mail-source-start-idle-timer))
671 user (or (cdr (assoc from mail-source-password-cache)) 804 user (or (cdr (assoc from mail-source-password-cache))
672 password) buf) 805 password) buf)
673 (imap-mailbox-select mailbox nil buf)) 806 (imap-mailbox-select mailbox nil buf))
674 (let (str (coding-system-for-write 'binary)) 807 (let (str (coding-system-for-write 'binary))
675 (with-temp-file mail-source-crash-box 808 (with-temp-file mail-source-crash-box
809 ;; In some versions of FSF Emacs, inserting unibyte
810 ;; string into multibyte buffer may convert 8-bit chars
811 ;; into latin-iso8859-1 chars, which results \201's.
812 (mm-disable-multibyte)
676 ;; remember password 813 ;; remember password
677 (with-current-buffer buf 814 (with-current-buffer buf
678 (when (or imap-password 815 (when (or imap-password
679 (assoc from mail-source-password-cache)) 816 (assoc from mail-source-password-cache))
680 (push (cons from imap-password) mail-source-password-cache))) 817 (push (cons from imap-password) mail-source-password-cache)))