annotate lisp/gnus/nnmail.el @ 34:d620409f5eb8 r19-15b100

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