annotate lisp/vm/vm-digest.el @ 76:c0c698873ce1 r20-0b33

Import from CVS: tag r20-0b33
author cvs
date Mon, 13 Aug 2007 09:05:10 +0200
parents 131b0175ea99
children 0d2f883870bc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; Message encapsulation
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
2 ;;; Copyright (C) 1989, 1990, 1993, 1994 Kyle E. Jones
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;;; This program is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;;; the Free Software Foundation; either version 1, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;;; This program is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;;; along with this program; if not, write to the Free Software
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 (provide 'vm-digest)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 (defun vm-no-frills-encapsulate-message (m keep-list discard-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 "Encapsulate a message M for forwarding, simply.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 No message encapsulation standard is used. The message is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 inserted at point in the current buffer, surrounded by two dashed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 start/end separator lines. Point is not moved.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 M should be a message struct for a real message, not a virtual message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 This is the message that will be encapsulated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 KEEP-LIST should be a list of regexps matching headers to keep.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 DISCARD-REGEXP should be a regexp that matches headers to be discarded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 KEEP-LIST and DISCARD-REGEXP are used to order and trim the headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 to be forwarded. See the docs for vm-reorder-message-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 to find out how KEEP-LIST and DISCARD-REGEXP are used."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 (let ((target-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 source-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;; narrow to a zero length region to avoid interacting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;; with anything that might have already been inserted
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;; into the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (narrow-to-region (point) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 (insert "------- start of forwarded message -------\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (setq source-buffer (vm-buffer-of m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (set-buffer source-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (set-buffer target-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 (let ((beg (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (insert-buffer-substring source-buffer (vm-headers-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (vm-text-end-of m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (goto-char beg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (vm-reorder-message-headers nil nil "\\(X-VM-\\|Status:\\)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (vm-reorder-message-headers nil keep-list discard-regexp)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (insert "------- end of forwarded message -------\n"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (defun vm-rfc934-char-stuff-region (start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 "Quote RFC 934 message separators between START and END.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 START and END are buffer positions in the current buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 Lines beginning with `-' in the region have `- ' prepended to them."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (setq end (vm-marker end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (goto-char start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (while (and (< (point) end) (re-search-forward "^-" end t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (replace-match "- -" t t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (set-marker end nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (defun vm-rfc934-char-unstuff-region (start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 "Unquote lines in between START and END as per RFC 934.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 START and END are buffer positions in the current buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 Lines beginning with `- ' in the region have that string stripped
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 from them."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (setq end (vm-marker end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (goto-char start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (while (and (< (point) end) (re-search-forward "^- " end t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (replace-match "" t t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (forward-char)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (set-marker end nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (defun vm-rfc934-encapsulate-messages (message-list keep-list discard-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 "Encapsulate the messages in MESSAGE-LIST as per RFC 934.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 The resulting digest is inserted at point in the current buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 Point is not moved.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 MESSAGE-LIST should be a list of message structs (real or virtual).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 These are the messages that will be encapsulated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 KEEP-LIST should be a list of regexps matching headers to keep.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 DISCARD-REGEXP should be a regexp that matches headers to be discarded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 KEEP-LIST and DISCARD-REGEXP are used to order and trim the headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 to be forwarded. See the docs for vm-reorder-message-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 to find out how KEEP-LIST and DISCARD-REGEXP are used."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (if message-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (let ((target-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (mlist message-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 source-buffer m start n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 ;; narrow to a zero length region to avoid interacting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 ;; with anything that might have already been inserted
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 ;; into the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (narrow-to-region (point) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (setq start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (while mlist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (insert "---------------\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (setq m (vm-real-message-of (car mlist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 source-buffer (vm-buffer-of m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (set-buffer source-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (set-buffer target-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (let ((beg (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (insert-buffer-substring source-buffer (vm-headers-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (vm-text-end-of m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (goto-char beg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (vm-reorder-message-headers nil nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 "\\(X-VM-\\|Status:\\)")
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
119 (vm-reorder-message-headers nil keep-list discard-regexp)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (vm-rfc934-char-stuff-region beg (point-max))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (insert "---------------")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (setq mlist (cdr mlist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (delete-region (point) (progn (beginning-of-line) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (insert "------- end -------\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (goto-char start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (delete-region (point) (progn (forward-line 1) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (setq n (length message-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (insert (format "------- start of %s%s(RFC 934 encapsulation) -------\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (if (cdr message-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 "digest "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 "forwarded message ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (if (cdr message-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (format "(%d messages) " n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (goto-char start)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (defun vm-rfc1153-char-stuff-region (start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 "Quote RFC 1153 message separators between START and END.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 START and END are buffer positions in the current buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 Lines consisting only of 30 hyphens have the first hyphen
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 converted to a space."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 (setq end (vm-marker end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (goto-char start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 (while (and (< (point) end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 (re-search-forward "^------------------------------$" end t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (replace-match " -----------------------------" t t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 (set-marker end nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 (defun vm-rfc1153-char-unstuff-region (start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 "Unquote lines in between START and END as per RFC 1153.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 START and END are buffer positions in the current buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 Lines consisting only of a space following by 29 hyphens have the space
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 converted to a hyphen."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 (setq end (vm-marker end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (goto-char start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 (while (and (< (point) end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 (re-search-forward "^ -----------------------------$" end t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 (replace-match "------------------------------" t t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (set-marker end nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (defun vm-rfc1153-encapsulate-messages (message-list keep-list discard-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 "Encapsulate the messages in MESSAGE-LIST as per RFC 1153.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 The resulting digest is inserted at point in the current buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 Point is not moved.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 MESSAGE-LIST should be a list of message structs (real or virtual).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 These are the messages that will be encapsulated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 KEEP-LIST should be a list of regexps matching headers to keep.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 DISCARD-REGEXP should be a regexp that matches headers to be discarded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 KEEP-LIST and DISCARD-REGEXP are used to order and trim the headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 to be forwarded. See the docs for vm-reorder-message-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 to find out how KEEP-LIST and DISCARD-REGEXP are used."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (if message-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 (let ((target-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (mlist message-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 source-buffer m start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 ;; narrow to a zero length region to avoid interacting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 ;; with anything that might have already been inserted
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 ;; into the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (narrow-to-region (point) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (setq start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (while mlist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (insert "---------------\n\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (setq m (vm-real-message-of (car mlist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 source-buffer (vm-buffer-of m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (set-buffer source-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (set-buffer target-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (let ((beg (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (insert-buffer-substring source-buffer (vm-headers-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (vm-text-end-of m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (goto-char beg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (vm-reorder-message-headers nil nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 "\\(X-VM-\\|Status:\\)")
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
202 (vm-reorder-message-headers nil keep-list discard-regexp)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (vm-rfc1153-char-stuff-region beg (point-max))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (insert "\n---------------")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 (setq mlist (cdr mlist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (insert "---------------\n\nEnd of this Digest\n******************\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (goto-char start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (delete-region (point) (progn (forward-line 1) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (insert (format "This is an RFC 1153 digest.\n(%d message%s)\n----------------------------------------------------------------------\n" (length message-list) (if (cdr message-list) "s" "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 (goto-char start)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (defun vm-rfc1153-or-rfc934-burst-message (m rfc1153)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 "Burst messages from the digest message M.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 M should be a message struct for a real message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 If RFC1153 is non-nil, assume the digest is of the form specified by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 RFC 1153. Otherwise assume RFC 934 digests."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (let ((work-buffer nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (match t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (prev-sep nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (ident-header nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 after-prev-sep prologue-separator-regexp separator-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (folder-type vm-folder-type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (if vm-digest-identifier-header-format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (setq ident-header (vm-sprintf 'vm-digest-identifier-header-format m)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (if rfc1153
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 (setq prologue-separator-regexp "^----------------------------------------------------------------------\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 separator-regexp "^------------------------------\n")
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
229 (setq prologue-separator-regexp "^-[^ ].*\n"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
230 separator-regexp "^-[^ ].*\n"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
231 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
232 (vm-save-restriction
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (catch 'done
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (setq work-buffer (generate-new-buffer "*vm-work*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (set-buffer work-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (insert-buffer-substring (vm-buffer-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 (vm-text-of m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (vm-text-end-of m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (if (not (re-search-forward prologue-separator-regexp nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (throw 'done nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 ;; think of this as a do-while loop.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (while match
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (cond ((null prev-sep)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 ;; from (point-min) to end of match
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 ;; is the digest prologue, devour it and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 ;; carry on.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (delete-region (point-min) (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 ;; munge previous messages message separators
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (let ((md (match-data)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (vm-munge-message-separators
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 folder-type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 after-prev-sep
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (match-beginning 0))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
259 (store-match-data md)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
260 ;; eat preceding newlines
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
261 (while (= (preceding-char) ?\n)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
262 (delete-char -1))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
263 ;; put one back
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
264 (insert ?\n)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
265 ;; insert a trailing message separator
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
266 ;; delete the digest separator
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
267 ;; insert the leading separator
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
268 (if prev-sep
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
269 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
270 (delete-region (match-beginning 0) (match-end 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
271 (insert (vm-trailing-message-separator folder-type))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
272 (setq prev-sep (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
273 (insert (vm-leading-message-separator folder-type))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
274 (setq after-prev-sep (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
275 ;; eat trailing newlines
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
276 (while (= (following-char) ?\n)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
277 (delete-char 1))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
278 (insert ident-header)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 ;; try to match message separator and repeat.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (setq match (re-search-forward separator-regexp nil t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 ;; from the last separator to eof is the digest epilogue.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 ;; discard it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (delete-region (or prev-sep (point-min)) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 ;; Undo the quoting of the embedded message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 ;; separators. This must be done before header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 ;; conversions, else the Content-Length offsets might be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 ;; rendered invalid by buffer size changes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (if rfc1153
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (vm-rfc1153-char-unstuff-region (point-min) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (vm-rfc934-char-unstuff-region (point-min) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 ;; do header conversions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (let ((vm-folder-type folder-type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (while (vm-find-leading-message-separator)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 (vm-skip-past-leading-message-separator)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (vm-convert-folder-type-headers folder-type folder-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 (vm-find-trailing-message-separator)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (vm-skip-past-trailing-message-separator)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 ;; now insert the messages into the folder buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 (cond ((not (zerop (buffer-size)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 (set-buffer (vm-buffer-of m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (let ((old-buffer-modified-p (buffer-modified-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (inhibit-quit t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (insert-buffer-substring work-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (set-buffer-modified-p old-buffer-modified-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 ;; return non-nil so caller knows we found some messages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 t ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 ;; return nil so the caller knows we didn't find anything
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (t nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (and work-buffer (kill-buffer work-buffer)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (defun vm-rfc934-burst-message (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 "Burst messages from the RFC 934 digest message M.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 M should be a message struct for a real message."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (vm-rfc1153-or-rfc934-burst-message m nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (defun vm-rfc1153-burst-message (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 "Burst messages from the RFC 1153 digest message M.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 M should be a message struct for a real message."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (vm-rfc1153-or-rfc934-burst-message m t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (defun vm-burst-digest (&optional digest-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 "Burst the current message (a digest) into its individual messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 The digest's messages are assimilated into the folder as new mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 would be.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 Optional argument DIGEST-TYPE is a string that tells VM what kind
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 of digest the current message is. If it is not given the value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 defaults to the value of vm-digest-burst-type. When called
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 interactively DIGEST-TYPE will be read from the minibuffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 If invoked on marked messages (via vm-next-command-uses-marks),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 all marked messages will be burst."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (let ((type nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (this-command this-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (last-command last-command))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (setq type (completing-read (format "Digest type: (default %s) "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 vm-digest-burst-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (append vm-digest-type-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (list '("guess")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 'identity nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (if (string= type "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 vm-digest-burst-type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 type ))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (or digest-type (setq digest-type vm-digest-burst-type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (let ((start-buffer (current-buffer)) m totals-blurb
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (mlist (vm-select-marked-or-prefixed-messages 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (while mlist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (if (vm-virtual-message-p (car mlist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (setq m (vm-real-message-of (car mlist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (set-buffer (vm-buffer-of m)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (setq m (car mlist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (vm-error-if-folder-read-only)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (if (equal digest-type "guess")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (setq digest-type (vm-guess-digest-type m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (if (null digest-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (error "Couldn't guess digest type."))))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
368 (vm-unsaved-message "Bursting %s digest..." digest-type)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (cond
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
370 ((cond ((equal digest-type "rfc934")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (vm-rfc934-burst-message m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 ((equal digest-type "rfc1153")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (vm-rfc1153-burst-message m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (t (error "Unknown digest type: %s" digest-type)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (message "Bursting %s digest... done" digest-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (vm-clear-modification-flag-undos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (vm-set-buffer-modified-p t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (vm-increment vm-modification-counter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (and vm-delete-after-bursting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 ;; if start folder was virtual, we're now in the wrong
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 ;; buffer. switch back.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (set-buffer start-buffer)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
384 (vm-delete-message 1)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
385 (vm-assimilate-new-messages t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 ;; do this now so if we error later in another iteration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 ;; of the loop the summary and mode line will be correct.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (vm-update-summary-and-mode-line)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 (setq mlist (cdr mlist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 ;; collect this data NOW, before the non-previewers read a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 ;; message, alter the new message count and confuse
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 ;; themselves.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 (setq totals-blurb (vm-emit-totals-blurb))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 (vm-display nil nil '(vm-burst-digest
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 vm-burst-rfc934-digest
76
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 70
diff changeset
396 vm-burst-rfc1153-digest)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 (list this-command))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 (if (vm-thoughtfully-select-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 (vm-preview-current-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 (vm-update-summary-and-mode-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 (message totals-blurb)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 (defun vm-burst-rfc934-digest ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 "Burst an RFC 934 style digest"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 (vm-burst-digest "rfc934"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 (defun vm-burst-rfc1153-digest ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 "Burst an RFC 1153 style digest"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 (vm-burst-digest "rfc1153"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 (defun vm-guess-digest-type (m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 "Guess the digest type of the message M.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 M should be the message struct of a real message.
76
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 70
diff changeset
416 Returns either \"rfc934\" or \"rfc1153\"."
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
417 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
418 (set-buffer (vm-buffer-of m))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 (widen)
76
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 70
diff changeset
422 (goto-char (vm-text-of m))
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 70
diff changeset
423 (if (search-forward "\n----------------------------------------------------------------------\n" nil t)
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 70
diff changeset
424 "rfc1153"
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 70
diff changeset
425 "rfc934")))))