1;;; sb-airs.el --- shimbun backend for lists.airs.net
2
3;; Copyright (C) 2001-2003, 2005, 2007, 2019
4;; Yuuichi Teranishi <teranisi@gohome.org>
5
6;; Author: Yuuichi Teranishi  <teranisi@gohome.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;;; Commentary:
27
28;; Original was nnshimbun-airs.el on http://homepage2.nifty.com/strlcat/
29
30;;; Code:
31
32(eval-when-compile (require 'cl-lib)) ;; cl-incf
33(require 'shimbun)
34(require 'sb-mhonarc)
35
36(luna-define-class shimbun-airs (shimbun-mhonarc) ())
37
38(defconst shimbun-airs-group-path-alist
39  '(("semi-gnus-ja" "semi-gnus/archive" "semi-gnus-ja@meadowy.org")
40    ("wl" "wl/archive" "wl@lists.airs.net")
41    ("wl-en" "wl-en/archive" "wl-en@lists.airs.net")))
42
43(defvar shimbun-airs-url "http://lists.airs.net/")
44(defvar shimbun-airs-groups (mapcar 'car shimbun-airs-group-path-alist))
45(defvar shimbun-airs-reverse-flag nil)
46(defvar shimbun-airs-litemplate-regexp
47  "<STRONG><a name=\"\\([0-9]+\\)\" href=\"\\(msg[0-9]+.html\\)\">\\([^<]+\\)</a></STRONG> <EM>\\([^<]+\\)</EM>")
48
49(defmacro shimbun-airs-concat-url (shimbun url)
50  `(concat (shimbun-url-internal ,shimbun)
51	   (nth 1 (assoc (shimbun-current-group-internal ,shimbun)
52			 shimbun-airs-group-path-alist))
53	   "/"
54	   ,url))
55
56(luna-define-method shimbun-index-url ((shimbun shimbun-airs))
57  (shimbun-airs-concat-url shimbun "index.html"))
58
59(luna-define-method shimbun-reply-to ((shimbun shimbun-airs))
60  (nth 2 (assoc (shimbun-current-group-internal shimbun)
61		shimbun-airs-group-path-alist)))
62
63(luna-define-method shimbun-get-headers ((shimbun shimbun-airs)
64					 &optional range)
65  (let ((case-fold-search t)
66	(pages (shimbun-header-index-pages range))
67	(count 0)
68	headers months month url)
69    (goto-char (point-min))
70    (catch 'stop
71      (while (and (if pages (<= (cl-incf count) pages) t)
72		  (re-search-forward
73		   "<A HREF=\"\\([12][0-9][0-9][0-9][01][0-9]\\)/\">"
74		   nil t))
75	(push (match-string 1) months))
76      (setq months (nreverse months))
77      (while months
78	(setq month (pop months)
79	      url (shimbun-airs-concat-url shimbun (concat month "/")))
80	(erase-buffer)
81	(shimbun-retrieve-url url t)
82	(shimbun-mhonarc-get-headers shimbun url headers month)))
83    headers))
84
85(provide 'sb-airs)
86
87;;; sb-airs.el ends here
88