Mercurial > hg > xemacs-beta
comparison lisp/gnus/gnus-soup.el @ 16:0293115a14e9 r19-15b91
Import from CVS: tag r19-15b91
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:49:20 +0200 |
parents | 376386a54a3c |
children | ec9a17fef872 |
comparison
equal
deleted
inserted
replaced
15:ad457d5f7d04 | 16:0293115a14e9 |
---|---|
1 ;;; gnus-soup.el --- SOUP packet writing support for Gnus | 1 ;;; gnus-soup.el --- SOUP packet writing support for Gnus |
2 ;; Copyright (C) 1995,96 Free Software Foundation, Inc. | 2 ;; Copyright (C) 1995,96,97 Free Software Foundation, Inc. |
3 | 3 |
4 ;; Author: Per Abrahamsen <abraham@iesd.auc.dk> | 4 ;; Author: Per Abrahamsen <abraham@iesd.auc.dk> |
5 ;; Lars Magne Ingebrigtsen <larsi@ifi.uio.no> | 5 ;; Lars Magne Ingebrigtsen <larsi@ifi.uio.no> |
6 ;; Keywords: news, mail | 6 ;; Keywords: news, mail |
7 | 7 |
24 | 24 |
25 ;;; Commentary: | 25 ;;; Commentary: |
26 | 26 |
27 ;;; Code: | 27 ;;; Code: |
28 | 28 |
29 (require 'gnus-msg) | |
30 (require 'gnus) | 29 (require 'gnus) |
31 (eval-when-compile (require 'cl)) | 30 (require 'gnus-art) |
31 (require 'message) | |
32 (require 'gnus-start) | |
33 (require 'gnus-range) | |
32 | 34 |
33 ;;; User Variables: | 35 ;;; User Variables: |
34 | 36 |
35 (defvar gnus-soup-directory "~/SoupBrew/" | 37 (defvar gnus-soup-directory "~/SoupBrew/" |
36 "*Directory containing an unpacked SOUP packet.") | 38 "*Directory containing an unpacked SOUP packet.") |
42 "*Name of the file where Gnus stores the last used prefix.") | 44 "*Name of the file where Gnus stores the last used prefix.") |
43 | 45 |
44 (defvar gnus-soup-packer "tar cf - %s | gzip > $HOME/Soupout%d.tgz" | 46 (defvar gnus-soup-packer "tar cf - %s | gzip > $HOME/Soupout%d.tgz" |
45 "Format string command for packing a SOUP packet. | 47 "Format string command for packing a SOUP packet. |
46 The SOUP files will be inserted where the %s is in the string. | 48 The SOUP files will be inserted where the %s is in the string. |
47 This string MUST contain both %s and %d. The file number will be | 49 This string MUST contain both %s and %d. The file number will be |
48 inserted where %d appears.") | 50 inserted where %d appears.") |
49 | 51 |
50 (defvar gnus-soup-unpacker "gunzip -c %s | tar xvf -" | 52 (defvar gnus-soup-unpacker "gunzip -c %s | tar xvf -" |
51 "*Format string command for unpacking a SOUP packet. | 53 "*Format string command for unpacking a SOUP packet. |
52 The SOUP packet file name will be inserted at the %s.") | 54 The SOUP packet file name will be inserted at the %s.") |
68 format.") | 70 format.") |
69 | 71 |
70 (defvar gnus-soup-index-type ?c | 72 (defvar gnus-soup-index-type ?c |
71 "*Soup index type. | 73 "*Soup index type. |
72 `n' means no index file and `c' means standard Cnews overview | 74 `n' means no index file and `c' means standard Cnews overview |
73 format.") | 75 format.") |
74 | 76 |
75 (defvar gnus-soup-areas nil) | 77 (defvar gnus-soup-areas nil) |
76 (defvar gnus-soup-last-prefix nil) | 78 (defvar gnus-soup-last-prefix nil) |
77 (defvar gnus-soup-prev-prefix nil) | 79 (defvar gnus-soup-prev-prefix nil) |
78 (defvar gnus-soup-buffers nil) | 80 (defvar gnus-soup-buffers nil) |
114 "Unpack and send all replies in the reply packet." | 116 "Unpack and send all replies in the reply packet." |
115 (interactive) | 117 (interactive) |
116 (let ((packets (directory-files | 118 (let ((packets (directory-files |
117 gnus-soup-packet-directory t gnus-soup-packet-regexp))) | 119 gnus-soup-packet-directory t gnus-soup-packet-regexp))) |
118 (while packets | 120 (while packets |
119 (and (gnus-soup-send-packet (car packets)) | 121 (when (gnus-soup-send-packet (car packets)) |
120 (delete-file (car packets))) | 122 (delete-file (car packets))) |
121 (setq packets (cdr packets))))) | 123 (setq packets (cdr packets))))) |
122 | 124 |
123 (defun gnus-soup-add-article (n) | 125 (defun gnus-soup-add-article (n) |
124 "Add the current article to SOUP packet. | 126 "Add the current article to SOUP packet. |
125 If N is a positive number, add the N next articles. | 127 If N is a positive number, add the N next articles. |
161 | 163 |
162 (defun gnus-soup-pack-packet () | 164 (defun gnus-soup-pack-packet () |
163 "Make a SOUP packet from the SOUP areas." | 165 "Make a SOUP packet from the SOUP areas." |
164 (interactive) | 166 (interactive) |
165 (gnus-soup-read-areas) | 167 (gnus-soup-read-areas) |
168 (unless (file-exists-p gnus-soup-directory) | |
169 (message "No such directory: %s" gnus-soup-directory)) | |
170 (when (null (directory-files gnus-soup-directory nil "\\.MSG$")) | |
171 (message "No files to pack.")) | |
166 (gnus-soup-pack gnus-soup-directory gnus-soup-packer)) | 172 (gnus-soup-pack gnus-soup-directory gnus-soup-packer)) |
167 | 173 |
168 (defun gnus-group-brew-soup (n) | 174 (defun gnus-group-brew-soup (n) |
169 "Make a soup packet from the current group. | 175 "Make a soup packet from the current group. |
170 Uses the process/prefix convention." | 176 Uses the process/prefix convention." |
180 "Go through all groups on LEVEL or less and make a soup packet." | 186 "Go through all groups on LEVEL or less and make a soup packet." |
181 (interactive "P") | 187 (interactive "P") |
182 (let ((level (or level gnus-level-subscribed)) | 188 (let ((level (or level gnus-level-subscribed)) |
183 (newsrc (cdr gnus-newsrc-alist))) | 189 (newsrc (cdr gnus-newsrc-alist))) |
184 (while newsrc | 190 (while newsrc |
185 (and (<= (nth 1 (car newsrc)) level) | 191 (when (<= (nth 1 (car newsrc)) level) |
186 (gnus-soup-group-brew (caar newsrc) t)) | 192 (gnus-soup-group-brew (caar newsrc) t)) |
187 (setq newsrc (cdr newsrc))) | 193 (setq newsrc (cdr newsrc))) |
188 (gnus-soup-save-areas))) | 194 (gnus-soup-save-areas))) |
189 | 195 |
190 ;;;###autoload | 196 ;;;###autoload |
191 (defun gnus-batch-brew-soup () | 197 (defun gnus-batch-brew-soup () |
196 For instance, if you want to brew on all the nnml groups, as well as | 202 For instance, if you want to brew on all the nnml groups, as well as |
197 groups with \"emacs\" in the name, you could say something like: | 203 groups with \"emacs\" in the name, you could say something like: |
198 | 204 |
199 $ emacs -batch -f gnus-batch-brew-soup ^nnml \".*emacs.*\"" | 205 $ emacs -batch -f gnus-batch-brew-soup ^nnml \".*emacs.*\"" |
200 (interactive) | 206 (interactive) |
201 ) | 207 nil) |
202 | 208 |
203 ;;; Internal Functions: | 209 ;;; Internal Functions: |
204 | 210 |
205 ;; Store the current buffer. | 211 ;; Store the current buffer. |
206 (defun gnus-soup-store (directory prefix headers format index) | 212 (defun gnus-soup-store (directory prefix headers format index) |
207 ;; Create the directory, if needed. | 213 ;; Create the directory, if needed. |
208 (or (file-directory-p directory) | 214 (gnus-make-directory directory) |
209 (gnus-make-directory directory)) | 215 (let* ((msg-buf (nnheader-find-file-noselect |
210 (let* ((msg-buf (find-file-noselect | |
211 (concat directory prefix ".MSG"))) | 216 (concat directory prefix ".MSG"))) |
212 (idx-buf (if (= index ?n) | 217 (idx-buf (if (= index ?n) |
213 nil | 218 nil |
214 (find-file-noselect | 219 (nnheader-find-file-noselect |
215 (concat directory prefix ".IDX")))) | 220 (concat directory prefix ".IDX")))) |
216 (article-buf (current-buffer)) | 221 (article-buf (current-buffer)) |
217 from head-line beg type) | 222 from head-line beg type) |
218 (setq gnus-soup-buffers (cons msg-buf (delq msg-buf gnus-soup-buffers))) | 223 (setq gnus-soup-buffers (cons msg-buf (delq msg-buf gnus-soup-buffers))) |
219 (buffer-disable-undo msg-buf) | 224 (buffer-disable-undo msg-buf) |
220 (and idx-buf | 225 (when idx-buf |
221 (progn | 226 (push idx-buf gnus-soup-buffers) |
222 (setq gnus-soup-buffers (cons idx-buf gnus-soup-buffers)) | 227 (buffer-disable-undo idx-buf)) |
223 (buffer-disable-undo idx-buf))) | |
224 (save-excursion | 228 (save-excursion |
225 ;; Make sure the last char in the buffer is a newline. | 229 ;; Make sure the last char in the buffer is a newline. |
226 (goto-char (point-max)) | 230 (goto-char (point-max)) |
227 (or (= (current-column) 0) | 231 (unless (= (current-column) 0) |
228 (insert "\n")) | 232 (insert "\n")) |
229 ;; Find the "from". | 233 ;; Find the "from". |
230 (goto-char (point-min)) | 234 (goto-char (point-min)) |
231 (setq from | 235 (setq from |
232 (gnus-mail-strip-quoted-names | 236 (gnus-mail-strip-quoted-names |
233 (or (mail-fetch-field "from") | 237 (or (mail-fetch-field "from") |
298 (concat "soup-dummy-id-" | 302 (concat "soup-dummy-id-" |
299 (mapconcat | 303 (mapconcat |
300 (lambda (time) (int-to-string time)) | 304 (lambda (time) (int-to-string time)) |
301 (current-time) "-"))) | 305 (current-time) "-"))) |
302 (or (mail-header-references header) "") | 306 (or (mail-header-references header) "") |
303 (or (mail-header-chars header) 0) | 307 (or (mail-header-chars header) 0) |
304 (or (mail-header-lines header) "0")))) | 308 (or (mail-header-lines header) "0")))) |
305 | 309 |
306 (defun gnus-soup-save-areas () | 310 (defun gnus-soup-save-areas () |
307 (gnus-soup-write-areas) | 311 (gnus-soup-write-areas) |
308 (save-excursion | 312 (save-excursion |
311 (setq buf (car gnus-soup-buffers) | 315 (setq buf (car gnus-soup-buffers) |
312 gnus-soup-buffers (cdr gnus-soup-buffers)) | 316 gnus-soup-buffers (cdr gnus-soup-buffers)) |
313 (if (not (buffer-name buf)) | 317 (if (not (buffer-name buf)) |
314 () | 318 () |
315 (set-buffer buf) | 319 (set-buffer buf) |
316 (and (buffer-modified-p) (save-buffer)) | 320 (when (buffer-modified-p) |
321 (save-buffer)) | |
317 (kill-buffer (current-buffer))))) | 322 (kill-buffer (current-buffer))))) |
318 (gnus-soup-write-prefixes))) | 323 (gnus-soup-write-prefixes))) |
319 | 324 |
320 (defun gnus-soup-write-prefixes () | 325 (defun gnus-soup-write-prefixes () |
321 (let ((prefix gnus-soup-last-prefix)) | 326 (let ((prefixes gnus-soup-last-prefix) |
327 prefix) | |
322 (save-excursion | 328 (save-excursion |
323 (while prefix | 329 (gnus-set-work-buffer) |
324 (gnus-set-work-buffer) | 330 (while (setq prefix (pop prefixes)) |
325 (insert (format "(setq gnus-soup-prev-prefix %d)\n" (cdar prefix))) | 331 (erase-buffer) |
326 (gnus-make-directory (caar prefix)) | 332 (insert (format "(setq gnus-soup-prev-prefix %d)\n" (cdr prefix))) |
327 (write-region (point-min) (point-max) | 333 (gnus-write-buffer (concat (car prefix) gnus-soup-prefix-file)))))) |
328 (concat (caar prefix) gnus-soup-prefix-file) | |
329 nil 'nomesg) | |
330 (setq prefix (cdr prefix)))))) | |
331 | 334 |
332 (defun gnus-soup-pack (dir packer) | 335 (defun gnus-soup-pack (dir packer) |
333 (let* ((files (mapconcat 'identity | 336 (let* ((files (mapconcat 'identity |
334 '("AREAS" "*.MSG" "*.IDX" "INFO" | 337 '("AREAS" "*.MSG" "*.IDX" "INFO" |
335 "LIST" "REPLIES" "COMMANDS" "ERRORS") | 338 "LIST" "REPLIES" "COMMANDS" "ERRORS") |
340 (string-to-int (gnus-soup-unique-prefix dir))) | 343 (string-to-int (gnus-soup-unique-prefix dir))) |
341 (format packer | 344 (format packer |
342 (string-to-int (gnus-soup-unique-prefix dir)) | 345 (string-to-int (gnus-soup-unique-prefix dir)) |
343 files))) | 346 files))) |
344 (dir (expand-file-name dir))) | 347 (dir (expand-file-name dir))) |
345 (or (file-directory-p dir) | 348 (gnus-make-directory dir) |
346 (gnus-make-directory dir)) | |
347 (setq gnus-soup-areas nil) | 349 (setq gnus-soup-areas nil) |
348 (gnus-message 4 "Packing %s..." packer) | 350 (gnus-message 4 "Packing %s..." packer) |
349 (if (zerop (call-process shell-file-name | 351 (if (zerop (call-process shell-file-name |
350 nil nil nil shell-command-switch | 352 nil nil nil shell-command-switch |
351 (concat "cd " dir " ; " packer))) | 353 (concat "cd " dir " ; " packer))) |
361 The vector contain five strings, | 363 The vector contain five strings, |
362 [prefix name encoding description number] | 364 [prefix name encoding description number] |
363 though the two last may be nil if they are missing." | 365 though the two last may be nil if they are missing." |
364 (let (areas) | 366 (let (areas) |
365 (save-excursion | 367 (save-excursion |
366 (set-buffer (find-file-noselect file 'force)) | 368 (set-buffer (nnheader-find-file-noselect file 'force)) |
367 (buffer-disable-undo (current-buffer)) | 369 (buffer-disable-undo (current-buffer)) |
368 (goto-char (point-min)) | 370 (goto-char (point-min)) |
369 (while (not (eobp)) | 371 (while (not (eobp)) |
370 (setq areas | 372 (push (vector (gnus-soup-field) |
371 (cons (vector (gnus-soup-field) | 373 (gnus-soup-field) |
372 (gnus-soup-field) | 374 (gnus-soup-field) |
373 (gnus-soup-field) | 375 (and (eq (preceding-char) ?\t) |
374 (and (eq (preceding-char) ?\t) | 376 (gnus-soup-field)) |
375 (gnus-soup-field)) | 377 (and (eq (preceding-char) ?\t) |
376 (and (eq (preceding-char) ?\t) | 378 (string-to-int (gnus-soup-field)))) |
377 (string-to-int (gnus-soup-field)))) | 379 areas) |
378 areas)) | 380 (when (eq (preceding-char) ?\t) |
379 (if (eq (preceding-char) ?\t) | 381 (beginning-of-line 2))) |
380 (beginning-of-line 2))) | |
381 (kill-buffer (current-buffer))) | 382 (kill-buffer (current-buffer))) |
382 areas)) | 383 areas)) |
383 | 384 |
384 (defun gnus-soup-parse-replies (file) | 385 (defun gnus-soup-parse-replies (file) |
385 "Parse soup REPLIES file FILE. | 386 "Parse soup REPLIES file FILE. |
386 The result is a of vectors, each containing one entry from the REPLIES | 387 The result is a of vectors, each containing one entry from the REPLIES |
387 file. The vector contain three strings, [prefix name encoding]." | 388 file. The vector contain three strings, [prefix name encoding]." |
388 (let (replies) | 389 (let (replies) |
389 (save-excursion | 390 (save-excursion |
390 (set-buffer (find-file-noselect file)) | 391 (set-buffer (nnheader-find-file-noselect file)) |
391 (buffer-disable-undo (current-buffer)) | 392 (buffer-disable-undo (current-buffer)) |
392 (goto-char (point-min)) | 393 (goto-char (point-min)) |
393 (while (not (eobp)) | 394 (while (not (eobp)) |
394 (setq replies | 395 (push (vector (gnus-soup-field) (gnus-soup-field) |
395 (cons (vector (gnus-soup-field) (gnus-soup-field) | 396 (gnus-soup-field)) |
396 (gnus-soup-field)) | 397 replies) |
397 replies)) | 398 (when (eq (preceding-char) ?\t) |
398 (if (eq (preceding-char) ?\t) | 399 (beginning-of-line 2))) |
399 (beginning-of-line 2))) | |
400 (kill-buffer (current-buffer))) | 400 (kill-buffer (current-buffer))) |
401 replies)) | 401 replies)) |
402 | 402 |
403 (defun gnus-soup-field () | 403 (defun gnus-soup-field () |
404 (prog1 | 404 (prog1 |
420 (while (setq area (pop areas)) | 420 (while (setq area (pop areas)) |
421 (insert | 421 (insert |
422 (format | 422 (format |
423 "%s\t%s\t%s%s\n" | 423 "%s\t%s\t%s%s\n" |
424 (gnus-soup-area-prefix area) | 424 (gnus-soup-area-prefix area) |
425 (gnus-soup-area-name area) | 425 (gnus-soup-area-name area) |
426 (gnus-soup-area-encoding area) | 426 (gnus-soup-area-encoding area) |
427 (if (or (gnus-soup-area-description area) | 427 (if (or (gnus-soup-area-description area) |
428 (gnus-soup-area-number area)) | 428 (gnus-soup-area-number area)) |
429 (concat "\t" (or (gnus-soup-area-description | 429 (concat "\t" (or (gnus-soup-area-description |
430 area) "") | 430 area) "") |
431 (if (gnus-soup-area-number area) | 431 (if (gnus-soup-area-number area) |
432 (concat "\t" (int-to-string | 432 (concat "\t" (int-to-string |
438 (nnheader-temp-write (concat dir "REPLIES") | 438 (nnheader-temp-write (concat dir "REPLIES") |
439 (let (area) | 439 (let (area) |
440 (while (setq area (pop areas)) | 440 (while (setq area (pop areas)) |
441 (insert (format "%s\t%s\t%s\n" | 441 (insert (format "%s\t%s\t%s\n" |
442 (gnus-soup-reply-prefix area) | 442 (gnus-soup-reply-prefix area) |
443 (gnus-soup-reply-kind area) | 443 (gnus-soup-reply-kind area) |
444 (gnus-soup-reply-encoding area))))))) | 444 (gnus-soup-reply-encoding area))))))) |
445 | 445 |
446 (defun gnus-soup-area (group) | 446 (defun gnus-soup-area (group) |
447 (gnus-soup-read-areas) | 447 (gnus-soup-read-areas) |
448 (let ((areas gnus-soup-areas) | 448 (let ((areas gnus-soup-areas) |
449 (real-group (gnus-group-real-name group)) | 449 (real-group (gnus-group-real-name group)) |
450 area result) | 450 area result) |
451 (while areas | 451 (while areas |
452 (setq area (car areas) | 452 (setq area (car areas) |
453 areas (cdr areas)) | 453 areas (cdr areas)) |
454 (if (equal (gnus-soup-area-name area) real-group) | 454 (when (equal (gnus-soup-area-name area) real-group) |
455 (setq result area))) | 455 (setq result area))) |
456 (or result | 456 (unless result |
457 (setq result | 457 (setq result |
458 (vector (gnus-soup-unique-prefix) | 458 (vector (gnus-soup-unique-prefix) |
459 real-group | 459 real-group |
460 (format "%c%c%c" | 460 (format "%c%c%c" |
461 gnus-soup-encoding-type | 461 gnus-soup-encoding-type |
462 gnus-soup-index-type | 462 gnus-soup-index-type |
463 (if (gnus-member-of-valid 'mail group) ?m ?n)) | 463 (if (gnus-member-of-valid 'mail group) ?m ?n)) |
464 nil nil) | 464 nil nil) |
465 gnus-soup-areas (cons result gnus-soup-areas))) | 465 gnus-soup-areas (cons result gnus-soup-areas))) |
466 result)) | 466 result)) |
467 | 467 |
468 (defun gnus-soup-unique-prefix (&optional dir) | 468 (defun gnus-soup-unique-prefix (&optional dir) |
469 (let* ((dir (file-name-as-directory (or dir gnus-soup-directory))) | 469 (let* ((dir (file-name-as-directory (or dir gnus-soup-directory))) |
470 (entry (assoc dir gnus-soup-last-prefix)) | 470 (entry (assoc dir gnus-soup-last-prefix)) |
471 gnus-soup-prev-prefix) | 471 gnus-soup-prev-prefix) |
472 (if entry | 472 (if entry |
473 () | 473 () |
474 (and (file-exists-p (concat dir gnus-soup-prefix-file)) | 474 (when (file-exists-p (concat dir gnus-soup-prefix-file)) |
475 (condition-case nil | 475 (ignore-errors |
476 (load (concat dir gnus-soup-prefix-file) nil t t) | 476 (load (concat dir gnus-soup-prefix-file) nil t t))) |
477 (error nil))) | 477 (push (setq entry (cons dir (or gnus-soup-prev-prefix 0))) |
478 (setq gnus-soup-last-prefix | 478 gnus-soup-last-prefix)) |
479 (cons (setq entry (cons dir (or gnus-soup-prev-prefix 0))) | |
480 gnus-soup-last-prefix))) | |
481 (setcdr entry (1+ (cdr entry))) | 479 (setcdr entry (1+ (cdr entry))) |
482 (gnus-soup-write-prefixes) | 480 (gnus-soup-write-prefixes) |
483 (int-to-string (cdr entry)))) | 481 (int-to-string (cdr entry)))) |
484 | 482 |
485 (defun gnus-soup-unpack-packet (dir unpacker packet) | 483 (defun gnus-soup-unpack-packet (dir unpacker packet) |
488 (gnus-make-directory dir) | 486 (gnus-make-directory dir) |
489 (gnus-message 4 "Unpacking: %s" (format unpacker packet)) | 487 (gnus-message 4 "Unpacking: %s" (format unpacker packet)) |
490 (prog1 | 488 (prog1 |
491 (zerop (call-process | 489 (zerop (call-process |
492 shell-file-name nil nil nil shell-command-switch | 490 shell-file-name nil nil nil shell-command-switch |
493 (format "cd %s ; %s" (expand-file-name dir) | 491 (format "cd %s ; %s" (expand-file-name dir) |
494 (format unpacker packet)))) | 492 (format unpacker packet)))) |
495 (gnus-message 4 "Unpacking...done"))) | 493 (gnus-message 4 "Unpacking...done"))) |
496 | 494 |
497 (defun gnus-soup-send-packet (packet) | 495 (defun gnus-soup-send-packet (packet) |
498 (gnus-soup-unpack-packet | 496 (gnus-soup-unpack-packet |
503 (while replies | 501 (while replies |
504 (let* ((msg-file (concat gnus-soup-replies-directory | 502 (let* ((msg-file (concat gnus-soup-replies-directory |
505 (gnus-soup-reply-prefix (car replies)) | 503 (gnus-soup-reply-prefix (car replies)) |
506 ".MSG")) | 504 ".MSG")) |
507 (msg-buf (and (file-exists-p msg-file) | 505 (msg-buf (and (file-exists-p msg-file) |
508 (find-file-noselect msg-file))) | 506 (nnheader-find-file-noselect msg-file))) |
509 (tmp-buf (get-buffer-create " *soup send*")) | 507 (tmp-buf (get-buffer-create " *soup send*")) |
510 beg end) | 508 beg end) |
511 (cond | 509 (cond |
512 ((/= (gnus-soup-encoding-format | 510 ((/= (gnus-soup-encoding-format |
513 (gnus-soup-reply-encoding (car replies))) ?n) | 511 (gnus-soup-reply-encoding (car replies))) |
512 ?n) | |
514 (error "Unsupported encoding")) | 513 (error "Unsupported encoding")) |
515 ((null msg-buf) | 514 ((null msg-buf) |
516 t) | 515 t) |
517 (t | 516 (t |
518 (buffer-disable-undo msg-buf) | 517 (buffer-disable-undo msg-buf) |
519 (buffer-disable-undo tmp-buf) | 518 (buffer-disable-undo tmp-buf) |
520 (set-buffer msg-buf) | 519 (set-buffer msg-buf) |
521 (goto-char (point-min)) | 520 (goto-char (point-min)) |
522 (while (not (eobp)) | 521 (while (not (eobp)) |
523 (or (looking-at "#! *rnews +\\([0-9]+\\)") | 522 (unless (looking-at "#! *rnews +\\([0-9]+\\)") |
524 (error "Bad header.")) | 523 (error "Bad header.")) |
525 (forward-line 1) | 524 (forward-line 1) |
526 (setq beg (point) | 525 (setq beg (point) |
527 end (+ (point) (string-to-int | 526 end (+ (point) (string-to-int |
528 (buffer-substring | 527 (buffer-substring |
529 (match-beginning 1) (match-end 1))))) | 528 (match-beginning 1) (match-end 1))))) |
539 (cond | 538 (cond |
540 ((string= (gnus-soup-reply-kind (car replies)) "news") | 539 ((string= (gnus-soup-reply-kind (car replies)) "news") |
541 (gnus-message 5 "Sending news message to %s..." | 540 (gnus-message 5 "Sending news message to %s..." |
542 (mail-fetch-field "newsgroups")) | 541 (mail-fetch-field "newsgroups")) |
543 (sit-for 1) | 542 (sit-for 1) |
544 (funcall message-send-news-function)) | 543 (let ((message-syntax-checks |
544 'dont-check-for-anything-just-trust-me)) | |
545 (funcall message-send-news-function))) | |
545 ((string= (gnus-soup-reply-kind (car replies)) "mail") | 546 ((string= (gnus-soup-reply-kind (car replies)) "mail") |
546 (gnus-message 5 "Sending mail to %s..." | 547 (gnus-message 5 "Sending mail to %s..." |
547 (mail-fetch-field "to")) | 548 (mail-fetch-field "to")) |
548 (sit-for 1) | 549 (sit-for 1) |
549 (message-send-mail)) | 550 (message-send-mail)) |
550 (t | 551 (t |
551 (error "Unknown reply kind"))) | 552 (error "Unknown reply kind"))) |
552 (set-buffer msg-buf) | 553 (set-buffer msg-buf) |