annotate lisp/gnus/mail-source.el @ 52697:be2a2142ad3d

*** empty log message ***
author Nick Roberts <nickrob@snap.net.nz>
date Tue, 30 Sep 2003 17:55:08 +0000
parents 695cf19ef79e
children 55fd4f77387a 0fde48feb604 375f2633d815
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
43421
a949c187ce13 * mail-source.el (mail-source-fetch-directory): Run scripts.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 38413
diff changeset
2 ;; Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
31717
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
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44075
diff changeset
95 (const :format "" :value :server)
32918
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
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44075
diff changeset
98 (const :format "" :value :port)
32918
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
99 (choice :tag "Port"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44075
diff changeset
100 :value "pop3"
32918
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
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44075
diff changeset
122 (const :format ""
32918
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)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44075
diff changeset
148 (choice :tag "Port"
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44075
diff changeset
149 :value 143
32918
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)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44075
diff changeset
174 (string :tag "Predicate"
32961
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
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44075
diff changeset
190 (group :inline t
32918
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
43422
fa370bd262ee Patched a wrong location.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 43421
diff changeset
279 (:prescript)
fa370bd262ee Patched a wrong location.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 43421
diff changeset
280 (:prescript-delay)
fa370bd262ee Patched a wrong location.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 43421
diff changeset
281 (:postscript)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
282 (:path)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
283 (:suffix ".spool")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
284 (:predicate identity))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
285 (pop
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
286 (:prescript)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
287 (:prescript-delay)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
288 (:postscript)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
289 (:server (getenv "MAILHOST"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
290 (:port 110)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
291 (:user (or (user-login-name) (getenv "LOGNAME") (getenv "USER")))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
292 (:program)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
293 (:function)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
294 (:password)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
295 (:authentication password))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
296 (maildir
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
297 (:path (or (getenv "MAILDIR") "~/Maildir/"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
298 (:subdirs ("new" "cur"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
299 (:function))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
300 (imap
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
301 (:server (getenv "MAILHOST"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
302 (:port)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
303 (:stream)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
304 (:authentication)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
305 (:user (or (user-login-name) (getenv "LOGNAME") (getenv "USER")))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
306 (:password)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
307 (:mailbox "INBOX")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
308 (:predicate "UNSEEN UNDELETED")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
309 (:fetchflag "\\Deleted")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
310 (:dontexpunge))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
311 (webmail
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
312 (:subtype hotmail)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
313 (:user (or (user-login-name) (getenv "LOGNAME") (getenv "USER")))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
314 (:password)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
315 (:dontexpunge)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
316 (:authentication password)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
317 "Mapping from keywords to default values.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
318 All keywords that can be used must be listed here."))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
319
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
320 (defvar mail-source-fetcher-alist
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
321 '((file mail-source-fetch-file)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
322 (directory mail-source-fetch-directory)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
323 (pop mail-source-fetch-pop)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
324 (maildir mail-source-fetch-maildir)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
325 (imap mail-source-fetch-imap)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
326 (webmail mail-source-fetch-webmail))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
327 "A mapping from source type to fetcher function.")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
328
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
329 (defvar mail-source-password-cache nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
330
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
331 (defvar mail-source-plugged t)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
332
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
333 ;;; Functions
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
334
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
335 (eval-and-compile
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
336 (defun mail-source-strip-keyword (keyword)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
337 "Strip the leading colon off the KEYWORD."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
338 (intern (substring (symbol-name keyword) 1))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
339
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
340 (eval-and-compile
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
341 (defun mail-source-bind-1 (type)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
342 (let* ((defaults (cdr (assq type mail-source-keyword-map)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
343 default bind)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
344 (while (setq default (pop defaults))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
345 (push (list (mail-source-strip-keyword (car default))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
346 nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
347 bind))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
348 bind)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
349
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
350 (defmacro mail-source-bind (type-source &rest body)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
351 "Return a `let' form that binds all variables in source TYPE.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
352 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
353 the second variable is the SOURCE.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
354 At run time, the mail source specifier SOURCE will be inspected,
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
355 and the variables will be set according to it. Variables not
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
356 specified will be given default values.
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 After this is done, BODY will be executed in the scope
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
359 of the `let' form.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
360
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
361 The variables bound and their default values are described by
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
362 the `mail-source-keyword-map' variable."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
363 `(let ,(mail-source-bind-1 (car type-source))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
364 (mail-source-set-1 ,(cadr type-source))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
365 ,@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 (put 'mail-source-bind 'lisp-indent-function 1)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
368 (put 'mail-source-bind 'edebug-form-spec '(form body))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
369
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
370 (defun mail-source-set-1 (source)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
371 (let* ((type (pop source))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
372 (defaults (cdr (assq type mail-source-keyword-map)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
373 default value keyword)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
374 (while (setq default (pop defaults))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
375 (set (mail-source-strip-keyword (setq keyword (car default)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
376 (if (setq value (plist-get source keyword))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
377 (mail-source-value value)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
378 (mail-source-value (cadr default)))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
379
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
380 (eval-and-compile
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
381 (defun mail-source-bind-common-1 ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
382 (let* ((defaults mail-source-common-keyword-map)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
383 default bind)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
384 (while (setq default (pop defaults))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
385 (push (list (mail-source-strip-keyword (car default))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
386 nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
387 bind))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
388 bind)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
389
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
390 (defun mail-source-set-common-1 (source)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
391 (let* ((type (pop source))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
392 (defaults mail-source-common-keyword-map)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
393 (defaults-1 (cdr (assq type mail-source-keyword-map)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
394 default value keyword)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
395 (while (setq default (pop defaults))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
396 (set (mail-source-strip-keyword (setq keyword (car default)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
397 (if (setq value (plist-get source keyword))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
398 (mail-source-value value)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
399 (if (setq value (assq keyword defaults-1))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
400 (mail-source-value (cadr value))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
401 (mail-source-value (cadr default))))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
402
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
403 (defmacro mail-source-bind-common (source &rest body)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
404 "Return a `let' form that binds all common variables.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
405 See `mail-source-bind'."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
406 `(let ,(mail-source-bind-common-1)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
407 (mail-source-set-common-1 source)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
408 ,@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 (put 'mail-source-bind-common 'lisp-indent-function 1)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
411 (put 'mail-source-bind-common 'edebug-form-spec '(form body))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
412
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
413 (defun mail-source-value (value)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
414 "Return the value of VALUE."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
415 (cond
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
416 ;; String
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
417 ((stringp value)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
418 value)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
419 ;; Function
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
420 ((and (listp value)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
421 (functionp (car value)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
422 (eval value))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
423 ;; Just return the value.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
424 (t
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
425 value)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
426
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
427 (defun mail-source-fetch (source callback)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
428 "Fetch mail from SOURCE and call CALLBACK zero or more times.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
429 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
430 the mail from SOURCE is put.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
431 Return the number of files that were found."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
432 (mail-source-bind-common source
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
433 (if (or mail-source-plugged plugged)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
434 (save-excursion
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
435 (let ((function (cadr (assq (car source) mail-source-fetcher-alist)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
436 (found 0))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
437 (unless function
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
438 (error "%S is an invalid mail source specification" source))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
439 ;; If there's anything in the crash box, we do it first.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
440 (when (file-exists-p mail-source-crash-box)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
441 (message "Processing mail from %s..." mail-source-crash-box)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
442 (setq found (mail-source-callback
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
443 callback mail-source-crash-box)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
444 (+ found
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
445 (condition-case err
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
446 (funcall function source callback)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
447 (error
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
448 (unless (yes-or-no-p
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
449 (format "Mail source error (%s). Continue? " err))
38413
a26d9b55abb6 Some fixes to follow coding conventions in files from Gnus.
Pavel Janík <Pavel@Janik.cz>
parents: 33342
diff changeset
450 (error "Cannot get new mail"))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
451 0))))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
452
44075
7782e54757bb * mail-source.el (make-source-make-complex-temp-name): Use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 43422
diff changeset
453 (eval-and-compile
7782e54757bb * mail-source.el (make-source-make-complex-temp-name): Use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 43422
diff changeset
454 (if (fboundp 'make-temp-file)
7782e54757bb * mail-source.el (make-source-make-complex-temp-name): Use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 43422
diff changeset
455 (defalias 'mail-source-make-complex-temp-name 'make-temp-file)
7782e54757bb * mail-source.el (make-source-make-complex-temp-name): Use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 43422
diff changeset
456 (defun mail-source-make-complex-temp-name (prefix)
7782e54757bb * mail-source.el (make-source-make-complex-temp-name): Use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 43422
diff changeset
457 (let ((newname (make-temp-name prefix))
7782e54757bb * mail-source.el (make-source-make-complex-temp-name): Use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 43422
diff changeset
458 (newprefix prefix))
7782e54757bb * mail-source.el (make-source-make-complex-temp-name): Use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 43422
diff changeset
459 (while (file-exists-p newname)
7782e54757bb * mail-source.el (make-source-make-complex-temp-name): Use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 43422
diff changeset
460 (setq newprefix (concat newprefix "x"))
7782e54757bb * mail-source.el (make-source-make-complex-temp-name): Use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 43422
diff changeset
461 (setq newname (make-temp-name newprefix)))
7782e54757bb * mail-source.el (make-source-make-complex-temp-name): Use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 43422
diff changeset
462 newname))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
463
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
464 (defun mail-source-callback (callback info)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
465 "Call CALLBACK on the mail file, and then remove the mail file.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
466 Pass INFO on to CALLBACK."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
467 (if (or (not (file-exists-p mail-source-crash-box))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
468 (zerop (nth 7 (file-attributes mail-source-crash-box))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
469 (progn
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
470 (when (file-exists-p mail-source-crash-box)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
471 (delete-file mail-source-crash-box))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
472 0)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
473 (prog1
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
474 (funcall callback mail-source-crash-box info)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
475 (when (file-exists-p mail-source-crash-box)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
476 ;; Delete or move the incoming mail out of the way.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
477 (if mail-source-delete-incoming
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
478 (delete-file mail-source-crash-box)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
479 (let ((incoming
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
480 (mail-source-make-complex-temp-name
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
481 (expand-file-name
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
482 mail-source-incoming-file-prefix
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
483 mail-source-directory))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
484 (unless (file-exists-p (file-name-directory incoming))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
485 (make-directory (file-name-directory incoming) t))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
486 (rename-file mail-source-crash-box incoming t)))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
487
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
488 (defun mail-source-movemail (from to)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
489 "Move FROM to TO using movemail."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
490 (if (not (file-writable-p to))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
491 (error "Can't write to crash box %s. Not moving mail" to)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
492 (let ((to (file-truename (expand-file-name to)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
493 errors result)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
494 (setq to (file-truename to)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
495 from (file-truename from))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
496 ;; Set TO if have not already done so, and rename or copy
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
497 ;; the file FROM to TO if and as appropriate.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
498 (cond
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
499 ((file-exists-p to)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
500 ;; The crash box exists already.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
501 t)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
502 ((not (file-exists-p from))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
503 ;; There is no inbox.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
504 (setq to nil))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
505 ((zerop (nth 7 (file-attributes from)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
506 ;; Empty file.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
507 (setq to nil))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
508 (t
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
509 ;; If getting from mail spool directory, use movemail to move
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
510 ;; rather than just renaming, so as to interlock with the
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
511 ;; mailer.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
512 (unwind-protect
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
513 (save-excursion
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
514 (setq errors (generate-new-buffer " *mail source loss*"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
515 (let ((default-directory "/"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
516 (setq result
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
517 (apply
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
518 'call-process
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
519 (append
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
520 (list
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
521 (expand-file-name "movemail" exec-directory)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
522 nil errors nil from to)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
523 (when (file-exists-p to)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
524 (set-file-modes to mail-source-default-file-modes))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
525 (if (and (not (buffer-modified-p errors))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
526 (zerop result))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
527 ;; No output => movemail won.
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 (set-buffer errors)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
530 ;; There may be a warning about older revisions. We
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
531 ;; ignore that.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
532 (goto-char (point-min))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
533 (if (search-forward "older revision" nil t)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
534 t
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
535 ;; Probably a real error.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
536 (subst-char-in-region (point-min) (point-max) ?\n ?\ )
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
537 (goto-char (point-max))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
538 (skip-chars-backward " \t")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
539 (delete-region (point) (point-max))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
540 (goto-char (point-min))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
541 (when (looking-at "movemail: ")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
542 (delete-region (point-min) (match-end 0)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
543 (unless (yes-or-no-p
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
544 (format "movemail: %s (%d return). Continue? "
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
545 (buffer-string) result))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
546 (error "%s" (buffer-string)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
547 (setq to nil)))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
548 (when (and errors
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
549 (buffer-name errors))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
550 (kill-buffer errors))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
551 ;; Return whether we moved successfully or not.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
552 to)))
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 (defun mail-source-movemail-and-remove (from to)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
555 "Move FROM to TO using movemail, then remove FROM if empty."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
556 (or (not (mail-source-movemail from to))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
557 (not (zerop (nth 7 (file-attributes from))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
558 (delete-file from)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
559
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
560 (defvar mail-source-read-passwd nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
561 (defun mail-source-read-passwd (prompt &rest args)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
562 "Read a password using PROMPT.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
563 If ARGS, PROMPT is used as an argument to `format'."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
564 (let ((prompt
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
565 (if args
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
566 (apply 'format prompt args)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
567 prompt)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
568 (unless mail-source-read-passwd
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
569 (if (or (fboundp 'read-passwd) (load "passwd" t))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
570 (setq mail-source-read-passwd 'read-passwd)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
571 (unless (fboundp 'ange-ftp-read-passwd)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
572 (autoload 'ange-ftp-read-passwd "ange-ftp"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
573 (setq mail-source-read-passwd 'ange-ftp-read-passwd)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
574 (funcall mail-source-read-passwd prompt)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
575
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
576 (defun mail-source-fetch-with-program (program)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
577 (zerop (call-process shell-file-name nil nil nil
31764
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
578 shell-command-switch program)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
579
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
580 (defun mail-source-run-script (script spec &optional delay)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
581 (when script
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
582 (if (and (symbolp script) (fboundp script))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
583 (funcall script)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
584 (mail-source-call-script
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
585 (format-spec script spec))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
586 (when delay
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
587 (sleep-for delay)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
588
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
589 (defun mail-source-call-script (script)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
590 (let ((background nil))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
591 (when (string-match "& *$" script)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
592 (setq script (substring script 0 (match-beginning 0))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
593 background 0))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
594 (call-process shell-file-name nil background nil
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
595 shell-command-switch script)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
596
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
597 ;;;
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
598 ;;; Different fetchers
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
599 ;;;
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
600
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
601 (defun mail-source-fetch-file (source callback)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
602 "Fetcher for single-file sources."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
603 (mail-source-bind (file source)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
604 (mail-source-run-script
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
605 prescript (format-spec-make ?t mail-source-crash-box)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
606 prescript-delay)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
607 (let ((mail-source-string (format "file:%s" path)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
608 (if (mail-source-movemail path mail-source-crash-box)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
609 (prog1
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
610 (mail-source-callback callback path)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
611 (mail-source-run-script
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
612 postscript (format-spec-make ?t mail-source-crash-box)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
613 0))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
614
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
615 (defun mail-source-fetch-directory (source callback)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
616 "Fetcher for directory sources."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
617 (mail-source-bind (directory source)
43421
a949c187ce13 * mail-source.el (mail-source-fetch-directory): Run scripts.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 38413
diff changeset
618 (mail-source-run-script
a949c187ce13 * mail-source.el (mail-source-fetch-directory): Run scripts.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 38413
diff changeset
619 prescript (format-spec-make ?t path)
a949c187ce13 * mail-source.el (mail-source-fetch-directory): Run scripts.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 38413
diff changeset
620 prescript-delay)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
621 (let ((found 0)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
622 (mail-source-string (format "directory:%s" path)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
623 (dolist (file (directory-files
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
624 path t (concat (regexp-quote suffix) "$")))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
625 (when (and (file-regular-p file)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
626 (funcall predicate file)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
627 (mail-source-movemail file mail-source-crash-box))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
628 (incf found (mail-source-callback callback file))))
43421
a949c187ce13 * mail-source.el (mail-source-fetch-directory): Run scripts.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 38413
diff changeset
629 (mail-source-run-script
a949c187ce13 * mail-source.el (mail-source-fetch-directory): Run scripts.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 38413
diff changeset
630 postscript (format-spec-make ?t path))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
631 found)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
632
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
633 (defun mail-source-fetch-pop (source callback)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
634 "Fetcher for single-file sources."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
635 (mail-source-bind (pop source)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
636 (mail-source-run-script
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
637 prescript
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
638 (format-spec-make ?p password ?t mail-source-crash-box
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
639 ?s server ?P port ?u user)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
640 prescript-delay)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
641 (let ((from (format "%s:%s:%s" server user port))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
642 (mail-source-string (format "pop:%s@%s" user server))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
643 result)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
644 (when (eq authentication 'password)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
645 (setq password
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
646 (or password
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
647 (cdr (assoc from mail-source-password-cache))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
648 (mail-source-read-passwd
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
649 (format "Password for %s at %s: " user server)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
650 (when server
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
651 (setenv "MAILHOST" server))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
652 (setq result
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
653 (cond
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
654 (program
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
655 (mail-source-fetch-with-program
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
656 (format-spec
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
657 program
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
658 (format-spec-make ?p password ?t mail-source-crash-box
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
659 ?s server ?P port ?u user))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
660 (function
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
661 (funcall function mail-source-crash-box))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
662 ;; The default is to use pop3.el.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
663 (t
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
664 (let ((pop3-password password)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
665 (pop3-maildrop user)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
666 (pop3-mailhost server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
667 (pop3-port port)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
668 (pop3-authentication-scheme
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
669 (if (eq authentication 'apop) 'apop 'pass)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
670 (save-excursion (pop3-movemail mail-source-crash-box))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
671 (if result
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
672 (progn
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
673 (when (eq authentication 'password)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
674 (unless (assoc from mail-source-password-cache)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
675 (push (cons from password) mail-source-password-cache)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
676 (prog1
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
677 (mail-source-callback callback server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
678 ;; Update display-time's mail flag, if relevant.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
679 (if (equal source mail-source-primary-source)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
680 (setq mail-source-new-mail-available nil))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
681 (mail-source-run-script
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
682 postscript
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
683 (format-spec-make ?p password ?t mail-source-crash-box
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
684 ?s server ?P port ?u user))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
685 ;; We nix out the password in case the error
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
686 ;; was because of a wrong password being given.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
687 (setq mail-source-password-cache
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
688 (delq (assoc from mail-source-password-cache)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
689 mail-source-password-cache))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
690 0))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
691
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
692 (defun mail-source-check-pop (source)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
693 "Check whether there is new mail."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
694 (mail-source-bind (pop source)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
695 (let ((from (format "%s:%s:%s" server user port))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
696 (mail-source-string (format "pop:%s@%s" user server))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
697 result)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
698 (when (eq authentication 'password)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
699 (setq password
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
700 (or password
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
701 (cdr (assoc from mail-source-password-cache))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
702 (mail-source-read-passwd
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
703 (format "Password for %s at %s: " user server))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
704 (unless (assoc from mail-source-password-cache)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
705 (push (cons from password) mail-source-password-cache)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
706 (when server
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
707 (setenv "MAILHOST" server))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
708 (setq result
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
709 (cond
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
710 ;; No easy way to check whether mail is waiting for these.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
711 (program)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
712 (function)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
713 ;; The default is to use pop3.el.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
714 (t
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
715 (let ((pop3-password password)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
716 (pop3-maildrop user)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
717 (pop3-mailhost server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
718 (pop3-port port)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
719 (pop3-authentication-scheme
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
720 (if (eq authentication 'apop) 'apop 'pass)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
721 (save-excursion (pop3-get-message-count))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
722 (if result
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
723 ;; Inform display-time that we have new mail.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
724 (setq mail-source-new-mail-available (> result 0))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
725 ;; We nix out the password in case the error
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
726 ;; was because of a wrong password being given.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
727 (setq mail-source-password-cache
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
728 (delq (assoc from mail-source-password-cache)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
729 mail-source-password-cache)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
730 result)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
731
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
732 (defun mail-source-new-mail-p ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
733 "Handler for `display-time' to indicate when new mail is available."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
734 ;; Only report flag setting; flag is updated on a different schedule.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
735 mail-source-new-mail-available)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
736
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
737
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
738 (defvar mail-source-report-new-mail nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
739 (defvar mail-source-report-new-mail-timer nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
740 (defvar mail-source-report-new-mail-idle-timer nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
741
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44075
diff changeset
742 (eval-when-compile
32333
963ab34e3e60 (mail-source-fetch-imap): Bind
Dave Love <fx@gnu.org>
parents: 32102
diff changeset
743 (if (featurep 'xemacs)
963ab34e3e60 (mail-source-fetch-imap): Bind
Dave Love <fx@gnu.org>
parents: 32102
diff changeset
744 (require 'itimer)
963ab34e3e60 (mail-source-fetch-imap): Bind
Dave Love <fx@gnu.org>
parents: 32102
diff changeset
745 (require 'timer)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
746
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
747 (defun mail-source-start-idle-timer ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
748 ;; 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
749 ;; user isn't typing.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
750 (unless mail-source-report-new-mail-idle-timer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
751 (setq mail-source-report-new-mail-idle-timer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
752 (run-with-idle-timer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
753 mail-source-idle-time-delay
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
754 nil
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
755 (lambda ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
756 (setq mail-source-report-new-mail-idle-timer nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
757 (mail-source-check-pop mail-source-primary-source))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
758 ;; Since idle timers created when Emacs is already in the idle
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
759 ;; state don't get activated until Emacs _next_ becomes idle, we
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
760 ;; need to force our timer to be considered active now. We do
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
761 ;; this by being naughty and poking the timer internals directly
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
762 ;; (element 0 of the vector is nil if the timer is active).
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
763 (aset mail-source-report-new-mail-idle-timer 0 nil)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
764
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
765 (defun mail-source-report-new-mail (arg)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
766 "Toggle whether to report when new mail is available.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
767 This only works when `display-time' is enabled."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
768 (interactive "P")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
769 (if (not mail-source-primary-source)
38413
a26d9b55abb6 Some fixes to follow coding conventions in files from Gnus.
Pavel Janík <Pavel@Janik.cz>
parents: 33342
diff changeset
770 (error "Need to set `mail-source-primary-source' to check for new mail"))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
771 (let ((on (if (null arg)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
772 (not mail-source-report-new-mail)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
773 (> (prefix-numeric-value arg) 0))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
774 (setq mail-source-report-new-mail on)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
775 (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
776 (nnheader-cancel-timer mail-source-report-new-mail-timer))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
777 (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
778 (nnheader-cancel-timer mail-source-report-new-mail-idle-timer))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
779 (setq mail-source-report-new-mail-timer nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
780 (setq mail-source-report-new-mail-idle-timer nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
781 (if on
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
782 (progn
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
783 (require 'time)
31764
54ae1def18cf Merge from Gnus trunk.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
784 ;; display-time-mail-function is an Emacs 21 feature.
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
785 (setq display-time-mail-function #'mail-source-new-mail-p)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
786 ;; Set up the main timer.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
787 (setq mail-source-report-new-mail-timer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
788 (run-at-time t (* 60 mail-source-report-new-mail-interval)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
789 #'mail-source-start-idle-timer))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
790 ;; When you get new mail, clear "Mail" from the mode line.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
791 (add-hook 'nnmail-post-get-new-mail-hook
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
792 'display-time-event-handler)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
793 (message "Mail check enabled"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
794 (setq display-time-mail-function nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
795 (remove-hook 'nnmail-post-get-new-mail-hook
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
796 'display-time-event-handler)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
797 (message "Mail check disabled"))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
798
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
799 (defun mail-source-fetch-maildir (source callback)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
800 "Fetcher for maildir sources."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
801 (mail-source-bind (maildir source)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
802 (let ((found 0)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
803 mail-source-string)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
804 (unless (string-match "/$" path)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
805 (setq path (concat path "/")))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
806 (dolist (subdir subdirs)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
807 (when (file-directory-p (concat path subdir))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
808 (setq mail-source-string (format "maildir:%s%s" path subdir))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
809 (dolist (file (directory-files (concat path subdir) t))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
810 (when (and (not (file-directory-p file))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
811 (not (if function
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
812 (funcall function file mail-source-crash-box)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44075
diff changeset
813 (let ((coding-system-for-write
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
814 mm-text-coding-system)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44075
diff changeset
815 (coding-system-for-read
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
816 mm-text-coding-system))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
817 (with-temp-file mail-source-crash-box
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
818 (insert-file-contents file)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
819 (goto-char (point-min))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
820 ;;; ;; Unix mail format
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
821 ;;; (unless (looking-at "\n*From ")
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44075
diff changeset
822 ;;; (insert "From maildir "
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
823 ;;; (current-time-string) "\n"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
824 ;;; (while (re-search-forward "^From " nil t)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
825 ;;; (replace-match ">From "))
32333
963ab34e3e60 (mail-source-fetch-imap): Bind
Dave Love <fx@gnu.org>
parents: 32102
diff changeset
826 ;;; (goto-char (point-max))
963ab34e3e60 (mail-source-fetch-imap): Bind
Dave Love <fx@gnu.org>
parents: 32102
diff changeset
827 ;;; (insert "\n\n")
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
828 ;; MMDF mail format
32333
963ab34e3e60 (mail-source-fetch-imap): Bind
Dave Love <fx@gnu.org>
parents: 32102
diff changeset
829 (insert "\001\001\001\001\n"))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
830 (delete-file file)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
831 (incf found (mail-source-callback callback file))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
832 found)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
833
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
834 (eval-and-compile
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
835 (autoload 'imap-open "imap")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
836 (autoload 'imap-authenticate "imap")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
837 (autoload 'imap-mailbox-select "imap")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
838 (autoload 'imap-mailbox-unselect "imap")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
839 (autoload 'imap-mailbox-close "imap")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
840 (autoload 'imap-search "imap")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
841 (autoload 'imap-fetch "imap")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
842 (autoload 'imap-close "imap")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
843 (autoload 'imap-error-text "imap")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
844 (autoload 'imap-message-flags-add "imap")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
845 (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
846 (autoload 'imap-range-to-message-set "imap")
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
847 (autoload 'nnheader-ms-strip-cr "nnheader"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
848
32102
e5f46972a7c8 2000-10-03 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 31784
diff changeset
849 (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
850 "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
851
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
852 (defun mail-source-fetch-imap (source callback)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
853 "Fetcher for imap sources."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
854 (mail-source-bind (imap source)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
855 (let ((from (format "%s:%s:%s" server user port))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
856 (found 0)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
857 (buf (get-buffer-create (generate-new-buffer-name " *imap source*")))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
858 (mail-source-string (format "imap:%s:%s" server mailbox))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
859 remove)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
860 (if (and (imap-open server port stream authentication buf)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
861 (imap-authenticate
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
862 user (or (cdr (assoc from mail-source-password-cache))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
863 password) buf)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
864 (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
865 (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
866 str)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
867 (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
868 ;; 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
869 ;; multibyte.
dd8c5458b624 2000-10-26 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 32333
diff changeset
870 (mm-disable-multibyte)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
871 ;; remember password
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
872 (with-current-buffer buf
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
873 (when (or imap-password
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
874 (assoc from mail-source-password-cache))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
875 (push (cons from imap-password) mail-source-password-cache)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
876 ;; if predicate is nil, use all uids
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
877 (dolist (uid (imap-search (or predicate "1:*") buf))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
878 (when (setq str (imap-fetch uid "RFC822.PEEK" 'RFC822 nil buf))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
879 (push uid remove)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
880 (insert "From imap " (current-time-string) "\n")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
881 (save-excursion
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
882 (insert str "\n\n"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
883 (while (re-search-forward "^From " nil t)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
884 (replace-match ">From "))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
885 (goto-char (point-max))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
886 (nnheader-ms-strip-cr))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
887 (incf found (mail-source-callback callback server))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
888 (when (and remove fetchflag)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
889 (imap-message-flags-add
32102
e5f46972a7c8 2000-10-03 Dave Love <fx@gnu.org>
Dave Love <fx@gnu.org>
parents: 31784
diff changeset
890 (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
891 fetchflag nil buf))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
892 (if dontexpunge
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
893 (imap-mailbox-unselect buf)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
894 (imap-mailbox-close buf))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
895 (imap-close buf))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
896 (imap-close buf)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
897 ;; We nix out the password in case the error
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
898 ;; was because of a wrong password being given.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
899 (setq mail-source-password-cache
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
900 (delq (assoc from mail-source-password-cache)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
901 mail-source-password-cache))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
902 (error (imap-error-text buf)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
903 (kill-buffer buf)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
904 found)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
905
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
906 (eval-and-compile
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
907 (autoload 'webmail-fetch "webmail"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
908
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
909 (defun mail-source-fetch-webmail (source callback)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
910 "Fetch for webmail source."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
911 (mail-source-bind (webmail source)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
912 (let ((mail-source-string (format "webmail:%s:%s" subtype user))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
913 (webmail-newmail-only dontexpunge)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
914 (webmail-move-to-trash-can (not dontexpunge)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
915 (when (eq authentication 'password)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
916 (setq password
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
917 (or password
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44075
diff changeset
918 (cdr (assoc (format "webmail:%s:%s" subtype user)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
919 mail-source-password-cache))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
920 (mail-source-read-passwd
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
921 (format "Password for %s at %s: " user subtype))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
922 (when (and password
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44075
diff changeset
923 (not (assoc (format "webmail:%s:%s" subtype user)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
924 mail-source-password-cache)))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 44075
diff changeset
925 (push (cons (format "webmail:%s:%s" subtype user) password)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
926 mail-source-password-cache)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
927 (webmail-fetch mail-source-crash-box subtype user password)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
928 (mail-source-callback callback (symbol-name subtype)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
929
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
930 (provide 'mail-source)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
931
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49598
diff changeset
932 ;;; arch-tag: 72948025-1d17-4d6c-bb12-ef1aa2c490fd
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
933 ;;; mail-source.el ends here