annotate lisp/gnus/nnmail.el @ 2:ac2d302a0011 r19-15b2

Import from CVS: tag r19-15b2
author cvs
date Mon, 13 Aug 2007 08:46:35 +0200
parents 376386a54a3c
children 0293115a14e9
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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;; Copyright (C) 1995,96 Free Software Foundation, Inc.
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)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 (eval-when-compile (require 'cl))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 (defvar nnmail-split-methods
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 '(("mail.misc" ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 "*Incoming mail will be split according to this variable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 If you'd like, for instance, one mail group for mail from the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 \"4ad-l\" mailing list, one group for junk mail and one for everything
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 else, you could do something like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (setq nnmail-split-methods
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 '((\"mail.4ad\" \"From:.*4ad\")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (\"mail.junk\" \"From:.*Lars\\\\|Subject:.*buy\")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (\"mail.misc\" \"\")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 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
47 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
48 does not have to be called anything beginning with \"mail\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 \"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
50 nnmail will try to match on the header to find a fit.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 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
53 called narrowed to the headers with the first element of the rule as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 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
55 mail belongs in that group.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 The last element should always have \"\" as the regexp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 This variable can also have a function as its value.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 ;; Suggested by Erik Selberg <speed@cs.washington.edu>.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (defvar nnmail-crosspost t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 "*If non-nil, do crossposting if several split methods match the mail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 If nil, the first match found will be used.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 ;; Added by gord@enci.ucalgary.ca (Gordon Matzigkeit).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (defvar nnmail-keep-last-article nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 "*If non-nil, nnmail will never delete the last expired article in a directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 You may need to set this variable if other programs are putting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 new mail into folder numbers that Gnus has marked as expired.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (defvar nnmail-use-long-file-names nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 "*If non-nil the mail backends will use long file and directory names.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 If nil, groups like \"mail.misc\" will end up in directories like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 \"mail/misc/\".")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (defvar nnmail-expiry-wait 7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 "*Expirable articles that are older than this will be expired.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 This variable can either be a number (which will be interpreted as a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 number of days) -- this doesn't have to be an integer. This variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 can also be `immediate' and `never'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (defvar nnmail-expiry-wait-function nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 "*Variable that holds function to specify how old articles should be before they are expired.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 The function will be called with the name of the group that the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 expiry is to be performed in, and it should return an integer that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 says how many days an article can be stored before it is considered
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 \"old\". It can also return the values `never' and `immediate'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 Eg.:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (setq nnmail-expiry-wait-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (lambda (newsgroup)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (cond ((string-match \"private\" newsgroup) 31)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 ((string-match \"junk\" newsgroup) 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 ((string-match \"important\" newsgroup) 'never)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (t 7))))")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (defvar nnmail-spool-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (or (getenv "MAIL")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (concat "/usr/spool/mail/" (user-login-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 "Where the mail backends will look for incoming mail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 This variable is \"/usr/spool/mail/$user\" by default.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 If this variable is nil, no mail backends will read incoming mail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 If this variable is a list, all files mentioned in this list will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 used as incoming mailboxes.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (defvar nnmail-crash-box "~/.gnus-crash-box"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 "*File where Gnus will store mail while processing it.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (defvar nnmail-use-procmail nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 "*If non-nil, the mail backends will look in `nnmail-procmail-directory' for spool files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 The file(s) in `nnmail-spool-file' will also be read.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (defvar nnmail-procmail-directory "~/incoming/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 "*When using procmail (and the like), incoming mail is put in this directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 The Gnus mail backends will read the mail from this directory.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (defvar nnmail-procmail-suffix "\\.spool"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 "*Suffix of files created by procmail (and the like).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 This variable might be a suffix-regexp to match the suffixes of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 several files - eg. \".spool[0-9]*\".")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (defvar nnmail-resplit-incoming nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 "*If non-nil, re-split incoming procmail sorted mail.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (defvar nnmail-delete-file-function 'delete-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 "Function called to delete files in some mail backends.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (defvar nnmail-crosspost-link-function 'add-name-to-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 "Function called to create a copy of a file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 This is `add-name-to-file' by default, which means that crossposts
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 will use hard links. If your file system doesn't allow hard
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 links, you could set this variable to `copy-file' instead.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (defvar nnmail-movemail-program "movemail"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 "*A command to be executed to move mail from the inbox.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 The default is \"movemail\".")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (defvar nnmail-pop-password-required nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 "*Non-nil if a password is required when reading mail using POP.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 (defvar nnmail-read-incoming-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 "*Hook that will be run after the incoming mail has been transferred.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 The incoming mail is moved from `nnmail-spool-file' (which normally is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 something like \"/usr/spool/mail/$user\") to the user's home
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 directory. This hook is called after the incoming mail box has been
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 emptied, and can be used to call any mail box programs you have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 running (\"xwatch\", etc.)
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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 \(add-hook 'nnmail-read-incoming-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 (lambda ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (start-process \"mailsend\" nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 \"/local/bin/mailsend\" \"read\" \"mbox\")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 If you have xwatch running, this will alert it that mail has been
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 read.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 If you use `display-time', you could use something like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 \(add-hook 'nnmail-read-incoming-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (lambda ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 ;; Update the displayed time, since that will clear out
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 ;; the flag that says you have mail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 (if (eq (process-status \"display-time\") 'run)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (display-time-filter display-time-process \"\"))))")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (when (eq system-type 'windows-nt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (add-hook 'nnmail-prepare-incoming-hook 'nnheader-ms-strip-cr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 ;; Suggested by Erik Selberg <speed@cs.washington.edu>.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 (defvar nnmail-prepare-incoming-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 "*Hook called before treating incoming mail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 The hook is run in a buffer with all the new, incoming mail.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (defvar nnmail-pre-get-new-mail-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 "Hook called just before starting to handle new incoming mail.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 (defvar nnmail-post-get-new-mail-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 "Hook called just after finishing handling new incoming mail.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 ;; Suggested by Mejia Pablo J <pjm9806@usl.edu>.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (defvar nnmail-tmp-directory nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 "*If non-nil, use this directory for temporary storage when reading incoming mail.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (defvar nnmail-large-newsgroup 50
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 "*The number of the articles which indicates a large newsgroup.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 If the number of the articles is greater than the value, verbose
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 messages will be shown to indicate the current status.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (defvar nnmail-split-fancy "mail.misc"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 "*Incoming mail can be split according to this fancy variable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 To enable this, set `nnmail-split-methods' to `nnmail-split-fancy'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 The format is this variable is SPLIT, where SPLIT can be one of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 the following:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 GROUP: Mail will be stored in GROUP (a string).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 \(FIELD VALUE SPLIT): If the message field FIELD (a regexp) contains
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 VALUE (a regexp), store the messages as specified by SPLIT.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 \(| SPLIT...): Process each SPLIT expression until one of them matches.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 A SPLIT expression is said to match if it will cause the mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 message to be stored in one or more groups.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 \(& SPLIT...): Process each SPLIT expression.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 FIELD must match a complete field name. VALUE must match a complete
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 word according to the `nnmail-split-fancy-syntax-table' syntax table.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 You can use .* in the regexps to match partial field names or words.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 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
216 as specified in `nnmail-split-abbrev-alist'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 Example:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 \(setq nnmail-split-methods 'nnmail-split-fancy
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 nnmail-split-fancy
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 ;; Messages from the mailer deamon are not crossposted to any of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 ;; the ordinary groups. Warnings are put in a separate group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 ;; from real errors.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 '(| (\"from\" mail (| (\"subject\" \"warn.*\" \"mail.warning\")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 \"mail.misc\"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 ;; Non-error messages are crossposted to all relevant
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 ;; groups, but we don't crosspost between the group for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 ;; (ding) list and the group for other (ding) related mail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (& (| (any \"ding@ifi\\\\.uio\\\\.no\" \"ding.list\")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (\"subject\" \"ding\" \"ding.misc\"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 ;; Other mailing lists...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (any \"procmail@informatik\\\\.rwth-aachen\\\\.de\" \"procmail.list\")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (any \"SmartList@informatik\\\\.rwth-aachen\\\\.de\" \"SmartList.list\")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 ;; People...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (any \"larsi@ifi\\\\.uio\\\\.no\" \"people.Lars Magne Ingebrigtsen\"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 ;; Unmatched mail goes to the catch all group.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 \"misc.misc\"))")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (defvar nnmail-split-abbrev-alist
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
241 '((any . "from\\|to\\|cc\\|sender\\|apparently-to\\|resent-from\\|resent-to\\|resent-cc")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (mail . "mailer-daemon\\|postmaster"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 "*Alist of abbreviations allowed in `nnmail-split-fancy'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (defvar nnmail-delete-incoming t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 "*If non-nil, the mail backends will delete incoming files after splitting.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (defvar nnmail-message-id-cache-length 1000
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 "*The approximate number of Message-IDs nnmail will keep in its cache.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 If this variable is nil, no checking on duplicate messages will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 performed.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (defvar nnmail-message-id-cache-file "~/.nnmail-cache"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 "*The file name of the nnmail Message-ID cache.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (defvar nnmail-treat-duplicates 'warn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 "*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
258 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
259 Message-ID cache; `warn', which means that nnmail should insert extra
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 headers to warn the user about the duplication (this is the default);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 and `delete', which means that nnmail will delete duplicated mails.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 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
264 narrowed to the article in question with the Message-ID as a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 parameter. It should return nil, `warn' or `delete'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 ;;; Internal variables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 (defvar nnmail-pop-password nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 "*Password to use when reading mail from a POP server, if required.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
272 (defvar nnmail-split-fancy-syntax-table nil
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 "Syntax table used by `nnmail-split-fancy'.")
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
274 (unless (syntax-table-p nnmail-split-fancy-syntax-table)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
275 (setq nnmail-split-fancy-syntax-table
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
276 (copy-syntax-table (standard-syntax-table)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
277 ;; support the %-hack
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
278 (modify-syntax-entry ?\% "." nnmail-split-fancy-syntax-table))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
279
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (defvar nnmail-prepare-save-mail-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 "Hook called before saving mail.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (defvar nnmail-moved-inboxes nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 "List of inboxes that have been moved.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (defvar nnmail-internal-password nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 (defconst nnmail-version "nnmail 1.0"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 "nnmail version.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (defun nnmail-request-post (&optional server)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 (mail-send-and-exit nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 (defun nnmail-find-file (file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 "Insert FILE in server buffer safely."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 (set-buffer nntp-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (let ((format-alist nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (after-insert-file-functions nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (progn (insert-file-contents file) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (file-error nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (defun nnmail-group-pathname (group dir &optional file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 "Make pathname for GROUP."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (let ((dir (file-name-as-directory (expand-file-name dir))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 ;; If this directory exists, we use it directly.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (if (or nnmail-use-long-file-names
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (file-directory-p (concat dir group)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (concat dir group "/")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 ;; If not, we translate dots into slashes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (concat dir (nnheader-replace-chars-in-string group ?. ?/) "/")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (or file "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 (defun nnmail-date-to-time (date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 "Convert DATE into time."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (let* ((d1 (timezone-parse-date date))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (t1 (timezone-parse-time (aref d1 3))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (apply 'encode-time
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (mapcar (lambda (el)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (and el (string-to-number el)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (aref t1 2) (aref t1 1) (aref t1 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (aref d1 2) (aref d1 1) (aref d1 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (aref d1 4))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (defun nnmail-time-less (t1 t2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 "Say whether time T1 is less than time T2."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (or (< (car t1) (car t2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (and (= (car t1) (car t2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (< (nth 1 t1) (nth 1 t2)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (defun nnmail-days-to-time (days)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 "Convert DAYS into time."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (let* ((seconds (* 1.0 days 60 60 24))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (rest (expt 2 16))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (ms (condition-case nil (round (/ seconds rest))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (range-error (expt 2 16)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (list ms (condition-case nil (round (- seconds (* ms rest)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (range-error (expt 2 16))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (defun nnmail-time-since (time)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 "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
350 (when (stringp time)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 ;; Convert date strings to internal time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (setq time (nnmail-date-to-time time)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (let* ((current (current-time))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (rest (if (< (nth 1 current) (nth 1 time)) (expt 2 16))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (list (- (+ (car current) (if rest -1 0)) (car time))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (- (+ (or rest 0) (nth 1 current)) (nth 1 time)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 ;; Function rewritten from rmail.el.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (defun nnmail-move-inbox (inbox)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 "Move INBOX to `nnmail-crash-box'."
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
361 (let ((inbox (file-truename (expand-file-name inbox)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
362 (tofile (file-truename (expand-file-name nnmail-crash-box)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 movemail popmail errors password)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 ;; If getting from mail spool directory,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 ;; use movemail to move rather than just renaming,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 ;; so as to interlock with the mailer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (unless (setq popmail (string-match "^po:" (file-name-nondirectory inbox)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (setq movemail t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (when popmail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (setq inbox (file-name-nondirectory inbox)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (when (and movemail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 ;; On some systems, /usr/spool/mail/foo is a directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 ;; and the actual inbox is /usr/spool/mail/foo/foo.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (file-directory-p inbox))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (setq inbox (expand-file-name (user-login-name) inbox)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (if (member inbox nnmail-moved-inboxes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (if popmail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (setq nnmail-internal-password nnmail-pop-password)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 (when (and nnmail-pop-password-required (not nnmail-pop-password))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (setq nnmail-internal-password
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (nnmail-read-passwd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 (format "Password for %s: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (substring inbox (+ popmail 3))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (message "Getting mail from post office ..."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 (when (or (and (file-exists-p tofile)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
388 (/= 0 (nnheader-file-size tofile)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 (and (file-exists-p inbox)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
390 (/= 0 (nnheader-file-size inbox))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (message "Getting mail from %s..." inbox)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 ;; Set TOFILE if have not already done so, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 ;; rename or copy the file INBOX to TOFILE if and as appropriate.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 ((file-exists-p tofile)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 ;; The crash box exists already.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 ((and (not popmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 (not (file-exists-p inbox)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 ;; There is no inbox.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 (setq tofile nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 ((and (not movemail) (not popmail))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 ;; Try copying. If that fails (perhaps no space),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 ;; rename instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 (copy-file inbox tofile nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 (error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 ;; Third arg is t so we can replace existing file TOFILE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 (rename-file inbox tofile t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (push inbox nnmail-moved-inboxes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 ;; Make the real inbox file empty.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 ;; Leaving it deleted could cause lossage
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 ;; because mailers often won't create the file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 (write-region (point) (point) inbox)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 (file-error nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 ;; Use movemail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 (setq errors (generate-new-buffer " *nnmail loss*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 (buffer-disable-undo errors)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 (let ((default-directory "/"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 (apply
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 'call-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 (append
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 (expand-file-name nnmail-movemail-program exec-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 nil errors nil inbox tofile)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 (when nnmail-internal-password
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 (list nnmail-internal-password)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 (if (not (buffer-modified-p errors))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 ;; No output => movemail won
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 (push inbox nnmail-moved-inboxes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 (set-buffer errors)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 (subst-char-in-region (point-min) (point-max) ?\n ?\ )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 (skip-chars-backward " \t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 (delete-region (point) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 (if (looking-at "movemail: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 (delete-region (point-min) (match-end 0)))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
443 (error (concat "movemail: " (buffer-string)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 (setq tofile nil))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 (and errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 (buffer-name errors)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 (kill-buffer errors))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 tofile)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (defun nnmail-get-active ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 "Returns an assoc of group names and active ranges.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 nn*-request-list should have been called before calling this function."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 (let (group-assoc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 ;; Go through all groups from the active list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 (set-buffer nntp-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 (while (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 "^\\([^ \t]+\\)[ \t]+\\([0-9]+\\)[ \t]+\\([0-9]+\\)" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 ;; We create an alist with `(GROUP (LOW . HIGH))' elements.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 (push (list (match-string 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 (cons (string-to-int (match-string 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 (string-to-int (match-string 2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 group-assoc)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 group-assoc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 (defun nnmail-save-active (group-assoc file-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 "Save GROUP-ASSOC in ACTIVE-FILE."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 (when file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 (let (group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 (set-buffer (get-buffer-create " *nnmail active*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 (buffer-disable-undo (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 (while group-assoc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 (setq group (pop group-assoc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 (insert (format "%s %d %d y\n" (car group) (cdadr group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 (caadr group))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 (unless (file-exists-p (file-name-directory file-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 (make-directory (file-name-directory file-name) t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 (write-region 1 (point-max) (expand-file-name file-name) nil 'nomesg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 (kill-buffer (current-buffer))))))
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-get-split-group (file group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (if (or (eq nnmail-spool-file 'procmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 nnmail-use-procmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (cond (group group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 ((string-match (concat "^" (expand-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 (file-name-as-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 nnmail-procmail-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 "\\([^/]*\\)" nnmail-procmail-suffix "$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 (expand-file-name file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 (substring (expand-file-name file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 (match-beginning 1) (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 group))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 group))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 (defun nnmail-process-babyl-mail-format (func)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 (let ((case-fold-search t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 start message-id content-length do-search end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 (while (not (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 " \n0, *unseen,+\n\\(\\*\\*\\* EOOH \\*\\*\\*\n\\)?" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 (goto-char (match-end 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 (delete-region (match-beginning 0) (match-end 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 (setq start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 ;; Skip all the headers in case there are more "From "s...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 (or (search-forward "\n\n" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 (search-forward-regexp "^[^:]*\\( .*\\|\\)$" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 (search-forward " "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 ;; Find the Message-ID header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 (if (re-search-backward "^Message-ID:[ \t]*\\(<[^>]*>\\)" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 (setq message-id (buffer-substring (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 ;; There is no Message-ID here, so we create one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 (when (re-search-backward "^Message-ID:" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 (insert "Original-")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 (forward-line -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 (insert "Message-ID: " (setq message-id (nnmail-message-id))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 "\n")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 ;; Look for a Content-Length header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 (if (not (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 (and (re-search-backward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 "^Content-Length:[ \t]*\\([0-9]+\\)" start t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 (setq content-length (string-to-int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 (buffer-substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 (match-end 1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 ;; We destroy the header, since none of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 ;; the backends ever use it, and we do not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 ;; want to confuse other mailers by having
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 ;; a (possibly) faulty header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 (progn (insert "X-") t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 (setq do-search t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 (if (or (= (+ (point) content-length) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 (goto-char (+ (point) content-length))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 (looking-at "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 (goto-char (+ (point) content-length))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 (setq do-search nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 (setq do-search t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 ;; Go to the beginning of the next article - or to the end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 ;; of the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 (if do-search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 (if (re-search-forward "^" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 (goto-char (match-beginning 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 (goto-char (1- (point-max)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 (delete-char 1) ; delete ^_
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 (narrow-to-region start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 (nnmail-check-duplication message-id func)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 (setq end (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 (goto-char end))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 (defun nnmail-search-unix-mail-delim ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 "Put point at the beginning of the next message."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 (let ((case-fold-search t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 (delim (concat "^" message-unix-mail-delimiter))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 found)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 (while (not found)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 (if (re-search-forward delim nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 (when (or (looking-at "[^\n :]+ *:")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 (looking-at delim)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 (looking-at (concat ">" message-unix-mail-delimiter)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 (forward-line -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 (setq found 'yes))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 (setq found 'no)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 (eq found 'yes)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 (defun nnmail-process-unix-mail-format (func)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 (let ((case-fold-search t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 (delim (concat "^" message-unix-mail-delimiter))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 start message-id content-length end skip head-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 (if (not (and (re-search-forward delim nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 (goto-char (match-beginning 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 ;; Possibly wrong format?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 (error "Error, unknown mail format! (Possibly corrupted.)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 ;; Carry on until the bitter end.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 (while (not (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 (setq start (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 end nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 ;; Find the end of the head.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 (narrow-to-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 (if (search-forward "\n\n" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 (1- (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 ;; This will never happen, but just to be on the safe side --
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 ;; if there is no head-body delimiter, we search a bit manually.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 (while (and (looking-at "From \\|[^ \t]+:")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 (not (eobp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 ;; Find the Message-ID header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 (if (re-search-forward "^Message-ID:[ \t]*\\(<[^>]+>\\)" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 (setq message-id (match-string 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 (when (re-search-forward "^Message-ID:" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 (insert "Original-")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 ;; There is no Message-ID here, so we create one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 (insert "Message-ID: " (setq message-id (nnmail-message-id)) "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 ;; Look for a Content-Length header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 (if (not (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 "^Content-Length:[ \t]*\\([0-9]+\\)" nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 (setq content-length nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 (setq content-length (string-to-int (match-string 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 ;; We destroy the header, since none of the backends ever
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 ;; use it, and we do not want to confuse other mailers by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 ;; having a (possibly) faulty header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 (insert "X-"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 ;; Find the end of this article.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 (setq head-end (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 ;; We try the Content-Length value. The idea: skip over the header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 ;; separator, then check what happens content-length bytes into the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 ;; message body. This should be either the end ot the buffer, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 ;; message separator or a blank line followed by the separator.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 ;; The blank line should probably be deleted. If neither of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 ;; three is met, the content-length header is probably invalid.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 (when content-length
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 (setq skip (+ (point) content-length))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 (goto-char skip)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 (cond ((or (= skip (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 (= (1+ skip) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 (setq end (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 ((looking-at delim)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 (setq end skip))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 (concat "[ \t]*\n\\(" delim "\\)"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 (setq end (match-beginning 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 (t (setq end nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 (if end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 (goto-char end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 ;; No Content-Length, so we find the beginning of the next
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 ;; article or the end of the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 (goto-char head-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 (or (nnmail-search-unix-mail-delim)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 (goto-char (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 ;; Allow the backend to save the article.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 (narrow-to-region start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 (nnmail-check-duplication message-id func)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 (setq end (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 (goto-char end)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 (defun nnmail-process-mmdf-mail-format (func)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 (let ((delim "^\^A\^A\^A\^A$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 (case-fold-search t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 start message-id end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 (if (not (and (re-search-forward delim nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 (forward-line 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 ;; Possibly wrong format?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 (error "Error, unknown mail format! (Possibly corrupted.)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 ;; Carry on until the bitter end.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 (while (not (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 (setq start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 ;; Find the end of the head.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 (narrow-to-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 (if (search-forward "\n\n" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 (1- (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 ;; This will never happen, but just to be on the safe side --
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 ;; if there is no head-body delimiter, we search a bit manually.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 (while (and (looking-at "From \\|[^ \t]+:")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 (not (eobp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 ;; Find the Message-ID header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 (if (re-search-forward "^Message-ID:[ \t]*\\(<[^>]+>\\)" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 (setq message-id (match-string 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 ;; There is no Message-ID here, so we create one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 (when (re-search-backward "^Message-ID:" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 (insert "Original-")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 (insert "Message-ID: " (setq message-id (nnmail-message-id)) "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 ;; Find the end of this article.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 (if (re-search-forward delim nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 (goto-char (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 ;; Allow the backend to save the article.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 (narrow-to-region start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 (nnmail-check-duplication message-id func)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 (setq end (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 (goto-char end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 (forward-line 2)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 (defun nnmail-split-incoming (incoming func &optional exit-func group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 "Go through the entire INCOMING file and pick out each individual mail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 FUNC will be called with the buffer narrowed to each mail."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 (let (;; If this is a group-specific split, we bind the split
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 ;; methods to just this group.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 (nnmail-split-methods (if (and group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 (or (eq nnmail-spool-file 'procmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 nnmail-use-procmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 (not nnmail-resplit-incoming))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 (list (list group ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 nnmail-split-methods)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 ;; Insert the incoming file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 (set-buffer (get-buffer-create " *nnmail incoming*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 (buffer-disable-undo (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 (nnheader-insert-file-contents-literally incoming)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 (unless (zerop (buffer-size))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 (save-excursion (run-hooks 'nnmail-prepare-incoming-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 ;; Handle both babyl, MMDF and unix mail formats, since movemail will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 ;; use the former when fetching from a mailbox, the latter when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 ;; fetches from a file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 (cond ((or (looking-at "\^L")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 (looking-at "BABYL OPTIONS:"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 (nnmail-process-babyl-mail-format func))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 ((looking-at "\^A\^A\^A\^A")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 (nnmail-process-mmdf-mail-format func))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 (nnmail-process-unix-mail-format func))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 (if exit-func (funcall exit-func))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 (kill-buffer (current-buffer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 ;; Mail crossposts suggested by Brian Edmonds <edmonds@cs.ubc.ca>.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 (defun nnmail-article-group (func)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 "Look at the headers and return an alist of groups that match.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 FUNC will be called with the group name to determine the article number."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 (let ((methods nnmail-split-methods)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 (obuf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 (beg (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 end group-art method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 (if (and (sequencep methods) (= (length methods) 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 ;; If there is only just one group to put everything in, we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 ;; just return a list with just this one method in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 (setq group-art
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 (list (cons (caar methods) (funcall func (caar methods)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 ;; We do actual comparison.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 ;; Find headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 (goto-char beg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 (setq end (if (search-forward "\n\n" nil t) (point) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 (set-buffer nntp-server-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 ;; Copy the headers into the work buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 (insert-buffer-substring obuf beg end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 ;; Fold continuation lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 (while (re-search-forward "\\(\r?\n[ \t]+\\)+" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 (replace-match " " t t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 (if (and (symbolp nnmail-split-methods)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 (fboundp nnmail-split-methods))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 ;; `nnmail-split-methods' is a function, so we just call
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 ;; this function here and use the result.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 (setq group-art
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 (mapcar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 (lambda (group) (cons group (funcall func group)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 (or (funcall nnmail-split-methods)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 '("bogus"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 (error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 (message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 "Error in `nnmail-split-methods'; using `bogus' mail group")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 (sit-for 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 '("bogus")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 ;; Go through the split methods to find a match.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 (while (and methods (or nnmail-crosspost (not group-art)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 (setq method (pop methods))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 (if (or methods
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 (not (equal "" (nth 1 method))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 (when (and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 (if (stringp (nth 1 method))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 (re-search-backward (cadr method) nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 ;; Function to say whether this is a match.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 (funcall (nth 1 method) (car method)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 (error nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 ;; Don't enter the article into the same
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 ;; group twice.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 (not (assoc (car method) group-art)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 (push (cons (car method) (funcall func (car method)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 group-art))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 ;; This is the final group, which is used as a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 ;; catch-all.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 (unless group-art
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 (setq group-art
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 (list (cons (car method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 (funcall func (car method)))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 group-art))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 (defun nnmail-insert-lines ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 "Insert how many lines there are in the body of the mail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 Return the number of characters in the body."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 (let (lines chars)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 (when (search-forward "\n\n" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 (setq chars (- (point-max) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 (setq lines (count-lines (point) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 (forward-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 (when (re-search-backward "^Lines: " nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 (delete-region (point) (progn (forward-line 1) (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 (insert (format "Lines: %d\n" (max lines 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 chars))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 (defun nnmail-insert-xref (group-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 "Insert an Xref line based on the (group . article) alist."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 (when (search-forward "\n\n" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 (forward-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 (when (re-search-backward "^Xref: " nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 (delete-region (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 (progn (forward-line 1) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 (insert (format "Xref: %s" (system-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 (while group-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 (insert (format " %s:%d" (caar group-alist) (cdar group-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 (setq group-alist (cdr group-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 (insert "\n"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 ;; Written by byer@mv.us.adobe.com (Scott Byer).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 (defun nnmail-make-complex-temp-name (prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 (let ((newname (make-temp-name prefix))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 (newprefix prefix))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 (while (file-exists-p newname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 (setq newprefix (concat newprefix "x"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 (setq newname (make-temp-name newprefix)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 newname))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 ;; Written by Per Abrahamsen <amanda@iesd.auc.dk>.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 (defun nnmail-split-fancy ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 "Fancy splitting method.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 See the documentation for the variable `nnmail-split-fancy' for documentation."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 (let ((syntab (syntax-table)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 (set-syntax-table nnmail-split-fancy-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 (nnmail-split-it nnmail-split-fancy))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 (set-syntax-table syntab))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 (defvar nnmail-split-cache nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 ;; Alist of split expressions their equivalent regexps.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 (defun nnmail-split-it (split)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 ;; Return a list of groups matching SPLIT.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 (cond ((stringp split)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 ;; A group.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 (list split))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 ((eq (car split) '&)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 (apply 'nconc (mapcar 'nnmail-split-it (cdr split))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 ((eq (car split) '|)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 (let (done)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 (while (and (not done) (cdr split))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 (setq split (cdr split)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 done (nnmail-split-it (car split))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 done))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 ((assq split nnmail-split-cache)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 ;; A compiled match expression.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 (if (re-search-backward (cdr (assq split nnmail-split-cache)) nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 (nnmail-split-it (nth 2 split))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 ;; An uncompiled match.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 (let* ((field (nth 0 split))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 (value (nth 1 split))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 (regexp (concat "^\\("
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 (if (symbolp field)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 (cdr (assq field
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 nnmail-split-abbrev-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 field)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 "\\):.*\\<\\("
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 (if (symbolp value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 (cdr (assq value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 nnmail-split-abbrev-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 "\\)\\>")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 (setq nnmail-split-cache
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 (cons (cons split regexp) nnmail-split-cache))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 (if (re-search-backward regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 (nnmail-split-it (nth 2 split)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 ;; Get a list of spool files to read.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 (defun nnmail-get-spool-files (&optional group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 (if (null nnmail-spool-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 ;; No spool file whatsoever.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 (let* ((procmails
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 ;; If procmail is used to get incoming mail, the files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 ;; are stored in this directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 (and (file-exists-p nnmail-procmail-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 (or (eq nnmail-spool-file 'procmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 nnmail-use-procmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 (directory-files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 nnmail-procmail-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 t (concat (if group (concat "^" group) "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 nnmail-procmail-suffix "$") t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 (p procmails)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 (crash (when (and (file-exists-p nnmail-crash-box)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
925 (> (nnheader-file-size
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
926 (file-truename nnmail-crash-box)) 0))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 (list nnmail-crash-box))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 ;; Remove any directories that inadvertantly match the procmail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 ;; suffix, which might happen if the suffix is "".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 (while p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 (when (file-directory-p (car p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 (setq procmails (delete (car p) procmails)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 (setq p (cdr p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 ;; Return the list of spools.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 (append
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 crash
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 (cond ((and group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 (or (eq nnmail-spool-file 'procmail)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
939 nnmail-use-procmail)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
940 procmails)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 procmails)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
942 ((and group
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
943 (eq nnmail-spool-file 'procmail))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
944 nil)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 ((listp nnmail-spool-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 (append nnmail-spool-file procmails))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 ((stringp nnmail-spool-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 (cons nnmail-spool-file procmails))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 ((eq nnmail-spool-file 'pop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 (cons (format "po:%s" (user-login-name)) procmails))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 procmails))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 ;; Activate a backend only if it isn't already activated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 ;; If FORCE, re-read the active file even if the backend is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 ;; already activated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 (defun nnmail-activate (backend &optional force)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 (let (file timestamp file-time)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 (if (or (not (symbol-value (intern (format "%s-group-alist" backend))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 force
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 (and (setq file (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 (symbol-value (intern (format "%s-active-file"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 backend)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 (error nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 (setq file-time (nth 5 (file-attributes file)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 (or (not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 (setq timestamp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 (symbol-value (intern
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 (format "%s-active-timestamp"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 backend)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 (error 'none))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 (not (consp timestamp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 (equal timestamp '(0 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 (> (nth 0 file-time) (nth 0 timestamp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 (and (= (nth 0 file-time) (nth 0 timestamp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 (> (nth 1 file-time) (nth 1 timestamp))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 (or (eq timestamp 'none)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 (set (intern (format "%s-active-timestamp" backend))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 (current-time)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 (funcall (intern (format "%s-request-list" backend)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 (set (intern (format "%s-group-alist" backend))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 (nnmail-get-active))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 (defun nnmail-message-id ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 (concat "<" (message-unique-id) "@totally-fudged-out-message-id>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 ;;; nnmail duplicate handling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 (defvar nnmail-cache-buffer nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 (defun nnmail-cache-open ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 (if (or (not nnmail-treat-duplicates)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 (and nnmail-cache-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 (buffer-name nnmail-cache-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 () ; The buffer is open.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 (set-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 (setq nnmail-cache-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 (get-buffer-create " *nnmail message-id cache*")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 (buffer-disable-undo (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 (and (file-exists-p nnmail-message-id-cache-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 (insert-file-contents nnmail-message-id-cache-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 (set-buffer-modified-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 (current-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 (defun nnmail-cache-close ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 (when (and nnmail-cache-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 nnmail-treat-duplicates
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 (buffer-name nnmail-cache-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 (buffer-modified-p nnmail-cache-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 (set-buffer nnmail-cache-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 ;; Weed out the excess number of Message-IDs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 (and (search-backward "\n" nil t nnmail-message-id-cache-length)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 (delete-region (point-min) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 ;; Save the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 (or (file-exists-p (file-name-directory nnmail-message-id-cache-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 (make-directory (file-name-directory nnmail-message-id-cache-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 (write-region (point-min) (point-max)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 nnmail-message-id-cache-file nil 'silent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 (set-buffer-modified-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 (setq nnmail-cache-buffer nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 ;;(kill-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 (defun nnmail-cache-insert (id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 (when nnmail-treat-duplicates
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 (set-buffer nnmail-cache-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 (insert id "\n"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 (defun nnmail-cache-id-exists-p (id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 (when nnmail-treat-duplicates
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 (set-buffer nnmail-cache-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 (search-backward id nil t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 (defun nnmail-check-duplication (message-id func)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 ;; If this is a duplicate message, then we do not save it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 (let* ((duplication (nnmail-cache-id-exists-p message-id))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 (action (when duplication
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 ((memq nnmail-treat-duplicates '(warn delete))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 nnmail-treat-duplicates)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 ((nnheader-functionp nnmail-treat-duplicates)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 (funcall nnmail-treat-duplicates message-id))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 nnmail-treat-duplicates)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 ((not duplication)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 (nnmail-cache-insert message-id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 (funcall func))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 ((eq action 'delete)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 (delete-region (point-min) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 ((eq action 'warn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 ;; We insert a warning.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068 (let ((case-fold-search t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 (newid (nnmail-message-id)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071 (when (re-search-forward "^message-id:" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 (insert "Original-"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 (insert
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 "Message-ID: " newid "\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 "Gnus-Warning: This is a duplicate of message " message-id "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 (nnmail-cache-insert newid)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 (funcall func)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 (funcall func)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 ;;; Get new mail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 (defun nnmail-get-value (&rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 (let ((sym (intern (apply 'format args))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087 (when (boundp sym)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 (symbol-value sym))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 (defun nnmail-get-new-mail (method exit-func temp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 &optional group spool-func)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 "Read new incoming mail."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 (let* ((spools (nnmail-get-spool-files group))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 (group-in group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 incoming incomings spool)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 (when (and (nnmail-get-value "%s-get-new-mail" method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 nnmail-spool-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 ;; We first activate all the groups.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 (nnmail-activate method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 ;; Allow the user to hook.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 (run-hooks 'nnmail-pre-get-new-mail-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 ;; Open the message-id cache.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 (nnmail-cache-open)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 ;; The we go through all the existing spool files and split the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 ;; mail from each.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 (while spools
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 (setq spool (pop spools))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108 ;; We read each spool file if either the spool is a POP-mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 ;; spool, or the file exists. We can't check for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 ;; existance of POPped mail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 (when (or (string-match "^po:" spool)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112 (and (file-exists-p spool)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1113 (> (nnheader-file-size (file-truename spool)) 0)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114 (nnheader-message 3 "%s: Reading incoming mail..." method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 (when (and (nnmail-move-inbox spool)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116 (file-exists-p nnmail-crash-box))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 ;; There is new mail. We first find out if all this mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 ;; is supposed to go to some specific group.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 (setq group (nnmail-get-split-group spool group-in))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120 ;; We split the mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121 (nnmail-split-incoming
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 nnmail-crash-box (intern (format "%s-save-mail" method))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123 spool-func group)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 ;; Check whether the inbox is to be moved to the special tmp dir.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125 (setq incoming
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 (nnmail-make-complex-temp-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127 (expand-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128 (if nnmail-tmp-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130 (file-name-as-directory nnmail-tmp-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131 (file-name-nondirectory (concat temp "Incoming")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132 (concat temp "Incoming")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 (rename-file nnmail-crash-box incoming t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 (push incoming incomings))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 ;; If we did indeed read any incoming spools, we save all info.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 (when incomings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 (nnmail-save-active
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 (nnmail-get-value "%s-group-alist" method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 (nnmail-get-value "%s-active-file" method))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140 (when exit-func
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 (funcall exit-func))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142 (run-hooks 'nnmail-read-incoming-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 (nnheader-message 3 "%s: Reading incoming mail...done" method))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 ;; Close the message-id cache.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 (nnmail-cache-close)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 ;; Allow the user to hook.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 (run-hooks 'nnmail-post-get-new-mail-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148 ;; Delete all the temporary files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149 (while incomings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 (setq incoming (pop incomings))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151 (and nnmail-delete-incoming
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 (file-exists-p incoming)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 (file-writable-p incoming)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 (delete-file incoming))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156 (defun nnmail-expired-article-p (group time force &optional inhibit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157 "Say whether an article that is TIME old in GROUP should be expired."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 (if force
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159 t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 (let ((days (or (and nnmail-expiry-wait-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 (funcall nnmail-expiry-wait-function group))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162 nnmail-expiry-wait)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163 (cond ((or (eq days 'never)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164 (and (not force)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 inhibit))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166 ;; This isn't an expirable group.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168 ((eq days 'immediate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 ;; We expire all articles on sight.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171 ((equal time '(0 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172 ;; This is an ange-ftp group, and we don't have any dates.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 ((numberp days)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175 (setq days (nnmail-days-to-time days))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176 ;; Compare the time with the current time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177 (nnmail-time-less days (nnmail-time-since time)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1178
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179 (defvar nnmail-read-passwd nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180 (defun nnmail-read-passwd (prompt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1181 (unless nnmail-read-passwd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182 (if (load "passwd" t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183 (setq nnmail-read-passwd 'read-passwd)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1184 (autoload 'ange-ftp-read-passwd "ange-ftp")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185 (setq nnmail-read-passwd 'ange-ftp-read-passwd)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186 (funcall nnmail-read-passwd prompt))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188 (defun nnmail-check-syntax ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189 "Check (and modify) the syntax of the message in the current buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191 (message-narrow-to-head)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 (let ((case-fold-search t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 (unless (re-search-forward "^Message-Id:" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194 (insert "Message-ID: " (nnmail-message-id) "\n")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196 (run-hooks 'nnmail-load-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198 (provide 'nnmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1199
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1200 ;;; nnmail.el ends here