1 ;;; mail-source.el --- functions for fetching mail
3 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
4 ;; 2005 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 2, or (at your option)
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; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
33 (eval-when-compile (defvar display-time-mail-function)))
35 (autoload 'pop3-movemail "pop3")
36 (autoload 'pop3-get-message-count "pop3")
37 (autoload 'nnheader-cancel-timer "nnheader"))
38 (require 'format-spec)
40 (require 'message) ;; for `message-directory'
42 (defgroup mail-source nil
43 "The mail-fetching library."
47 ;; Define these at compile time to avoid dragging in imap always.
48 (defconst mail-source-imap-authenticators
51 (list 'const (car a)))
52 imap-authenticator-alist)))
53 (defconst mail-source-imap-streams
56 (list 'const (car a)))
59 (defcustom mail-sources nil
60 "*Where the mail backends will look for incoming mail.
61 This variable is a list of mail source specifiers.
62 See Info node `(gnus)Mail Source Specifiers'."
64 :link '(custom-manual "(gnus)Mail Source Specifiers")
66 (choice :format "%[Value Menu%] %v"
68 (cons :tag "Spool file"
69 (const :format "" file)
70 (checklist :tag "Options" :greedy t
72 (const :format "" :value :path)
74 (cons :tag "Several files in a directory"
75 (const :format "" directory)
76 (checklist :tag "Options" :greedy t
78 (const :format "" :value :path)
79 (directory :tag "Path"))
81 (const :format "" :value :suffix)
82 (string :tag "Suffix"))
84 (const :format "" :value :predicate)
85 (function :tag "Predicate"))
87 (const :format "" :value :prescript)
88 (choice :tag "Prescript"
91 (function :format "%v")))
93 (const :format "" :value :postscript)
94 (choice :tag "Postscript"
97 (function :format "%v")))
99 (const :format "" :value :plugged)
100 (boolean :tag "Plugged"))))
101 (cons :tag "POP3 server"
102 (const :format "" pop)
103 (checklist :tag "Options" :greedy t
105 (const :format "" :value :server)
106 (string :tag "Server"))
108 (const :format "" :value :port)
111 (integer :format "%v")
112 (string :format "%v")))
114 (const :format "" :value :user)
115 (string :tag "User"))
117 (const :format "" :value :password)
118 (string :tag "Password"))
120 (const :format "" :value :program)
121 (string :tag "Program"))
123 (const :format "" :value :prescript)
124 (choice :tag "Prescript"
126 (string :format "%v")
127 (function :format "%v")
128 (const :tag "None" nil)))
130 (const :format "" :value :postscript)
131 (choice :tag "Postscript"
133 (string :format "%v")
134 (function :format "%v")
135 (const :tag "None" nil)))
137 (const :format "" :value :function)
138 (function :tag "Function"))
141 :value :authentication)
142 (choice :tag "Authentication"
147 (const :format "" :value :plugged)
148 (boolean :tag "Plugged"))
150 (const :format "" :value :stream)
151 (choice :tag "Stream"
153 (const :tag "Clear" nil)
155 (const :tag "SSL/TLS" ssl)))))
156 (cons :tag "Maildir (qmail, postfix...)"
157 (const :format "" maildir)
158 (checklist :tag "Options" :greedy t
160 (const :format "" :value :path)
161 (directory :tag "Path"))
163 (const :format "" :value :plugged)
164 (boolean :tag "Plugged"))))
165 (cons :tag "IMAP server"
166 (const :format "" imap)
167 (checklist :tag "Options" :greedy t
169 (const :format "" :value :server)
170 (string :tag "Server"))
172 (const :format "" :value :port)
177 (const :format "" :value :user)
178 (string :tag "User"))
180 (const :format "" :value :password)
181 (string :tag "Password"))
183 (const :format "" :value :stream)
184 (choice :tag "Stream"