annotate lisp/gnus/nnmail.el @ 147:e186c2b7192d xemacs-20-2

Added tag r20-2p1 for changeset 2af401a6ecca
author cvs
date Mon, 13 Aug 2007 09:34:48 +0200
parents 585fb297b004
children 59463afc5666
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")
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
396 (mail . "mailer-daemon\\|postmaster\\|uucp")
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 114
diff changeset
397 (to . "to\\|cc\\|apparently-to\\|resent-to\\|resent-cc")
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 116
diff changeset
398 (from . "from\\|sender\\|resent-from")
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 116
diff changeset
399 (nato . "to\\|cc\\|resent-to\\|resent-cc")
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents: 116
diff changeset
400 (naany . "from\\|to\\|cc\\|sender\\|resent-from\\|resent-to\\|resent-cc"))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
401 "Alist of abbreviations allowed in `nnmail-split-fancy'."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
402 :group 'nnmail-split
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
403 :type '(repeat (cons :format "%v" symbol regexp)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
405 (defcustom nnmail-delete-incoming t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
406 "*If non-nil, the mail backends will delete incoming files after
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
407 splitting."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
408 :group 'nnmail-retrieve
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
409 :type 'boolean)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
411 (defcustom nnmail-message-id-cache-length 1000
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 "*The approximate number of Message-IDs nnmail will keep in its cache.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 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
414 performed."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
415 :group 'nnmail-duplicate
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
416 :type '(choice (const :tag "disable" nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
417 (integer :format "%v")))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
419 (defcustom nnmail-message-id-cache-file "~/.nnmail-cache"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
420 "*The file name of the nnmail Message-ID cache."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
421 :group 'nnmail-duplicate
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
422 :group 'nnmail-files
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
423 :type 'file)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
425 (defcustom nnmail-treat-duplicates 'warn
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 "*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
427 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
428 Message-ID cache; `warn', which means that nnmail should insert extra
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 headers to warn the user about the duplication (this is the default);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 and `delete', which means that nnmail will delete duplicated mails.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 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
433 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
434 parameter. It should return nil, `warn' or `delete'."
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
435 :group 'nnmail-duplicate
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
436 :type '(choice (const :tag "off" nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
437 (const warn)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
438 (const delete)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 ;;; Internal variables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
442 (defvar nnmail-split-history nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
443 "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
444
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 (defvar nnmail-pop-password nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 "*Password to use when reading mail from a POP server, if required.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
448 (defvar nnmail-split-fancy-syntax-table nil
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 "Syntax table used by `nnmail-split-fancy'.")
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
450 (unless (syntax-table-p nnmail-split-fancy-syntax-table)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
451 (setq nnmail-split-fancy-syntax-table
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
452 (copy-syntax-table (standard-syntax-table)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
453 ;; support the %-hack
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
454 (modify-syntax-entry ?\% "." nnmail-split-fancy-syntax-table))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
455
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 (defvar nnmail-prepare-save-mail-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 "Hook called before saving mail.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 (defvar nnmail-moved-inboxes nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 "List of inboxes that have been moved.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 (defvar nnmail-internal-password nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463
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 (defconst nnmail-version "nnmail 1.0"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 "nnmail version.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 (defun nnmail-request-post (&optional server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 (mail-send-and-exit nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 (defun nnmail-find-file (file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 "Insert FILE in server buffer safely."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 (set-buffer nntp-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 (let ((format-alist nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 (after-insert-file-functions nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 (progn (insert-file-contents file) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 (file-error nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 (defun nnmail-group-pathname (group dir &optional file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 "Make pathname for GROUP."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (let ((dir (file-name-as-directory (expand-file-name dir))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 ;; If this directory exists, we use it directly.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
489 (if (or nnmail-use-long-file-names
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 (file-directory-p (concat dir group)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (concat dir group "/")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 ;; If not, we translate dots into slashes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 (concat dir (nnheader-replace-chars-in-string group ?. ?/) "/")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 (or file "")))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
495
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 (defun nnmail-date-to-time (date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 "Convert DATE into time."
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
498 (condition-case ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
499 (let* ((d1 (timezone-parse-date date))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
500 (t1 (timezone-parse-time (aref d1 3))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
501 (apply 'encode-time
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
502 (mapcar (lambda (el)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
503 (and el (string-to-number el)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
504 (list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
505 (aref t1 2) (aref t1 1) (aref t1 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
506 (aref d1 2) (aref d1 1) (aref d1 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
507 (number-to-string
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
508 (* 60 (timezone-zone-to-minute (aref d1 4))))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
509 ;; If we get an error, then we just return a 0 time.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
510 (error (list 0 0))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 (defun nnmail-time-less (t1 t2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 "Say whether time T1 is less than time T2."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 (or (< (car t1) (car t2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 (and (= (car t1) (car t2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 (< (nth 1 t1) (nth 1 t2)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 (defun nnmail-days-to-time (days)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 "Convert DAYS into time."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 (let* ((seconds (* 1.0 days 60 60 24))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 (rest (expt 2 16))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
522 (ms (condition-case nil (round (/ seconds rest))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 (range-error (expt 2 16)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 (list ms (condition-case nil (round (- seconds (* ms rest)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 (range-error (expt 2 16))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 (defun nnmail-time-since (time)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 "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
529 (when (stringp time)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 ;; Convert date strings to internal time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 (setq time (nnmail-date-to-time time)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 (let* ((current (current-time))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
533 (rest (when (< (nth 1 current) (nth 1 time))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
534 (expt 2 16))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 (list (- (+ (car current) (if rest -1 0)) (car time))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 (- (+ (or rest 0) (nth 1 current)) (nth 1 time)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 ;; Function rewritten from rmail.el.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 (defun nnmail-move-inbox (inbox)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 "Move INBOX to `nnmail-crash-box'."
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
541 (if (not (file-writable-p nnmail-crash-box))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
542 (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
543 nnmail-crash-box)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
544 ;; If the crash box exists and is empty, we delete it.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
545 (when (and (file-exists-p nnmail-crash-box)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
546 (zerop (nnheader-file-size (file-truename nnmail-crash-box))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
547 (delete-file nnmail-crash-box))
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
548 (let ((tofile (file-truename (expand-file-name nnmail-crash-box)))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
549 (popmail (string-match "^po:" inbox))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
550 movemail errors result)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
551 (unless popmail
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
552 (setq inbox (file-truename (expand-file-name inbox)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
553 (setq movemail t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
554 ;; On some systems, /usr/spool/mail/foo is a directory
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
555 ;; and the actual inbox is /usr/spool/mail/foo/foo.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
556 (when (file-directory-p inbox)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
557 (setq inbox (expand-file-name (user-login-name) inbox))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
558 (if (member inbox nnmail-moved-inboxes)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
559 ;; We don't try to move an already moved inbox.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
560 nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
561 (if popmail
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
562 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
563 (when (and nnmail-pop-password
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 nnmail-pop-password))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
566 (when (and nnmail-pop-password-required
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
567 (not nnmail-internal-password))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
568 (setq nnmail-internal-password
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
569 (nnmail-read-passwd
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
570 (format "Password for %s: "
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
571 (substring inbox (+ popmail 3))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
572 (message "Getting mail from post office ..."))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
573 (when (or (and (file-exists-p tofile)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
574 (/= 0 (nnheader-file-size tofile)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
575 (and (file-exists-p inbox)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
576 (/= 0 (nnheader-file-size inbox))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
577 (message "Getting mail from %s..." inbox)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
578 ;; Set TOFILE if have not already done so, and
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
579 ;; 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
580 (cond
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
581 ((file-exists-p tofile)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
582 ;; The crash box exists already.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
583 t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
584 ((and (not popmail)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
585 (not (file-exists-p inbox)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
586 ;; There is no inbox.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
587 (setq tofile nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
588 (t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
589 ;; If getting from mail spool directory, use movemail to move
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
590 ;; rather than just renaming, so as to interlock with the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
591 ;; mailer.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
592 (unwind-protect
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
593 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
594 (setq errors (generate-new-buffer " *nnmail loss*"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
595 (buffer-disable-undo errors)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
596 (let ((default-directory "/"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
597 (if (nnheader-functionp nnmail-movemail-program)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
598 (condition-case err
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
599 (progn
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
600 (funcall nnmail-movemail-program inbox tofile)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
601 (setq result 0))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
602 (error
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
603 (save-excursion
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
604 (set-buffer errors)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
605 (insert (prin1-to-string err))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
606 (setq result 255))))
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
607 (setq result
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
608 (apply
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
609 'call-process
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
610 (append
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
611 (list
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
612 (expand-file-name
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
613 nnmail-movemail-program exec-directory)
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
614 nil errors nil inbox tofile)
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
615 (when nnmail-internal-password
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
616 (list nnmail-internal-password)))))))
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
617 (if (and (not (buffer-modified-p errors))
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
618 (zerop result))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
619 ;; No output => movemail won
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
620 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
621 (unless popmail
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
622 (when (file-exists-p tofile)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
623 (set-file-modes tofile nnmail-default-file-modes)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
624 (push inbox nnmail-moved-inboxes))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
625 (set-buffer errors)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
626 ;; There may be a warning about older revisions. We
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
627 ;; ignore those.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
628 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
629 (if (search-forward "older revision" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
630 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
631 (unless popmail
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
632 (when (file-exists-p tofile)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
633 (set-file-modes tofile nnmail-default-file-modes)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
634 (push inbox nnmail-moved-inboxes))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
635 ;; Probably a real error.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
636 (subst-char-in-region (point-min) (point-max) ?\n ?\ )
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
637 (goto-char (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
638 (skip-chars-backward " \t")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
639 (delete-region (point) (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
640 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
641 (when (looking-at "movemail: ")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
642 (delete-region (point-min) (match-end 0)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
643 (unless (yes-or-no-p
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
644 (format "movemail: %s (%d return). Continue? "
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
645 (buffer-string) result))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
646 (error "%s" (buffer-string)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
647 (setq tofile nil)))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
648 (message "Getting mail from %s...done" inbox)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
649 (and errors
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
650 (buffer-name errors)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
651 (kill-buffer errors))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
652 tofile))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 (defun nnmail-get-active ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 "Returns an assoc of group names and active ranges.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 nn*-request-list should have been called before calling this function."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 (let (group-assoc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 ;; Go through all groups from the active list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 (set-buffer nntp-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 (goto-char (point-min))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
662 (while (re-search-forward
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 "^\\([^ \t]+\\)[ \t]+\\([0-9]+\\)[ \t]+\\([0-9]+\\)" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 ;; We create an alist with `(GROUP (LOW . HIGH))' elements.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 (push (list (match-string 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 (cons (string-to-int (match-string 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 (string-to-int (match-string 2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 group-assoc)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 group-assoc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 (defun nnmail-save-active (group-assoc file-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 "Save GROUP-ASSOC in ACTIVE-FILE."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 (when file-name
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
674 (nnheader-temp-write file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
675 (nnmail-generate-active group-assoc))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
676
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
677 (defun nnmail-generate-active (alist)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
678 "Generate an active file from group-alist ALIST."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
679 (erase-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
680 (let (group)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
681 (while (setq group (pop alist))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
682 (insert (format "%s %d %d y\n" (car group) (cdadr group)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
683 (caadr group))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 (defun nnmail-get-split-group (file group)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
686 "Find out whether this FILE is to be split into GROUP only.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
687 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
688 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
689 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
690 is a spool. If not using procmail, return GROUP."
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 (if (or (eq nnmail-spool-file 'procmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 nnmail-use-procmail)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
693 (if (string-match (concat "^" (expand-file-name
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
694 (file-name-as-directory
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
695 nnmail-procmail-directory))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
696 "\\([^/]*\\)" nnmail-procmail-suffix "$")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
697 (expand-file-name file))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
698 (let ((procmail-group (substring (expand-file-name file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
699 (match-beginning 1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
700 (match-end 1))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
701 (if group
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
702 (if (string-equal group procmail-group)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
703 group
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
704 nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
705 procmail-group))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
706 nil)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 group))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
709 (defun nnmail-process-babyl-mail-format (func artnum-func)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 (let ((case-fold-search t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 start message-id content-length do-search end)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
712 (goto-char (point-min))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 (while (not (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 " \n0, *unseen,+\n\\(\\*\\*\\* EOOH \\*\\*\\*\n\\)?" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 (goto-char (match-end 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 (delete-region (match-beginning 0) (match-end 0))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
718 (narrow-to-region
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
719 (setq start (point))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
720 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
721 ;; Skip all the headers in case there are more "From "s...
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
722 (or (search-forward "\n\n" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
723 (search-forward-regexp "^[^:]*\\( .*\\|\\)$" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
724 (search-forward " "))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
725 (point)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
726 ;; Unquote the ">From " line, if any.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
727 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
728 (when (looking-at ">From ")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
729 (replace-match "X-From-Line: ") )
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
730 (run-hooks 'nnmail-prepare-incoming-header-hook)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
731 (goto-char (point-max))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 ;; Find the Message-ID header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 (save-excursion
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
734 (if (re-search-backward
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
735 "^Message-ID[ \t]*:[ \n\t]*\\(<[^>]*>\\)" nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 (setq message-id (buffer-substring (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 ;; There is no Message-ID here, so we create one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 (save-excursion
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
740 (when (re-search-backward "^Message-ID[ \t]*:" nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 (insert "Original-")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 (forward-line -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 (insert "Message-ID: " (setq message-id (nnmail-message-id))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 "\n")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 ;; Look for a Content-Length header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 (if (not (save-excursion
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
748 (and (re-search-backward
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 "^Content-Length:[ \t]*\\([0-9]+\\)" start t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 (setq content-length (string-to-int
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
751 (buffer-substring
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 (match-end 1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 ;; We destroy the header, since none of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 ;; the backends ever use it, and we do not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 ;; want to confuse other mailers by having
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 ;; a (possibly) faulty header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 (progn (insert "X-") t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 (setq do-search t)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
760 (widen)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 (if (or (= (+ (point) content-length) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 (save-excursion
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 (looking-at "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 (goto-char (+ (point) content-length))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 (setq do-search nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 (setq do-search t)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
769 (widen)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 ;; 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
771 ;; of the buffer.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
772 (when do-search
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
773 (if (re-search-forward "^" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
774 (goto-char (match-beginning 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
775 (goto-char (1- (point-max)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 (delete-char 1) ; delete ^_
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 (narrow-to-region start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 (goto-char (point-min))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
781 (nnmail-check-duplication message-id func artnum-func)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 (setq end (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 (goto-char end))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
785 (defsubst nnmail-search-unix-mail-delim ()
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
786 "Put point at the beginning of the next Unix mbox message."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
787 ;; Algorithm used to find the the next article in the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
788 ;; brain-dead Unix mbox format:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
789 ;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
790 ;; 1) Search for "^From ".
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
791 ;; 2) If we find it, then see whether the previous
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
792 ;; line is blank and the next line looks like a header.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
793 ;; 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
794 (let ((case-fold-search nil)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 found)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 (while (not found)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
797 (if (not (re-search-forward "^From " nil t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
798 (setq found 'no)
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 (beginning-of-line)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
801 (when (and (or (bobp)
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 (= (following-char) ?\n)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
805 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
806 (forward-line 1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
807 (while (looking-at ">From ")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
808 (forward-line 1))
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
809 (looking-at "[^ \n\t:]+[ \n\t]*:")))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
810 (setq found 'yes)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
811 (beginning-of-line)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 (eq found 'yes)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
814 (defun nnmail-search-unix-mail-delim-backward ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
815 "Put point at the beginning of the current Unix mbox message."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
816 ;; Algorithm used to find the the next article in the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
817 ;; brain-dead Unix mbox format:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
818 ;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
819 ;; 1) Search for "^From ".
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
820 ;; 2) If we find it, then see whether the previous
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
821 ;; line is blank and the next line looks like a header.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
822 ;; 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
823 (let ((case-fold-search nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
824 found)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
825 (while (not found)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
826 (if (not (re-search-backward "^From " nil t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
827 (setq found 'no)
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 (beginning-of-line)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
830 (when (and (or (bobp)
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 (= (following-char) ?\n)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
834 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
835 (forward-line 1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
836 (while (looking-at ">From ")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
837 (forward-line 1))
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
838 (looking-at "[^ \n\t:]+[ \n\t]*:")))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
839 (setq found 'yes)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
840 (beginning-of-line)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
841 (eq found 'yes)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
842
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
843 (defun nnmail-process-unix-mail-format (func artnum-func)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 (let ((case-fold-search t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 start message-id content-length end skip head-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 (goto-char (point-min))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
847 (if (not (and (re-search-forward "^From " nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 (goto-char (match-beginning 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 ;; Possibly wrong format?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 (error "Error, unknown mail format! (Possibly corrupted.)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 ;; Carry on until the bitter end.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 (while (not (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 (setq start (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 end nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 ;; Find the end of the head.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 (narrow-to-region
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
857 start
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 (if (search-forward "\n\n" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 (1- (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 ;; This will never happen, but just to be on the safe side --
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 ;; if there is no head-body delimiter, we search a bit manually.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 (while (and (looking-at "From \\|[^ \t]+:")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 (not (eobp)))
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 112
diff changeset
864 (forward-line 1))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 112
diff changeset
865 (point)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 ;; Find the Message-ID header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 (goto-char (point-min))
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
868 (if (re-search-forward "^Message-ID[ \t]*:[ \n\t]*\\(<[^>]+>\\)" nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 (setq message-id (match-string 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 (save-excursion
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
871 (when (re-search-forward "^Message-ID[ \t]*:" nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 (insert "Original-")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 ;; There is no Message-ID here, so we create one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 (insert "Message-ID: " (setq message-id (nnmail-message-id)) "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 ;; Look for a Content-Length header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 (if (not (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 "^Content-Length:[ \t]*\\([0-9]+\\)" nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 (setq content-length nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 (setq content-length (string-to-int (match-string 1)))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
883 ;; We destroy the header, since none of the backends ever
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 ;; use it, and we do not want to confuse other mailers by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 ;; having a (possibly) faulty header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 (insert "X-"))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
888 (run-hooks 'nnmail-prepare-incoming-header-hook)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 ;; Find the end of this article.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 (setq head-end (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 ;; We try the Content-Length value. The idea: skip over the header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 ;; separator, then check what happens content-length bytes into the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 ;; message body. This should be either the end ot the buffer, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 ;; message separator or a blank line followed by the separator.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 ;; The blank line should probably be deleted. If neither of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 ;; three is met, the content-length header is probably invalid.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 (when content-length
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 (setq skip (+ (point) content-length))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 (goto-char skip)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 (cond ((or (= skip (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 (= (1+ skip) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 (setq end (point-max)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
906 ((looking-at "From ")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 (setq end skip))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
908 ((looking-at "[ \t]*\n\\(From \\)")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 (setq end (match-beginning 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 (t (setq end nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 (if end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 (goto-char end)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
913 ;; No Content-Length, so we find the beginning of the next
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 ;; article or the end of the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 (goto-char head-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 (or (nnmail-search-unix-mail-delim)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 (goto-char (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 ;; Allow the backend to save the article.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 (narrow-to-region start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 (goto-char (point-min))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
923 (nnmail-check-duplication message-id func artnum-func)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 (setq end (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 (goto-char end)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
927 (defun nnmail-process-mmdf-mail-format (func artnum-func)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 (let ((delim "^\^A\^A\^A\^A$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 (case-fold-search t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 start message-id end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 (if (not (and (re-search-forward delim nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 (forward-line 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 ;; Possibly wrong format?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 (error "Error, unknown mail format! (Possibly corrupted.)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 ;; Carry on until the bitter end.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 (while (not (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 (setq start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 ;; Find the end of the head.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 (narrow-to-region
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
941 start
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 (if (search-forward "\n\n" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 (1- (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 ;; This will never happen, but just to be on the safe side --
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 ;; if there is no head-body delimiter, we search a bit manually.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 (while (and (looking-at "From \\|[^ \t]+:")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 (not (eobp)))
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 112
diff changeset
948 (forward-line 1))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 112
diff changeset
949 (point)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 ;; Find the Message-ID header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 (goto-char (point-min))
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
952 (if (re-search-forward "^Message-ID[ \t]*:[ \n\t]*\\(<[^>]+>\\)" nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 (setq message-id (match-string 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 ;; There is no Message-ID here, so we create one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 (save-excursion
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
956 (when (re-search-backward "^Message-ID[ \t]*:" nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 (insert "Original-")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 (insert "Message-ID: " (setq message-id (nnmail-message-id)) "\n"))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
961 (run-hooks 'nnmail-prepare-incoming-header-hook)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 ;; Find the end of this article.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 (if (re-search-forward delim nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 (goto-char (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 ;; Allow the backend to save the article.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 (narrow-to-region start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 (goto-char (point-min))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
973 (nnmail-check-duplication message-id func artnum-func)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 (setq end (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 (goto-char end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 (forward-line 2)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
978 (defun nnmail-split-incoming (incoming func &optional exit-func
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
979 group artnum-func)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 "Go through the entire INCOMING file and pick out each individual mail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 FUNC will be called with the buffer narrowed to each mail."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 (let (;; If this is a group-specific split, we bind the split
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 ;; methods to just this group.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 (nnmail-split-methods (if (and group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 (or (eq nnmail-spool-file 'procmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 nnmail-use-procmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 (not nnmail-resplit-incoming))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 (list (list group ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 nnmail-split-methods)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 ;; Insert the incoming file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 (set-buffer (get-buffer-create " *nnmail incoming*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 (buffer-disable-undo (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 (erase-buffer)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
995 (nnheader-insert-file-contents incoming)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 (unless (zerop (buffer-size))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 (save-excursion (run-hooks 'nnmail-prepare-incoming-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 ;; Handle both babyl, MMDF and unix mail formats, since movemail will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 ;; use the former when fetching from a mailbox, the latter when
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
1001 ;; fetching from a file.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 (cond ((or (looking-at "\^L")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 (looking-at "BABYL OPTIONS:"))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1004 (nnmail-process-babyl-mail-format func artnum-func))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 ((looking-at "\^A\^A\^A\^A")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1006 (nnmail-process-mmdf-mail-format func artnum-func))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 (t
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1008 (nnmail-process-unix-mail-format func artnum-func))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1009 (when exit-func
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1010 (funcall exit-func))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 (kill-buffer (current-buffer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1013 ;; Mail crossposts suggested by Brian Edmonds <edmonds@cs.ubc.ca>.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 (defun nnmail-article-group (func)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 "Look at the headers and return an alist of groups that match.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 FUNC will be called with the group name to determine the article number."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 (let ((methods nnmail-split-methods)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 (obuf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 (beg (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 end group-art method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 (if (and (sequencep methods) (= (length methods) 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 ;; If there is only just one group to put everything in, we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 ;; just return a list with just this one method in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 (setq group-art
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 (list (cons (caar methods) (funcall func (caar methods)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 ;; We do actual comparison.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 ;; Find headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 (goto-char beg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 (setq end (if (search-forward "\n\n" nil t) (point) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 (set-buffer nntp-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 ;; Copy the headers into the work buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 (insert-buffer-substring obuf beg end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 ;; Fold continuation lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 (while (re-search-forward "\\(\r?\n[ \t]+\\)+" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 (replace-match " " t t))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1039 ;; Allow washing.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1040 (run-hooks 'nnmail-split-hook)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 (if (and (symbolp nnmail-split-methods)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 (fboundp nnmail-split-methods))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1043 (let ((split
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 (or (funcall nnmail-split-methods)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 '("bogus"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 (error
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1048 (message
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 "Error in `nnmail-split-methods'; using `bogus' mail group")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 (sit-for 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 '("bogus")))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1052 (unless (equal split '(junk))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1053 ;; `nnmail-split-methods' is a function, so we just call
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1054 ;; this function here and use the result.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1055 (setq group-art
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1056 (mapcar
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1057 (lambda (group) (cons group (funcall func group)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1058 split))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 ;; Go through the split methods to find a match.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 (while (and methods (or nnmail-crosspost (not group-art)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 (setq method (pop methods))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 (if (or methods
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 (not (equal "" (nth 1 method))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 (when (and
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1066 (ignore-errors
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1067 (if (stringp (nth 1 method))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1068 (re-search-backward (cadr method) nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1069 ;; Function to say whether this is a match.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1070 (funcall (nth 1 method) (car method))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1071 ;; Don't enter the article into the same
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 ;; group twice.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 (not (assoc (car method) group-art)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1074 (push (cons (car method) (funcall func (car method)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 group-art))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1076 ;; This is the final group, which is used as a
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 ;; catch-all.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 (unless group-art
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1079 (setq group-art
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1080 (list (cons (car method)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 (funcall func (car method)))))))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1082 ;; See whether the split methods returned `junk'.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1083 (if (equal group-art '(junk))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1084 nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1085 (nreverse (delq 'junk group-art)))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087 (defun nnmail-insert-lines ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 "Insert how many lines there are in the body of the mail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 Return the number of characters in the body."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 (let (lines chars)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 (goto-char (point-min))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1093 (when (search-forward "\n\n" nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 (setq chars (- (point-max) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 (setq lines (count-lines (point) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 (forward-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 (when (re-search-backward "^Lines: " nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 (delete-region (point) (progn (forward-line 1) (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 (insert (format "Lines: %d\n" (max lines 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 chars))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 (defun nnmail-insert-xref (group-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 "Insert an Xref line based on the (group . article) alist."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 (goto-char (point-min))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1108 (when (search-forward "\n\n" nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 (forward-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 (when (re-search-backward "^Xref: " nil t)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1111 (delete-region (match-beginning 0)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112 (progn (forward-line 1) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 (insert (format "Xref: %s" (system-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114 (while group-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 (insert (format " %s:%d" (caar group-alist) (cdar group-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116 (setq group-alist (cdr group-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 (insert "\n"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1119 ;;; Message washing functions
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1120
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1121 (defun nnmail-remove-leading-whitespace ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1122 "Remove excessive whitespace from all headers."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1123 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1124 (while (re-search-forward "^\\([^ :]+: \\) +" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1125 (replace-match "\\1" t)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1126
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1127 (defun nnmail-remove-list-identifiers ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1128 "Remove list identifiers from Subject headers."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1129 (let ((regexp (if (stringp nnmail-list-identifiers) nnmail-list-identifiers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1130 (mapconcat 'identity nnmail-list-identifiers "\\|"))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1131 (when regexp
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1132 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1133 (when (re-search-forward
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1134 (concat "^Subject: +\\(Re: +\\)?\\(" regexp "\\) *")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1135 nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1136 (delete-region (match-beginning 2) (match-end 0))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1137
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1138 (defun nnmail-remove-tabs ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1139 "Translate TAB characters into SPACE characters."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1140 (subst-char-in-region (point-min) (point-max) ?\t ? t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1141
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1142 ;;; Utility functions
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1143
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 ;; Written by byer@mv.us.adobe.com (Scott Byer).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 (defun nnmail-make-complex-temp-name (prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 (let ((newname (make-temp-name prefix))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 (newprefix prefix))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148 (while (file-exists-p newname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149 (setq newprefix (concat newprefix "x"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 (setq newname (make-temp-name newprefix)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151 newname))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 ;; Written by Per Abrahamsen <amanda@iesd.auc.dk>.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155 (defun nnmail-split-fancy ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156 "Fancy splitting method.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157 See the documentation for the variable `nnmail-split-fancy' for documentation."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 (let ((syntab (syntax-table)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 (set-syntax-table nnmail-split-fancy-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162 (nnmail-split-it nnmail-split-fancy))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163 (set-syntax-table syntab))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 (defvar nnmail-split-cache nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166 ;; Alist of split expressions their equivalent regexps.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168 (defun nnmail-split-it (split)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 ;; Return a list of groups matching SPLIT.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1170 (cond
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1171 ;; nil split
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1172 ((null split)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1173 nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1174
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1175 ;; A group name. Do the \& and \N subs into the string.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1176 ((stringp split)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1177 (list (nnmail-expand-newtext split)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1178
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1179 ;; Junk the message.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1180 ((eq split 'junk)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1181 (list 'junk))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1182
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1183 ;; Builtin & operation.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1184 ((eq (car split) '&)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1185 (apply 'nconc (mapcar 'nnmail-split-it (cdr split))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1186
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1187 ;; Builtin | operation.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1188 ((eq (car split) '|)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1189 (let (done)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1190 (while (and (not done) (cdr split))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1191 (setq split (cdr split)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1192 done (nnmail-split-it (car split))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1193 done))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1194
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1195 ;; Builtin : operation.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1196 ((eq (car split) ':)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1197 (nnmail-split-it (eval (cdr split))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1198
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1199 ;; Check the cache for the regexp for this split.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1200 ;; FIX FIX FIX could avoid calling assq twice here
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1201 ((assq split nnmail-split-cache)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1202 (goto-char (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1203 ;; 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
1204 ;; a split: (from "foo-\\(bar\\|baz\\)@gnus.org "mail.foo.\\1")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1205 ;; and someone mails a message with 'To: foo-bar@gnus.org' and
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1206 ;; '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
1207 ;; 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
1208 ;; is probably better. Also, this routine won't do a crosspost
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1209 ;; when there are two different matches.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1210 ;; I guess you could just make this more determined, and it could
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1211 ;; look for still more matches prior to this one, and recurse
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1212 ;; on each of the multiple matches hit. Of course, then you'd
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1213 ;; want to make sure that nnmail-article-group or nnmail-split-fancy
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1214 ;; removed duplicates, since there might be more of those.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1215 ;; I guess we could also remove duplicates in the & split case, since
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1216 ;; that's the only thing that can introduce them.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1217 (when (re-search-backward (cdr (assq split nnmail-split-cache)) nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1218 ;; 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
1219 ;; correct match positions.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1220 (goto-char (match-end 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1221 (let ((value (nth 1 split)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1222 (re-search-backward (if (symbolp value)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1223 (cdr (assq value nnmail-split-abbrev-alist))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1224 value)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1225 (match-end 1)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1226 (nnmail-split-it (nth 2 split))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1227
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1228 ;; Not in cache, compute a regexp for the field/value pair.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1229 (t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1230 (let* ((field (nth 0 split))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1231 (value (nth 1 split))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1232 (regexp (concat "^\\(\\("
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1233 (if (symbolp field)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1234 (cdr (assq field nnmail-split-abbrev-alist))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1235 field)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1236 "\\):.*\\)\\<\\("
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1237 (if (symbolp value)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1238 (cdr (assq value nnmail-split-abbrev-alist))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1239 value)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1240 "\\)\\>")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1241 (push (cons split regexp) nnmail-split-cache)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1242 ;; 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
1243 ;; on the same split, which will find it immediately in the cache.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1244 (nnmail-split-it split)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1245
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1246 (defun nnmail-expand-newtext (newtext)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1247 (let ((len (length newtext))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1248 (pos 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1249 c expanded beg N did-expand)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1250 (while (< pos len)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1251 (setq beg pos)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1252 (while (and (< pos len)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1253 (not (= (aref newtext pos) ?\\)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1254 (setq pos (1+ pos)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1255 (unless (= beg pos)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1256 (push (substring newtext beg pos) expanded))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1257 (when (< pos len)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1258 ;; we hit a \, expand it.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1259 (setq did-expand t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1260 (setq pos (1+ pos))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1261 (setq c (aref newtext pos))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1262 (if (not (or (= c ?\&)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1263 (and (>= c ?1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1264 (<= c ?9))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1265 ;; \ followed by some character we don't expand
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1266 (push (char-to-string c) expanded)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1267 ;; \& or \N
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1268 (if (= c ?\&)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1269 (setq N 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1270 (setq N (- c ?0)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1271 (when (match-beginning N)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1272 (push (buffer-substring (match-beginning N) (match-end N))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1273 expanded))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1274 (setq pos (1+ pos)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1275 (if did-expand
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1276 (apply 'concat (nreverse expanded))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1277 newtext)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 ;; Get a list of spool files to read.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 (defun nnmail-get-spool-files (&optional group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 (if (null nnmail-spool-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282 ;; No spool file whatsoever.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283 nil
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1284 (let* ((procmails
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 ;; If procmail is used to get incoming mail, the files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 ;; are stored in this directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 (and (file-exists-p nnmail-procmail-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 (or (eq nnmail-spool-file 'procmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289 nnmail-use-procmail)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1290 (directory-files
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1291 nnmail-procmail-directory
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 t (concat (if group (concat "^" group) "")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1293 nnmail-procmail-suffix "$"))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 (p procmails)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 (crash (when (and (file-exists-p nnmail-crash-box)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1296 (> (nnheader-file-size
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1297 (file-truename nnmail-crash-box))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1298 0))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299 (list nnmail-crash-box))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1300 ;; Remove any directories that inadvertently match the procmail
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1301 ;; suffix, which might happen if the suffix is "".
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302 (while p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1303 (when (file-directory-p (car p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304 (setq procmails (delete (car p) procmails)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1305 (setq p (cdr p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1306 ;; Return the list of spools.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1307 (append
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1308 crash
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1309 (cond ((and group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1310 (or (eq nnmail-spool-file 'procmail)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1311 nnmail-use-procmail)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1312 procmails)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1313 procmails)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1314 ((and group
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1315 (eq nnmail-spool-file 'procmail))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1316 nil)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317 ((listp nnmail-spool-file)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1318 (nconc
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1319 (apply
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1320 'nconc
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1321 (mapcar
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1322 (lambda (file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1323 (if (and (not (string-match "^po:" file))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1324 (file-directory-p file))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1325 (nnheader-directory-regular-files file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1326 (list file)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1327 nnmail-spool-file))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1328 procmails))
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 16
diff changeset
1329 ((stringp nnmail-spool-file)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1330 (if (and (not (string-match "^po:" nnmail-spool-file))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1331 (file-directory-p nnmail-spool-file))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1332 (nconc
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1333 (nnheader-directory-regular-files nnmail-spool-file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1334 procmails)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1335 (cons nnmail-spool-file procmails)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1336 ((eq nnmail-spool-file 'pop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1337 (cons (format "po:%s" (user-login-name)) procmails))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1338 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1339 procmails))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1340
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1341 ;; Activate a backend only if it isn't already activated.
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1342 ;; If FORCE, re-read the active file even if the backend is
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1343 ;; already activated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1344 (defun nnmail-activate (backend &optional force)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1345 (let (file timestamp file-time)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1346 (if (or (not (symbol-value (intern (format "%s-group-alist" backend))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1347 force
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1348 (and (setq file (ignore-errors
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1349 (symbol-value (intern (format "%s-active-file"
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1350 backend)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351 (setq file-time (nth 5 (file-attributes file)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1352 (or (not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1353 (setq timestamp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1354 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1355 (symbol-value (intern
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1356 (format "%s-active-timestamp"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1357 backend)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1358 (error 'none))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1359 (not (consp timestamp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1360 (equal timestamp '(0 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1361 (> (nth 0 file-time) (nth 0 timestamp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362 (and (= (nth 0 file-time) (nth 0 timestamp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1363 (> (nth 1 file-time) (nth 1 timestamp))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1365 (or (eq timestamp 'none)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1366 (set (intern (format "%s-active-timestamp" backend))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1367 file-time))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1368 (funcall (intern (format "%s-request-list" backend)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369 t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1371 (defun nnmail-message-id ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1372 (concat "<" (message-unique-id) "@totally-fudged-out-message-id>"))
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 ;;; nnmail duplicate handling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1376 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1378 (defvar nnmail-cache-buffer nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1380 (defun nnmail-cache-open ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1381 (if (or (not nnmail-treat-duplicates)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382 (and nnmail-cache-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383 (buffer-name nnmail-cache-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384 () ; The buffer is open.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385 (save-excursion
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1386 (set-buffer
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1387 (setq nnmail-cache-buffer
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1388 (get-buffer-create " *nnmail message-id cache*")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389 (buffer-disable-undo (current-buffer))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1390 (when (file-exists-p nnmail-message-id-cache-file)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1391 (nnheader-insert-file-contents nnmail-message-id-cache-file))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392 (set-buffer-modified-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393 (current-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1394
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1395 (defun nnmail-cache-close ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1396 (when (and nnmail-cache-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1397 nnmail-treat-duplicates
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1398 (buffer-name nnmail-cache-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1399 (buffer-modified-p nnmail-cache-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1400 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1401 (set-buffer nnmail-cache-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1402 ;; Weed out the excess number of Message-IDs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1403 (goto-char (point-max))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1404 (when (search-backward "\n" nil t nnmail-message-id-cache-length)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1405 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1406 (beginning-of-line)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1407 (delete-region (point-min) (point))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1408 ;; Save the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1409 (or (file-exists-p (file-name-directory nnmail-message-id-cache-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1410 (make-directory (file-name-directory nnmail-message-id-cache-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1411 t))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1412 (nnmail-write-region (point-min) (point-max)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1413 nnmail-message-id-cache-file nil 'silent)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414 (set-buffer-modified-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1415 (setq nnmail-cache-buffer nil)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1416 (kill-buffer (current-buffer)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1417
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1418 (defun nnmail-cache-insert (id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1419 (when nnmail-treat-duplicates
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1420 (unless (gnus-buffer-live-p nnmail-cache-buffer)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1421 (nnmail-cache-open))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1422 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1423 (set-buffer nnmail-cache-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1424 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1425 (insert id "\n"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1426
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1427 (defun nnmail-cache-id-exists-p (id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1428 (when nnmail-treat-duplicates
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1429 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1430 (set-buffer nnmail-cache-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1431 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1432 (search-backward id nil t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1433
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1434 (defun nnmail-fetch-field (header)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1435 (save-excursion
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1436 (save-restriction
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1437 (message-narrow-to-head)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1438 (message-fetch-field header))))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1439
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1440 (defun nnmail-check-duplication (message-id func artnum-func)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1441 (run-hooks 'nnmail-prepare-incoming-message-hook)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1442 ;; If this is a duplicate message, then we do not save it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1443 (let* ((duplication (nnmail-cache-id-exists-p message-id))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1444 (case-fold-search t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1445 (action (when duplication
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1446 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1447 ((memq nnmail-treat-duplicates '(warn delete))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1448 nnmail-treat-duplicates)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1449 ((nnheader-functionp nnmail-treat-duplicates)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1450 (funcall nnmail-treat-duplicates message-id))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1451 (t
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1452 nnmail-treat-duplicates))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1453 group-art)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1454 ;; Let the backend save the article (or not).
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1455 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1456 ((not duplication)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1457 (nnmail-cache-insert message-id)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1458 (funcall func (setq group-art
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1459 (nreverse (nnmail-article-group artnum-func)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1460 ((eq action 'delete)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1461 (setq group-art nil))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1462 ((eq action 'warn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1463 ;; We insert a warning.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1464 (let ((case-fold-search t))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1465 (goto-char (point-min))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1466 (re-search-forward "^message-id[ \t]*:" nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1467 (beginning-of-line)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1468 (insert
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1469 "Gnus-Warning: This is a duplicate of message " message-id "\n")
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))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472 (t
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1473 (funcall func (setq group-art
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1474 (nreverse (nnmail-article-group artnum-func))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1475 ;; Add the group-art list to the history list.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1476 (if group-art
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1477 (push group-art nnmail-split-history)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1478 (delete-region (point-min) (point-max)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1479
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1480 ;;; Get new mail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1481
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482 (defun nnmail-get-value (&rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1483 (let ((sym (intern (apply 'format args))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1484 (when (boundp sym)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1485 (symbol-value sym))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1486
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1487 (defun nnmail-get-new-mail (method exit-func temp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1488 &optional group spool-func)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1489 "Read new incoming mail."
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1490 ;; Nix out the previous split history.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1491 (unless group
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1492 (setq nnmail-split-history nil))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1493 (let* ((spools (nnmail-get-spool-files group))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1494 (group-in group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1495 incoming incomings spool)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1496 (when (and (nnmail-get-value "%s-get-new-mail" method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1497 nnmail-spool-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1498 ;; We first activate all the groups.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1499 (nnmail-activate method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1500 ;; Allow the user to hook.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1501 (run-hooks 'nnmail-pre-get-new-mail-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1502 ;; Open the message-id cache.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1503 (nnmail-cache-open)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1504 ;; The we go through all the existing spool files and split the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1505 ;; mail from each.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1506 (while spools
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1507 (setq spool (pop spools))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1508 ;; We read each spool file if either the spool is a POP-mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1509 ;; spool, or the file exists. We can't check for the
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1510 ;; existence of POPped mail.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1511 (when (or (string-match "^po:" spool)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1512 (and (file-exists-p (file-truename spool))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1513 (> (nnheader-file-size (file-truename spool)) 0)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1514 (nnheader-message 3 "%s: Reading incoming mail..." method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1515 (when (and (nnmail-move-inbox spool)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1516 (file-exists-p nnmail-crash-box))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1517 ;; There is new mail. We first find out if all this mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1518 ;; is supposed to go to some specific group.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1519 (setq group (nnmail-get-split-group spool group-in))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1520 ;; We split the mail
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1521 (nnmail-split-incoming
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1522 nnmail-crash-box (intern (format "%s-save-mail" method))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1523 spool-func group (intern (format "%s-active-number" method)))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1524 ;; 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
1525 (setq incoming
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1526 (nnmail-make-complex-temp-name
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1527 (expand-file-name
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1528 (if nnmail-tmp-directory
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1529 (concat
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1530 (file-name-as-directory nnmail-tmp-directory)
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1531 (file-name-nondirectory
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1532 (concat (file-name-as-directory temp) "Incoming")))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1533 (concat (file-name-as-directory temp) "Incoming")))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1534 (rename-file nnmail-crash-box incoming t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1535 (push incoming incomings))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1536 ;; If we did indeed read any incoming spools, we save all info.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1537 (when incomings
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1538 (nnmail-save-active
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1539 (nnmail-get-value "%s-group-alist" method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1540 (nnmail-get-value "%s-active-file" method))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1541 (when exit-func
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1542 (funcall exit-func))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1543 (run-hooks 'nnmail-read-incoming-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1544 (nnheader-message 3 "%s: Reading incoming mail...done" method))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1545 ;; Close the message-id cache.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1546 (nnmail-cache-close)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1547 ;; Allow the user to hook.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1548 (run-hooks 'nnmail-post-get-new-mail-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1549 ;; Delete all the temporary files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1550 (while incomings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1551 (setq incoming (pop incomings))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1552 (and nnmail-delete-incoming
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1553 (file-exists-p incoming)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1554 (file-writable-p incoming)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1555 (delete-file incoming))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1556
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1557 (defun nnmail-expired-article-p (group time force &optional inhibit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1558 "Say whether an article that is TIME old in GROUP should be expired."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1559 (if force
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1560 t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1561 (let ((days (or (and nnmail-expiry-wait-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1562 (funcall nnmail-expiry-wait-function group))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1563 nnmail-expiry-wait)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1564 (cond ((or (eq days 'never)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1565 (and (not force)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1566 inhibit))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1567 ;; This isn't an expirable group.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1568 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1569 ((eq days 'immediate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1570 ;; We expire all articles on sight.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1571 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1572 ((equal time '(0 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1573 ;; This is an ange-ftp group, and we don't have any dates.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1574 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1575 ((numberp days)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1576 (setq days (nnmail-days-to-time days))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1577 ;; Compare the time with the current time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1578 (nnmail-time-less days (nnmail-time-since time)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1579
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1580 (defvar nnmail-read-passwd nil)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1581 (defun nnmail-read-passwd (prompt &rest args)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1582 "Read a password using PROMPT.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1583 If ARGS, PROMPT is used as an argument to `format'."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1584 (let ((prompt
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1585 (if args
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1586 (apply 'format prompt args)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1587 prompt)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1588 (unless nnmail-read-passwd
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1589 (if (load "passwd" t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1590 (setq nnmail-read-passwd 'read-passwd)
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1591 (unless (fboundp 'ange-ftp-read-passwd)
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1592 (autoload 'ange-ftp-read-passwd "ange-ftp"))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1593 (setq nnmail-read-passwd 'ange-ftp-read-passwd)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1594 (funcall nnmail-read-passwd prompt)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1595
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1596 (defun nnmail-check-syntax ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1597 "Check (and modify) the syntax of the message in the current buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1598 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1599 (message-narrow-to-head)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1600 (let ((case-fold-search t))
104
cf808b4c4290 Import from CVS: tag r20-1b4
cvs
parents: 100
diff changeset
1601 (unless (re-search-forward "^Message-ID[ \t]*:" nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1602 (insert "Message-ID: " (nnmail-message-id) "\n")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1603
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1604 (defun nnmail-write-region (start end filename &optional append visit lockname)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1605 "Do a `write-region', and then set the file modes."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1606 (write-region start end filename append visit lockname)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1607 (set-file-modes filename nnmail-default-file-modes))
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 ;;; Status functions
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1611 ;;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1612
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1613 (defun nnmail-replace-status (name value)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1614 "Make status NAME and VALUE part of the current status line."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1615 (save-restriction
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1616 (message-narrow-to-head)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1617 (let ((status (nnmail-decode-status)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1618 (setq status (delq (member name status) status))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1619 (when value
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1620 (push (cons name value) status))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1621 (message-remove-header "status")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1622 (goto-char (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1623 (insert "Status: " (nnmail-encode-status status) "\n"))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1624
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1625 (defun nnmail-decode-status ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1626 "Return a status-value alist from STATUS."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1627 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1628 (when (re-search-forward "^Status: " nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1629 (let (name value status)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1630 (save-restriction
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1631 ;; Narrow to the status.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1632 (narrow-to-region
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1633 (point)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1634 (if (re-search-forward "^[^ \t]" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1635 (1- (point))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1636 (point-max)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1637 ;; Go through all elements and add them to the list.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1638 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1639 (while (re-search-forward "[^ \t=]+" nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1640 (setq name (match-string 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1641 (if (not (= (following-char) ?=))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1642 ;; Implied "yes".
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1643 (setq value "yes")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1644 (forward-char 1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1645 (if (not (= (following-char) ?\"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1646 (if (not (looking-at "[^ \t]"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1647 ;; Implied "no".
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1648 (setq value "no")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1649 ;; Unquoted value.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1650 (setq value (match-string 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1651 (goto-char (match-end 0)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1652 ;; Quoted value.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1653 (setq value (read (current-buffer)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1654 (push (cons name value) status)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1655 status)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1656
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1657 (defun nnmail-encode-status (status)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1658 "Return a status string from STATUS."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1659 (mapconcat
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1660 (lambda (elem)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1661 (concat
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1662 (car elem) "="
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1663 (if (string-match "[ \t]" (cdr elem))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1664 (prin1-to-string (cdr elem))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1665 (cdr elem))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1666 status " "))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1667
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1668 (defun nnmail-split-history ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1669 "Generate an overview of where the last mail split put articles."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1670 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1671 (unless nnmail-split-history
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1672 (error "No current split history"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1673 (with-output-to-temp-buffer "*nnmail split history*"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1674 (let ((history nnmail-split-history)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1675 elem)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1676 (while (setq elem (pop history))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1677 (princ (mapconcat (lambda (ga)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1678 (concat (car ga) ":" (int-to-string (cdr ga))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1679 elem
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1680 ", "))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1681 (princ "\n")))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1682
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1683 (defun nnmail-new-mail-p (group)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1684 "Say whether GROUP has new mail."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1685 (let ((his nnmail-split-history)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1686 found)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1687 (while his
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1688 (when (assoc group (pop his))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1689 (setq found t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1690 his nil)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
1691 found))
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1692
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1693 (eval-and-compile
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1694 (autoload 'pop3-movemail "pop3"))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1695
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1696 (defun nnmail-pop3-movemail (inbox crashbox)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1697 "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
1698 (let ((pop3-maildrop
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1699 (substring inbox (match-end (string-match "^po:" inbox)))))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1700 (pop3-movemail crashbox)))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
1701
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1702 (run-hooks 'nnmail-load-hook)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 104
diff changeset
1703
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1704 (provide 'nnmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1705
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1706 ;;; nnmail.el ends here