1 ;;; mail-source.el --- functions for fetching mail
3 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
4 ;; 2008, 2009, 2010 Free Software Foundation, Inc.
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
7 ;; Keywords: news, mail
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
30 (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
32 (require 'format-spec)
36 (autoload 'auth-source-user-or-password "auth-source")
37 (autoload 'pop3-movemail "pop3")
38 (autoload 'pop3-get-message-count "pop3")
39 (autoload 'nnheader-cancel-timer "nnheader")
41 (require 'message) ;; for `message-directory'
43 (defvar display-time-mail-function)
45 (defgroup mail-source nil
46 "The mail-fetching library."
50 ;; Define these at compile time to avoid dragging in imap always.
51 (defconst mail-source-imap-authenticators
54 (list 'const (car a)))
55 imap-authenticator-alist)))
56 (defconst mail-source-imap-streams
59 (list 'const (car a)))
62 (defcustom mail-sources '((file))
63 "Where the mail backends will look for incoming mail.
64 This variable is a list of mail source specifiers.
65 See Info node `(gnus)Mail Source Specifiers'."
67 :version "23.1" ;; No Gnus
68 :link '(custom-manual "(gnus)Mail Source Specifiers")
70 (const :tag "None" nil)
72 (choice :format "%[Value Menu%] %v"
74 (cons :tag "Group parameter `mail-source'"
75 (const :format "" group))
76 (cons :tag "Spool file"
77 (const :format "" file)
78 (checklist :tag "Options" :greedy t
80 (const :format "" :value :path)
82 (cons :tag "Several files in a directory"
83 (const :format "" directory)
84 (checklist :tag "Options" :greedy t
86 (const :format "" :value :path)
87 (directory :tag "Path"))
89 (const :format "" :value :suffix)
90 (string :tag "Suffix"))
92 (const :format "" :value :predicate)
93 (function :tag "Predicate"))
95 (const :format "" :value :prescript)
96 (choice :tag "Prescript"
99 (function :format "%v")))
101 (const :format "" :value :postscript)
102 (choice :tag "Postscript"
104 (string :format "%v")
105 (function :format "%v")))
107 (const :format "" :value :plugged)
108 (boolean :tag "Plugged"))))
109 (cons :tag "POP3 server"
110 (const :format "" pop)
111 (checklist :tag "Options" :greedy t
113 (const :format "" :value :server)
114 (string :tag "Server"))
116 (const :format "" :value :port)
119 (integer :format "%v")
120 (string :format "%v")))
122 (const :format "" :value :user)
123 (string :tag "User"))
125 (const :format "" :value :password)
126 (string :tag "Password"))
128 (const :format "" :value :program)
129 (string :tag "Program"))
131 (const :format "" :value :prescript)
132 (choice :tag "Prescript"
134 (string :format "%v")
135 (function :format "%v")
136 (const :tag "None" nil)))
138 (const :format "" :value :postscript)
139 (choice :tag "Postscript"
141 (string :format "%v")
142 (function :format "%v")
143 (const :tag "None" nil)))
145 (const :format "" :value :function)
146 (function :tag "Function"))
149 :value :authentication)
150 (choice :tag "Authentication"
155 (const :format "" :value :plugged)
156 (boolean :tag "Plugged"))
158 (const :format "" :value :stream)
159 (choice :tag "Stream"
161 (const :tag "Clear" nil)
163 (const :tag "SSL/TLS" ssl)))))
164 (cons :tag "Maildir (qmail, postfix...)"
165 (const :format "" maildir)
166 (checklist :tag "Options" :greedy t
168 (const :format "" :value :path)
169 (directory :tag "Path"))
171 (const :format "" :value :plugged)
172 (boolean :tag "Plugged"))))
173 (cons :tag "IMAP server"
174 (const :format "" imap)
175 (checklist :tag "Options" :greedy t
177 (const :format "" :value :server)
178 (string :tag "Server"))
180 (const :format "" :value :port)
185 (const :format "" :value :user)
186 (string :tag "User"))
188 (const :format "" :value :password)
189 (string :tag "Password"))
191 (const :format "" :value :stream)
192 (choice :tag "Stream"
194 ,@mail-source-imap-streams))
196 (const :format "" :value :program)
197 (string :tag "Program"))
200 :value :authenticator)