annotate lisp/gnus/nnmail.el @ 108:360340f9fd5f r20-1b6

Import from CVS: tag r20-1b6
author cvs
date Mon, 13 Aug 2007 09:18:39 +0200
parents cf808b4c4290
children fe104dbd9147
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; nnmail.el --- mail support functions for the Gnus mail backends
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2 ;; Copyright (C) 1995,96,97 Free Software Foundation, Inc.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Keywords: news, mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; Boston, MA 02111-1307, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 (require 'nnheader)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 (require 'timezone)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 (require 'message)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
31 (require 'cl)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
32 (require 'custom)
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
33
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
34 (eval-and-compile
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
35 (autoload 'gnus-error "gnus-util"))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
36
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
37 (defgroup nnmail nil
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
38 "Reading mail with Gnus."
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
39 :group 'gnus)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
40
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
41 (defgroup nnmail-retrieve nil
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
42 "Retrieving new mail."
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
43 :group 'nnmail)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
44
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
45 (defgroup nnmail-prepare nil
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
46 "Preparing (or mangling) new mail after retrival."
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
47 :group 'nnmail)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
48
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
49 (defgroup nnmail-duplicate nil
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
50 "Handling of duplicate mail messages."
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
51 :group 'nnmail)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
52
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
53 (defgroup nnmail-split nil
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
54 "Organizing the incomming mail in folders."
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
55 :group 'nnmail)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
56
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
57 (defgroup nnmail-files nil
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
58 "Mail files."
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
59 :group 'gnus-files
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
60 :group 'nnmail)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
61
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
62 (defgroup nnmail-expire nil
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
63 "Expiring old mail."
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
64 :group 'nnmail)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
65
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
66 (defgroup nnmail-procmail nil
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
67 "Interfacing with procmail and other mail agents."
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
68 :group 'nnmail)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
69
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
70 (defgroup nnmail-various nil
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
71 "Various mail options."
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
72 :group 'nnmail)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
73
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
74 (defcustom nnmail-split-methods
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 '(("mail.misc" ""))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
76 "Incoming mail will be split according to this variable.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 If you'd like, for instance, one mail group for mail from the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 \"4ad-l\" mailing list, one group for junk mail and one for everything
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 else, you could do something like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (setq nnmail-split-methods
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 '((\"mail.4ad\" \"From:.*4ad\")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (\"mail.junk\" \"From:.*Lars\\\\|Subject:.*buy\")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (\"mail.misc\" \"\")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 As you can see, this variable is a list of lists, where the first
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 element in each \"rule\" is the name of the group (which, by the way,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 does not have to be called anything beginning with \"mail\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 \"yonka.zow\" is a fine, fine name), and the second is a regexp that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 nnmail will try to match on the header to find a fit.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 The second element can also be a function. In that case, it will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 called narrowed to the headers with the first element of the rule as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 the argument. It should return a non-nil value if it thinks that the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 mail belongs in that group.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 The last element should always have \"\" as the regexp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
100 This variable can also have a function as its value."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
101 :group 'nnmail-split
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
102 :type '(choice (repeat :tag "Alist" (group (string :tag "Name") regexp))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
103 (function-item nnmail-split-fancy)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
104 (function :tag "Other")))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 ;; Suggested by Erik Selberg <speed@cs.washington.edu>.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
107 (defcustom nnmail-crosspost t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
108 "If non-nil, do crossposting if several split methods match the mail.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
109 If nil, the first match found will be used."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
110 :group 'nnmail-split
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
111 :type 'boolean)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 ;; Added by gord@enci.ucalgary.ca (Gordon Matzigkeit).
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
114 (defcustom nnmail-keep-last-article nil
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
115 "If non-nil, nnmail will never delete the last expired article in a directory.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 You may need to set this variable if other programs are putting
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
117 new mail into folder numbers that Gnus has marked as expired."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
118 :group 'nnmail-procmail
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
119 :group 'nnmail-various
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
120 :type 'boolean)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
122 (defcustom nnmail-use-long-file-names nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
123 "If non-nil the mail backends will use long file and directory names.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 If nil, groups like \"mail.misc\" will end up in directories like
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
125 \"mail/misc/\"."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
126 :group 'nnmail-files
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
127 :type 'boolean)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
129 (defcustom nnmail-default-file-modes 384
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
130 "Set the mode bits of all new mail files to this integer."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
131 :group 'nnmail-files
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
132 :type 'integer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
133
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
134 (defcustom nnmail-expiry-wait 7
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 "*Expirable articles that are older than this will be expired.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 This variable can either be a number (which will be interpreted as a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 number of days) -- this doesn't have to be an integer. This variable
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
138 can also be `immediate' and `never'."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
139 :group 'nnmail-expire
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
140 :type '(choice (const immediate)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
141 (integer :tag "days")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
142 (const never)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
144 (defcustom nnmail-expiry-wait-function nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
145 "Variable that holds function to specify how old articles should be before they are expired.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 The function will be called with the name of the group that the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 expiry is to be performed in, and it should return an integer that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 says how many days an article can be stored before it is considered
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 \"old\". It can also return the values `never' and `immediate'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 Eg.:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
153 \(setq nnmail-expiry-wait-function
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 (lambda (newsgroup)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (cond ((string-match \"private\" newsgroup) 31)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 ((string-match \"junk\" newsgroup) 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 ((string-match \"important\" newsgroup) 'never)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
158 (t 7))))"
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
159 :group 'nnmail-expire
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
160 :type '(choice (const :tag "nnmail-expiry-wait" nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
161 (function :format "%v" nnmail-)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
163 (defcustom nnmail-spool-file
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (or (getenv "MAIL")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 (concat "/usr/spool/mail/" (user-login-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 "Where the mail backends will look for incoming mail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 This variable is \"/usr/spool/mail/$user\" by default.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 If this variable is nil, no mail backends will read incoming mail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 If this variable is a list, all files mentioned in this list will be
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
170 used as incoming mailboxes.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
171 If this variable is a directory (i. e., it's name ends with a \"/\"),
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
172 treat all files in that directory as incoming spool files."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
173 :group 'nnmail-files
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
174 :type 'file)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
176 (defcustom nnmail-crash-box "~/.gnus-crash-box"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
177 "File where Gnus will store mail while processing it."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
178 :group 'nnmail-files
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
179 :type 'file)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
181 (defcustom nnmail-use-procmail nil
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 "*If non-nil, the mail backends will look in `nnmail-procmail-directory' for spool files.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
183 The file(s) in `nnmail-spool-file' will also be read."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
184 :group 'nnmail-procmail
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
185 :type 'boolean)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
187 (defcustom nnmail-procmail-directory "~/incoming/"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 "*When using procmail (and the like), incoming mail is put in this directory.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
189 The Gnus mail backends will read the mail from this directory."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
190 :group 'nnmail-procmail
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
191 :type 'directory)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
193 (defcustom nnmail-procmail-suffix "\\.spool"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 "*Suffix of files created by procmail (and the like).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 This variable might be a suffix-regexp to match the suffixes of
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
196 several files - eg. \".spool[0-9]*\"."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
197 :group 'nnmail-procmail
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
198 :type 'regexp)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
200 (defcustom nnmail-resplit-incoming nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
201 "*If non-nil, re-split incoming procmail sorted mail."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
202 :group 'nnmail-procmail
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
203 :type 'boolean)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
204
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
205 (defcustom nnmail-delete-file-function 'delete-file
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
206 "Function called to delete files in some mail backends."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
207 :group 'nnmail-files
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
208 :type 'function)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
209
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
210 (defcustom nnmail-crosspost-link-function 'add-name-to-file
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 "Function called to create a copy of a file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 This is `add-name-to-file' by default, which means that crossposts
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 will use hard links. If your file system doesn't allow hard
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
214 links, you could set this variable to `copy-file' instead."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
215 :group 'nnmail-files
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
216 :type '(radio (function-item add-name-to-file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
217 (function-item copy-file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
218 (function :tag "Other")))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
220 (defcustom nnmail-movemail-program "movemail"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 "*A command to be executed to move mail from the inbox.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
222 The default is \"movemail\".
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
224 This can also be a function. In that case, the function will be
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
225 called with two parameters -- the name of the INBOX file, and the file
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
226 to be moved to."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
227 :group 'nnmail-files
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
228 :group 'nnmail-retrieve
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
229 :type 'string)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
231 (defcustom nnmail-pop-password-required nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
232 "*Non-nil if a password is required when reading mail using POP."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
233 :group 'nnmail-retrieve
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
234 :type 'boolean)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
235
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
236 (defcustom nnmail-read-incoming-hook
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
237 (if (eq system-type 'windows-nt)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
238 '(nnheader-ms-strip-cr)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
239 nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
240 "Hook that will be run after the incoming mail has been transferred.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 The incoming mail is moved from `nnmail-spool-file' (which normally is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 something like \"/usr/spool/mail/$user\") to the user's home
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
243 directory. This hook is called after the incoming mail box has been
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 emptied, and can be used to call any mail box programs you have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 running (\"xwatch\", etc.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 Eg.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
249 \(add-hook 'nnmail-read-incoming-hook
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
250 (lambda ()
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
251 (start-process \"mailsend\" nil
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 \"/local/bin/mailsend\" \"read\" \"mbox\")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 If you have xwatch running, this will alert it that mail has been
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
255 read.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 If you use `display-time', you could use something like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 \(add-hook 'nnmail-read-incoming-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 (lambda ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 ;; Update the displayed time, since that will clear out
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 ;; the flag that says you have mail.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
263 (when (eq (process-status \"display-time\") 'run)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
264 (display-time-filter display-time-process \"\"))))"
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
265 :group 'nnmail-prepare
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
266 :type 'hook)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 ;; Suggested by Erik Selberg <speed@cs.washington.edu>.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
269 (defcustom nnmail-prepare-incoming-hook nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
270 "Hook called before treating incoming mail.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
271 The hook is run in a buffer with all the new, incoming mail."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
272 :group 'nnmail-prepare
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
273 :type 'hook)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
274
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
275 (defcustom nnmail-prepare-incoming-header-hook nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
276 "Hook called narrowed to the headers of each message.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
277 This can be used to remove excessive spaces (and stuff like
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
278 that) from the headers before splitting and saving the messages."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
279 :group 'nnmail-prepare
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
280 :type 'hook)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
281
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
282 (defcustom nnmail-prepare-incoming-message-hook nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
283 "Hook called narrowed to each message."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
284 :group 'nnmail-prepare
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
285 :type 'hook)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
287 (defcustom nnmail-list-identifiers nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
288 "Regexp that matches list identifiers to be removed.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
289 This can also be a list of regexps."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
290 :group 'nnmail-prepare
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
291 :type '(choice (const :tag "none" nil)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
292 regexp
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
293 (repeat regexp)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
294
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
295 (defcustom nnmail-pre-get-new-mail-hook nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
296 "Hook called just before starting to handle new incoming mail."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
297 :group 'nnmail-retrieve
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
298 :type 'hook)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
300 (defcustom nnmail-post-get-new-mail-hook nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
301 "Hook called just after finishing handling new incoming mail."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
302 :group 'nnmail-retrieve
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
303 :type 'hook)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
304
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
305 (defcustom nnmail-split-hook nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
306 "Hook called before deciding where to split an article.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
307 The functions in this hook are free to modify the buffer
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
308 contents in any way they choose -- the buffer contents are
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
309 discarded after running the split process."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
310 :group 'nnmail-split
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
311 :type 'hook)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 ;; Suggested by Mejia Pablo J <pjm9806@usl.edu>.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
314 (defcustom nnmail-tmp-directory nil
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
315 "*If non-nil, use this directory for temporary storage.
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
316 Used when reading incoming mail."
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
317 :group 'nnmail-files
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
318 :group 'nnmail-retrieve
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
319 :type '(choice (const :tag "default" nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
320 (directory :format "%v")))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
322 (defcustom nnmail-large-newsgroup 50
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 "*The number of the articles which indicates a large newsgroup.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 If the number of the articles is greater than the value, verbose
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
325 messages will be shown to indicate the current status."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
326 :group 'nnmail-various
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
327 :type 'integer)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
329 (defcustom nnmail-split-fancy "mail.misc"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
330 "Incoming mail can be split according to this fancy variable.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 To enable this, set `nnmail-split-methods' to `nnmail-split-fancy'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 The format is this variable is SPLIT, where SPLIT can be one of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 the following:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
336 GROUP: Mail will be stored in GROUP (a string).
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 \(FIELD VALUE SPLIT): If the message field FIELD (a regexp) contains
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 VALUE (a regexp), store the messages as specified by SPLIT.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 \(| SPLIT...): Process each SPLIT expression until one of them matches.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 A SPLIT expression is said to match if it will cause the mail
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
343 message to be stored in one or more groups.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 \(& SPLIT...): Process each SPLIT expression.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
347 \(: FUNCTION optional args): Call FUNCTION with the optional args, in
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
348 the buffer containing the message headers. The return value FUNCTION
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
349 should be a split, which is then recursively processed.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
350
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 FIELD must match a complete field name. VALUE must match a complete
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 word according to the `nnmail-split-fancy-syntax-table' syntax table.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
353 You can use \".*\" in the regexps to match partial field names or words.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 FIELD and VALUE can also be lisp symbols, in that case they are expanded
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 as specified in `nnmail-split-abbrev-alist'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
358 GROUP can contain \\& and \\N which will substitute from matching
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
359 \\(\\) patterns in the previous VALUE.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
360
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 Example:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 \(setq nnmail-split-methods 'nnmail-split-fancy
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 nnmail-split-fancy
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
365 ;; Messages from the mailer daemon are not crossposted to any of
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 ;; the ordinary groups. Warnings are put in a separate group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 ;; from real errors.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 '(| (\"from\" mail (| (\"subject\" \"warn.*\" \"mail.warning\")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 \"mail.misc\"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 ;; Non-error messages are crossposted to all relevant
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 ;; groups, but we don't crosspost between the group for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 ;; (ding) list and the group for other (ding) related mail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (& (| (any \"ding@ifi\\\\.uio\\\\.no\" \"ding.list\")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (\"subject\" \"ding\" \"ding.misc\"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 ;; Other mailing lists...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (any \"procmail@informatik\\\\.rwth-aachen\\\\.de\" \"procmail.list\")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (any \"SmartList@informatik\\\\.rwth-aachen\\\\.de\" \"SmartList.list\")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 ;; People...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (any \"larsi@ifi\\\\.uio\\\\.no\" \"people.Lars Magne Ingebrigtsen\"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 ;; Unmatched mail goes to the catch all group.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
381 \"misc.misc\"))"
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
382 :group 'nnmail-split
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
383 ;; Sigh!
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
384 :type 'sexp)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
386 (defcustom nnmail-split-abbrev-alist
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
387 '((any . "from\\|to\\|cc\\|sender\\|apparently-to\\|resent-from\\|resent-to\\|resent-cc")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
388 (mail . "mailer-daemon\\|postmaster\\|uucp"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
389 "Alist of abbreviations allowed in `nnmail-split-fancy'."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
390 :group 'nnmail-split
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
391 :type '(repeat (cons :format "%v" symbol regexp)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
393 (defcustom nnmail-delete-incoming t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
394 "*If non-nil, the mail backends will delete incoming files after
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
395 splitting."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
396 :group 'nnmail-retrieve
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
397 :type 'boolean)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
399 (defcustom nnmail-message-id-cache-length 1000
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 "*The approximate number of Message-IDs nnmail will keep in its cache.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 If this variable is nil, no checking on duplicate messages will be
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
402 performed."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
403 :group 'nnmail-duplicate
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
404 :type '(choice (const :tag "disable" nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
405 (integer :format "%v")))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
407 (defcustom nnmail-message-id-cache-file "~/.nnmail-cache"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
408 "*The file name of the nnmail Message-ID cache."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
409 :group 'nnmail-duplicate
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
410 :group 'nnmail-files
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
411 :type 'file)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
413 (defcustom nnmail-treat-duplicates 'warn
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 "*If non-nil, nnmail keep a cache of Message-IDs to discover mail duplicates.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 Three values are legal: nil, which means that nnmail is not to keep a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 Message-ID cache; `warn', which means that nnmail should insert extra
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 headers to warn the user about the duplication (this is the default);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 and `delete', which means that nnmail will delete duplicated mails.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 This variable can also be a function. It will be called from a buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 narrowed to the article in question with the Message-ID as a
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
422 parameter. It should return nil, `warn' or `delete'."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
423 :group 'nnmail-duplicate
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
424 :type '(choice (const :tag "off" nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
425 (const warn)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
426 (const delete)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 ;;; Internal variables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
430 (defvar nnmail-split-history nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
431 "List of group/article elements that say where the previous split put messages.")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
432
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 (defvar nnmail-pop-password nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 "*Password to use when reading mail from a POP server, if required.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
436 (defvar nnmail-split-fancy-syntax-table nil
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 "Syntax table used by `nnmail-split-fancy'.")
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
438 (unless (syntax-table-p nnmail-split-fancy-syntax-table)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
439 (setq nnmail-split-fancy-syntax-table
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
440 (copy-syntax-table (standard-syntax-table)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
441 ;; support the %-hack
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
442 (modify-syntax-entry ?\% "." nnmail-split-fancy-syntax-table))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
443
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 (defvar nnmail-prepare-save-mail-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 "Hook called before saving mail.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 (defvar nnmail-moved-inboxes nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 "List of inboxes that have been moved.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (defvar nnmail-internal-password nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 (defconst nnmail-version "nnmail 1.0"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 "nnmail version.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 (defun nnmail-request-post (&optional server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 (mail-send-and-exit nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 (defun nnmail-find-file (file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 "Insert FILE in server buffer safely."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 (set-buffer nntp-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 (let ((format-alist nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 (after-insert-file-functions nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 (progn (insert-file-contents file) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 (file-error nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 (defun nnmail-group-pathname (group dir &optional file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 "Make pathname for GROUP."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 (let ((dir (file-name-as-directory (expand-file-name dir))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 ;; If this directory exists, we use it directly.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
477 (if (or nnmail-use-long-file-names
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 (file-directory-p (concat dir group)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 (concat dir group "/")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 ;; If not, we translate dots into slashes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 (concat dir (nnheader-replace-chars-in-string group ?. ?/) "/")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 (or file "")))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
483
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 (defun nnmail-date-to-time (date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 "Convert DATE into time."
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
486 (condition-case ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
487 (let* ((d1 (timezone-parse-date date))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
488 (t1 (timezone-parse-time (aref d1 3))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
489 (apply 'encode-time
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
490 (mapcar (lambda (el)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
491 (and el (string-to-number el)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
492 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
493 (aref t1 2) (aref t1 1) (aref t1 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
494 (aref d1 2) (aref d1 1) (aref d1 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
495 (number-to-string
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
496 (* 60 (timezone-zone-to-minute (aref d1 4))))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
497 ;; If we get an error, then we just return a 0 time.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
498 (error (list 0 0))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 (defun nnmail-time-less (t1 t2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 "Say whether time T1 is less than time T2."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 (or (< (car t1) (car t2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 (and (= (car t1) (car t2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 (< (nth 1 t1) (nth 1 t2)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 (defun nnmail-days-to-time (days)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 "Convert DAYS into time."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 (let* ((seconds (* 1.0 days 60 60 24))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 (rest (expt 2 16))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
510 (ms (condition-case nil (round (/ seconds rest))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 (range-error (expt 2 16)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 (list ms (condition-case nil (round (- seconds (* ms rest)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 (range-error (expt 2 16))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 (defun nnmail-time-since (time)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 "Return the time since TIME, which is either an internal time or a date."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 (when (stringp time)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 ;; Convert date strings to internal time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 (setq time (nnmail-date-to-time time)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 (let* ((current (current-time))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
521 (rest (when (< (nth 1 current) (nth 1 time))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
522 (expt 2 16))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 (list (- (+ (car current) (if rest -1 0)) (car time))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 (- (+ (or rest 0) (nth 1 current)) (nth 1 time)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 ;; Function rewritten from rmail.el.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 (defun nnmail-move-inbox (inbox)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 "Move INBOX to `nnmail-crash-box'."
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
529 (if (not (file-writable-p nnmail-crash-box))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
530 (gnus-error 1 "Can't write to crash box %s. Not moving mail."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
531 nnmail-crash-box)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
532 ;; If the crash box exists and is empty, we delete it.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
533 (when (and (file-exists-p nnmail-crash-box)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
534 (zerop (nnheader-file-size (file-truename nnmail-crash-box))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
535 (delete-file nnmail-crash-box))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
536 (let ((inbox (file-truename (expand-file-name inbox)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
537 (tofile (file-truename (expand-file-name nnmail-crash-box)))
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
538 movemail popmail errors result)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
539 (if (setq popmail (string-match
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
540 "^po:" (file-name-nondirectory inbox)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
541 (setq inbox (file-name-nondirectory inbox))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
542 (setq movemail t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
543 ;; On some systems, /usr/spool/mail/foo is a directory
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
544 ;; and the actual inbox is /usr/spool/mail/foo/foo.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
545 (when (file-directory-p inbox)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
546 (setq inbox (expand-file-name (user-login-name) inbox))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
547 (if (member inbox nnmail-moved-inboxes)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
548 ;; We don't try to move an already moved inbox.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
549 nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
550 (if popmail
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
551 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
552 (when (and nnmail-pop-password
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
553 (not nnmail-internal-password))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
554 (setq nnmail-internal-password nnmail-pop-password))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
555 (when (and nnmail-pop-password-required
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
556 (not nnmail-internal-password))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
557 (setq nnmail-internal-password
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
558 (nnmail-read-passwd
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
559 (format "Password for %s: "
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
560 (substring inbox (+ popmail 3))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
561 (message "Getting mail from post office ..."))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
562 (when (or (and (file-exists-p tofile)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
563 (/= 0 (nnheader-file-size tofile)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
564 (and (file-exists-p inbox)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
565 (/= 0 (nnheader-file-size inbox))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
566 (message "Getting mail from %s..." inbox)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
567 ;; Set TOFILE if have not already done so, and
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
568 ;; rename or copy the file INBOX to TOFILE if and as appropriate.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
569 (cond
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
570 ((file-exists-p tofile)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
571 ;; The crash box exists already.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
572 t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
573 ((and (not popmail)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
574 (not (file-exists-p inbox)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
575 ;; There is no inbox.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
576 (setq tofile nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
577 (t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
578 ;; If getting from mail spool directory, use movemail to move
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
579 ;; rather than just renaming, so as to interlock with the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
580 ;; mailer.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
581 (unwind-protect
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
582 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
583 (setq errors (generate-new-buffer " *nnmail loss*"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
584 (buffer-disable-undo errors)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
585 (let ((default-directory "/"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
586 (if (nnheader-functionp nnmail-movemail-program)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
587 (condition-case err
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
588 (progn
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
589 (funcall nnmail-movemail-program inbox tofile)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
590 (setq result 0))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
591 (error
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
592 (save-excursion
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
593 (set-buffer errors)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
594 (insert (prin1-to-string err))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
595 (setq result 255))))
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
596 (setq result
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
597 (apply
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
598 'call-process
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
599 (append
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
600 (list
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
601 (expand-file-name
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
602 nnmail-movemail-program exec-directory)
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
603 nil errors nil inbox tofile)
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
604 (when nnmail-internal-password
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
605 (list nnmail-internal-password)))))))
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
606 (if (and (not (buffer-modified-p errors))
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
607 (zerop result))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
608 ;; No output => movemail won
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
609 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
610 (unless popmail
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
611 (when (file-exists-p tofile)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
612 (set-file-modes tofile nnmail-default-file-modes)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
613 (push inbox nnmail-moved-inboxes))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
614 (set-buffer errors)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
615 ;; There may be a warning about older revisions. We
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
616 ;; ignore those.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
617 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
618 (if (search-forward "older revision" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
619 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
620 (unless popmail
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
621 (when (file-exists-p tofile)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
622 (set-file-modes tofile nnmail-default-file-modes)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
623 (push inbox nnmail-moved-inboxes))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
624 ;; Probably a real error.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
625 (subst-char-in-region (point-min) (point-max) ?\n ?\ )
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
626 (goto-char (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
627 (skip-chars-backward " \t")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
628 (delete-region (point) (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
629 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
630 (when (looking-at "movemail: ")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
631 (delete-region (point-min) (match-end 0)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
632 (unless (yes-or-no-p
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
633 (format "movemail: %s (%d return). Continue? "
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
634 (buffer-string) result))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
635 (error "%s" (buffer-string)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
636 (setq tofile nil)))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
637 (message "Getting mail from %s...done" inbox)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
638 (and errors
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
639 (buffer-name errors)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
640 (kill-buffer errors))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
641 tofile))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 (defun nnmail-get-active ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 "Returns an assoc of group names and active ranges.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 nn*-request-list should have been called before calling this function."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 (let (group-assoc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 ;; Go through all groups from the active list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 (set-buffer nntp-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 (goto-char (point-min))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
651 (while (re-search-forward
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 "^\\([^ \t]+\\)[ \t]+\\([0-9]+\\)[ \t]+\\([0-9]+\\)" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 ;; We create an alist with `(GROUP (LOW . HIGH))' elements.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 (push (list (match-string 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 (cons (string-to-int (match-string 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 (string-to-int (match-string 2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 group-assoc)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 group-assoc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 (defun nnmail-save-active (group-assoc file-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 "Save GROUP-ASSOC in ACTIVE-FILE."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 (when file-name
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
663 (nnheader-temp-write file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
664 (nnmail-generate-active group-assoc))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
665
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
666 (defun nnmail-generate-active (alist)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
667 "Generate an active file from group-alist ALIST."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
668 (erase-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
669 (let (group)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
670 (while (setq group (pop alist))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
671 (insert (format "%s %d %d y\n" (car group) (cdadr group)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
672 (caadr group))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 (defun nnmail-get-split-group (file group)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
675 "Find out whether this FILE is to be split into GROUP only.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
676 If GROUP is non-nil and we are using procmail, return the group name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
677 only when the file is the correct procmail file. When GROUP is nil,
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
678 return nil if FILE is a spool file or the procmail group for which it
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
679 is a spool. If not using procmail, return GROUP."
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 (if (or (eq nnmail-spool-file 'procmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 nnmail-use-procmail)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
682 (if (string-match (concat "^" (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
683 (file-name-as-directory
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
684 nnmail-procmail-directory))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
685 "\\([^/]*\\)" nnmail-procmail-suffix "$")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
686 (expand-file-name file))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
687 (let ((procmail-group (substring (expand-file-name file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
688 (match-beginning 1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
689 (match-end 1))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
690 (if group
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
691 (if (string-equal group procmail-group)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
692 group
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
693 nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
694 procmail-group))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
695 nil)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 group))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
698 (defun nnmail-process-babyl-mail-format (func artnum-func)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 (let ((case-fold-search t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 start message-id content-length do-search end)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
701 (goto-char (point-min))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 (while (not (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 " \n0, *unseen,+\n\\(\\*\\*\\* EOOH \\*\\*\\*\n\\)?" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 (goto-char (match-end 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 (delete-region (match-beginning 0) (match-end 0))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
707 (narrow-to-region
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
708 (setq start (point))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
709 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
710 ;; Skip all the headers in case there are more "From "s...
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
711 (or (search-forward "\n\n" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
712 (search-forward-regexp "^[^:]*\\( .*\\|\\)$" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
713 (search-forward " "))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
714 (point)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
715 ;; Unquote the ">From " line, if any.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
716 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
717 (when (looking-at ">From ")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
718 (replace-match "X-From-Line: ") )
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
719 (run-hooks 'nnmail-prepare-incoming-header-hook)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
720 (goto-char (point-max))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 ;; Find the Message-ID header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 (save-excursion
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
723 (if (re-search-backward
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
724 "^Message-ID[ \t]*:[ \n\t]*\\(<[^>]*>\\)" nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 (setq message-id (buffer-substring (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 ;; There is no Message-ID here, so we create one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 (save-excursion
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
729 (when (re-search-backward "^Message-ID[ \t]*:" nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 (insert "Original-")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 (forward-line -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 (insert "Message-ID: " (setq message-id (nnmail-message-id))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 "\n")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 ;; Look for a Content-Length header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 (if (not (save-excursion
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
737 (and (re-search-backward
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 "^Content-Length:[ \t]*\\([0-9]+\\)" start t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 (setq content-length (string-to-int
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
740 (buffer-substring
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 (match-end 1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 ;; We destroy the header, since none of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 ;; the backends ever use it, and we do not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 ;; want to confuse other mailers by having
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 ;; a (possibly) faulty header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 (progn (insert "X-") t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 (setq do-search t)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
749 (widen)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 (if (or (= (+ (point) content-length) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 (goto-char (+ (point) content-length))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 (looking-at "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 (goto-char (+ (point) content-length))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 (setq do-search nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 (setq do-search t)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
758 (widen)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 ;; Go to the beginning of the next article - or to the end
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
760 ;; of the buffer.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
761 (when do-search
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
762 (if (re-search-forward "^" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
763 (goto-char (match-beginning 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
764 (goto-char (1- (point-max)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 (delete-char 1) ; delete ^_
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 (narrow-to-region start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 (goto-char (point-min))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
770 (nnmail-check-duplication message-id func artnum-func)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 (setq end (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 (goto-char end))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
774 (defun nnmail-search-unix-mail-delim ()
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
775 "Put point at the beginning of the next Unix mbox message."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
776 ;; Algorithm used to find the the next article in the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
777 ;; brain-dead Unix mbox format:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
778 ;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
779 ;; 1) Search for "^From ".
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
780 ;; 2) If we find it, then see whether the previous
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
781 ;; line is blank and the next line looks like a header.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
782 ;; Then it's possible that this is a mail delim, and we use it.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
783 (let ((case-fold-search nil)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 found)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 (while (not found)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
786 (if (not (re-search-forward "^From " nil t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
787 (setq found 'no)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
788 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
789 (beginning-of-line)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
790 (when (and (or (bobp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
791 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
792 (forward-line -1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
793 (= (following-char) ?\n)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
794 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
795 (forward-line 1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
796 (while (looking-at ">From ")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
797 (forward-line 1))
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
798 (looking-at "[^ \n\t:]+[ \n\t]*:")))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
799 (setq found 'yes)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
800 (beginning-of-line)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 (eq found 'yes)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
803 (defun nnmail-search-unix-mail-delim-backward ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
804 "Put point at the beginning of the current Unix mbox message."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
805 ;; Algorithm used to find the the next article in the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
806 ;; brain-dead Unix mbox format:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
807 ;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
808 ;; 1) Search for "^From ".
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
809 ;; 2) If we find it, then see whether the previous
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
810 ;; line is blank and the next line looks like a header.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
811 ;; Then it's possible that this is a mail delim, and we use it.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
812 (let ((case-fold-search nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
813 found)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
814 (while (not found)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
815 (if (not (re-search-backward "^From " nil t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
816 (setq found 'no)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
817 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
818 (beginning-of-line)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
819 (when (and (or (bobp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
820 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
821 (forward-line -1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
822 (= (following-char) ?\n)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
823 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
824 (forward-line 1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
825 (while (looking-at ">From ")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
826 (forward-line 1))
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
827 (looking-at "[^ \n\t:]+[ \n\t]*:")))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
828 (setq found 'yes)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
829 (beginning-of-line)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
830 (eq found 'yes)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
831
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
832 (defun nnmail-process-unix-mail-format (func artnum-func)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 (let ((case-fold-search t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 start message-id content-length end skip head-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 (goto-char (point-min))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
836 (if (not (and (re-search-forward "^From " nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 (goto-char (match-beginning 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 ;; Possibly wrong format?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 (error "Error, unknown mail format! (Possibly corrupted.)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 ;; Carry on until the bitter end.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 (while (not (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 (setq start (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 end nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 ;; Find the end of the head.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 (narrow-to-region
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
846 start
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 (if (search-forward "\n\n" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 (1- (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 ;; This will never happen, but just to be on the safe side --
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 ;; if there is no head-body delimiter, we search a bit manually.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 (while (and (looking-at "From \\|[^ \t]+:")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 (not (eobp)))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
853 (forward-line 1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
854 (point))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 ;; Find the Message-ID header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 (goto-char (point-min))
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
857 (if (re-search-forward "^Message-ID[ \t]*:[ \n\t]*\\(<[^>]+>\\)" nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 (setq message-id (match-string 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 (save-excursion
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
860 (when (re-search-forward "^Message-ID[ \t]*:" nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 (insert "Original-")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 ;; There is no Message-ID here, so we create one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 (insert "Message-ID: " (setq message-id (nnmail-message-id)) "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 ;; Look for a Content-Length header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 (if (not (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 "^Content-Length:[ \t]*\\([0-9]+\\)" nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 (setq content-length nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 (setq content-length (string-to-int (match-string 1)))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
872 ;; We destroy the header, since none of the backends ever
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 ;; use it, and we do not want to confuse other mailers by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 ;; having a (possibly) faulty header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 (insert "X-"))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
877 (run-hooks 'nnmail-prepare-incoming-header-hook)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 ;; Find the end of this article.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 (setq head-end (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 ;; We try the Content-Length value. The idea: skip over the header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 ;; separator, then check what happens content-length bytes into the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 ;; message body. This should be either the end ot the buffer, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 ;; message separator or a blank line followed by the separator.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 ;; The blank line should probably be deleted. If neither of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 ;; three is met, the content-length header is probably invalid.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 (when content-length
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 (setq skip (+ (point) content-length))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 (goto-char skip)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 (cond ((or (= skip (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 (= (1+ skip) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 (setq end (point-max)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
895 ((looking-at "From ")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 (setq end skip))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
897 ((looking-at "[ \t]*\n\\(From \\)")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 (setq end (match-beginning 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 (t (setq end nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 (if end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 (goto-char end)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
902 ;; No Content-Length, so we find the beginning of the next
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 ;; article or the end of the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 (goto-char head-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 (or (nnmail-search-unix-mail-delim)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 (goto-char (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 ;; Allow the backend to save the article.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 (narrow-to-region start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 (goto-char (point-min))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
912 (nnmail-check-duplication message-id func artnum-func)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 (setq end (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 (goto-char end)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
916 (defun nnmail-process-mmdf-mail-format (func artnum-func)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 (let ((delim "^\^A\^A\^A\^A$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 (case-fold-search t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 start message-id end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 (if (not (and (re-search-forward delim nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 (forward-line 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 ;; Possibly wrong format?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 (error "Error, unknown mail format! (Possibly corrupted.)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 ;; Carry on until the bitter end.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 (while (not (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 (setq start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 ;; Find the end of the head.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 (narrow-to-region
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
930 start
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 (if (search-forward "\n\n" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 (1- (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 ;; This will never happen, but just to be on the safe side --
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 ;; if there is no head-body delimiter, we search a bit manually.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 (while (and (looking-at "From \\|[^ \t]+:")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 (not (eobp)))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
937 (forward-line 1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
938 (point))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 ;; Find the Message-ID header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 (goto-char (point-min))
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
941 (if (re-search-forward "^Message-ID[ \t]*:[ \n\t]*\\(<[^>]+>\\)" nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 (setq message-id (match-string 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 ;; There is no Message-ID here, so we create one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 (save-excursion
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
945 (when (re-search-backward "^Message-ID[ \t]*:" nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 (insert "Original-")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 (insert "Message-ID: " (setq message-id (nnmail-message-id)) "\n"))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
950 (run-hooks 'nnmail-prepare-incoming-header-hook)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 ;; Find the end of this article.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 (if (re-search-forward delim nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 (goto-char (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 ;; Allow the backend to save the article.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 (narrow-to-region start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 (goto-char (point-min))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
962 (nnmail-check-duplication message-id func artnum-func)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 (setq end (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 (goto-char end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 (forward-line 2)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
967 (defun nnmail-split-incoming (incoming func &optional exit-func
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
968 group artnum-func)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 "Go through the entire INCOMING file and pick out each individual mail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 FUNC will be called with the buffer narrowed to each mail."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 (let (;; If this is a group-specific split, we bind the split
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 ;; methods to just this group.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 (nnmail-split-methods (if (and group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 (or (eq nnmail-spool-file 'procmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 nnmail-use-procmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 (not nnmail-resplit-incoming))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 (list (list group ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 nnmail-split-methods)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 ;; Insert the incoming file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 (set-buffer (get-buffer-create " *nnmail incoming*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 (buffer-disable-undo (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 (erase-buffer)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
984 (nnheader-insert-file-contents incoming)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 (unless (zerop (buffer-size))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 (save-excursion (run-hooks 'nnmail-prepare-incoming-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 ;; Handle both babyl, MMDF and unix mail formats, since movemail will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 ;; use the former when fetching from a mailbox, the latter when
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
990 ;; fetches from a file.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 (cond ((or (looking-at "\^L")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 (looking-at "BABYL OPTIONS:"))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
993 (nnmail-process-babyl-mail-format func artnum-func))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 ((looking-at "\^A\^A\^A\^A")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
995 (nnmail-process-mmdf-mail-format func artnum-func))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 (t
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
997 (nnmail-process-unix-mail-format func artnum-func))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
998 (when exit-func
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
999 (funcall exit-func))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 (kill-buffer (current-buffer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1002 ;; Mail crossposts suggested by Brian Edmonds <edmonds@cs.ubc.ca>.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 (defun nnmail-article-group (func)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 "Look at the headers and return an alist of groups that match.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 FUNC will be called with the group name to determine the article number."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 (let ((methods nnmail-split-methods)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 (obuf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 (beg (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 end group-art method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 (if (and (sequencep methods) (= (length methods) 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 ;; If there is only just one group to put everything in, we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 ;; just return a list with just this one method in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 (setq group-art
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 (list (cons (caar methods) (funcall func (caar methods)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 ;; We do actual comparison.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 ;; Find headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 (goto-char beg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 (setq end (if (search-forward "\n\n" nil t) (point) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 (set-buffer nntp-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 ;; Copy the headers into the work buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 (insert-buffer-substring obuf beg end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 ;; Fold continuation lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 (while (re-search-forward "\\(\r?\n[ \t]+\\)+" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 (replace-match " " t t))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1028 ;; Allow washing.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1029 (run-hooks 'nnmail-split-hook)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 (if (and (symbolp nnmail-split-methods)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 (fboundp nnmail-split-methods))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1032 (let ((split
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 (or (funcall nnmail-split-methods)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 '("bogus"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 (error
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1037 (message
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 "Error in `nnmail-split-methods'; using `bogus' mail group")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 (sit-for 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 '("bogus")))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1041 (unless (equal split '(junk))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1042 ;; `nnmail-split-methods' is a function, so we just call
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1043 ;; this function here and use the result.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1044 (setq group-art
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1045 (mapcar
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1046 (lambda (group) (cons group (funcall func group)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1047 split))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 ;; Go through the split methods to find a match.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 (while (and methods (or nnmail-crosspost (not group-art)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 (setq method (pop methods))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 (if (or methods
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 (not (equal "" (nth 1 method))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 (when (and
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1055 (ignore-errors
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1056 (if (stringp (nth 1 method))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1057 (re-search-backward (cadr method) nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1058 ;; Function to say whether this is a match.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1059 (funcall (nth 1 method) (car method))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1060 ;; Don't enter the article into the same
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 ;; group twice.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 (not (assoc (car method) group-art)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1063 (push (cons (car method) (funcall func (car method)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 group-art))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1065 ;; This is the final group, which is used as a
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 ;; catch-all.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 (unless group-art
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1068 (setq group-art
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1069 (list (cons (car method)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 (funcall func (car method)))))))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1071 ;; See whether the split methods returned `junk'.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1072 (if (equal group-art '(junk))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1073 nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1074 (nreverse (delq 'junk group-art)))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 (defun nnmail-insert-lines ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 "Insert how many lines there are in the body of the mail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 Return the number of characters in the body."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 (let (lines chars)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 (goto-char (point-min))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1082 (when (search-forward "\n\n" nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 (setq chars (- (point-max) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 (setq lines (count-lines (point) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 (forward-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087 (when (re-search-backward "^Lines: " nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 (delete-region (point) (progn (forward-line 1) (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 (insert (format "Lines: %d\n" (max lines 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 chars))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 (defun nnmail-insert-xref (group-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 "Insert an Xref line based on the (group . article) alist."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 (goto-char (point-min))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1097 (when (search-forward "\n\n" nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 (forward-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 (when (re-search-backward "^Xref: " nil t)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1100 (delete-region (match-beginning 0)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 (progn (forward-line 1) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 (insert (format "Xref: %s" (system-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 (while group-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 (insert (format " %s:%d" (caar group-alist) (cdar group-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 (setq group-alist (cdr group-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 (insert "\n"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1108 ;;; Message washing functions
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1109
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1110 (defun nnmail-remove-leading-whitespace ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1111 "Remove excessive whitespace from all headers."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1112 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1113 (while (re-search-forward "^\\([^ :]+: \\) +" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1114 (replace-match "\\1" t)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1115
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1116 (defun nnmail-remove-list-identifiers ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1117 "Remove list identifiers from Subject headers."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1118 (let ((regexp (if (stringp nnmail-list-identifiers) nnmail-list-identifiers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1119 (mapconcat 'identity nnmail-list-identifiers "\\|"))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1120 (when regexp
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1121 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1122 (when (re-search-forward
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1123 (concat "^Subject: +\\(Re: +\\)?\\(" regexp "\\) *")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1124 nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1125 (delete-region (match-beginning 2) (match-end 0))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1126
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1127 (defun nnmail-remove-tabs ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1128 "Translate TAB characters into SPACE characters."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1129 (subst-char-in-region (point-min) (point-max) ?\t ? t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1130
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1131 ;;; Utility functions
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1132
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 ;; Written by byer@mv.us.adobe.com (Scott Byer).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 (defun nnmail-make-complex-temp-name (prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 (let ((newname (make-temp-name prefix))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 (newprefix prefix))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 (while (file-exists-p newname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 (setq newprefix (concat newprefix "x"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 (setq newname (make-temp-name newprefix)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140 newname))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142 ;; Written by Per Abrahamsen <amanda@iesd.auc.dk>.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 (defun nnmail-split-fancy ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 "Fancy splitting method.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 See the documentation for the variable `nnmail-split-fancy' for documentation."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 (let ((syntab (syntax-table)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 (set-syntax-table nnmail-split-fancy-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151 (nnmail-split-it nnmail-split-fancy))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 (set-syntax-table syntab))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 (defvar nnmail-split-cache nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155 ;; Alist of split expressions their equivalent regexps.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157 (defun nnmail-split-it (split)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 ;; Return a list of groups matching SPLIT.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1159 (cond
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1160 ;; nil split
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1161 ((null split)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1162 nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1163
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1164 ;; A group name. Do the \& and \N subs into the string.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1165 ((stringp split)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1166 (list (nnmail-expand-newtext split)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1167
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1168 ;; Junk the message.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1169 ((eq split 'junk)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1170 (list 'junk))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1171
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1172 ;; Builtin & operation.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1173 ((eq (car split) '&)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1174 (apply 'nconc (mapcar 'nnmail-split-it (cdr split))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1175
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1176 ;; Builtin | operation.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1177 ((eq (car split) '|)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1178 (let (done)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1179 (while (and (not done) (cdr split))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1180 (setq split (cdr split)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1181 done (nnmail-split-it (car split))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1182 done))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1183
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1184 ;; Builtin : operation.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1185 ((eq (car split) ':)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1186 (nnmail-split-it (eval (cdr split))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1187
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1188 ;; Check the cache for the regexp for this split.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1189 ;; FIX FIX FIX could avoid calling assq twice here
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1190 ((assq split nnmail-split-cache)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1191 (goto-char (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1192 ;; FIX FIX FIX problem with re-search-backward is that if you have
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1193 ;; a split: (from "foo-\\(bar\\|baz\\)@gnus.org "mail.foo.\\1")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1194 ;; and someone mails a message with 'To: foo-bar@gnus.org' and
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1195 ;; 'CC: foo-baz@gnus.org', we'll pick 'mail.foo.baz' as the group
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1196 ;; if the cc line is a later header, even though the other choice
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1197 ;; is probably better. Also, this routine won't do a crosspost
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1198 ;; when there are two different matches.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1199 ;; I guess you could just make this more determined, and it could
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1200 ;; look for still more matches prior to this one, and recurse
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1201 ;; on each of the multiple matches hit. Of course, then you'd
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1202 ;; want to make sure that nnmail-article-group or nnmail-split-fancy
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1203 ;; removed duplicates, since there might be more of those.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1204 ;; I guess we could also remove duplicates in the & split case, since
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1205 ;; that's the only thing that can introduce them.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1206 (when (re-search-backward (cdr (assq split nnmail-split-cache)) nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1207 ;; Someone might want to do a \N sub on this match, so get the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1208 ;; correct match positions.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1209 (goto-char (match-end 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1210 (let ((value (nth 1 split)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1211 (re-search-backward (if (symbolp value)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1212 (cdr (assq value nnmail-split-abbrev-alist))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1213 value)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1214 (match-end 1)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1215 (nnmail-split-it (nth 2 split))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1216
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1217 ;; Not in cache, compute a regexp for the field/value pair.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1218 (t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1219 (let* ((field (nth 0 split))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1220 (value (nth 1 split))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1221 (regexp (concat "^\\(\\("
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1222 (if (symbolp field)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1223 (cdr (assq field nnmail-split-abbrev-alist))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1224 field)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1225 "\\):.*\\)\\<\\("
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1226 (if (symbolp value)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1227 (cdr (assq value nnmail-split-abbrev-alist))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1228 value)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1229 "\\)\\>")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1230 (push (cons split regexp) nnmail-split-cache)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1231 ;; Now that it's in the cache, just call nnmail-split-it again
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1232 ;; on the same split, which will find it immediately in the cache.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1233 (nnmail-split-it split)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1234
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1235 (defun nnmail-expand-newtext (newtext)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1236 (let ((len (length newtext))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1237 (pos 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1238 c expanded beg N did-expand)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1239 (while (< pos len)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1240 (setq beg pos)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1241 (while (and (< pos len)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1242 (not (= (aref newtext pos) ?\\)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1243 (setq pos (1+ pos)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1244 (unless (= beg pos)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1245 (push (substring newtext beg pos) expanded))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1246 (when (< pos len)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1247 ;; we hit a \, expand it.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1248 (setq did-expand t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1249 (setq pos (1+ pos))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1250 (setq c (aref newtext pos))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1251 (if (not (or (= c ?\&)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1252 (and (>= c ?1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1253 (<= c ?9))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1254 ;; \ followed by some character we don't expand
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1255 (push (char-to-string c) expanded)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1256 ;; \& or \N
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1257 (if (= c ?\&)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1258 (setq N 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1259 (setq N (- c ?0)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1260 (when (match-beginning N)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1261 (push (buffer-substring (match-beginning N) (match-end N))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1262 expanded))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1263 (setq pos (1+ pos)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1264 (if did-expand
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1265 (apply 'concat (nreverse expanded))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1266 newtext)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 ;; Get a list of spool files to read.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 (defun nnmail-get-spool-files (&optional group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270 (if (null nnmail-spool-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 ;; No spool file whatsoever.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 nil
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1273 (let* ((procmails
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 ;; If procmail is used to get incoming mail, the files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275 ;; are stored in this directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 (and (file-exists-p nnmail-procmail-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277 (or (eq nnmail-spool-file 'procmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278 nnmail-use-procmail)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1279 (directory-files
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1280 nnmail-procmail-directory
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 t (concat (if group (concat "^" group) "")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1282 nnmail-procmail-suffix "$"))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283 (p procmails)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1284 (crash (when (and (file-exists-p nnmail-crash-box)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1285 (> (nnheader-file-size
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1286 (file-truename nnmail-crash-box))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1287 0))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 (list nnmail-crash-box))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1289 ;; Remove any directories that inadvertently match the procmail
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1290 ;; suffix, which might happen if the suffix is "".
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 (while p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 (when (file-directory-p (car p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 (setq procmails (delete (car p) procmails)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 (setq p (cdr p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 ;; Return the list of spools.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1296 (append
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297 crash
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298 (cond ((and group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299 (or (eq nnmail-spool-file 'procmail)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1300 nnmail-use-procmail)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1301 procmails)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302 procmails)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1303 ((and group
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1304 (eq nnmail-spool-file 'procmail))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1305 nil)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1306 ((listp nnmail-spool-file)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1307 (nconc
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1308 (apply
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1309 'nconc
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1310 (mapcar
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1311 (lambda (file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1312 (if (and (not (string-match "^po:" file))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1313 (file-directory-p file))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1314 (nnheader-directory-regular-files file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1315 (list file)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1316 nnmail-spool-file))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1317 procmails))
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 16
diff changeset
1318 ((stringp nnmail-spool-file)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1319 (if (and (not (string-match "^po:" nnmail-spool-file))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1320 (file-directory-p nnmail-spool-file))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1321 (nconc
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1322 (nnheader-directory-regular-files nnmail-spool-file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1323 procmails)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1324 (cons nnmail-spool-file procmails)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325 ((eq nnmail-spool-file 'pop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1326 (cons (format "po:%s" (user-login-name)) procmails))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328 procmails))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1329
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1330 ;; Activate a backend only if it isn't already activated.
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1331 ;; If FORCE, re-read the active file even if the backend is
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1332 ;; already activated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333 (defun nnmail-activate (backend &optional force)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334 (let (file timestamp file-time)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1335 (if (or (not (symbol-value (intern (format "%s-group-alist" backend))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1336 force
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1337 (and (setq file (ignore-errors
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1338 (symbol-value (intern (format "%s-active-file"
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1339 backend)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1340 (setq file-time (nth 5 (file-attributes file)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1341 (or (not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1342 (setq timestamp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1343 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1344 (symbol-value (intern
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1345 (format "%s-active-timestamp"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1346 backend)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1347 (error 'none))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1348 (not (consp timestamp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349 (equal timestamp '(0 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1350 (> (nth 0 file-time) (nth 0 timestamp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351 (and (= (nth 0 file-time) (nth 0 timestamp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1352 (> (nth 1 file-time) (nth 1 timestamp))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1353 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1354 (or (eq timestamp 'none)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1355 (set (intern (format "%s-active-timestamp" backend))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1356 file-time))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1357 (funcall (intern (format "%s-request-list" backend)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1358 t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1359
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1360 (defun nnmail-message-id ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1361 (concat "<" (message-unique-id) "@totally-fudged-out-message-id>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1363 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364 ;;; nnmail duplicate handling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1365 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1366
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1367 (defvar nnmail-cache-buffer nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369 (defun nnmail-cache-open ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370 (if (or (not nnmail-treat-duplicates)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1371 (and nnmail-cache-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1372 (buffer-name nnmail-cache-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1373 () ; The buffer is open.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1374 (save-excursion
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1375 (set-buffer
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1376 (setq nnmail-cache-buffer
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377 (get-buffer-create " *nnmail message-id cache*")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1378 (buffer-disable-undo (current-buffer))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1379 (when (file-exists-p nnmail-message-id-cache-file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1380 (nnheader-insert-file-contents nnmail-message-id-cache-file))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1381 (set-buffer-modified-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382 (current-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384 (defun nnmail-cache-close ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385 (when (and nnmail-cache-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1386 nnmail-treat-duplicates
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1387 (buffer-name nnmail-cache-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1388 (buffer-modified-p nnmail-cache-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1390 (set-buffer nnmail-cache-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1391 ;; Weed out the excess number of Message-IDs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392 (goto-char (point-max))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1393 (when (search-backward "\n" nil t nnmail-message-id-cache-length)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1394 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1395 (beginning-of-line)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1396 (delete-region (point-min) (point))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1397 ;; Save the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1398 (or (file-exists-p (file-name-directory nnmail-message-id-cache-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1399 (make-directory (file-name-directory nnmail-message-id-cache-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1400 t))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1401 (nnmail-write-region (point-min) (point-max)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1402 nnmail-message-id-cache-file nil 'silent)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1403 (set-buffer-modified-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1404 (setq nnmail-cache-buffer nil)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1405 (kill-buffer (current-buffer)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1406
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1407 (defun nnmail-cache-insert (id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1408 (when nnmail-treat-duplicates
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1409 (unless (gnus-buffer-live-p nnmail-cache-buffer)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1410 (nnmail-cache-open))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1411 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1412 (set-buffer nnmail-cache-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1413 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414 (insert id "\n"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1415
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1416 (defun nnmail-cache-id-exists-p (id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1417 (when nnmail-treat-duplicates
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1418 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1419 (set-buffer nnmail-cache-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1420 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1421 (search-backward id nil t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1422
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1423 (defun nnmail-fetch-field (header)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1424 (save-excursion
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1425 (save-restriction
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1426 (message-narrow-to-head)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1427 (message-fetch-field header))))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1428
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1429 (defun nnmail-check-duplication (message-id func artnum-func)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1430 (run-hooks 'nnmail-prepare-incoming-message-hook)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1431 ;; If this is a duplicate message, then we do not save it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1432 (let* ((duplication (nnmail-cache-id-exists-p message-id))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1433 (case-fold-search t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1434 (action (when duplication
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1435 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1436 ((memq nnmail-treat-duplicates '(warn delete))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1437 nnmail-treat-duplicates)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1438 ((nnheader-functionp nnmail-treat-duplicates)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1439 (funcall nnmail-treat-duplicates message-id))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1440 (t
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1441 nnmail-treat-duplicates))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1442 group-art)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1443 ;; Let the backend save the article (or not).
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1444 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1445 ((not duplication)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1446 (nnmail-cache-insert message-id)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1447 (funcall func (setq group-art
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1448 (nreverse (nnmail-article-group artnum-func)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1449 ((eq action 'delete)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1450 (setq group-art nil))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1451 ((eq action 'warn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1452 ;; We insert a warning.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1453 (let ((case-fold-search t))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1454 (goto-char (point-min))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1455 (re-search-forward "^message-id[ \t]*:" nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1456 (beginning-of-line)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1457 (insert
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1458 "Gnus-Warning: This is a duplicate of message " message-id "\n")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1459 (funcall func (setq group-art
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1460 (nreverse (nnmail-article-group artnum-func))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1461 (t
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1462 (funcall func (setq group-art
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1463 (nreverse (nnmail-article-group artnum-func))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1464 ;; Add the group-art list to the history list.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1465 (if group-art
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1466 (push group-art nnmail-split-history)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1467 (delete-region (point-min) (point-max)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1468
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1469 ;;; Get new mail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1470
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1471 (defun nnmail-get-value (&rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472 (let ((sym (intern (apply 'format args))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1473 (when (boundp sym)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1474 (symbol-value sym))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1475
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1476 (defun nnmail-get-new-mail (method exit-func temp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1477 &optional group spool-func)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1478 "Read new incoming mail."
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1479 ;; Nix out the previous split history.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1480 (unless group
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1481 (setq nnmail-split-history nil))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482 (let* ((spools (nnmail-get-spool-files group))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1483 (group-in group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1484 incoming incomings spool)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1485 (when (and (nnmail-get-value "%s-get-new-mail" method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1486 nnmail-spool-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1487 ;; We first activate all the groups.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1488 (nnmail-activate method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1489 ;; Allow the user to hook.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1490 (run-hooks 'nnmail-pre-get-new-mail-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1491 ;; Open the message-id cache.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1492 (nnmail-cache-open)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1493 ;; The we go through all the existing spool files and split the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1494 ;; mail from each.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1495 (while spools
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1496 (setq spool (pop spools))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1497 ;; We read each spool file if either the spool is a POP-mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1498 ;; spool, or the file exists. We can't check for the
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1499 ;; existence of POPped mail.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1500 (when (or (string-match "^po:" spool)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1501 (and (file-exists-p (file-truename spool))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1502 (> (nnheader-file-size (file-truename spool)) 0)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1503 (nnheader-message 3 "%s: Reading incoming mail..." method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1504 (when (and (nnmail-move-inbox spool)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1505 (file-exists-p nnmail-crash-box))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1506 ;; There is new mail. We first find out if all this mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1507 ;; is supposed to go to some specific group.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1508 (setq group (nnmail-get-split-group spool group-in))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1509 ;; We split the mail
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1510 (nnmail-split-incoming
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1511 nnmail-crash-box (intern (format "%s-save-mail" method))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1512 spool-func group (intern (format "%s-active-number" method)))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1513 ;; Check whether the inbox is to be moved to the special tmp dir.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1514 (setq incoming
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1515 (nnmail-make-complex-temp-name
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1516 (expand-file-name
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1517 (if nnmail-tmp-directory
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1518 (concat
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1519 (file-name-as-directory nnmail-tmp-directory)
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1520 (file-name-nondirectory
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1521 (concat (file-name-as-directory temp) "Incoming")))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1522 (concat (file-name-as-directory temp) "Incoming")))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1523 (rename-file nnmail-crash-box incoming t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1524 (push incoming incomings))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1525 ;; If we did indeed read any incoming spools, we save all info.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1526 (when incomings
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1527 (nnmail-save-active
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1528 (nnmail-get-value "%s-group-alist" method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1529 (nnmail-get-value "%s-active-file" method))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1530 (when exit-func
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1531 (funcall exit-func))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1532 (run-hooks 'nnmail-read-incoming-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1533 (nnheader-message 3 "%s: Reading incoming mail...done" method))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1534 ;; Close the message-id cache.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1535 (nnmail-cache-close)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1536 ;; Allow the user to hook.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1537 (run-hooks 'nnmail-post-get-new-mail-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1538 ;; Delete all the temporary files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1539 (while incomings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1540 (setq incoming (pop incomings))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1541 (and nnmail-delete-incoming
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1542 (file-exists-p incoming)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1543 (file-writable-p incoming)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1544 (delete-file incoming))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1545
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1546 (defun nnmail-expired-article-p (group time force &optional inhibit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1547 "Say whether an article that is TIME old in GROUP should be expired."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1548 (if force
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1549 t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1550 (let ((days (or (and nnmail-expiry-wait-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1551 (funcall nnmail-expiry-wait-function group))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1552 nnmail-expiry-wait)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1553 (cond ((or (eq days 'never)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1554 (and (not force)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1555 inhibit))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1556 ;; This isn't an expirable group.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1557 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1558 ((eq days 'immediate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1559 ;; We expire all articles on sight.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1560 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1561 ((equal time '(0 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1562 ;; This is an ange-ftp group, and we don't have any dates.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1563 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1564 ((numberp days)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1565 (setq days (nnmail-days-to-time days))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1566 ;; Compare the time with the current time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1567 (nnmail-time-less days (nnmail-time-since time)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1568
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1569 (defvar nnmail-read-passwd nil)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1570 (defun nnmail-read-passwd (prompt &rest args)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1571 "Read a password using PROMPT.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1572 If ARGS, PROMPT is used as an argument to `format'."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1573 (let ((prompt
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1574 (if args
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1575 (apply 'format prompt args)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1576 prompt)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1577 (unless nnmail-read-passwd
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1578 (if (load "passwd" t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1579 (setq nnmail-read-passwd 'read-passwd)
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1580 (unless (fboundp 'ange-ftp-read-passwd)
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1581 (autoload 'ange-ftp-read-passwd "ange-ftp"))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1582 (setq nnmail-read-passwd 'ange-ftp-read-passwd)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1583 (funcall nnmail-read-passwd prompt)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1584
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1585 (defun nnmail-check-syntax ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1586 "Check (and modify) the syntax of the message in the current buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1587 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1588 (message-narrow-to-head)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1589 (let ((case-fold-search t))
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1590 (unless (re-search-forward "^Message-ID[ \t]*:" nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1591 (insert "Message-ID: " (nnmail-message-id) "\n")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1592
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1593 (defun nnmail-write-region (start end filename &optional append visit lockname)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1594 "Do a `write-region', and then set the file modes."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1595 (write-region start end filename append visit lockname)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1596 (set-file-modes filename nnmail-default-file-modes))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1597
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1598 ;;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1599 ;;; Status functions
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1600 ;;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1601
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1602 (defun nnmail-replace-status (name value)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1603 "Make status NAME and VALUE part of the current status line."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1604 (save-restriction
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1605 (message-narrow-to-head)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1606 (let ((status (nnmail-decode-status)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1607 (setq status (delq (member name status) status))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1608 (when value
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1609 (push (cons name value) status))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1610 (message-remove-header "status")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1611 (goto-char (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1612 (insert "Status: " (nnmail-encode-status status) "\n"))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1613
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1614 (defun nnmail-decode-status ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1615 "Return a status-value alist from STATUS."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1616 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1617 (when (re-search-forward "^Status: " nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1618 (let (name value status)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1619 (save-restriction
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1620 ;; Narrow to the status.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1621 (narrow-to-region
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1622 (point)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1623 (if (re-search-forward "^[^ \t]" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1624 (1- (point))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1625 (point-max)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1626 ;; Go through all elements and add them to the list.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1627 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1628 (while (re-search-forward "[^ \t=]+" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1629 (setq name (match-string 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1630 (if (not (= (following-char) ?=))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1631 ;; Implied "yes".
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1632 (setq value "yes")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1633 (forward-char 1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1634 (if (not (= (following-char) ?\"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1635 (if (not (looking-at "[^ \t]"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1636 ;; Implied "no".
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1637 (setq value "no")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1638 ;; Unquoted value.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1639 (setq value (match-string 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1640 (goto-char (match-end 0)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1641 ;; Quoted value.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1642 (setq value (read (current-buffer)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1643 (push (cons name value) status)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1644 status)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1645
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1646 (defun nnmail-encode-status (status)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1647 "Return a status string from STATUS."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1648 (mapconcat
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1649 (lambda (elem)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1650 (concat
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1651 (car elem) "="
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1652 (if (string-match "[ \t]" (cdr elem))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1653 (prin1-to-string (cdr elem))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1654 (cdr elem))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1655 status " "))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1656
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1657 (defun nnmail-split-history ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1658 "Generate an overview of where the last mail split put articles."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1659 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1660 (unless nnmail-split-history
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1661 (error "No current split history"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1662 (with-output-to-temp-buffer "*nnmail split history*"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1663 (let ((history nnmail-split-history)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1664 elem)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1665 (while (setq elem (pop history))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1666 (princ (mapconcat (lambda (ga)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1667 (concat (car ga) ":" (int-to-string (cdr ga))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1668 elem
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1669 ", "))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1670 (princ "\n")))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1671
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1672 (defun nnmail-new-mail-p (group)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1673 "Say whether GROUP has new mail."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1674 (let ((his nnmail-split-history)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1675 found)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1676 (while his
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1677 (when (assoc group (pop his))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1678 (setq found t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1679 his nil)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1680 found))
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1681
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1682 (eval-and-compile
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1683 (autoload 'pop3-movemail "pop3"))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1684
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1685 (defun nnmail-pop3-movemail (inbox crashbox)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1686 "Function to move mail from INBOX on a pop3 server to file CRASHBOX."
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1687 (let ((pop3-maildrop
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1688 (substring inbox (match-end (string-match "^po:" inbox)))))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1689 (pop3-movemail crashbox)))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1690
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1691 (run-hooks 'nnmail-load-hook)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1692
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1693 (provide 'nnmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1694
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1695 ;;; nnmail.el ends here