aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2000-10-26 17:13:22 +0000
committerDave Love2000-10-26 17:13:22 +0000
commit4f926b3e43fdd96feb861f5fafd5cd9920ffa873 (patch)
tree05d2643a45b3d1642033bd8bd87492f7b0618292
parent8490337987c917ae1cbe892c34afcd588e14511c (diff)
downloademacs-4f926b3e43fdd96feb861f5fafd5cd9920ffa873.tar.gz
emacs-4f926b3e43fdd96feb861f5fafd5cd9920ffa873.zip
2000-10-26 Dave Love <fx@gnu.org>
* mail-source.el: Require imap when compiling and defvar display-time-mail-function. Require mm-util. (nnheader-cancel-timer): Autoload. (mail-source-imap-authenticators, mail-source-imap-streams): New variables. (mail-sources): Use them. (defvar): Use rmail-spool-directory unconditionally. 2000-10-26 Per Abrahamsen <abraham@dina.kvl.dk> * mail-source.el (mail-sources): Better `:type'. 2000-10-26 Kai Gro�ohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> * mail-source.el (mail-source-keyword-map): Use `rmail-spool-directory' as a default directory for the `file' source, if the variable is defined. Fall back to hardcoded "/usr/spool/mail/", as before. Suggestion by Steven E. Harris <seh@speakeasy.org>.
-rw-r--r--lisp/gnus/mail-source.el302
1 files changed, 170 insertions, 132 deletions
diff --git a/lisp/gnus/mail-source.el b/lisp/gnus/mail-source.el
index 613038aa03b..a6be19cfae2 100644
--- a/lisp/gnus/mail-source.el
+++ b/lisp/gnus/mail-source.el
@@ -2,6 +2,7 @@
2;; Copyright (C) 1999, 2000 Free Software Foundation, Inc. 2;; Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3 3
4;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> 4;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
5;; Maintainer: bugs@gnus.org
5;; Keywords: news, mail 6;; Keywords: news, mail
6 7
7;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
@@ -25,153 +26,190 @@
25 26
26;;; Code: 27;;; Code:
27 28
28(eval-when-compile (require 'cl)) 29(eval-when-compile
30 (require 'cl)
31 (require 'imap)
32 (eval-when-compile (defvar display-time-mail-function)))
29(eval-and-compile 33(eval-and-compile
30 (autoload 'pop3-movemail "pop3") 34 (autoload 'pop3-movemail "pop3")
31 (autoload 'pop3-get-message-count "pop3")) 35 (autoload 'pop3-get-message-count "pop3")
36 (autoload 'nnheader-cancel-timer "nnheader"))
32(require 'format-spec) 37(require 'format-spec)
38(require 'mm-util)
33 39
34(defgroup mail-source nil 40(defgroup mail-source nil
35 "The mail-fetching library." 41 "The mail-fetching library."
36 :version "21.1" 42 :version "21.1"
37 :group 'gnus) 43 :group 'gnus)
38 44
45;; Define these at compile time to avoid dragging in imap always.
46(defconst mail-source-imap-authenticators
47 (eval-when-compile
48 (mapcar (lambda (a)
49 (list 'const (car a)))
50 imap-authenticator-alist)))
51(defconst mail-source-imap-streams
52 (eval-when-compile
53 (mapcar (lambda (a)
54 (list 'const (car a)))
55 imap-stream-alist)))
56
39(defcustom mail-sources nil 57(defcustom mail-sources nil
40 "*Where the mail backends will look for incoming mail. 58 "*Where the mail backends will look for incoming mail.
41This variable is a list of mail source specifiers. 59This variable is a list of mail source specifiers.
42See Info node `(gnus)Mail Source Specifiers'." 60See Info node `(gnus)Mail Source Specifiers'."
43 :group 'mail-source 61 :group 'mail-source
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 62 :type `(repeat
48 (choice (const :tag "Default spool file" (file)) 63 (choice :format "%[Value Menu%] %v"
49 (list :tag "Specified spool file" 64 :value (file)
50 (const file) 65 (cons :tag "Spool file"
51 (const :value :path) 66 (const :format "" file)
52 file) 67 (checklist :tag "Options" :greedy t
68 (group :inline t
69 (const :format "" :value :path)
70 file)))
53 (cons :tag "Several files in a directory" 71 (cons :tag "Several files in a directory"
54 (const directory) 72 (const :format "" directory)
55 (choice 73 (checklist :tag "Options" :greedy t
56 :tag "Options" 74 (group :inline t
57 (const :tag "None" nil) 75 (const :format "" :value :path)
58 (repeat 76 (directory :tag "Path"))
59 (choice 77 (group :inline t
60 (list :inline t :tag "path" 78 (const :format "" :value :suffix)
61 (const :value :path) directory) 79 (string :tag "Suffix"))
62 (list :inline t :tag "suffix" 80 (group :inline t
63 (const :value :suffix) string) 81 (const :format "" :value :predicate)
64 (list :inline t :tag "predicate" 82 (function :tag "Predicate"))
65 (const :value :predicate) function) 83 (group :inline t
66 (list :inline t :tag "prescript" 84 (const :format "" :value :prescript)
67 (const :value :prescript) string) 85 (string :tag "Prescript"))
68 (list :inline t :tag "postscript" 86 (group :inline t
69 (const :value :postscript) string) 87 (const :format "" :value :postscript)
70 (list :inline t :tag "plugged" 88 (string :tag "Postscript"))
71 (const :value :plugged) boolean))))) 89 (group :inline t
90 (const :format "" :value :plugged)
91 (boolean :tag "Plugged"))))
72 (cons :tag "POP3 server" 92 (cons :tag "POP3 server"
73 (const pop) 93 (const :format "" pop)
74 (choice 94 (checklist :tag "Options" :greedy t
75 :tag "Options" 95 (group :inline t
76 (const :tag "None" nil) 96 (const :format "" :value :server)
77 (repeat 97 (string :tag "Server"))
78 (choice 98 (group :inline t
79 (list :inline t :tag "server" 99 (const :format "" :value :port)
80 (const :value :server) string) 100 (choice :tag "Port"
81 (list :inline t :tag "port" 101 :value "pop3"
82 (const :value :port) (choice number string)) 102 (number :format "%v")
83 (list :inline t :tag "user" 103 (string :format "%v")))
84 (const :value :user) string) 104 (group :inline t
85 (list :inline t :tag "password" 105 (const :format "" :value :user)
86 (const :value :password) string) 106 (string :tag "User"))
87 (list :inline t :tag "program" 107 (group :inline t
88 (const :value :program) string) 108 (const :format "" :value :password)
89 (list :inline t :tag "prescript" 109 (string :tag "Password"))
90 (const :value :prescript) string) 110 (group :inline t
91 (list :inline t :tag "postscript" 111 (const :format "" :value :program)
92 (const :value :postscript) string) 112 (string :tag "Program"))
93 (list :inline t :tag "function" 113 (group :inline t
94 (const :value :function) function) 114 (const :format "" :value :prescript)
95 (list :inline t :tag "authentication" 115 (string :tag "Prescript"))
96 (const :value :authentication) 116 (group :inline t
97 (choice (const password) 117 (const :format "" :value :postscript)
98 (const apop))) 118 (string :tag "Postscript"))
99 (list :inline t :tag "plugged" 119 (group :inline t
100 (const :value :plugged) boolean))))) 120 (const :format "" :value :function)
121 (function :tag "Function"))
122 (group :inline t
123 (const :format ""
124 :value :authentication)
125 (choice :tag "Authentication"
126 :value apop
127 (const password)
128 (const apop)))
129 (group :inline t
130 (const :format "" :value :plugged)
131 (boolean :tag "Plugged"))))
101 (cons :tag "Maildir (qmail, postfix...)" 132 (cons :tag "Maildir (qmail, postfix...)"
102 (const maildir) 133 (const :format "" maildir)
103 (choice 134 (checklist :tag "Options" :greedy t
104 :tag "Options" 135 (group :inline t
105 (const :tag "None" nil) 136 (const :format "" :value :path)
106 (repeat 137 (directory :tag "Path"))
107 (choice 138 (group :inline t
108 (list :inline t :tag "path" 139 (const :format "" :value :plugged)
109 (const :value :path) directory) 140 (boolean :tag "Plugged"))))
110 (list :inline t :tag "plugged"
111 (const :value :plugged) boolean)))))
112 (cons :tag "IMAP server" 141 (cons :tag "IMAP server"
113 (const imap) 142 (const :format "" imap)
114 (choice 143 (checklist :tag "Options" :greedy t
115 :tag "Options" 144 (group :inline t
116 (const :tag "None" nil) 145 (const :format "" :value :server)
117 (repeat 146 (string :tag "Server"))
118 (choice 147 (group :inline t
119 (list :inline t :tag "server" 148 (const :format "" :value :port)
120 (const :value :server) string) 149 (choice :tag "Port"
121 (list :inline t :tag "port" 150 :value 143
122 (const :value :port) 151 number string))
123 (choice number string)) 152 (group :inline t
124 (list :inline t :tag "user" 153 (const :format "" :value :user)
125 (const :value :user) string) 154 (string :tag "User"))
126 (list :inline t :tag "password" 155 (group :inline t
127 (const :value :password) string) 156 (const :format "" :value :password)
128 (list :inline t :tag "stream" 157 (string :tag "Password"))
129 (const :value :stream) 158 (group :inline t
130 (choice ,@(progn (require 'imap) 159 (const :format "" :value :stream)
131 (mapcar 160 (choice :tag "Stream"
132 (lambda (a) 161 :value network
133 (list 'const (car a))) 162 ,@mail-source-imap-streams))
134 imap-stream-alist)))) 163 (group :inline t
135 (list :inline t :tag "authenticator" 164 (const :format ""
136 (const :value :authenticator) 165 :value :authenticator)
137 (choice ,@(progn (require 'imap) 166 (choice :tag "Authenticator"
138 (mapcar 167 :value login
139 (lambda (a) 168 ,@mail-source-imap-authenticators))
140 (list 'const (car a))) 169 (group :inline t
141 imap-authenticator-alist)))) 170 (const :format "" :value :mailbox)
142 (list :inline t :tag "mailbox" 171 (string :tag "Mailbox"))
143 (const :value :mailbox) string) 172 (group :inline t
144 (list :inline t :tag "predicate" 173 (const :format "" :value :predicate)
145 (const :value :predicate) function) 174 (function :tag "Predicate"))
146 (list :inline t :tag "fetchflag" 175 (group :inline t
147 (const :value :fetchflag) string) 176 (const :format "" :value :fetchflag)
148 (list :inline t :tag "dontexpunge" 177 (string :tag "Fetchflag"))
149 (const :value :dontexpunge) boolean) 178 (group :inline t
150 (list :inline t :tag "plugged" 179 (const :format ""
151 (const :value :plugged) ))))) 180 :value :dontexpunge)
181 (boolean :tag "Dontexpunge"))
182 (group :inline t
183 (const :format "" :value :plugged)
184 (boolean :tag "Plugged"))))
152 (cons :tag "Webmail server" 185 (cons :tag "Webmail server"
153 (const webmail) 186 (const :format "" webmail)
154 (choice 187 (checklist :tag "Options" :greedy t
155 :tag "Options" 188 (group :inline t
156 (const :tag "None" nil) 189 (const :format "" :value :subtype)
157 (repeat 190 ;; Should be generated from
158 (choice 191 ;; `webmail-type-definition', but we
159 (list :inline t :tag "subtype" 192 ;; can't require webmail without W3.
160 (const :value :subtype) 193 (choice :tag "Subtype"
161 ;; Should be generated from 194 :value hotmail
162 ;; `webmail-type-definition', but we 195 (const hotmail)
163 ;; can't require webmail without W3. 196 (const yahoo)
164 (choice (const hotmail) (const yahoo) 197 (const netaddress)
165 (const netaddress) (const netscape) 198 (const netscape)
166 (const my-deja))) 199 (const my-deja)))
167 (list :inline t :tag "user" 200 (group :inline t
168 (const :value :user) string) 201 (const :format "" :value :user)
169 (list :inline t :tag "password" 202 (string :tag "User"))
170 (const :value :password) string) 203 (group :inline t
171 (list :inline t :tag "dontexpunge" 204 (const :format "" :value :password)
172 (const :value :dontexpunge) boolean) 205 (string :tag "Password"))
173 (list :inline t :tag "plugged" 206 (group :inline t
174 (const :value :plugged) boolean)))))))) 207 (const :format ""
208 :value :dontexpunge)
209 (boolean :tag "Dontexpunge"))
210 (group :inline t
211 (const :format "" :value :plugged)
212 (boolean :tag "Plugged")))))))
175 213
176(defcustom mail-source-primary-source nil 214(defcustom mail-source-primary-source nil
177 "*Primary source for incoming mail. 215 "*Primary source for incoming mail.
@@ -234,7 +272,7 @@ Common keywords should be listed here.")
234 (:prescript-delay) 272 (:prescript-delay)
235 (:postscript) 273 (:postscript)
236 (:path (or (getenv "MAIL") 274 (:path (or (getenv "MAIL")
237 (concat "/usr/spool/mail/" (user-login-name))))) 275 (expand-file-name (user-login-name) rmail-spool-directory))))
238 (directory 276 (directory
239 (:path) 277 (:path)
240 (:suffix ".spool") 278 (:suffix ".spool")
@@ -811,12 +849,12 @@ This only works when `display-time' is enabled."
811 user (or (cdr (assoc from mail-source-password-cache)) 849 user (or (cdr (assoc from mail-source-password-cache))
812 password) buf) 850 password) buf)
813 (imap-mailbox-select mailbox nil buf)) 851 (imap-mailbox-select mailbox nil buf))
814 (let ((coding-system-for-write mail-source-imap-file-coding-system) 852 (let ((coding-system-for-write mail-source-imap-file-coding-system)
815 ;; Avoid converting 8-bit chars from inserted strings to
816 ;; multibyte.
817 default-enable-multibyte-characters
818 str) 853 str)
819 (with-temp-file mail-source-crash-box 854 (with-temp-file mail-source-crash-box
855 ;; Avoid converting 8-bit chars from inserted strings to
856 ;; multibyte.
857 (mm-disable-multibyte)
820 ;; remember password 858 ;; remember password
821 (with-current-buffer buf 859 (with-current-buffer buf
822 (when (or imap-password 860 (when (or imap-password