annotate lisp/gnus/mail-source.el @ 37117:17b120bee51b

*** empty log message ***
author Kenichi Handa <handa@m17n.org>
date Sat, 31 Mar 2001 02:22:45 +0000
parents e06db3b8e558
children a26d9b55abb6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1 ;;; mail-source.el --- functions for fetching mail
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
2 ;; Copyright (C) 1999, 2000 Free Software Foundation, Inc.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
3
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
5 ;; Keywords: news, mail
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
6
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
8
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
11 ;; the Free Software Foundation; either version 2, or (at your option)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
12 ;; any later version.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
13
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
17 ;; GNU General Public License for more details.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
18
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
22 ;; Boston, MA 02111-1307, USA.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
23
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
24 ;;; Commentary:
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
25
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
26 ;;; Code:
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
27
32918
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
28 (eval-when-compile
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
29 (require 'cl)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
30 (require 'imap)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
31 (eval-when-compile (defvar display-time-mail-function)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
32 (eval-and-compile
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
33 (autoload 'pop3-movemail "pop3")
32918
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
34 (autoload 'pop3-get-message-count "pop3")
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
35 (autoload 'nnheader-cancel-timer "nnheader"))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
36 (require 'format-spec)
32918
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
37 (require 'mm-util)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
38
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
39 (defgroup mail-source nil
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
40 "The mail-fetching library."
31764
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
41 :version "21.1"
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
42 :group 'gnus)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
43
32918
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
44 ;; Define these at compile time to avoid dragging in imap always.
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
45 (defconst mail-source-imap-authenticators
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
46 (eval-when-compile
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
47 (mapcar (lambda (a)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
48 (list 'const (car a)))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
49 imap-authenticator-alist)))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
50 (defconst mail-source-imap-streams
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
51 (eval-when-compile
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
52 (mapcar (lambda (a)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
53 (list 'const (car a)))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
54 imap-stream-alist)))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
55
32102
e5f46972a7c8 2000-10-03 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 31784
diff changeset
56 (defcustom mail-sources nil
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
57 "*Where the mail backends will look for incoming mail.
31764
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
58 This variable is a list of mail source specifiers.
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
59 See Info node `(gnus)Mail Source Specifiers'."
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
60 :group 'mail-source
31764
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
61 :type `(repeat
32918
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
62 (choice :format "%[Value Menu%] %v"
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
63 :value (file)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
64 (cons :tag "Spool file"
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
65 (const :format "" file)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
66 (checklist :tag "Options" :greedy t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
67 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
68 (const :format "" :value :path)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
69 file)))
31764
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
70 (cons :tag "Several files in a directory"
32918
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
71 (const :format "" directory)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
72 (checklist :tag "Options" :greedy t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
73 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
74 (const :format "" :value :path)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
75 (directory :tag "Path"))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
76 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
77 (const :format "" :value :suffix)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
78 (string :tag "Suffix"))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
79 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
80 (const :format "" :value :predicate)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
81 (function :tag "Predicate"))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
82 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
83 (const :format "" :value :prescript)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
84 (string :tag "Prescript"))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
85 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
86 (const :format "" :value :postscript)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
87 (string :tag "Postscript"))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
88 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
89 (const :format "" :value :plugged)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
90 (boolean :tag "Plugged"))))
31764
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
91 (cons :tag "POP3 server"
32918
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
92 (const :format "" pop)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
93 (checklist :tag "Options" :greedy t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
94 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
95 (const :format "" :value :server)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
96 (string :tag "Server"))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
97 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
98 (const :format "" :value :port)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
99 (choice :tag "Port"
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
100 :value "pop3"
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
101 (number :format "%v")
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
102 (string :format "%v")))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
103 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
104 (const :format "" :value :user)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
105 (string :tag "User"))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
106 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
107 (const :format "" :value :password)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
108 (string :tag "Password"))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
109 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
110 (const :format "" :value :program)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
111 (string :tag "Program"))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
112 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
113 (const :format "" :value :prescript)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
114 (string :tag "Prescript"))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
115 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
116 (const :format "" :value :postscript)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
117 (string :tag "Postscript"))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
118 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
119 (const :format "" :value :function)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
120 (function :tag "Function"))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
121 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
122 (const :format ""
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
123 :value :authentication)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
124 (choice :tag "Authentication"
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
125 :value apop
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
126 (const password)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
127 (const apop)))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
128 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
129 (const :format "" :value :plugged)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
130 (boolean :tag "Plugged"))))
31764
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
131 (cons :tag "Maildir (qmail, postfix...)"
32918
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
132 (const :format "" maildir)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
133 (checklist :tag "Options" :greedy t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
134 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
135 (const :format "" :value :path)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
136 (directory :tag "Path"))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
137 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
138 (const :format "" :value :plugged)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
139 (boolean :tag "Plugged"))))
31764
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
140 (cons :tag "IMAP server"
32918
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
141 (const :format "" imap)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
142 (checklist :tag "Options" :greedy t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
143 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
144 (const :format "" :value :server)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
145 (string :tag "Server"))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
146 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
147 (const :format "" :value :port)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
148 (choice :tag "Port"
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
149 :value 143
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
150 number string))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
151 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
152 (const :format "" :value :user)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
153 (string :tag "User"))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
154 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
155 (const :format "" :value :password)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
156 (string :tag "Password"))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
157 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
158 (const :format "" :value :stream)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
159 (choice :tag "Stream"
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
160 :value network
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
161 ,@mail-source-imap-streams))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
162 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
163 (const :format ""
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
164 :value :authenticator)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
165 (choice :tag "Authenticator"
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
166 :value login
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
167 ,@mail-source-imap-authenticators))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
168 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
169 (const :format "" :value :mailbox)
32961
5357dbf00515 2000-10-26 Simon Josefsson <sj@extundo.com>
Dave Love <fx@gnu.org>
parents: 32918
diff changeset
170 (string :tag "Mailbox"
5357dbf00515 2000-10-26 Simon Josefsson <sj@extundo.com>
Dave Love <fx@gnu.org>
parents: 32918
diff changeset
171 :value "INBOX"))
32918
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
172 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
173 (const :format "" :value :predicate)
32961
5357dbf00515 2000-10-26 Simon Josefsson <sj@extundo.com>
Dave Love <fx@gnu.org>
parents: 32918
diff changeset
174 (string :tag "Predicate"
5357dbf00515 2000-10-26 Simon Josefsson <sj@extundo.com>
Dave Love <fx@gnu.org>
parents: 32918
diff changeset
175 :value "UNSEEN UNDELETED"))
32918
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
176 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
177 (const :format "" :value :fetchflag)
32961
5357dbf00515 2000-10-26 Simon Josefsson <sj@extundo.com>
Dave Love <fx@gnu.org>
parents: 32918
diff changeset
178 (string :tag "Fetchflag"
5357dbf00515 2000-10-26 Simon Josefsson <sj@extundo.com>
Dave Love <fx@gnu.org>
parents: 32918
diff changeset
179 :value "\\Deleted"))
32918
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
180 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
181 (const :format ""
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
182 :value :dontexpunge)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
183 (boolean :tag "Dontexpunge"))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
184 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
185 (const :format "" :value :plugged)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
186 (boolean :tag "Plugged"))))
31764
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
187 (cons :tag "Webmail server"
32918
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
188 (const :format "" webmail)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
189 (checklist :tag "Options" :greedy t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
190 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
191 (const :format "" :value :subtype)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
192 ;; Should be generated from
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
193 ;; `webmail-type-definition', but we
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
194 ;; can't require webmail without W3.
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
195 (choice :tag "Subtype"
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
196 :value hotmail
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
197 (const hotmail)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
198 (const yahoo)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
199 (const netaddress)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
200 (const netscape)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
201 (const my-deja)))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
202 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
203 (const :format "" :value :user)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
204 (string :tag "User"))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
205 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
206 (const :format "" :value :password)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
207 (string :tag "Password"))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
208 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
209 (const :format ""
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
210 :value :dontexpunge)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
211 (boolean :tag "Dontexpunge"))
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
212 (group :inline t
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
213 (const :format "" :value :plugged)
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
214 (boolean :tag "Plugged")))))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
215
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
216 (defcustom mail-source-primary-source nil
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
217 "*Primary source for incoming mail.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
218 If non-nil, this maildrop will be checked periodically for new mail."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
219 :group 'mail-source
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
220 :type 'sexp)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
221
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
222 (defcustom mail-source-crash-box "~/.emacs-mail-crash-box"
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
223 "File where mail will be stored while processing it."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
224 :group 'mail-source
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
225 :type 'file)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
226
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
227 (defcustom mail-source-directory "~/Mail/"
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
228 "Directory where files (if any) will be stored."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
229 :group 'mail-source
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
230 :type 'directory)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
231
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
232 (defcustom mail-source-default-file-modes 384
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
233 "Set the mode bits of all new mail files to this integer."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
234 :group 'mail-source
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
235 :type 'integer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
236
31784
33d474f4b866 (mail-source-delete-incoming): Set to t, assuming
Dave Love <fx@gnu.org>
parents: 31764
diff changeset
237 (defcustom mail-source-delete-incoming t
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
238 "*If non-nil, delete incoming files after handling."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
239 :group 'mail-source
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
240 :type 'boolean)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
241
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
242 (defcustom mail-source-incoming-file-prefix "Incoming"
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
243 "Prefix for file name for storing incoming mail"
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
244 :group 'mail-source
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
245 :type 'string)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
246
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
247 (defcustom mail-source-report-new-mail-interval 5
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
248 "Interval in minutes between checks for new mail."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
249 :group 'mail-source
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
250 :type 'number)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
251
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
252 (defcustom mail-source-idle-time-delay 5
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
253 "Number of idle seconds to wait before checking for new mail."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
254 :group 'mail-source
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
255 :type 'number)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
256
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
257 ;;; Internal variables.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
258
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
259 (defvar mail-source-string ""
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
260 "A dynamically bound string that says what the current mail source is.")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
261
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
262 (defvar mail-source-new-mail-available nil
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
263 "Flag indicating when new mail is available.")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
264
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
265 (eval-and-compile
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
266 (defvar mail-source-common-keyword-map
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
267 '((:plugged))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
268 "Mapping from keywords to default values.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
269 Common keywords should be listed here.")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
270
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
271 (defvar mail-source-keyword-map
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
272 '((file
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
273 (:prescript)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
274 (:prescript-delay)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
275 (:postscript)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
276 (:path (or (getenv "MAIL")
32918
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
277 (expand-file-name (user-login-name) rmail-spool-directory))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
278 (directory
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
279 (:path)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
280 (:suffix ".spool")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
281 (:predicate identity))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
282 (pop
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
283 (:prescript)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
284 (:prescript-delay)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
285 (:postscript)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
286 (:server (getenv "MAILHOST"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
287 (:port 110)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
288 (:user (or (user-login-name) (getenv "LOGNAME") (getenv "USER")))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
289 (:program)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
290 (:function)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
291 (:password)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
292 (:authentication password))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
293 (maildir
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
294 (:path (or (getenv "MAILDIR") "~/Maildir/"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
295 (:subdirs ("new" "cur"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
296 (:function))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
297 (imap
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
298 (:server (getenv "MAILHOST"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
299 (:port)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
300 (:stream)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
301 (:authentication)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
302 (:user (or (user-login-name) (getenv "LOGNAME") (getenv "USER")))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
303 (:password)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
304 (:mailbox "INBOX")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
305 (:predicate "UNSEEN UNDELETED")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
306 (:fetchflag "\\Deleted")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
307 (:dontexpunge))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
308 (webmail
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
309 (:subtype hotmail)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
310 (:user (or (user-login-name) (getenv "LOGNAME") (getenv "USER")))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
311 (:password)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
312 (:dontexpunge)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
313 (:authentication password)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
314 "Mapping from keywords to default values.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
315 All keywords that can be used must be listed here."))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
316
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
317 (defvar mail-source-fetcher-alist
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
318 '((file mail-source-fetch-file)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
319 (directory mail-source-fetch-directory)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
320 (pop mail-source-fetch-pop)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
321 (maildir mail-source-fetch-maildir)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
322 (imap mail-source-fetch-imap)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
323 (webmail mail-source-fetch-webmail))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
324 "A mapping from source type to fetcher function.")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
325
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
326 (defvar mail-source-password-cache nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
327
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
328 (defvar mail-source-plugged t)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
329
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
330 ;;; Functions
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
331
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
332 (eval-and-compile
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
333 (defun mail-source-strip-keyword (keyword)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
334 "Strip the leading colon off the KEYWORD."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
335 (intern (substring (symbol-name keyword) 1))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
336
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
337 (eval-and-compile
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
338 (defun mail-source-bind-1 (type)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
339 (let* ((defaults (cdr (assq type mail-source-keyword-map)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
340 default bind)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
341 (while (setq default (pop defaults))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
342 (push (list (mail-source-strip-keyword (car default))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
343 nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
344 bind))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
345 bind)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
346
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
347 (defmacro mail-source-bind (type-source &rest body)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
348 "Return a `let' form that binds all variables in source TYPE.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
349 TYPE-SOURCE is a list where the first element is the TYPE, and
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
350 the second variable is the SOURCE.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
351 At run time, the mail source specifier SOURCE will be inspected,
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
352 and the variables will be set according to it. Variables not
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
353 specified will be given default values.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
354
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
355 After this is done, BODY will be executed in the scope
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
356 of the `let' form.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
357
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
358 The variables bound and their default values are described by
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
359 the `mail-source-keyword-map' variable."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
360 `(let ,(mail-source-bind-1 (car type-source))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
361 (mail-source-set-1 ,(cadr type-source))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
362 ,@body))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
363
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
364 (put 'mail-source-bind 'lisp-indent-function 1)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
365 (put 'mail-source-bind 'edebug-form-spec '(form body))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
366
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
367 (defun mail-source-set-1 (source)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
368 (let* ((type (pop source))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
369 (defaults (cdr (assq type mail-source-keyword-map)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
370 default value keyword)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
371 (while (setq default (pop defaults))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
372 (set (mail-source-strip-keyword (setq keyword (car default)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
373 (if (setq value (plist-get source keyword))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
374 (mail-source-value value)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
375 (mail-source-value (cadr default)))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
376
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
377 (eval-and-compile
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
378 (defun mail-source-bind-common-1 ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
379 (let* ((defaults mail-source-common-keyword-map)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
380 default bind)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
381 (while (setq default (pop defaults))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
382 (push (list (mail-source-strip-keyword (car default))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
383 nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
384 bind))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
385 bind)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
386
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
387 (defun mail-source-set-common-1 (source)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
388 (let* ((type (pop source))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
389 (defaults mail-source-common-keyword-map)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
390 (defaults-1 (cdr (assq type mail-source-keyword-map)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
391 default value keyword)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
392 (while (setq default (pop defaults))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
393 (set (mail-source-strip-keyword (setq keyword (car default)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
394 (if (setq value (plist-get source keyword))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
395 (mail-source-value value)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
396 (if (setq value (assq keyword defaults-1))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
397 (mail-source-value (cadr value))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
398 (mail-source-value (cadr default))))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
399
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
400 (defmacro mail-source-bind-common (source &rest body)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
401 "Return a `let' form that binds all common variables.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
402 See `mail-source-bind'."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
403 `(let ,(mail-source-bind-common-1)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
404 (mail-source-set-common-1 source)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
405 ,@body))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
406
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
407 (put 'mail-source-bind-common 'lisp-indent-function 1)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
408 (put 'mail-source-bind-common 'edebug-form-spec '(form body))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
409
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
410 (defun mail-source-value (value)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
411 "Return the value of VALUE."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
412 (cond
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
413 ;; String
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
414 ((stringp value)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
415 value)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
416 ;; Function
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
417 ((and (listp value)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
418 (functionp (car value)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
419 (eval value))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
420 ;; Just return the value.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
421 (t
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
422 value)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
423
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
424 (defun mail-source-fetch (source callback)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
425 "Fetch mail from SOURCE and call CALLBACK zero or more times.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
426 CALLBACK will be called with the name of the file where (some of)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
427 the mail from SOURCE is put.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
428 Return the number of files that were found."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
429 (mail-source-bind-common source
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
430 (if (or mail-source-plugged plugged)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
431 (save-excursion
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
432 (let ((function (cadr (assq (car source) mail-source-fetcher-alist)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
433 (found 0))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
434 (unless function
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
435 (error "%S is an invalid mail source specification" source))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
436 ;; If there's anything in the crash box, we do it first.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
437 (when (file-exists-p mail-source-crash-box)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
438 (message "Processing mail from %s..." mail-source-crash-box)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
439 (setq found (mail-source-callback
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
440 callback mail-source-crash-box)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
441 (+ found
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
442 (condition-case err
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
443 (funcall function source callback)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
444 (error
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
445 (unless (yes-or-no-p
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
446 (format "Mail source error (%s). Continue? " err))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
447 (error "Cannot get new mail."))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
448 0))))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
449
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
450 (defun mail-source-make-complex-temp-name (prefix)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
451 (let ((newname (make-temp-name prefix))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
452 (newprefix prefix))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
453 (while (file-exists-p newname)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
454 (setq newprefix (concat newprefix "x"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
455 (setq newname (make-temp-name newprefix)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
456 newname))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
457
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
458 (defun mail-source-callback (callback info)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
459 "Call CALLBACK on the mail file, and then remove the mail file.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
460 Pass INFO on to CALLBACK."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
461 (if (or (not (file-exists-p mail-source-crash-box))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
462 (zerop (nth 7 (file-attributes mail-source-crash-box))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
463 (progn
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
464 (when (file-exists-p mail-source-crash-box)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
465 (delete-file mail-source-crash-box))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
466 0)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
467 (prog1
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
468 (funcall callback mail-source-crash-box info)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
469 (when (file-exists-p mail-source-crash-box)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
470 ;; Delete or move the incoming mail out of the way.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
471 (if mail-source-delete-incoming
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
472 (delete-file mail-source-crash-box)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
473 (let ((incoming
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
474 (mail-source-make-complex-temp-name
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
475 (expand-file-name
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
476 mail-source-incoming-file-prefix
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
477 mail-source-directory))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
478 (unless (file-exists-p (file-name-directory incoming))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
479 (make-directory (file-name-directory incoming) t))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
480 (rename-file mail-source-crash-box incoming t)))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
481
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
482 (defun mail-source-movemail (from to)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
483 "Move FROM to TO using movemail."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
484 (if (not (file-writable-p to))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
485 (error "Can't write to crash box %s. Not moving mail" to)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
486 (let ((to (file-truename (expand-file-name to)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
487 errors result)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
488 (setq to (file-truename to)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
489 from (file-truename from))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
490 ;; Set TO if have not already done so, and rename or copy
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
491 ;; the file FROM to TO if and as appropriate.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
492 (cond
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
493 ((file-exists-p to)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
494 ;; The crash box exists already.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
495 t)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
496 ((not (file-exists-p from))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
497 ;; There is no inbox.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
498 (setq to nil))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
499 ((zerop (nth 7 (file-attributes from)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
500 ;; Empty file.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
501 (setq to nil))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
502 (t
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
503 ;; If getting from mail spool directory, use movemail to move
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
504 ;; rather than just renaming, so as to interlock with the
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
505 ;; mailer.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
506 (unwind-protect
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
507 (save-excursion
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
508 (setq errors (generate-new-buffer " *mail source loss*"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
509 (let ((default-directory "/"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
510 (setq result
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
511 (apply
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
512 'call-process
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
513 (append
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
514 (list
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
515 (expand-file-name "movemail" exec-directory)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
516 nil errors nil from to)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
517 (when (file-exists-p to)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
518 (set-file-modes to mail-source-default-file-modes))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
519 (if (and (not (buffer-modified-p errors))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
520 (zerop result))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
521 ;; No output => movemail won.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
522 t
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
523 (set-buffer errors)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
524 ;; There may be a warning about older revisions. We
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
525 ;; ignore that.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
526 (goto-char (point-min))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
527 (if (search-forward "older revision" nil t)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
528 t
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
529 ;; Probably a real error.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
530 (subst-char-in-region (point-min) (point-max) ?\n ?\ )
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
531 (goto-char (point-max))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
532 (skip-chars-backward " \t")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
533 (delete-region (point) (point-max))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
534 (goto-char (point-min))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
535 (when (looking-at "movemail: ")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
536 (delete-region (point-min) (match-end 0)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
537 (unless (yes-or-no-p
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
538 (format "movemail: %s (%d return). Continue? "
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
539 (buffer-string) result))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
540 (error "%s" (buffer-string)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
541 (setq to nil)))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
542 (when (and errors
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
543 (buffer-name errors))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
544 (kill-buffer errors))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
545 ;; Return whether we moved successfully or not.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
546 to)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
547
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
548 (defun mail-source-movemail-and-remove (from to)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
549 "Move FROM to TO using movemail, then remove FROM if empty."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
550 (or (not (mail-source-movemail from to))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
551 (not (zerop (nth 7 (file-attributes from))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
552 (delete-file from)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
553
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
554 (defvar mail-source-read-passwd nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
555 (defun mail-source-read-passwd (prompt &rest args)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
556 "Read a password using PROMPT.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
557 If ARGS, PROMPT is used as an argument to `format'."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
558 (let ((prompt
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
559 (if args
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
560 (apply 'format prompt args)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
561 prompt)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
562 (unless mail-source-read-passwd
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
563 (if (or (fboundp 'read-passwd) (load "passwd" t))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
564 (setq mail-source-read-passwd 'read-passwd)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
565 (unless (fboundp 'ange-ftp-read-passwd)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
566 (autoload 'ange-ftp-read-passwd "ange-ftp"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
567 (setq mail-source-read-passwd 'ange-ftp-read-passwd)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
568 (funcall mail-source-read-passwd prompt)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
569
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
570 (defun mail-source-fetch-with-program (program)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
571 (zerop (call-process shell-file-name nil nil nil
31764
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
572 shell-command-switch program)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
573
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
574 (defun mail-source-run-script (script spec &optional delay)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
575 (when script
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
576 (if (and (symbolp script) (fboundp script))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
577 (funcall script)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
578 (mail-source-call-script
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
579 (format-spec script spec))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
580 (when delay
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
581 (sleep-for delay)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
582
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
583 (defun mail-source-call-script (script)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
584 (let ((background nil))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
585 (when (string-match "& *$" script)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
586 (setq script (substring script 0 (match-beginning 0))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
587 background 0))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
588 (call-process shell-file-name nil background nil
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
589 shell-command-switch script)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
590
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
591 ;;;
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
592 ;;; Different fetchers
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
593 ;;;
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
594
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
595 (defun mail-source-fetch-file (source callback)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
596 "Fetcher for single-file sources."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
597 (mail-source-bind (file source)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
598 (mail-source-run-script
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
599 prescript (format-spec-make ?t mail-source-crash-box)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
600 prescript-delay)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
601 (let ((mail-source-string (format "file:%s" path)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
602 (if (mail-source-movemail path mail-source-crash-box)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
603 (prog1
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
604 (mail-source-callback callback path)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
605 (mail-source-run-script
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
606 postscript (format-spec-make ?t mail-source-crash-box)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
607 0))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
608
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
609 (defun mail-source-fetch-directory (source callback)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
610 "Fetcher for directory sources."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
611 (mail-source-bind (directory source)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
612 (let ((found 0)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
613 (mail-source-string (format "directory:%s" path)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
614 (dolist (file (directory-files
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
615 path t (concat (regexp-quote suffix) "$")))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
616 (when (and (file-regular-p file)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
617 (funcall predicate file)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
618 (mail-source-movemail file mail-source-crash-box))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
619 (incf found (mail-source-callback callback file))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
620 found)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
621
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
622 (defun mail-source-fetch-pop (source callback)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
623 "Fetcher for single-file sources."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
624 (mail-source-bind (pop source)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
625 (mail-source-run-script
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
626 prescript
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
627 (format-spec-make ?p password ?t mail-source-crash-box
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
628 ?s server ?P port ?u user)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
629 prescript-delay)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
630 (let ((from (format "%s:%s:%s" server user port))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
631 (mail-source-string (format "pop:%s@%s" user server))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
632 result)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
633 (when (eq authentication 'password)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
634 (setq password
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
635 (or password
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
636 (cdr (assoc from mail-source-password-cache))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
637 (mail-source-read-passwd
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
638 (format "Password for %s at %s: " user server)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
639 (when server
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
640 (setenv "MAILHOST" server))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
641 (setq result
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
642 (cond
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
643 (program
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
644 (mail-source-fetch-with-program
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
645 (format-spec
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
646 program
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
647 (format-spec-make ?p password ?t mail-source-crash-box
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
648 ?s server ?P port ?u user))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
649 (function
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
650 (funcall function mail-source-crash-box))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
651 ;; The default is to use pop3.el.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
652 (t
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
653 (let ((pop3-password password)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
654 (pop3-maildrop user)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
655 (pop3-mailhost server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
656 (pop3-port port)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
657 (pop3-authentication-scheme
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
658 (if (eq authentication 'apop) 'apop 'pass)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
659 (save-excursion (pop3-movemail mail-source-crash-box))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
660 (if result
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
661 (progn
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
662 (when (eq authentication 'password)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
663 (unless (assoc from mail-source-password-cache)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
664 (push (cons from password) mail-source-password-cache)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
665 (prog1
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
666 (mail-source-callback callback server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
667 ;; Update display-time's mail flag, if relevant.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
668 (if (equal source mail-source-primary-source)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
669 (setq mail-source-new-mail-available nil))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
670 (mail-source-run-script
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
671 postscript
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
672 (format-spec-make ?p password ?t mail-source-crash-box
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
673 ?s server ?P port ?u user))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
674 ;; We nix out the password in case the error
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
675 ;; was because of a wrong password being given.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
676 (setq mail-source-password-cache
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
677 (delq (assoc from mail-source-password-cache)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
678 mail-source-password-cache))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
679 0))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
680
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
681 (defun mail-source-check-pop (source)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
682 "Check whether there is new mail."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
683 (mail-source-bind (pop source)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
684 (let ((from (format "%s:%s:%s" server user port))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
685 (mail-source-string (format "pop:%s@%s" user server))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
686 result)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
687 (when (eq authentication 'password)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
688 (setq password
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
689 (or password
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
690 (cdr (assoc from mail-source-password-cache))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
691 (mail-source-read-passwd
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
692 (format "Password for %s at %s: " user server))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
693 (unless (assoc from mail-source-password-cache)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
694 (push (cons from password) mail-source-password-cache)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
695 (when server
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
696 (setenv "MAILHOST" server))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
697 (setq result
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
698 (cond
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
699 ;; No easy way to check whether mail is waiting for these.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
700 (program)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
701 (function)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
702 ;; The default is to use pop3.el.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
703 (t
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
704 (let ((pop3-password password)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
705 (pop3-maildrop user)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
706 (pop3-mailhost server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
707 (pop3-port port)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
708 (pop3-authentication-scheme
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
709 (if (eq authentication 'apop) 'apop 'pass)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
710 (save-excursion (pop3-get-message-count))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
711 (if result
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
712 ;; Inform display-time that we have new mail.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
713 (setq mail-source-new-mail-available (> result 0))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
714 ;; We nix out the password in case the error
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
715 ;; was because of a wrong password being given.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
716 (setq mail-source-password-cache
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
717 (delq (assoc from mail-source-password-cache)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
718 mail-source-password-cache)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
719 result)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
720
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
721 (defun mail-source-new-mail-p ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
722 "Handler for `display-time' to indicate when new mail is available."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
723 ;; Only report flag setting; flag is updated on a different schedule.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
724 mail-source-new-mail-available)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
725
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
726
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
727 (defvar mail-source-report-new-mail nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
728 (defvar mail-source-report-new-mail-timer nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
729 (defvar mail-source-report-new-mail-idle-timer nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
730
32333
963ab34e3e60 (mail-source-fetch-imap): Bind
Dave Love <fx@gnu.org>
parents: 32102
diff changeset
731 (eval-when-compile
963ab34e3e60 (mail-source-fetch-imap): Bind
Dave Love <fx@gnu.org>
parents: 32102
diff changeset
732 (if (featurep 'xemacs)
963ab34e3e60 (mail-source-fetch-imap): Bind
Dave Love <fx@gnu.org>
parents: 32102
diff changeset
733 (require 'itimer)
963ab34e3e60 (mail-source-fetch-imap): Bind
Dave Love <fx@gnu.org>
parents: 32102
diff changeset
734 (require 'timer)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
735
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
736 (defun mail-source-start-idle-timer ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
737 ;; Start our idle timer if necessary, so we delay the check until the
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
738 ;; user isn't typing.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
739 (unless mail-source-report-new-mail-idle-timer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
740 (setq mail-source-report-new-mail-idle-timer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
741 (run-with-idle-timer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
742 mail-source-idle-time-delay
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
743 nil
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
744 (lambda ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
745 (setq mail-source-report-new-mail-idle-timer nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
746 (mail-source-check-pop mail-source-primary-source))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
747 ;; Since idle timers created when Emacs is already in the idle
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
748 ;; state don't get activated until Emacs _next_ becomes idle, we
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
749 ;; need to force our timer to be considered active now. We do
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
750 ;; this by being naughty and poking the timer internals directly
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
751 ;; (element 0 of the vector is nil if the timer is active).
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
752 (aset mail-source-report-new-mail-idle-timer 0 nil)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
753
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
754 (defun mail-source-report-new-mail (arg)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
755 "Toggle whether to report when new mail is available.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
756 This only works when `display-time' is enabled."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
757 (interactive "P")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
758 (if (not mail-source-primary-source)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
759 (error "Need to set `mail-source-primary-source' to check for new mail."))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
760 (let ((on (if (null arg)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
761 (not mail-source-report-new-mail)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
762 (> (prefix-numeric-value arg) 0))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
763 (setq mail-source-report-new-mail on)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
764 (and mail-source-report-new-mail-timer
32102
e5f46972a7c8 2000-10-03 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 31784
diff changeset
765 (nnheader-cancel-timer mail-source-report-new-mail-timer))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
766 (and mail-source-report-new-mail-idle-timer
32102
e5f46972a7c8 2000-10-03 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 31784
diff changeset
767 (nnheader-cancel-timer mail-source-report-new-mail-idle-timer))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
768 (setq mail-source-report-new-mail-timer nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
769 (setq mail-source-report-new-mail-idle-timer nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
770 (if on
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
771 (progn
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
772 (require 'time)
31764
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
773 ;; display-time-mail-function is an Emacs 21 feature.
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
774 (setq display-time-mail-function #'mail-source-new-mail-p)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
775 ;; Set up the main timer.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
776 (setq mail-source-report-new-mail-timer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
777 (run-at-time t (* 60 mail-source-report-new-mail-interval)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
778 #'mail-source-start-idle-timer))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
779 ;; When you get new mail, clear "Mail" from the mode line.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
780 (add-hook 'nnmail-post-get-new-mail-hook
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
781 'display-time-event-handler)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
782 (message "Mail check enabled"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
783 (setq display-time-mail-function nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
784 (remove-hook 'nnmail-post-get-new-mail-hook
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
785 'display-time-event-handler)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
786 (message "Mail check disabled"))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
787
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
788 (defun mail-source-fetch-maildir (source callback)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
789 "Fetcher for maildir sources."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
790 (mail-source-bind (maildir source)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
791 (let ((found 0)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
792 mail-source-string)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
793 (unless (string-match "/$" path)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
794 (setq path (concat path "/")))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
795 (dolist (subdir subdirs)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
796 (when (file-directory-p (concat path subdir))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
797 (setq mail-source-string (format "maildir:%s%s" path subdir))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
798 (dolist (file (directory-files (concat path subdir) t))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
799 (when (and (not (file-directory-p file))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
800 (not (if function
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
801 (funcall function file mail-source-crash-box)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
802 (let ((coding-system-for-write
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
803 mm-text-coding-system)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
804 (coding-system-for-read
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
805 mm-text-coding-system))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
806 (with-temp-file mail-source-crash-box
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
807 (insert-file-contents file)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
808 (goto-char (point-min))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
809 ;;; ;; Unix mail format
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
810 ;;; (unless (looking-at "\n*From ")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
811 ;;; (insert "From maildir "
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
812 ;;; (current-time-string) "\n"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
813 ;;; (while (re-search-forward "^From " nil t)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
814 ;;; (replace-match ">From "))
32333
963ab34e3e60 (mail-source-fetch-imap): Bind
Dave Love <fx@gnu.org>
parents: 32102
diff changeset
815 ;;; (goto-char (point-max))
963ab34e3e60 (mail-source-fetch-imap): Bind
Dave Love <fx@gnu.org>
parents: 32102
diff changeset
816 ;;; (insert "\n\n")
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
817 ;; MMDF mail format
32333
963ab34e3e60 (mail-source-fetch-imap): Bind
Dave Love <fx@gnu.org>
parents: 32102
diff changeset
818 (insert "\001\001\001\001\n"))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
819 (delete-file file)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
820 (incf found (mail-source-callback callback file))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
821 found)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
822
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
823 (eval-and-compile
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
824 (autoload 'imap-open "imap")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
825 (autoload 'imap-authenticate "imap")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
826 (autoload 'imap-mailbox-select "imap")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
827 (autoload 'imap-mailbox-unselect "imap")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
828 (autoload 'imap-mailbox-close "imap")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
829 (autoload 'imap-search "imap")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
830 (autoload 'imap-fetch "imap")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
831 (autoload 'imap-close "imap")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
832 (autoload 'imap-error-text "imap")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
833 (autoload 'imap-message-flags-add "imap")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
834 (autoload 'imap-list-to-message-set "imap")
32102
e5f46972a7c8 2000-10-03 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 31784
diff changeset
835 (autoload 'imap-range-to-message-set "imap")
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
836 (autoload 'nnheader-ms-strip-cr "nnheader"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
837
32102
e5f46972a7c8 2000-10-03 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 31784
diff changeset
838 (defvar mail-source-imap-file-coding-system 'binary
e5f46972a7c8 2000-10-03 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 31784
diff changeset
839 "Coding system for the crashbox made by `mail-source-fetch-imap'.")
e5f46972a7c8 2000-10-03 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 31784
diff changeset
840
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
841 (defun mail-source-fetch-imap (source callback)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
842 "Fetcher for imap sources."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
843 (mail-source-bind (imap source)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
844 (let ((from (format "%s:%s:%s" server user port))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
845 (found 0)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
846 (buf (get-buffer-create (generate-new-buffer-name " *imap source*")))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
847 (mail-source-string (format "imap:%s:%s" server mailbox))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
848 remove)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
849 (if (and (imap-open server port stream authentication buf)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
850 (imap-authenticate
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
851 user (or (cdr (assoc from mail-source-password-cache))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
852 password) buf)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
853 (imap-mailbox-select mailbox nil buf))
32918
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
854 (let ((coding-system-for-write mail-source-imap-file-coding-system)
32333
963ab34e3e60 (mail-source-fetch-imap): Bind
Dave Love <fx@gnu.org>
parents: 32102
diff changeset
855 str)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
856 (with-temp-file mail-source-crash-box
32918
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
857 ;; Avoid converting 8-bit chars from inserted strings to
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
858 ;; multibyte.
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
859 (mm-disable-multibyte)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
860 ;; remember password
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
861 (with-current-buffer buf
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
862 (when (or imap-password
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
863 (assoc from mail-source-password-cache))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
864 (push (cons from imap-password) mail-source-password-cache)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
865 ;; if predicate is nil, use all uids
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
866 (dolist (uid (imap-search (or predicate "1:*") buf))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
867 (when (setq str (imap-fetch uid "RFC822.PEEK" 'RFC822 nil buf))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
868 (push uid remove)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
869 (insert "From imap " (current-time-string) "\n")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
870 (save-excursion
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
871 (insert str "\n\n"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
872 (while (re-search-forward "^From " nil t)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
873 (replace-match ">From "))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
874 (goto-char (point-max))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
875 (nnheader-ms-strip-cr))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
876 (incf found (mail-source-callback callback server))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
877 (when (and remove fetchflag)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
878 (imap-message-flags-add
32102
e5f46972a7c8 2000-10-03 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 31784
diff changeset
879 (imap-range-to-message-set (gnus-compress-sequence remove))
e5f46972a7c8 2000-10-03 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 31784
diff changeset
880 fetchflag nil buf))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
881 (if dontexpunge
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
882 (imap-mailbox-unselect buf)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
883 (imap-mailbox-close buf))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
884 (imap-close buf))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
885 (imap-close buf)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
886 ;; We nix out the password in case the error
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
887 ;; was because of a wrong password being given.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
888 (setq mail-source-password-cache
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
889 (delq (assoc from mail-source-password-cache)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
890 mail-source-password-cache))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
891 (error (imap-error-text buf)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
892 (kill-buffer buf)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
893 found)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
894
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
895 (eval-and-compile
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
896 (autoload 'webmail-fetch "webmail"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
897
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
898 (defun mail-source-fetch-webmail (source callback)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
899 "Fetch for webmail source."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
900 (mail-source-bind (webmail source)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
901 (let ((mail-source-string (format "webmail:%s:%s" subtype user))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
902 (webmail-newmail-only dontexpunge)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
903 (webmail-move-to-trash-can (not dontexpunge)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
904 (when (eq authentication 'password)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
905 (setq password
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
906 (or password
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
907 (cdr (assoc (format "webmail:%s:%s" subtype user)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
908 mail-source-password-cache))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
909 (mail-source-read-passwd
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
910 (format "Password for %s at %s: " user subtype))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
911 (when (and password
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
912 (not (assoc (format "webmail:%s:%s" subtype user)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
913 mail-source-password-cache)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
914 (push (cons (format "webmail:%s:%s" subtype user) password)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
915 mail-source-password-cache)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
916 (webmail-fetch mail-source-crash-box subtype user password)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
917 (mail-source-callback callback (symbol-name subtype)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
918
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
919 (provide 'mail-source)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
920
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
921 ;;; mail-source.el ends here