1 ;;; sb-mhonarc.el --- shimbun backend class for mhonarc
3 ;; Author: TSUCHIYA Masatoshi <tsuchiya@pine.kuee.kyoto-u.ac.jp>
4 ;; Akihiro Arisawa <ari@atesoft.advantest.co.jp>
5 ;; Yuuichi Teranishi <teranisi@gohome.org>
11 ;; This program is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; This program is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with this program; if not, you can either send email to this
23 ;; program's maintainer or write to: The Free Software Foundation,
24 ;; Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.
28 ;; Original code was nnshimbun.el written by
29 ;; TSUCHIYA Masatoshi <tsuchiya@pine.kuee.kyoto-u.ac.jp>.
34 (luna-define-class shimbun-mhonarc (shimbun) ())
36 (luna-define-method shimbun-make-contents ((shimbun shimbun-mhonarc)
38 (if (search-forward "<!--X-Head-End-->" nil t)
41 ;; Processing headers.
43 (narrow-to-region (point-min) (point))
44 (shimbun-decode-entities)
45 (goto-char (point-min))
46 (while (search-forward "\n<!--X-" nil t)
48 (goto-char (point-min))
49 (while (search-forward " -->\n" nil t)
51 (goto-char (point-min))
52 (while (search-forward "\t" nil t)
54 (goto-char (point-min))
59 (delete-region (point) (progn (forward-line 1) (point))))
60 ((looking-at "Subject: +")
61 (shimbun-header-set-subject header
62 (shimbun-header-field-value))
63 (delete-region (point) (progn (forward-line 1) (point))))
64 ((looking-at "From: +")
65 (shimbun-header-set-from header (shimbun-header-field-value))
66 (delete-region (point) (progn (forward-line 1) (point))))
67 ((looking-at "Date: +")
68 (shimbun-header-set-date header (shimbun-header-field-value))
69 (delete-region (point) (progn (forward-line 1) (point))))
70 ((looking-at "Message-Id: +")
71 (shimbun-header-set-id header
72 (concat "<" (shimbun-header-field-value) ">"))
73 (delete-region (point) (progn (forward-line 1) (point))))
74 ((looking-at "Reference: +")
75 (push (concat "<" (shimbun-header-field-value) ">") refs)
76 (delete-region (point) (progn (forward-line 1) (point))))
77 ((looking-at "Content-Type: ")
78 (unless (search-forward "charset" (point-at-eol) t)
80 (insert "; charset=ISO-2022-JP"))
82 (t (forward-line 1))))
83 (insert "MIME-Version: 1.0\n")
85 (shimbun-header-set-references header
86 (mapconcat 'identity refs " ")))
88 (goto-char (point-min))
89 (shimbun-header-insert header))
90 (goto-char (point-max)))
93 (narrow-to-region (point) (point-max))
97 (search-forward "\n<!--X-Body-of-Message-->\n" nil t)
99 (when (search-forward "\n<!--X-Body-of-Message-End-->\n" nil t)
101 (delete-region (point) (point-max)))
102 (shimbun-remove-markup)
103 (shimbun-decode-entities)))
104 (goto-char (point-min))
105 (shimbun-header-insert header)
107 "Content-Type: text/html; charset=ISO-2022-JP\nMIME-Version: 1.0\n\n"))
108 (encode-coding-string (buffer-string)
109 (mime-charset-to-coding-system "ISO-2022-JP")))
111 (provide 'sb-mhonarc)
113 ;;; sb-mhonarc.el ends here