1;;; sb-orca.el --- shimbun backend for www.orca.med.or.jp ML archive
2
3;; Copyright (C) 2002, 2003, 2005, 2019
4;; Masamichi Goudge M.D. <Matanuki@Goudge.org>
5
6;; Author: Masamichi Goudge M.D. <Matanuki@Goudge.org>
7;; Keywords: news
8
9;; This file is a part of shimbun.
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; see the file COPYING.  If not, write to
23;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24;; Boston, MA 02110-1301, USA.
25
26;;; Code:
27
28(eval-when-compile (require 'cl-lib)) ;; cl-incf
29(require 'shimbun)
30(require 'sb-mhonarc)
31
32(luna-define-class shimbun-orca (shimbun-mhonarc) ())
33
34(defvar shimbun-orca-url "http://ml.orca.med.or.jp/")
35(defvar shimbun-orca-groups '("orca-users" "orca-dev" "orca-tech" "orca-announce"))
36(defvar shimbun-orca-reverse-flag nil)
37(defvar shimbun-orca-litemplate-regexp
38  "<LI>[^<]*<STRONG><A NAME=\"\\([0-9]+\\)\" HREF=\"\\(msg[0-9]+.html\\)\">\
39\\([^<]+\\)</A></STRONG> <EM>\\([^<]+\\)</EM>\n?</LI>")
40
41(luna-define-method shimbun-index-url ((shimbun shimbun-orca))
42  (concat (shimbun-url-internal shimbun)
43	  (shimbun-current-group-internal shimbun) "/index.html"))
44
45(luna-define-method shimbun-reply-to ((shimbun shimbun-orca))
46  (concat (shimbun-current-group-internal shimbun) "@orca"))
47
48(luna-define-method shimbun-get-headers ((shimbun shimbun-orca)
49					 &optional range)
50  (let ((url (shimbun-index-url shimbun))
51	(pages (shimbun-header-index-pages range))
52	(count 0)
53	headers)
54    (catch 'stop
55      (shimbun-mhonarc-get-headers shimbun url headers)
56      (goto-char (point-min))
57      (while (and (if pages (< (cl-incf count) pages) t)
58		  (re-search-forward
59		   "<A HREF=\"\\(mail[0-9]+\\.html\\)\">Prev Page</A>"
60		   nil t))
61	(setq url (shimbun-expand-url (match-string 1) url))
62	(erase-buffer)
63	(shimbun-retrieve-url url)
64	(shimbun-mhonarc-get-headers shimbun url headers)
65	(goto-char (point-min)))
66      headers)))
67
68(provide 'sb-orca)
69
70;;; sb-orca.el ends here
71