annotate lisp/nnmail.el @ 23475:6f03301d36a7

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