* sb-airs.el (toplevel): Require 'sb-mhonarc.
[elisp/wanderlust.git] / elmo / sb-cnet.el
1 ;;; sb-cnet.el --- shimbun backend for cnet
2
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>
6
7 ;; Keywords: news
8
9 ;;; Copyright:
10
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)
14 ;; any later version.
15
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.
20
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.
25
26 ;;; Commentary:
27
28 ;; Original code was nnshimbun.el written by
29 ;; TSUCHIYA Masatoshi <tsuchiya@pine.kuee.kyoto-u.ac.jp>.
30
31 ;;; Code:
32
33 (require 'shimbun)
34
35 (luna-define-class shimbun-cnet (shimbun) ())
36
37 (defvar shimbun-cnet-url "http://cnet.sphere.ne.jp/")
38 (defvar shimbun-cnet-groups '("comp"))
39 (defvar shimbun-cnet-coding-system  (static-if (boundp 'MULE)
40                                         '*sjis* 'shift_jis))
41 (defvar shimbun-cnet-from-address  "cnet@sphere.ad.jp")
42 (defvar shimbun-cnet-content-start "\n<!--KIJI-->\n")
43 (defvar shimbun-cnet-content-end "\n<!--/KIJI-->\n")
44
45 (luna-define-method shimbun-index-url ((shimbun shimbun-cnet))
46   (format "%s/News/Oneweek/" (shimbun-url-internal shimbun)))
47
48 (luna-define-method shimbun-get-headers ((shimbun shimbun-cnet))
49   (let ((case-fold-search t) headers)
50     (while (search-forward "\n<!--*****\e$B8+=P$7\e(B*****-->\n" nil t)
51       (let ((subject (buffer-substring (point) (point-at-eol)))
52             (point (point)))
53         (forward-line -2)
54         (when (looking-at "<a href=\"/\\(News/\\([0-9][0-9][0-9][0-9]\\)/Item/\\([0-9][0-9]\\([0-9][0-9]\\)\\([0-9][0-9]\\)-[0-9]+\\).html\\)\">")
55           (let ((url (match-string 1))
56                 (id  (format "<%s%s%%%s>"
57                              (match-string 2)
58                              (match-string 3)
59                              (shimbun-current-group-internal shimbun)))
60                 (date (shimbun-make-date-string
61                        (string-to-number (match-string 2))
62                        (string-to-number (match-string 4))
63                        (string-to-number (match-string 5)))))
64             (push (shimbun-make-header
65                    0
66                    (shimbun-mime-encode-string subject)
67                    (shimbun-from-address-internal shimbun)
68                    date id "" 0 0 (concat (shimbun-url-internal shimbun) url))
69                   headers)))
70         (goto-char point)))
71     headers))
72
73 (provide 'sb-cnet)
74
75 ;;; sb-cnet.el ends here