Mercurial > emacs
annotate lisp/gnus/nnlistserv.el @ 33289:834a6b4f08a4
(VCENTER_BASELINE_OFFSET): Fix previous change. If the
font is taller than the frame line, we don't have to vias the
division by two.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Wed, 08 Nov 2000 00:53:11 +0000 |
parents | 9968f55ad26e |
children | c8c683f24c57 |
rev | line source |
---|---|
24358 | 1 ;;; nnlistserv.el --- retrieving articles via web mailing list archives |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24577
diff
changeset
|
2 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24577
diff
changeset
|
3 ;; Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. |
24358 | 4 |
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> | |
6 ;; Keywords: news, mail | |
7 | |
8 ;; This file is part of GNU Emacs. | |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 ;; Boston, MA 02111-1307, USA. | |
24 | |
25 ;;; Commentary: | |
26 | |
27 ;; Note: You need to have `url' and `w3' installed for this | |
28 ;; backend to work. | |
29 | |
30 ;;; Code: | |
31 | |
32 (eval-when-compile (require 'cl)) | |
33 | |
34 (require 'nnoo) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24577
diff
changeset
|
35 (require 'nnweb) |
24358 | 36 |
37 (nnoo-declare nnlistserv | |
38 nnweb) | |
39 | |
40 (defvoo nnlistserv-directory (nnheader-concat gnus-directory "nnlistserv/") | |
41 "Where nnlistserv will save its files." | |
42 nnweb-directory) | |
43 | |
44 (defvoo nnlistserv-name 'kk | |
45 "What search engine type is being used." | |
46 nnweb-type) | |
47 | |
48 (defvoo nnlistserv-type-definition | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24577
diff
changeset
|
49 '((kk |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24577
diff
changeset
|
50 (article . nnlistserv-kk-wash-article) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24577
diff
changeset
|
51 (map . nnlistserv-kk-create-mapping) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24577
diff
changeset
|
52 (search . nnlistserv-kk-search) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24577
diff
changeset
|
53 (address . "http://www.itk.ntnu.no/ansatte/Andresen_Trond/kk-f/%s/") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24577
diff
changeset
|
54 (pages "fra160396" "fra160796" "fra061196" "fra160197" |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24577
diff
changeset
|
55 "fra090997" "fra040797" "fra130397" "nye") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24577
diff
changeset
|
56 (index . "date.html") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24577
diff
changeset
|
57 (identifier . nnlistserv-kk-identity))) |
24358 | 58 "Type-definition alist." |
59 nnweb-type-definition) | |
60 | |
61 (defvoo nnlistserv-search nil | |
62 "Search string to feed to DejaNews." | |
63 nnweb-search) | |
64 | |
65 (defvoo nnlistserv-ephemeral-p nil | |
66 "Whether this nnlistserv server is ephemeral." | |
67 nnweb-ephemeral-p) | |
68 | |
69 ;;; Internal variables | |
70 | |
71 ;;; Interface functions | |
72 | |
73 (nnoo-define-basics nnlistserv) | |
74 | |
75 (nnoo-import nnlistserv | |
76 (nnweb)) | |
77 | |
78 ;;; Internal functions | |
79 | |
80 ;;; | |
81 ;;; KK functions. | |
82 ;;; | |
83 | |
84 (defun nnlistserv-kk-create-mapping () | |
85 "Perform the search and create an number-to-url alist." | |
86 (save-excursion | |
87 (set-buffer nnweb-buffer) | |
88 (let ((case-fold-search t) | |
89 (active (or (cadr (assoc nnweb-group nnweb-group-alist)) | |
90 (cons 1 0))) | |
91 (pages (nnweb-definition 'pages)) | |
92 map url page subject from ) | |
93 (while (setq page (pop pages)) | |
94 (erase-buffer) | |
95 (when (funcall (nnweb-definition 'search) page) | |
96 ;; Go through all the article hits on this page. | |
97 (goto-char (point-min)) | |
98 (nnweb-decode-entities) | |
99 (goto-char (point-min)) | |
100 (while (re-search-forward "^<li> *<a href=\"\\([^\"]+\\)\"><b>\\([^\\>]+\\)</b></a> *<[^>]+><i>\\([^>]+\\)<" nil t) | |
101 (setq url (match-string 1) | |
102 subject (match-string 2) | |
103 from (match-string 3)) | |
104 (setq url (concat (format (nnweb-definition 'address) page) url)) | |
105 (unless (nnweb-get-hashtb url) | |
106 (push | |
107 (list | |
108 (incf (cdr active)) | |
109 (make-full-mail-header | |
110 (cdr active) subject from "" | |
111 (concat "<" (nnweb-identifier url) "@kk>") | |
112 nil 0 0 url)) | |
113 map) | |
114 (nnweb-set-hashtb (cadar map) (car map)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24577
diff
changeset
|
115 (nnheader-message 5 "%s %s %s" (cdr active) (point) pages))))) |
24358 | 116 ;; Return the articles in the right order. |
117 (setq nnweb-articles | |
118 (sort (nconc nnweb-articles map) 'car-less-than-car))))) | |
119 | |
120 (defun nnlistserv-kk-wash-article () | |
121 (let ((case-fold-search t) | |
122 (headers '(sent name email subject id)) | |
123 sent name email subject id) | |
124 (nnweb-decode-entities) | |
125 (while headers | |
126 (goto-char (point-min)) | |
127 (re-search-forward (format "<!-- %s=\"\\([^\"]+\\)" (car headers) nil t)) | |
128 (set (pop headers) (match-string 1))) | |
129 (goto-char (point-min)) | |
130 (search-forward "<!-- body" nil t) | |
131 (delete-region (point-min) (progn (forward-line 1) (point))) | |
132 (goto-char (point-max)) | |
133 (search-backward "<!-- body" nil t) | |
134 (delete-region (point-max) (progn (beginning-of-line) (point))) | |
135 (nnweb-remove-markup) | |
136 (goto-char (point-min)) | |
137 (insert (format "From: %s <%s>\n" name email) | |
138 (format "Subject: %s\n" subject) | |
139 (format "Message-ID: %s\n" id) | |
140 (format "Date: %s\n\n" sent)))) | |
141 | |
142 (defun nnlistserv-kk-search (search) | |
143 (url-insert-file-contents | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24577
diff
changeset
|
144 (concat (format (nnweb-definition 'address) search) |
24358 | 145 (nnweb-definition 'index))) |
146 t) | |
147 | |
148 (defun nnlistserv-kk-identity (url) | |
149 "Return an unique identifier based on URL." | |
150 url) | |
151 | |
152 (provide 'nnlistserv) | |
153 | |
154 ;;; nnlistserv.el ends here |