Mercurial > emacs
annotate lisp/gnus/gnus-soup.el @ 99150:cdad15e238e0
Add arch tagline
author | Miles Bader <miles@gnu.org> |
---|---|
date | Mon, 27 Oct 2008 02:05:42 +0000 |
parents | f42ef85caf91 |
children | a9dc0e7c3f2b |
rev | line source |
---|---|
17493 | 1 ;;; gnus-soup.el --- SOUP packet writing support for Gnus |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2 |
74547 | 3 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
79708 | 4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
17493 | 5 |
6 ;; Author: Per Abrahamsen <abraham@iesd.auc.dk> | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
7 ;; Lars Magne Ingebrigtsen <larsi@gnus.org> |
17493 | 8 ;; Keywords: news, mail |
9 | |
10 ;; This file is part of GNU Emacs. | |
11 | |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
92772
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
17493 | 13 ;; it under the terms of the GNU General Public License as published by |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
92772
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
92772
diff
changeset
|
15 ;; (at your option) any later version. |
17493 | 16 |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
92772
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
17493 | 24 |
25 ;;; Commentary: | |
26 | |
27 ;;; Code: | |
28 | |
19634
118761d47324
Require cl at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
17493
diff
changeset
|
29 (eval-when-compile (require 'cl)) |
118761d47324
Require cl at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
17493
diff
changeset
|
30 |
17493 | 31 (require 'gnus) |
32 (require 'gnus-art) | |
33 (require 'message) | |
34 (require 'gnus-start) | |
35 (require 'gnus-range) | |
36 | |
75103
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
37 (defgroup gnus-soup nil |
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
38 "SOUP packet writing support for Gnus." |
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
39 :group 'gnus) |
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
40 |
17493 | 41 ;;; User Variables: |
42 | |
75103
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
43 (defcustom gnus-soup-directory (nnheader-concat gnus-home-directory "SoupBrew/") |
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
44 "Directory containing an unpacked SOUP packet." |
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
45 :version "22.1" ;; Gnus 5.10.9 |
75121
4da7c9c27b38
Add missing :group in previous change.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
75103
diff
changeset
|
46 :type 'directory |
4da7c9c27b38
Add missing :group in previous change.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
75103
diff
changeset
|
47 :group 'gnus-soup) |
17493 | 48 |
75103
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
49 (defcustom gnus-soup-replies-directory |
17493 | 50 (nnheader-concat gnus-soup-directory "SoupReplies/") |
75103
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
51 "Directory where Gnus will do processing of replies." |
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
52 :version "22.1" ;; Gnus 5.10.9 |
75121
4da7c9c27b38
Add missing :group in previous change.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
75103
diff
changeset
|
53 :type 'directory |
4da7c9c27b38
Add missing :group in previous change.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
75103
diff
changeset
|
54 :group 'gnus-soup) |
17493 | 55 |
75103
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
56 (defcustom gnus-soup-prefix-file "gnus-prefix" |
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
57 "Name of the file where Gnus stores the last used prefix." |
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
58 :version "22.1" ;; Gnus 5.10.9 |
75121
4da7c9c27b38
Add missing :group in previous change.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
75103
diff
changeset
|
59 :type 'file |
4da7c9c27b38
Add missing :group in previous change.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
75103
diff
changeset
|
60 :group 'gnus-soup) |
17493 | 61 |
75103
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
62 (defcustom gnus-soup-packer "tar cf - %s | gzip > $HOME/Soupout%d.tgz" |
17493 | 63 "Format string command for packing a SOUP packet. |
64 The SOUP files will be inserted where the %s is in the string. | |
65 This string MUST contain both %s and %d. The file number will be | |
75103
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
66 inserted where %d appears." |
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
67 :version "22.1" ;; Gnus 5.10.9 |
75121
4da7c9c27b38
Add missing :group in previous change.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
75103
diff
changeset
|
68 :type 'string |
4da7c9c27b38
Add missing :group in previous change.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
75103
diff
changeset
|
69 :group 'gnus-soup) |
17493 | 70 |
75103
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
71 (defcustom gnus-soup-unpacker "gunzip -c %s | tar xvf -" |
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
72 "Format string command for unpacking a SOUP packet. |
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
73 The SOUP packet file name will be inserted at the %s." |
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
74 :version "22.1" ;; Gnus 5.10.9 |
75121
4da7c9c27b38
Add missing :group in previous change.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
75103
diff
changeset
|
75 :type 'string |
4da7c9c27b38
Add missing :group in previous change.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
75103
diff
changeset
|
76 :group 'gnus-soup) |
17493 | 77 |
75103
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
78 (defcustom gnus-soup-packet-directory gnus-home-directory |
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
79 "Where gnus-soup will look for REPLIES packets." |
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
80 :version "22.1" ;; Gnus 5.10.9 |
75121
4da7c9c27b38
Add missing :group in previous change.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
75103
diff
changeset
|
81 :type 'directory |
4da7c9c27b38
Add missing :group in previous change.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
75103
diff
changeset
|
82 :group 'gnus-soup) |
17493 | 83 |
75103
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
84 (defcustom gnus-soup-packet-regexp "Soupin" |
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
85 "Regular expression matching SOUP REPLIES packets in `gnus-soup-packet-directory'." |
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
86 :version "22.1" ;; Gnus 5.10.9 |
75121
4da7c9c27b38
Add missing :group in previous change.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
75103
diff
changeset
|
87 :type 'regexp |
4da7c9c27b38
Add missing :group in previous change.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
75103
diff
changeset
|
88 :group 'gnus-soup) |
17493 | 89 |
75103
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
90 (defcustom gnus-soup-ignored-headers "^Xref:" |
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
91 "Regexp to match headers to be removed when brewing SOUP packets." |
9a023b421e07
(gnus-soup): New custom group. Make user variables customizable.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
74547
diff
changeset
|
92 :version "22.1" ;; Gnus 5.10.9 |
75121
4da7c9c27b38
Add missing :group in previous change.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
75103
diff
changeset
|
93 :type 'regexp |
4da7c9c27b38
Add missing :group in previous change.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
75103
diff
changeset
|
94 :group 'gnus-soup) |
17493 | 95 |
96 ;;; Internal Variables: | |
97 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
98 (defvar gnus-soup-encoding-type ?u |
17493 | 99 "*Soup encoding type. |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
100 `u' is USENET news format, `m' is Unix mbox format, and `M' is MMDF mailbox |
17493 | 101 format.") |
102 | |
103 (defvar gnus-soup-index-type ?c | |
104 "*Soup index type. | |
105 `n' means no index file and `c' means standard Cnews overview | |
106 format.") | |
107 | |
108 (defvar gnus-soup-areas nil) | |
109 (defvar gnus-soup-last-prefix nil) | |
110 (defvar gnus-soup-prev-prefix nil) | |
111 (defvar gnus-soup-buffers nil) | |
112 | |
113 ;;; Access macros: | |
114 | |
115 (defmacro gnus-soup-area-prefix (area) | |
116 `(aref ,area 0)) | |
117 (defmacro gnus-soup-set-area-prefix (area prefix) | |
118 `(aset ,area 0 ,prefix)) | |
119 (defmacro gnus-soup-area-name (area) | |
120 `(aref ,area 1)) | |
121 (defmacro gnus-soup-area-encoding (area) | |
122 `(aref ,area 2)) | |
123 (defmacro gnus-soup-area-description (area) | |
124 `(aref ,area 3)) | |
125 (defmacro gnus-soup-area-number (area) | |
126 `(aref ,area 4)) | |
127 (defmacro gnus-soup-area-set-number (area value) | |
128 `(aset ,area 4 ,value)) | |
129 | |
130 (defmacro gnus-soup-encoding-format (encoding) | |
131 `(aref ,encoding 0)) | |
132 (defmacro gnus-soup-encoding-index (encoding) | |
133 `(aref ,encoding 1)) | |
134 (defmacro gnus-soup-encoding-kind (encoding) | |
135 `(aref ,encoding 2)) | |
136 | |
137 (defmacro gnus-soup-reply-prefix (reply) | |
138 `(aref ,reply 0)) | |
139 (defmacro gnus-soup-reply-kind (reply) | |
140 `(aref ,reply 1)) | |
141 (defmacro gnus-soup-reply-encoding (reply) | |
142 `(aref ,reply 2)) | |
143 | |
144 ;;; Commands: | |
145 | |
146 (defun gnus-soup-send-replies () | |
147 "Unpack and send all replies in the reply packet." | |
148 (interactive) | |
149 (let ((packets (directory-files | |
150 gnus-soup-packet-directory t gnus-soup-packet-regexp))) | |
151 (while packets | |
152 (when (gnus-soup-send-packet (car packets)) | |
153 (delete-file (car packets))) | |
154 (setq packets (cdr packets))))) | |
155 | |
156 (defun gnus-soup-add-article (n) | |
157 "Add the current article to SOUP packet. | |
158 If N is a positive number, add the N next articles. | |
159 If N is a negative number, add the N previous articles. | |
160 If N is nil and any articles have been marked with the process mark, | |
161 move those articles instead." | |
162 (interactive "P") | |
163 (let* ((articles (gnus-summary-work-articles n)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
164 (tmp-buf (gnus-get-buffer-create "*soup work*")) |
17493 | 165 (area (gnus-soup-area gnus-newsgroup-name)) |
166 (prefix (gnus-soup-area-prefix area)) | |
167 headers) | |
168 (buffer-disable-undo tmp-buf) | |
169 (save-excursion | |
170 (while articles | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
171 ;; Put the article in a buffer. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
172 (set-buffer tmp-buf) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
173 (when (gnus-request-article-this-buffer |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
174 (car articles) gnus-newsgroup-name) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
175 (setq headers (nnheader-parse-head t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
176 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
177 (message-narrow-to-head) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
178 (message-remove-header gnus-soup-ignored-headers t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
179 (gnus-soup-store gnus-soup-directory prefix headers |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
180 gnus-soup-encoding-type |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
181 gnus-soup-index-type) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
182 (gnus-soup-area-set-number |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
183 area (1+ (or (gnus-soup-area-number area) 0))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
184 ;; Mark article as read. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
185 (set-buffer gnus-summary-buffer) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
186 (gnus-summary-mark-as-read (car articles) gnus-souped-mark)) |
17493 | 187 (gnus-summary-remove-process-mark (car articles)) |
188 (setq articles (cdr articles))) | |
189 (kill-buffer tmp-buf)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
190 (gnus-soup-save-areas) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
191 (gnus-set-mode-line 'summary))) |
17493 | 192 |
193 (defun gnus-soup-pack-packet () | |
194 "Make a SOUP packet from the SOUP areas." | |
195 (interactive) | |
196 (gnus-soup-read-areas) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
197 (if (file-exists-p gnus-soup-directory) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
198 (if (directory-files gnus-soup-directory nil "\\.MSG$") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
199 (gnus-soup-pack gnus-soup-directory gnus-soup-packer) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
200 (message "No files to pack.")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
201 (message "No such directory: %s" gnus-soup-directory))) |
17493 | 202 |
203 (defun gnus-group-brew-soup (n) | |
204 "Make a soup packet from the current group. | |
205 Uses the process/prefix convention." | |
206 (interactive "P") | |
207 (let ((groups (gnus-group-process-prefix n))) | |
208 (while groups | |
209 (gnus-group-remove-mark (car groups)) | |
210 (gnus-soup-group-brew (car groups) t) | |
211 (setq groups (cdr groups))) | |
212 (gnus-soup-save-areas))) | |
213 | |
214 (defun gnus-brew-soup (&optional level) | |
215 "Go through all groups on LEVEL or less and make a soup packet." | |
216 (interactive "P") | |
217 (let ((level (or level gnus-level-subscribed)) | |
218 (newsrc (cdr gnus-newsrc-alist))) | |
219 (while newsrc | |
220 (when (<= (nth 1 (car newsrc)) level) | |
221 (gnus-soup-group-brew (caar newsrc) t)) | |
222 (setq newsrc (cdr newsrc))) | |
223 (gnus-soup-save-areas))) | |
224 | |
225 ;;;###autoload | |
226 (defun gnus-batch-brew-soup () | |
227 "Brew a SOUP packet from groups mention on the command line. | |
228 Will use the remaining command line arguments as regular expressions | |
229 for matching on group names. | |
230 | |
231 For instance, if you want to brew on all the nnml groups, as well as | |
232 groups with \"emacs\" in the name, you could say something like: | |
233 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
234 $ emacs -batch -f gnus-batch-brew-soup ^nnml \".*emacs.*\" |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
235 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
236 Note -- this function hasn't been implemented yet." |
17493 | 237 (interactive) |
238 nil) | |
239 | |
240 ;;; Internal Functions: | |
241 | |
242 ;; Store the current buffer. | |
243 (defun gnus-soup-store (directory prefix headers format index) | |
244 ;; Create the directory, if needed. | |
245 (gnus-make-directory directory) | |
246 (let* ((msg-buf (nnheader-find-file-noselect | |
247 (concat directory prefix ".MSG"))) | |
248 (idx-buf (if (= index ?n) | |
249 nil | |
250 (nnheader-find-file-noselect | |
251 (concat directory prefix ".IDX")))) | |
252 (article-buf (current-buffer)) | |
253 from head-line beg type) | |
254 (setq gnus-soup-buffers (cons msg-buf (delq msg-buf gnus-soup-buffers))) | |
255 (buffer-disable-undo msg-buf) | |
256 (when idx-buf | |
257 (push idx-buf gnus-soup-buffers) | |
258 (buffer-disable-undo idx-buf)) | |
259 (save-excursion | |
260 ;; Make sure the last char in the buffer is a newline. | |
261 (goto-char (point-max)) | |
262 (unless (= (current-column) 0) | |
263 (insert "\n")) | |
264 ;; Find the "from". | |
265 (goto-char (point-min)) | |
266 (setq from | |
267 (gnus-mail-strip-quoted-names | |
268 (or (mail-fetch-field "from") | |
269 (mail-fetch-field "really-from") | |
270 (mail-fetch-field "sender")))) | |
271 (goto-char (point-min)) | |
272 ;; Depending on what encoding is supposed to be used, we make | |
273 ;; a soup header. | |
274 (setq head-line | |
275 (cond | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
276 ((or (= gnus-soup-encoding-type ?u) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
277 (= gnus-soup-encoding-type ?n)) ;;Gnus back compatibility. |
17493 | 278 (format "#! rnews %d\n" (buffer-size))) |
279 ((= gnus-soup-encoding-type ?m) | |
280 (while (search-forward "\nFrom " nil t) | |
281 (replace-match "\n>From " t t)) | |
282 (concat "From " (or from "unknown") | |
283 " " (current-time-string) "\n")) | |
284 ((= gnus-soup-encoding-type ?M) | |
285 "\^a\^a\^a\^a\n") | |
286 (t (error "Unsupported type: %c" gnus-soup-encoding-type)))) | |
287 ;; Insert the soup header and the article in the MSG buf. | |
288 (set-buffer msg-buf) | |
289 (goto-char (point-max)) | |
290 (insert head-line) | |
291 (setq beg (point)) | |
292 (insert-buffer-substring article-buf) | |
293 ;; Insert the index in the IDX buf. | |
294 (cond ((= index ?c) | |
295 (set-buffer idx-buf) | |
296 (gnus-soup-insert-idx beg headers)) | |
297 ((/= index ?n) | |
298 (error "Unknown index type: %c" type))) | |
299 ;; Return the MSG buf. | |
300 msg-buf))) | |
301 | |
302 (defun gnus-soup-group-brew (group &optional not-all) | |
303 "Enter GROUP and add all articles to a SOUP package. | |
304 If NOT-ALL, don't pack ticked articles." | |
305 (let ((gnus-expert-user t) | |
306 (gnus-large-newsgroup nil) | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78224
diff
changeset
|
307 (entry (gnus-group-entry group))) |
17493 | 308 (when (or (null entry) |
309 (eq (car entry) t) | |
310 (and (car entry) | |
311 (> (car entry) 0)) | |
312 (and (not not-all) | |
313 (gnus-range-length (cdr (assq 'tick (gnus-info-marks | |
314 (nth 2 entry))))))) | |
315 (when (gnus-summary-read-group group nil t) | |
316 (setq gnus-newsgroup-processable | |
317 (reverse | |
318 (if (not not-all) | |
319 (append gnus-newsgroup-marked gnus-newsgroup-unreads) | |
320 gnus-newsgroup-unreads))) | |
321 (gnus-soup-add-article nil) | |
322 (gnus-summary-exit))))) | |
323 | |
324 (defun gnus-soup-insert-idx (offset header) | |
325 ;; [number subject from date id references chars lines xref] | |
326 (goto-char (point-max)) | |
327 (insert | |
328 (format "%d\t%s\t%s\t%s\t%s\t%s\t%d\t%s\t\t\n" | |
329 offset | |
330 (or (mail-header-subject header) "(none)") | |
331 (or (mail-header-from header) "(nobody)") | |
332 (or (mail-header-date header) "") | |
333 (or (mail-header-id header) | |
334 (concat "soup-dummy-id-" | |
335 (mapconcat | |
336 (lambda (time) (int-to-string time)) | |
337 (current-time) "-"))) | |
338 (or (mail-header-references header) "") | |
339 (or (mail-header-chars header) 0) | |
340 (or (mail-header-lines header) "0")))) | |
341 | |
342 (defun gnus-soup-save-areas () | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
343 "Write all SOUP buffers." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
344 (interactive) |
17493 | 345 (gnus-soup-write-areas) |
346 (save-excursion | |
347 (let (buf) | |
348 (while gnus-soup-buffers | |
349 (setq buf (car gnus-soup-buffers) | |
350 gnus-soup-buffers (cdr gnus-soup-buffers)) | |
351 (if (not (buffer-name buf)) | |
352 () | |
353 (set-buffer buf) | |
354 (when (buffer-modified-p) | |
355 (save-buffer)) | |
356 (kill-buffer (current-buffer))))) | |
357 (gnus-soup-write-prefixes))) | |
358 | |
359 (defun gnus-soup-write-prefixes () | |
360 (let ((prefixes gnus-soup-last-prefix) | |
361 prefix) | |
362 (save-excursion | |
363 (gnus-set-work-buffer) | |
364 (while (setq prefix (pop prefixes)) | |
365 (erase-buffer) | |
366 (insert (format "(setq gnus-soup-prev-prefix %d)\n" (cdr prefix))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
367 (let ((coding-system-for-write mm-text-coding-system)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
368 (gnus-write-buffer (concat (car prefix) gnus-soup-prefix-file))))))) |
17493 | 369 |
370 (defun gnus-soup-pack (dir packer) | |
371 (let* ((files (mapconcat 'identity | |
372 '("AREAS" "*.MSG" "*.IDX" "INFO" | |
373 "LIST" "REPLIES" "COMMANDS" "ERRORS") | |
374 " ")) | |
375 (packer (if (< (string-match "%s" packer) | |
376 (string-match "%d" packer)) | |
377 (format packer files | |
62907
88db2adda4b7
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-339
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
378 (string-to-number (gnus-soup-unique-prefix dir))) |
17493 | 379 (format packer |
62907
88db2adda4b7
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-339
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
380 (string-to-number (gnus-soup-unique-prefix dir)) |
17493 | 381 files))) |
382 (dir (expand-file-name dir))) | |
383 (gnus-make-directory dir) | |
384 (setq gnus-soup-areas nil) | |
385 (gnus-message 4 "Packing %s..." packer) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
386 (if (eq 0 (call-process shell-file-name |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
387 nil nil nil shell-command-switch |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
388 (concat "cd " dir " ; " packer))) |
17493 | 389 (progn |
390 (call-process shell-file-name nil nil nil shell-command-switch | |
391 (concat "cd " dir " ; rm " files)) | |
392 (gnus-message 4 "Packing...done" packer)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19634
diff
changeset
|
393 (error "Couldn't pack packet")))) |
17493 | 394 |
395 (defun gnus-soup-parse-areas (file) | |
396 "Parse soup area file FILE. | |
397 The result is a of vectors, each containing one entry from the AREA file. | |
398 The vector contain five strings, | |
399 [prefix name encoding description number] | |
400 though the two last may be nil if they are missing." | |
401 (let (areas) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
402 (when (file-exists-p file) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
403 (save-excursion |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
404 (set-buffer (nnheader-find-file-noselect file 'force)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
405 (buffer-disable-undo) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
406 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
407 (while (not (eobp)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
408 (push (vector (gnus-soup-field) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
409 (gnus-soup-field) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
410 (gnus-soup-field) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
411 (and (eq (preceding-char) ?\t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
412 (gnus-soup-field)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
413 (and (eq (preceding-char) ?\t) |
62907
88db2adda4b7
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-339
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
414 (string-to-number (gnus-soup-field)))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
415 areas) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
416 (when (eq (preceding-char) ?\t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
417 (beginning-of-line 2))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
418 (kill-buffer (current-buffer)))) |
17493 | 419 areas)) |
420 | |
421 (defun gnus-soup-parse-replies (file) | |
422 "Parse soup REPLIES file FILE. | |
423 The result is a of vectors, each containing one entry from the REPLIES | |
424 file. The vector contain three strings, [prefix name encoding]." | |
425 (let (replies) | |
426 (save-excursion | |
427 (set-buffer (nnheader-find-file-noselect file)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
428 (buffer-disable-undo) |
17493 | 429 (goto-char (point-min)) |
430 (while (not (eobp)) | |
431 (push (vector (gnus-soup-field) (gnus-soup-field) | |
432 (gnus-soup-field)) | |
433 replies) | |
434 (when (eq (preceding-char) ?\t) | |
435 (beginning-of-line 2))) | |
436 (kill-buffer (current-buffer))) | |
437 replies)) | |
438 | |
439 (defun gnus-soup-field () | |
440 (prog1 | |
441 (buffer-substring (point) (progn (skip-chars-forward "^\t\n") (point))) | |
442 (forward-char 1))) | |
443 | |
444 (defun gnus-soup-read-areas () | |
445 (or gnus-soup-areas | |
446 (setq gnus-soup-areas | |
447 (gnus-soup-parse-areas (concat gnus-soup-directory "AREAS"))))) | |
448 | |
449 (defun gnus-soup-write-areas () | |
450 "Write the AREAS file." | |
451 (interactive) | |
452 (when gnus-soup-areas | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
453 (with-temp-file (concat gnus-soup-directory "AREAS") |
17493 | 454 (let ((areas gnus-soup-areas) |
455 area) | |
456 (while (setq area (pop areas)) | |
457 (insert | |
458 (format | |
459 "%s\t%s\t%s%s\n" | |
460 (gnus-soup-area-prefix area) | |
461 (gnus-soup-area-name area) | |
462 (gnus-soup-area-encoding area) | |
463 (if (or (gnus-soup-area-description area) | |
464 (gnus-soup-area-number area)) | |
465 (concat "\t" (or (gnus-soup-area-description | |
466 area) "") | |
467 (if (gnus-soup-area-number area) | |
468 (concat "\t" (int-to-string | |
469 (gnus-soup-area-number area))) | |
470 "")) "")))))))) | |
471 | |
472 (defun gnus-soup-write-replies (dir areas) | |
473 "Write a REPLIES file in DIR containing AREAS." | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
474 (with-temp-file (concat dir "REPLIES") |
17493 | 475 (let (area) |
476 (while (setq area (pop areas)) | |
477 (insert (format "%s\t%s\t%s\n" | |
478 (gnus-soup-reply-prefix area) | |
479 (gnus-soup-reply-kind area) | |
480 (gnus-soup-reply-encoding area))))))) | |
481 | |
482 (defun gnus-soup-area (group) | |
483 (gnus-soup-read-areas) | |
484 (let ((areas gnus-soup-areas) | |
485 (real-group (gnus-group-real-name group)) | |
486 area result) | |
487 (while areas | |
488 (setq area (car areas) | |
489 areas (cdr areas)) | |
490 (when (equal (gnus-soup-area-name area) real-group) | |
491 (setq result area))) | |
492 (unless result | |
493 (setq result | |
494 (vector (gnus-soup-unique-prefix) | |
495 real-group | |
496 (format "%c%c%c" | |
497 gnus-soup-encoding-type | |
498 gnus-soup-index-type | |
499 (if (gnus-member-of-valid 'mail group) ?m ?n)) | |
500 nil nil) | |
501 gnus-soup-areas (cons result gnus-soup-areas))) | |
502 result)) | |
503 | |
504 (defun gnus-soup-unique-prefix (&optional dir) | |
505 (let* ((dir (file-name-as-directory (or dir gnus-soup-directory))) | |
506 (entry (assoc dir gnus-soup-last-prefix)) | |
507 gnus-soup-prev-prefix) | |
508 (if entry | |
509 () | |
510 (when (file-exists-p (concat dir gnus-soup-prefix-file)) | |
511 (ignore-errors | |
512 (load (concat dir gnus-soup-prefix-file) nil t t))) | |
513 (push (setq entry (cons dir (or gnus-soup-prev-prefix 0))) | |
514 gnus-soup-last-prefix)) | |
515 (setcdr entry (1+ (cdr entry))) | |
516 (gnus-soup-write-prefixes) | |
517 (int-to-string (cdr entry)))) | |
518 | |
519 (defun gnus-soup-unpack-packet (dir unpacker packet) | |
520 "Unpack PACKET into DIR using UNPACKER. | |
521 Return whether the unpacking was successful." | |
522 (gnus-make-directory dir) | |
523 (gnus-message 4 "Unpacking: %s" (format unpacker packet)) | |
524 (prog1 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
525 (eq 0 (call-process |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
526 shell-file-name nil nil nil shell-command-switch |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
527 (format "cd %s ; %s" (expand-file-name dir) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
528 (format unpacker packet)))) |
17493 | 529 (gnus-message 4 "Unpacking...done"))) |
530 | |
531 (defun gnus-soup-send-packet (packet) | |
532 (gnus-soup-unpack-packet | |
533 gnus-soup-replies-directory gnus-soup-unpacker packet) | |
534 (let ((replies (gnus-soup-parse-replies | |
535 (concat gnus-soup-replies-directory "REPLIES")))) | |
536 (save-excursion | |
537 (while replies | |
538 (let* ((msg-file (concat gnus-soup-replies-directory | |
539 (gnus-soup-reply-prefix (car replies)) | |
540 ".MSG")) | |
541 (msg-buf (and (file-exists-p msg-file) | |
542 (nnheader-find-file-noselect msg-file))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
543 (tmp-buf (gnus-get-buffer-create " *soup send*")) |
17493 | 544 beg end) |
545 (cond | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
546 ((and (/= (gnus-soup-encoding-format |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
547 (gnus-soup-reply-encoding (car replies))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
548 ?u) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
549 (/= (gnus-soup-encoding-format |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
550 (gnus-soup-reply-encoding (car replies))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
551 ?n)) ;; Gnus back compatibility. |
17493 | 552 (error "Unsupported encoding")) |
553 ((null msg-buf) | |
554 t) | |
555 (t | |
556 (buffer-disable-undo msg-buf) | |
557 (set-buffer msg-buf) | |
558 (goto-char (point-min)) | |
559 (while (not (eobp)) | |
560 (unless (looking-at "#! *rnews +\\([0-9]+\\)") | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19634
diff
changeset
|
561 (error "Bad header")) |
17493 | 562 (forward-line 1) |
563 (setq beg (point) | |
62907
88db2adda4b7
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-339
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
564 end (+ (point) (string-to-number |
17493 | 565 (buffer-substring |
566 (match-beginning 1) (match-end 1))))) | |
567 (switch-to-buffer tmp-buf) | |
568 (erase-buffer) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
569 (mm-disable-multibyte) |
17493 | 570 (insert-buffer-substring msg-buf beg end) |
571 (cond | |
572 ((string= (gnus-soup-reply-kind (car replies)) "news") | |
573 (gnus-message 5 "Sending news message to %s..." | |
574 (mail-fetch-field "newsgroups")) | |
575 (sit-for 1) | |
576 (let ((message-syntax-checks | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
577 'dont-check-for-anything-just-trust-me) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
578 (method (if (functionp message-post-method) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
579 (funcall message-post-method) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
580 message-post-method)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
581 result) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
582 (run-hooks 'message-send-news-hook) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
583 (gnus-open-server method) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
584 (message "Sending news via %s..." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
585 (gnus-server-string method)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
586 (unless (let ((mail-header-separator "")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
587 (gnus-request-post method)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
588 (message "Couldn't send message via news: %s" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
589 (nnheader-get-report (car method)))))) |
17493 | 590 ((string= (gnus-soup-reply-kind (car replies)) "mail") |
591 (gnus-message 5 "Sending mail to %s..." | |
592 (mail-fetch-field "to")) | |
593 (sit-for 1) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
594 (let ((mail-header-separator "")) |
92772
3637573105bd
(gnus-soup-send-packet): Don't use mm-with-unibyte-current-buffer
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
595 (funcall (or message-send-mail-real-function |
3637573105bd
(gnus-soup-send-packet): Don't use mm-with-unibyte-current-buffer
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
596 message-send-mail-function)))) |
17493 | 597 (t |
598 (error "Unknown reply kind"))) | |
599 (set-buffer msg-buf) | |
600 (goto-char end)) | |
601 (delete-file (buffer-file-name)) | |
602 (kill-buffer msg-buf) | |
603 (kill-buffer tmp-buf) | |
604 (gnus-message 4 "Sent packet")))) | |
605 (setq replies (cdr replies))) | |
606 t))) | |
607 | |
608 (provide 'gnus-soup) | |
609 | |
92772
3637573105bd
(gnus-soup-send-packet): Don't use mm-with-unibyte-current-buffer
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
610 ;; arch-tag: eddfa69d-13e8-4aea-84ef-62a526ef185c |
17493 | 611 ;;; gnus-soup.el ends here |