aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShengHuo ZHU2002-06-21 18:56:00 +0000
committerShengHuo ZHU2002-06-21 18:56:00 +0000
commitb092f83d7fe0df6a3b33916700798318847fc751 (patch)
treeea914a2b421a5fe97b4c81dc906014692b95c930
parent3e7b2fa787a547dd577e59e9ce9c06932b5cffa7 (diff)
downloademacs-b092f83d7fe0df6a3b33916700798318847fc751.tar.gz
emacs-b092f83d7fe0df6a3b33916700798318847fc751.zip
* nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
* nndoc.el: Add several new types.
-rw-r--r--lisp/gnus/ChangeLog5
-rw-r--r--lisp/gnus/nndoc.el316
2 files changed, 242 insertions, 79 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 9545c9b82fe..4988b7d8fac 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,10 +1,13 @@
12002-06-15 ShengHuo ZHU <zsh@cs.rochester.edu> 12002-06-21 ShengHuo ZHU <zsh@cs.rochester.edu>
2 2
3 * nnheader.el (nnheader-file-name-translation-alist): Set the 3 * nnheader.el (nnheader-file-name-translation-alist): Set the
4 default value for MS Windows systems. 4 default value for MS Windows systems.
5 5
6 * gnus-ems.el (nnheader-file-name-translation-alist): Removed. 6 * gnus-ems.el (nnheader-file-name-translation-alist): Removed.
7 7
8 * nndoc.el (nndoc-mime-digest-type-p): Set proper file-end.
9 * nndoc.el: Add several new types.
10
82002-05-16 Juanma Barranquero <lektu@terra.es> 112002-05-16 Juanma Barranquero <lektu@terra.es>
9 12
10 * gnus-art.el (gnus-mime-copy-part): Fix typo. 13 * gnus-art.el (gnus-mime-copy-part): Fix typo.
diff --git a/lisp/gnus/nndoc.el b/lisp/gnus/nndoc.el
index a9824febc2c..101bb4023f9 100644
--- a/lisp/gnus/nndoc.el
+++ b/lisp/gnus/nndoc.el
@@ -1,9 +1,9 @@
1;;; nndoc.el --- single file access for Gnus 1;;; nndoc.el --- single file access for Gnus
2;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 2;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
3;; Free Software Foundation, Inc. 3;; Free Software Foundation, Inc.
4 4
5;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> 5;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6;; Masanobu UMEDA <umerin@flab.flab.fujitsu.junet> 6;; Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
7;; Keywords: news 7;; Keywords: news
8 8
9;; This file is part of GNU Emacs. 9;; This file is part of GNU Emacs.
@@ -25,6 +25,8 @@
25 25
26;;; Commentary: 26;;; Commentary:
27 27
28;; For Outlook mail boxes format, see http://mbx2mbox.sourceforge.net/
29
28;;; Code: 30;;; Code:
29 31
30(require 'nnheader) 32(require 'nnheader)
@@ -41,7 +43,8 @@
41 "*Type of the file. 43 "*Type of the file.
42One of `mbox', `babyl', `digest', `news', `rnews', `mmdf', `forward', 44One of `mbox', `babyl', `digest', `news', `rnews', `mmdf', `forward',
43`rfc934', `rfc822-forward', `mime-parts', `standard-digest', 45`rfc934', `rfc822-forward', `mime-parts', `standard-digest',
44`slack-digest', `clari-briefs', `nsmail' or `guess'.") 46`slack-digest', `clari-briefs', `nsmail', `outlook', `oe-dbx',
47`mailman', `exim-bounce', or `guess'.")
45 48
46(defvoo nndoc-post-type 'mail 49(defvoo nndoc-post-type 'mail
47 "*Whether the nndoc group is `mail' or `post'.") 50 "*Whether the nndoc group is `mail' or `post'.")
@@ -55,6 +58,9 @@ from the document.")
55 `((mmdf 58 `((mmdf
56 (article-begin . "^\^A\^A\^A\^A\n") 59 (article-begin . "^\^A\^A\^A\^A\n")
57 (body-end . "^\^A\^A\^A\^A\n")) 60 (body-end . "^\^A\^A\^A\^A\n"))
61 (exim-bounce
62 (article-begin . "^------ This is a copy of the message, including all the headers. ------\n\n")
63 (body-end-function . nndoc-exim-bounce-body-end-function))
58 (nsmail 64 (nsmail
59 (article-begin . "^From - ")) 65 (article-begin . "^From - "))
60 (news 66 (news
@@ -70,14 +76,14 @@ from the document.")
70 (body-end . "\^_") 76 (body-end . "\^_")
71 (body-begin-function . nndoc-babyl-body-begin) 77 (body-begin-function . nndoc-babyl-body-begin)
72 (head-begin-function . nndoc-babyl-head-begin)) 78 (head-begin-function . nndoc-babyl-head-begin))
73 (forward
74 (article-begin . "^-+ \\(Start of \\)?forwarded message.*\n+")
75 (body-end . "^-+ End \\(of \\)?forwarded message.*$")
76 (prepare-body-function . nndoc-unquote-dashes))
77 (rfc934 79 (rfc934
78 (article-begin . "^--.*\n+") 80 (article-begin . "^--.*\n+")
79 (body-end . "^--.*$") 81 (body-end . "^--.*$")
80 (prepare-body-function . nndoc-unquote-dashes)) 82 (prepare-body-function . nndoc-unquote-dashes))
83 (mailman
84 (article-begin . "^--__--__--\n\nMessage:")
85 (body-end . "^--__--__--$")
86 (prepare-body-function . nndoc-unquote-dashes))
81 (clari-briefs 87 (clari-briefs
82 (article-begin . "^ \\*") 88 (article-begin . "^ \\*")
83 (body-end . "^\t------*[ \t]^*\n^ \\*") 89 (body-end . "^\t------*[ \t]^*\n^ \\*")
@@ -117,8 +123,8 @@ from the document.")
117 (head-begin . "^Paper.*:") 123 (head-begin . "^Paper.*:")
118 (head-end . "\\(^\\\\\\\\.*\n\\|-----------------\\)") 124 (head-end . "\\(^\\\\\\\\.*\n\\|-----------------\\)")
119 (body-begin . "") 125 (body-begin . "")
120 (body-end . "-------------------------------------------------") 126 (body-end . "\\(-------------------------------------------------\\|%-%-%-%-%-%-%-%-%-%-%-%-%-%-\\|%%--%%--%%--%%--%%--%%--%%--%%--\\|%%%---%%%---%%%---%%%---\\)")
121 (file-end . "^Title: Recent Seminal") 127 (file-end . "\\(^Title: Recent Seminal\\|%%%---%%%---%%%---%%%---\\)")
122 (generate-head-function . nndoc-generate-lanl-gov-head) 128 (generate-head-function . nndoc-generate-lanl-gov-head)
123 (article-transform-function . nndoc-transform-lanl-gov-announce) 129 (article-transform-function . nndoc-transform-lanl-gov-announce)
124 (subtype preprints guess)) 130 (subtype preprints guess))
@@ -128,6 +134,16 @@ from the document.")
128 (outlook 134 (outlook
129 (article-begin-function . nndoc-outlook-article-begin) 135 (article-begin-function . nndoc-outlook-article-begin)
130 (body-end . "\0")) 136 (body-end . "\0"))
137 (oe-dbx ;; Outlook Express DBX format
138 (dissection-function . nndoc-oe-dbx-dissection)
139 (generate-head-function . nndoc-oe-dbx-generate-head)
140 (generate-article-function . nndoc-oe-dbx-generate-article))
141 (forward
142 (article-begin . "^-+ \\(Start of \\)?forwarded message.*\n+")
143 (body-end . "^-+ End \\(of \\)?forwarded message.*$")
144 (prepare-body-function . nndoc-unquote-dashes))
145 (mail-in-mail ;; Wild guess on mailer daemon's messages or others
146 (article-begin-function . nndoc-mail-in-mail-article-begin))
131 (guess 147 (guess
132 (guess . t) 148 (guess . t)
133 (subtype nil)) 149 (subtype nil))
@@ -138,6 +154,9 @@ from the document.")
138 (guess . t) 154 (guess . t)
139 (subtype nil)))) 155 (subtype nil))))
140 156
157(defvar nndoc-binary-file-names ".[Dd][Bb][Xx]$"
158 "Regexp for binary nndoc file names.")
159
141 160
142(defvoo nndoc-file-begin nil) 161(defvoo nndoc-file-begin nil)
143(defvoo nndoc-first-article nil) 162(defvoo nndoc-first-article nil)
@@ -163,6 +182,8 @@ from the document.")
163(defvoo nndoc-generate-head-function nil) 182(defvoo nndoc-generate-head-function nil)
164(defvoo nndoc-article-transform-function nil) 183(defvoo nndoc-article-transform-function nil)
165(defvoo nndoc-article-begin-function nil) 184(defvoo nndoc-article-begin-function nil)
185(defvoo nndoc-generate-article-function nil)
186(defvoo nndoc-dissection-function nil)
166 187
167(defvoo nndoc-status-string "") 188(defvoo nndoc-status-string "")
168(defvoo nndoc-group-alist nil) 189(defvoo nndoc-group-alist nil)
@@ -213,8 +234,11 @@ from the document.")
213 (set-buffer buffer) 234 (set-buffer buffer)
214 (erase-buffer) 235 (erase-buffer)
215 (when entry 236 (when entry
216 (if (stringp article) 237 (cond
217 nil 238 ((stringp article) nil)
239 (nndoc-generate-article-function
240 (funcall nndoc-generate-article-function article))
241 (t
218 (insert-buffer-substring 242 (insert-buffer-substring
219 nndoc-current-buffer (car entry) (nth 1 entry)) 243 nndoc-current-buffer (car entry) (nth 1 entry))
220 (insert "\n") 244 (insert "\n")
@@ -226,7 +250,7 @@ from the document.")
226 (funcall nndoc-prepare-body-function)) 250 (funcall nndoc-prepare-body-function))
227 (when nndoc-article-transform-function 251 (when nndoc-article-transform-function
228 (funcall nndoc-article-transform-function article)) 252 (funcall nndoc-article-transform-function article))
229 t))))) 253 t))))))
230 254
231(deffoo nndoc-request-group (group &optional server dont-check) 255(deffoo nndoc-request-group (group &optional server dont-check)
232 "Select news GROUP." 256 "Select news GROUP."
@@ -246,8 +270,8 @@ from the document.")
246 270
247(deffoo nndoc-request-type (group &optional article) 271(deffoo nndoc-request-type (group &optional article)
248 (cond ((not article) 'unknown) 272 (cond ((not article) 'unknown)
249 (nndoc-post-type nndoc-post-type) 273 (nndoc-post-type nndoc-post-type)
250 (t 'unknown))) 274 (t 'unknown)))
251 275
252(deffoo nndoc-close-group (group &optional server) 276(deffoo nndoc-close-group (group &optional server)
253 (nndoc-possibly-change-buffer group server) 277 (nndoc-possibly-change-buffer group server)
@@ -299,10 +323,14 @@ from the document.")
299 (save-excursion 323 (save-excursion
300 (set-buffer nndoc-current-buffer) 324 (set-buffer nndoc-current-buffer)
301 (erase-buffer) 325 (erase-buffer)
302 (if (stringp nndoc-address) 326 (if (and (stringp nndoc-address)
303 (nnheader-insert-file-contents nndoc-address) 327 (string-match nndoc-binary-file-names nndoc-address))
304 (insert-buffer-substring nndoc-address)) 328 (let ((coding-system-for-read 'binary))
305 (run-hooks 'nndoc-open-document-hook)))) 329 (mm-insert-file-contents nndoc-address))
330 (if (stringp nndoc-address)
331 (nnheader-insert-file-contents nndoc-address)
332 (insert-buffer-substring nndoc-address))
333 (run-hooks 'nndoc-open-document-hook)))))
306 ;; Initialize the nndoc structures according to this new document. 334 ;; Initialize the nndoc structures according to this new document.
307 (when (and nndoc-current-buffer 335 (when (and nndoc-current-buffer
308 (not nndoc-dissection-alist)) 336 (not nndoc-dissection-alist))
@@ -331,7 +359,9 @@ from the document.")
331 nndoc-body-begin nndoc-body-end-function nndoc-body-end 359 nndoc-body-begin nndoc-body-end-function nndoc-body-end
332 nndoc-prepare-body-function nndoc-article-transform-function 360 nndoc-prepare-body-function nndoc-article-transform-function
333 nndoc-generate-head-function nndoc-body-begin-function 361 nndoc-generate-head-function nndoc-body-begin-function
334 nndoc-head-begin-function))) 362 nndoc-head-begin-function
363 nndoc-generate-article-function
364 nndoc-dissection-function)))
335 (while vars 365 (while vars
336 (set (pop vars) nil))) 366 (set (pop vars) nil)))
337 (let (defs) 367 (let (defs)
@@ -436,11 +466,9 @@ from the document.")
436 t)) 466 t))
437 467
438(defun nndoc-forward-type-p () 468(defun nndoc-forward-type-p ()
439 (when (and (re-search-forward "^-+ \\(Start of \\)?forwarded message.*\n+" 469 (when (and (re-search-forward "^-+ \\(Start of \\)?forwarded message.*\n+"
440 nil t) 470 nil t)
441 (not (re-search-forward "^Subject:.*digest" nil t)) 471 (looking-at "[\r\n]*[a-zA-Z][a-zA-Z0-9-]*:"))
442 (not (re-search-backward "^From:" nil t 2))
443 (not (re-search-forward "^From:" nil t 2)))
444 t)) 472 t))
445 473
446(defun nndoc-rfc934-type-p () 474(defun nndoc-rfc934-type-p ()
@@ -450,6 +478,10 @@ from the document.")
450 (not (re-search-forward "^From:" nil t 2))) 478 (not (re-search-forward "^From:" nil t 2)))
451 t)) 479 t))
452 480
481(defun nndoc-mailman-type-p ()
482 (when (re-search-forward "^--__--__--\n+" nil t)
483 t))
484
453(defun nndoc-rfc822-forward-type-p () 485(defun nndoc-rfc822-forward-type-p ()
454 (save-restriction 486 (save-restriction
455 (message-narrow-to-head) 487 (message-narrow-to-head)
@@ -520,6 +552,13 @@ from the document.")
520 (insert "From: " "clari@clari.net (" (or from "unknown") ")" 552 (insert "From: " "clari@clari.net (" (or from "unknown") ")"
521 "\nSubject: " (or subject "(no subject)") "\n"))) 553 "\nSubject: " (or subject "(no subject)") "\n")))
522 554
555(defun nndoc-exim-bounce-type-p ()
556 (and (re-search-forward "^------ This is a copy of the message, including all the headers. ------" nil t)
557 t))
558
559(defun nndoc-exim-bounce-body-end-function ()
560 (goto-char (point-max)))
561
523 562
524(defun nndoc-mime-digest-type-p () 563(defun nndoc-mime-digest-type-p ()
525 (let ((case-fold-search t) 564 (let ((case-fold-search t)
@@ -540,7 +579,7 @@ from the document.")
540 (cons 'body-begin "^ ?\n") 579 (cons 'body-begin "^ ?\n")
541 (cons 'article-begin b-delimiter) 580 (cons 'article-begin b-delimiter)
542 (cons 'body-end-function 'nndoc-digest-body-end) 581 (cons 'body-end-function 'nndoc-digest-body-end)
543 (cons 'file-end (concat "\n--" boundary-id "--[ \t]*$")))) 582 (cons 'file-end (concat "^--" boundary-id "--[ \t]*$"))))
544 t))) 583 t)))
545 584
546(defun nndoc-standard-digest-type-p () 585(defun nndoc-standard-digest-type-p ()
@@ -558,35 +597,54 @@ from the document.")
558 597
559(defun nndoc-lanl-gov-announce-type-p () 598(defun nndoc-lanl-gov-announce-type-p ()
560 (when (let ((case-fold-search nil)) 599 (when (let ((case-fold-search nil))
561 (re-search-forward "^\\\\\\\\\nPaper: [a-z-]+/[0-9]+" nil t)) 600 (re-search-forward "^\\\\\\\\\nPaper\\( (\\*cross-listing\\*)\\)?: [a-zA-Z-\\.]+/[0-9]+" nil t))
562 t)) 601 t))
563 602
564(defun nndoc-transform-lanl-gov-announce (article) 603(defun nndoc-transform-lanl-gov-announce (article)
565 (goto-char (point-max)) 604 (goto-char (point-max))
566 (when (re-search-backward "^\\\\\\\\ +(\\([^ ]*\\) , *\\([^ ]*\\))" nil t) 605 (when (re-search-backward "^\\\\\\\\ +( *\\([^ ]*\\) , *\\([^ ]*\\))" nil t)
567 (replace-match "\n\nGet it at \\1 (\\2)" t nil))) 606 (replace-match "\n\nGet it at \\1 (\\2)" t nil))
607 (goto-char (point-min))
608 (while (re-search-forward "^\\\\\\\\$" nil t)
609 (replace-match "" t nil))
610 (goto-char (point-min))
611 (when (re-search-forward "^replaced with revised version +\\(.*[^ ]\\) +" nil t)
612 (replace-match "Date: \\1 (revised) " t nil))
613 (goto-char (point-min))
614 (unless (re-search-forward "^From" nil t)
615 (goto-char (point-min))
616 (when (re-search-forward "^Authors?: \\(.*\\)" nil t)
617 (goto-char (point-min))
618 (insert "From: " (match-string 1) "\n"))))
568 619
569(defun nndoc-generate-lanl-gov-head (article) 620(defun nndoc-generate-lanl-gov-head (article)
570 (let ((entry (cdr (assq article nndoc-dissection-alist))) 621 (let ((entry (cdr (assq article nndoc-dissection-alist)))
571 (e-mail "no address given") 622 (from "<no address given>")
572 subject from) 623 subject date)
573 (save-excursion 624 (save-excursion
574 (set-buffer nndoc-current-buffer) 625 (set-buffer nndoc-current-buffer)
575 (save-restriction 626 (save-restriction
576 (narrow-to-region (car entry) (nth 1 entry)) 627 (narrow-to-region (car entry) (nth 1 entry))
577 (goto-char (point-min)) 628 (goto-char (point-min))
578 (when (looking-at "^Paper.*: \\([a-z-]+/[0-9]+\\)") 629 (when (looking-at "^Paper.*: \\([a-zA-Z-\\.]+/[0-9]+\\)")
579 (setq subject (concat " (" (match-string 1) ")")) 630 (setq subject (concat " (" (match-string 1) ")"))
580 (when (re-search-forward "^From: \\([^ ]+\\)" nil t) 631 (when (re-search-forward "^From: \\(.*\\)" nil t)
581 (setq e-mail (match-string 1))) 632 (setq from (concat "<"
582 (when (re-search-forward "^Title: \\([^\f]*\\)\nAuthors?: \\(.*\\)" 633 (cadr (funcall gnus-extract-address-components
583 nil t) 634 (match-string 1))) ">")))
584 (setq subject (concat (match-string 1) subject)) 635 (if (re-search-forward "^Date: +\\([^(]*\\)" nil t)
585 (setq from (concat (match-string 2) " <" e-mail ">")))))) 636 (setq date (match-string 1))
637 (when (re-search-forward "^replaced with revised version +\\([^(]*\\)" nil t)
638 (setq date (match-string 1))))
639 (when (re-search-forward "^Title: \\([^\f]*\\)\nAuthors?: \\(.*\\)"
640 nil t)
641 (setq subject (concat (match-string 1) subject))
642 (setq from (concat (match-string 2) " " from))))))
586 (while (and from (string-match "(\[^)\]*)" from)) 643 (while (and from (string-match "(\[^)\]*)" from))
587 (setq from (replace-match "" t t from))) 644 (setq from (replace-match "" t t from)))
588 (insert "From: " (or from "unknown") 645 (insert "From: " (or from "unknown")
589 "\nSubject: " (or subject "(no subject)") "\n"))) 646 "\nSubject: " (or subject "(no subject)") "\n")
647 (if date (insert "Date: " date))))
590 648
591(defun nndoc-nsmail-type-p () 649(defun nndoc-nsmail-type-p ()
592 (when (looking-at "From - ") 650 (when (looking-at "From - ")
@@ -600,10 +658,106 @@ from the document.")
600 ;; FIXME: Is JMF the magic of outlook mailbox? -- ShengHuo. 658 ;; FIXME: Is JMF the magic of outlook mailbox? -- ShengHuo.
601 (looking-at "JMF")) 659 (looking-at "JMF"))
602 660
661(defun nndoc-oe-dbx-type-p ()
662 (looking-at (mm-string-as-multibyte "\317\255\022\376")))
663
664(defun nndoc-read-little-endian ()
665 (+ (prog1 (char-after) (forward-char 1))
666 (lsh (prog1 (char-after) (forward-char 1)) 8)
667 (lsh (prog1 (char-after) (forward-char 1)) 16)
668 (lsh (prog1 (char-after) (forward-char 1)) 24)))
669
670(defun nndoc-oe-dbx-decode-block ()
671 (list
672 (nndoc-read-little-endian) ;; this address
673 (nndoc-read-little-endian) ;; next address offset
674 (nndoc-read-little-endian) ;; blocksize
675 (nndoc-read-little-endian))) ;; next address
676
677(defun nndoc-oe-dbx-dissection ()
678 (let ((i 0) blk p tp)
679 (goto-char 60117) ;; 0x0000EAD4+1
680 (setq p (point))
681 (unless (eobp)
682 (setq blk (nndoc-oe-dbx-decode-block)))
683 (while (and blk (> (car blk) 0) (or (zerop (nth 3 blk))
684 (> (nth 3 blk) p)))
685 (push (list (incf i) p nil nil nil 0) nndoc-dissection-alist)
686 (while (and (> (car blk) 0) (> (nth 3 blk) p))
687 (goto-char (1+ (nth 3 blk)))
688 (setq blk (nndoc-oe-dbx-decode-block)))
689 (if (or (<= (car blk) p)
690 (<= (nth 1 blk) 0)
691 (not (zerop (nth 3 blk))))
692 (setq blk nil)
693 (setq tp (+ (car blk) (nth 1 blk) 17))
694 (if (or (<= tp p) (>= tp (point-max)))
695 (setq blk nil)
696 (goto-char tp)
697 (setq p tp
698 blk (nndoc-oe-dbx-decode-block)))))))
699
700(defun nndoc-oe-dbx-generate-article (article &optional head)
701 (let ((entry (cdr (assq article nndoc-dissection-alist)))
702 (cur (current-buffer))
703 (begin (point))
704 blk p)
705 (with-current-buffer nndoc-current-buffer
706 (setq p (car entry))
707 (while (> p (point-min))
708 (goto-char p)
709 (setq blk (nndoc-oe-dbx-decode-block))
710 (setq p (point))
711 (with-current-buffer cur
712 (insert-buffer-substring nndoc-current-buffer p (+ p (nth 2 blk))))
713 (setq p (1+ (nth 3 blk)))))
714 (goto-char begin)
715 (while (re-search-forward "\r$" nil t)
716 (delete-backward-char 1))
717 (when head
718 (goto-char begin)
719 (when (search-forward "\n\n" nil t)
720 (setcar (cddddr entry) (count-lines (point) (point-max)))
721 (delete-region (1- (point)) (point-max))))
722 t))
723
724(defun nndoc-oe-dbx-generate-head (article)
725 (nndoc-oe-dbx-generate-article article 'head))
726
727(defun nndoc-mail-in-mail-type-p ()
728 (let (found)
729 (save-excursion
730 (catch 'done
731 (while (re-search-forward "\n\n[-A-Za-z0-9]+:" nil t)
732 (setq found 0)
733 (forward-line)
734 (while (looking-at "[ \t]\\|[-A-Za-z0-9]+:")
735 (if (looking-at "[-A-Za-z0-9]+:")
736 (setq found (1+ found)))
737 (forward-line))
738 (if (and (> found 0) (looking-at "\n"))
739 (throw 'done 9999)))
740 nil))))
741
742(defun nndoc-mail-in-mail-article-begin ()
743 (let (point found)
744 (if (catch 'done
745 (while (re-search-forward "\n\n\\([-A-Za-z0-9]+:\\)" nil t)
746 (setq found 0)
747 (setq point (match-beginning 1))
748 (forward-line)
749 (while (looking-at "[ \t]\\|[-A-Za-z0-9]+:")
750 (if (looking-at "[-A-Za-z0-9]+:")
751 (setq found (1+ found)))
752 (forward-line))
753 (if (and (> found 0) (looking-at "\n"))
754 (throw 'done t)))
755 nil)
756 (goto-char point))))
757
603(deffoo nndoc-request-accept-article (group &optional server last) 758(deffoo nndoc-request-accept-article (group &optional server last)
604 nil) 759 nil)
605 760
606
607;;; 761;;;
608;;; Functions for dissecting the documents 762;;; Functions for dissecting the documents
609;;; 763;;;
@@ -625,43 +779,45 @@ from the document.")
625 ;; Remove blank lines. 779 ;; Remove blank lines.
626 (while (eq (following-char) ?\n) 780 (while (eq (following-char) ?\n)
627 (delete-char 1)) 781 (delete-char 1))
628 ;; Find the beginning of the file. 782 (if nndoc-dissection-function
629 (when nndoc-file-begin 783 (funcall nndoc-dissection-function)
630 (nndoc-search nndoc-file-begin)) 784 ;; Find the beginning of the file.
631 ;; Go through the file. 785 (when nndoc-file-begin
632 (while (if (and first nndoc-first-article) 786 (nndoc-search nndoc-file-begin))
633 (nndoc-search nndoc-first-article) 787 ;; Go through the file.
634 (nndoc-article-begin)) 788 (while (if (and first nndoc-first-article)
635 (setq first nil) 789 (nndoc-search nndoc-first-article)
636 (cond (nndoc-head-begin-function 790 (nndoc-article-begin))
637 (funcall nndoc-head-begin-function)) 791 (setq first nil)
638 (nndoc-head-begin 792 (cond (nndoc-head-begin-function
639 (nndoc-search nndoc-head-begin))) 793 (funcall nndoc-head-begin-function))
640 (if (or (eobp) 794 (nndoc-head-begin
641 (and nndoc-file-end 795 (nndoc-search nndoc-head-begin)))
642 (looking-at nndoc-file-end))) 796 (if (or (eobp)
643 (goto-char (point-max)) 797 (and nndoc-file-end
644 (setq head-begin (point)) 798 (looking-at nndoc-file-end)))
645 (nndoc-search (or nndoc-head-end "^$")) 799 (goto-char (point-max))
646 (setq head-end (point)) 800 (setq head-begin (point))
647 (if nndoc-body-begin-function 801 (nndoc-search (or nndoc-head-end "^$"))
648 (funcall nndoc-body-begin-function) 802 (setq head-end (point))
649 (nndoc-search (or nndoc-body-begin "^\n"))) 803 (if nndoc-body-begin-function
650 (setq body-begin (point)) 804 (funcall nndoc-body-begin-function)
651 (or (and nndoc-body-end-function 805 (nndoc-search (or nndoc-body-begin "^\n")))
652 (funcall nndoc-body-end-function)) 806 (setq body-begin (point))
653 (and nndoc-body-end 807 (or (and nndoc-body-end-function
654 (nndoc-search nndoc-body-end)) 808 (funcall nndoc-body-end-function))
655 (nndoc-article-begin) 809 (and nndoc-body-end
656 (progn 810 (nndoc-search nndoc-body-end))
657 (goto-char (point-max)) 811 (nndoc-article-begin)
658 (when nndoc-file-end 812 (progn
659 (and (re-search-backward nndoc-file-end nil t) 813 (goto-char (point-max))
660 (beginning-of-line))))) 814 (when nndoc-file-end
661 (setq body-end (point)) 815 (and (re-search-backward nndoc-file-end nil t)
662 (push (list (incf i) head-begin head-end body-begin body-end 816 (beginning-of-line)))))
663 (count-lines body-begin body-end)) 817 (setq body-end (point))
664 nndoc-dissection-alist)))))) 818 (push (list (incf i) head-begin head-end body-begin body-end
819 (count-lines body-begin body-end))
820 nndoc-dissection-alist)))))))
665 821
666(defun nndoc-article-begin () 822(defun nndoc-article-begin ()
667 (if nndoc-article-begin-function 823 (if nndoc-article-begin-function
@@ -736,6 +892,10 @@ PARENT is the message-ID of the parent summary line, or nil for none."
736 (unless article-insert 892 (unless article-insert
737 (setq article-insert (buffer-substring (point-min) (point-max)) 893 (setq article-insert (buffer-substring (point-min) (point-max))
738 head-end head-begin)) 894 head-end head-begin))
895 ;; Fix MIME-Version
896 (unless (string-match "MIME-Version:" article-insert)
897 (setq article-insert
898 (concat article-insert "MIME-Version: 1.0\n")))
739 (setq summary-insert article-insert) 899 (setq summary-insert article-insert)
740 ;; - summary Subject. 900 ;; - summary Subject.
741 (setq summary-insert 901 (setq summary-insert