annotate lisp/gnus/nnmail.el @ 114:8619ce7e4c50 r20-1b9

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