/[emacs]/emacs/lisp/gnus/nndoc.el
ViewVC logotype

Diff of /emacs/lisp/gnus/nndoc.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6.6.1 by handa, Fri Mar 12 00:03:11 2004 UTC revision 1.6.6.2 by miles, Thu Sep 9 09:36:26 2004 UTC
# Line 1  Line 1 
1  ;;; nndoc.el --- single file access for Gnus  ;;; nndoc.el --- single file access for Gnus
2  ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002  ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
3  ;;        Free Software Foundation, Inc.  ;;        Free Software Foundation, Inc.
4    
5  ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>  ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
# Line 58  from the document.") Line 58  from the document.")
58    `((mmdf    `((mmdf
59       (article-begin .  "^\^A\^A\^A\^A\n")       (article-begin .  "^\^A\^A\^A\^A\n")
60       (body-end .  "^\^A\^A\^A\^A\n"))       (body-end .  "^\^A\^A\^A\^A\n"))
61      (exim-bounce      (mime-digest
62       (article-begin . "^------ This is a copy of the message, including all the headers. ------\n\n")       (article-begin . "")
63       (body-end-function . nndoc-exim-bounce-body-end-function))       (head-begin . "^ ?\n")
64         (head-end . "^ ?$")
65         (body-end . "")
66         (file-end . "")
67         (subtype digest guess))
68        (mime-parts
69         (generate-head-function . nndoc-generate-mime-parts-head)
70         (article-transform-function . nndoc-transform-mime-parts))
71      (nsmail      (nsmail
72       (article-begin .  "^From - "))       (article-begin .  "^From - "))
73      (news      (news
# Line 76  from the document.") Line 83  from the document.")
83       (body-end . "\^_")       (body-end . "\^_")
84       (body-begin-function . nndoc-babyl-body-begin)       (body-begin-function . nndoc-babyl-body-begin)
85       (head-begin-function . nndoc-babyl-head-begin))       (head-begin-function . nndoc-babyl-head-begin))
86        (exim-bounce
87         (article-begin . "^------ This is a copy of the message, including all the headers. ------\n\n")
88         (body-end-function . nndoc-exim-bounce-body-end-function))
89      (rfc934      (rfc934
90       (article-begin . "^--.*\n+")       (article-begin . "^--.*\n+")
91       (body-end . "^--.*$")       (body-end . "^--.*$")
# Line 91  from the document.") Line 101  from the document.")
101       (head-end . "^\t")       (head-end . "^\t")
102       (generate-head-function . nndoc-generate-clari-briefs-head)       (generate-head-function . nndoc-generate-clari-briefs-head)
103       (article-transform-function . nndoc-transform-clari-briefs))       (article-transform-function . nndoc-transform-clari-briefs))
104      (mime-digest      
      (article-begin . "")  
      (head-begin . "^ ?\n")  
      (head-end . "^ ?$")  
      (body-end . "")  
      (file-end . "")  
      (subtype digest guess))  
     (mime-parts  
      (generate-head-function . nndoc-generate-mime-parts-head)  
      (article-transform-function . nndoc-transform-mime-parts))  
105      (standard-digest      (standard-digest
106       (first-article . ,(concat "^" (make-string 70 ?-) "\n *\n+"))       (first-article . ,(concat "^" (make-string 70 ?-) "\n *\n+"))
107       (article-begin . ,(concat "^\n" (make-string 30 ?-) "\n *\n+"))       (article-begin . ,(concat "^\n" (make-string 30 ?-) "\n *\n+"))
# Line 129  from the document.") Line 130  from the document.")
130       (article-transform-function . nndoc-transform-lanl-gov-announce)       (article-transform-function . nndoc-transform-lanl-gov-announce)
131       (subtype preprints guess))       (subtype preprints guess))
132      (rfc822-forward      (rfc822-forward
133       (article-begin . "^\n")       (article-begin . "^\n+")
134       (body-end-function . nndoc-rfc822-forward-body-end-function))       (body-end-function . nndoc-rfc822-forward-body-end-function)
135         (generate-head-function . nndoc-rfc822-forward-generate-head)
136         (generate-article-function . nndoc-rfc822-forward-generate-article))
137      (outlook      (outlook
138       (article-begin-function . nndoc-outlook-article-begin)       (article-begin-function . nndoc-outlook-article-begin)
139       (body-end .  "\0"))       (body-end .  "\0"))
# Line 393  from the document.") Line 396  from the document.")
396        (error "Document is not of any recognized type"))        (error "Document is not of any recognized type"))
397      (if result      (if result
398          (car entry)          (car entry)
399        (cadar (sort results 'car-less-than-car)))))        (cadar (last (sort results 'car-less-than-car))))))
400    
401  ;;;  ;;;
402  ;;; Built-in type predicates and functions  ;;; Built-in type predicates and functions
# Line 468  from the document.") Line 471  from the document.")
471  (defun nndoc-forward-type-p ()  (defun nndoc-forward-type-p ()
472    (when (and (re-search-forward "^-+ \\(Start of \\)?forwarded message.*\n+"    (when (and (re-search-forward "^-+ \\(Start of \\)?forwarded message.*\n+"
473                                  nil t)                                  nil t)
474               (looking-at "[\r\n]*[a-zA-Z][a-zA-Z0-9-]*:"))               (looking-at "[\r\n]*[a-zA-Z][a-zA-Z0-9-]*:\\|^>?From "))
475      t))      t))
476    
477  (defun nndoc-rfc934-type-p ()  (defun nndoc-rfc934-type-p ()
# Line 491  from the document.") Line 494  from the document.")
494  (defun nndoc-rfc822-forward-body-end-function ()  (defun nndoc-rfc822-forward-body-end-function ()
495    (goto-char (point-max)))    (goto-char (point-max)))
496    
497    (defun nndoc-rfc822-forward-generate-article (article &optional head)
498      (let ((entry (cdr (assq article nndoc-dissection-alist)))
499            (begin (point))
500            encoding)
501        (with-current-buffer nndoc-current-buffer
502          (save-restriction
503            (message-narrow-to-head)
504            (setq encoding (message-fetch-field "content-transfer-encoding"))))
505        (insert-buffer-substring nndoc-current-buffer (car entry) (nth 3 entry))
506        (when encoding
507          (save-restriction
508            (narrow-to-region begin (point-max))
509            (mm-decode-content-transfer-encoding
510             (intern (downcase (mail-header-strip encoding))))))
511        (when head
512          (goto-char begin)
513          (when (search-forward "\n\n" nil t)
514            (delete-region (1- (point)) (point-max)))))
515      t)
516    
517    (defun nndoc-rfc822-forward-generate-head (article)
518      (nndoc-rfc822-forward-generate-article article 'head))
519    
520  (defun nndoc-mime-parts-type-p ()  (defun nndoc-mime-parts-type-p ()
521    (let ((case-fold-search t)    (let ((case-fold-search t)
522          (limit (search-forward "\n\n" nil t)))          (limit (search-forward "\n\n" nil t)))
# Line 771  from the document.") Line 797  from the document.")
797    "Go through the document and partition it into heads/bodies/articles."    "Go through the document and partition it into heads/bodies/articles."
798    (let ((i 0)    (let ((i 0)
799          (first t)          (first t)
800          head-begin head-end body-begin body-end)          art-begin head-begin head-end body-begin body-end)
801      (setq nndoc-dissection-alist nil)      (setq nndoc-dissection-alist nil)
802      (save-excursion      (save-excursion
803        (set-buffer nndoc-current-buffer)        (set-buffer nndoc-current-buffer)
# Line 787  from the document.") Line 813  from the document.")
813          ;; Go through the file.          ;; Go through the file.
814          (while (if (and first nndoc-first-article)          (while (if (and first nndoc-first-article)
815                     (nndoc-search nndoc-first-article)                     (nndoc-search nndoc-first-article)
816                   (nndoc-article-begin))                   (if art-begin
817            (setq first nil)                       (goto-char art-begin)
818                       (nndoc-article-begin)))
819              (setq first nil
820                    art-begin nil)
821            (cond (nndoc-head-begin-function            (cond (nndoc-head-begin-function
822                   (funcall nndoc-head-begin-function))                   (funcall nndoc-head-begin-function))
823                  (nndoc-head-begin                  (nndoc-head-begin
# Line 808  from the document.") Line 837  from the document.")
837                       (funcall nndoc-body-end-function))                       (funcall nndoc-body-end-function))
838                  (and nndoc-body-end                  (and nndoc-body-end
839                       (nndoc-search nndoc-body-end))                       (nndoc-search nndoc-body-end))
840                  (nndoc-article-begin)                  (and (nndoc-article-begin)
841                         (setq art-begin (point)))
842                  (progn                  (progn
843                    (goto-char (point-max))                    (goto-char (point-max))
844                    (when nndoc-file-end                    (when nndoc-file-end
# Line 890  PARENT is the message-ID of the parent s Line 920  PARENT is the message-ID of the parent s
920              subtype "plain"))              subtype "plain"))
921      ;; Prepare the article and summary inserts.      ;; Prepare the article and summary inserts.
922      (unless article-insert      (unless article-insert
923        (setq article-insert (buffer-substring (point-min) (point-max))        (setq article-insert (buffer-string)
924              head-end head-begin))              head-end head-begin))
925      ;; Fix MIME-Version      ;; Fix MIME-Version
926      (unless (string-match "MIME-Version:" article-insert)      (unless (string-match "MIME-Version:" article-insert)

Legend:
Removed from v.1.6.6.1  
changed lines
  Added in v.1.6.6.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26