annotate lisp/gnus/nnultimate.el @ 45483:81cb13e7ce4f

*** empty log message ***
author Kim F. Storm <storm@cua.dk>
date Thu, 23 May 2002 10:20:12 +0000
parents 93f6c74a2f60
children 695cf19ef79e d7ddb3e565de
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
33374
1666541ea9be Add coding tag.
Dave Love <fx@gnu.org>
parents: 31717
diff changeset
1 ;;; nnultimate.el --- interfacing with the Ultimate Bulletin Board system -*- coding: iso-latin-1 -*-
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
2 ;; Copyright (C) 1999, 2000 Free Software Foundation, Inc.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
3
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
5 ;; Keywords: news
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
6
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
8
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
11 ;; the Free Software Foundation; either version 2, or (at your option)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
12 ;; any later version.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
13
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
17 ;; GNU General Public License for more details.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
18
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
22 ;; Boston, MA 02111-1307, USA.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
23
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
24 ;;; Commentary:
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
25
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
26 ;; Note: You need to have `url' and `w3' installed for this
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
27 ;; backend to work.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
28
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
29 ;;; Code:
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
30
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
31 (eval-when-compile (require 'cl))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
32
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
33 (require 'nnoo)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
34 (require 'message)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
35 (require 'gnus-util)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
36 (require 'gnus)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
37 (require 'nnmail)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
38 (require 'mm-util)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
39 (eval-when-compile
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
40 (ignore-errors
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
41 (require 'nnweb)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
42 ;; Report failure to find w3 at load time if appropriate.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
43 (eval '(require 'nnweb))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
44
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
45 (nnoo-declare nnultimate)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
46
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
47 (defvoo nnultimate-directory (nnheader-concat gnus-directory "ultimate/")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
48 "Where nnultimate will save its files.")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
49
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
50 (defvoo nnultimate-address ""
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
51 "The address of the Ultimate bulletin board.")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
52
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
53 ;;; Internal variables
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
54
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
55 (defvar nnultimate-groups-alist nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
56 (defvoo nnultimate-groups nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
57 (defvoo nnultimate-headers nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
58 (defvoo nnultimate-articles nil)
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
59 (defvar nnultimate-table-regexp
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
60 "postings.*editpost\\|forumdisplay\\|Forum[0-9]+/HTML\\|getbio")
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
61
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
62 ;;; Interface functions
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
63
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
64 (nnoo-define-basics nnultimate)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
65
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
66 (deffoo nnultimate-retrieve-headers (articles &optional group server fetch-old)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
67 (nnultimate-possibly-change-server group server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
68 (unless gnus-nov-is-evil
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
69 (let* ((last (car (last articles)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
70 (did nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
71 (start 1)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
72 (entry (assoc group nnultimate-groups))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
73 (sid (nth 2 entry))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
74 (topics (nth 4 entry))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
75 (mapping (nth 5 entry))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
76 (old-total (or (nth 6 entry) 1))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
77 (furl "forumdisplay.cgi?action=topics&number=%d&DaysPrune=1000")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
78 (furls (list (concat nnultimate-address (format furl sid))))
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
79 (nnultimate-table-regexp
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
80 "postings.*editpost\\|forumdisplay\\|getbio")
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
81 headers article subject score from date lines parent point
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
82 contents tinfo fetchers map elem a href garticles topic old-max
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
83 inc datel table current-page total-contents pages
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
84 farticles forum-contents parse furl-fetched mmap farticle)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
85 (setq map mapping)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
86 (while (and (setq article (car articles))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
87 map)
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
88 ;; Skip past the articles in the map until we reach the
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
89 ;; article we're looking for.
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
90 (while (and map
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
91 (or (> article (caar map))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
92 (< (cadar map) (caar map))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
93 (pop map))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
94 (when (setq mmap (car map))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
95 (setq farticle -1)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
96 (while (and article
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
97 (<= article (nth 1 mmap)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
98 ;; Do we already have a fetcher for this topic?
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
99 (if (setq elem (assq (nth 2 mmap) fetchers))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
100 ;; Yes, so we just add the spec to the end.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
101 (nconc elem (list (cons article
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
102 (+ (nth 3 mmap) (incf farticle)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
103 ;; No, so we add a new one.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
104 (push (list (nth 2 mmap)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
105 (cons article
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
106 (+ (nth 3 mmap) (incf farticle))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
107 fetchers))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
108 (pop articles)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
109 (setq article (car articles)))))
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
110 ;; Now we have the mapping from/to Gnus/nnultimate article numbers,
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
111 ;; so we start fetching the topics that we need to satisfy the
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
112 ;; request.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
113 (if (not fetchers)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
114 (save-excursion
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
115 (set-buffer nntp-server-buffer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
116 (erase-buffer))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
117 (setq nnultimate-articles nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
118 (mm-with-unibyte-buffer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
119 (dolist (elem fetchers)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
120 (setq pages 1
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
121 current-page 1
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
122 total-contents nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
123 (while (<= current-page pages)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
124 (erase-buffer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
125 (setq subject (nth 2 (assq (car elem) topics)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
126 (setq href (nth 3 (assq (car elem) topics)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
127 (if (= current-page 1)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
128 (nnweb-insert href)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
129 (string-match "\\.html$" href)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
130 (nnweb-insert (concat (substring href 0 (match-beginning 0))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
131 "-" (number-to-string current-page)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
132 (match-string 0 href))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
133 (goto-char (point-min))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
134 (setq contents
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
135 (ignore-errors (w3-parse-buffer (current-buffer))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
136 (setq table (nnultimate-find-forum-table contents))
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
137 (goto-char (point-min))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
138 (when (re-search-forward "topic is \\([0-9]+\\) pages" nil t)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
139 (setq pages (string-to-number (match-string 1))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
140 (setq contents (cdr (nth 2 (car (nth 2 table)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
141 (setq total-contents (nconc total-contents contents))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
142 (incf current-page))
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
143 (when t
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
144 (let ((i 0))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
145 (dolist (co total-contents)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
146 (push (list (or (nnultimate-topic-article-to-article
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
147 group (car elem) (incf i))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
148 1)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
149 co subject)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
150 nnultimate-articles))))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
151 (when nil
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
152 (dolist (art (cdr elem))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
153 (when (nth (1- (cdr art)) total-contents)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
154 (push (list (car art)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
155 (nth (1- (cdr art)) total-contents)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
156 subject)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
157 nnultimate-articles))))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
158 (setq nnultimate-articles
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
159 (sort nnultimate-articles 'car-less-than-car))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
160 ;; Now we have all the articles, conveniently in an alist
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
161 ;; where the key is the Gnus article number.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
162 (dolist (articlef nnultimate-articles)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
163 (setq article (nth 0 articlef)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
164 contents (nth 1 articlef)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
165 subject (nth 2 articlef))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
166 (setq from (mapconcat 'identity
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
167 (nnweb-text (car (nth 2 contents)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
168 " ")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
169 datel (nnweb-text (nth 2 (car (cdr (nth 2 contents))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
170 (while datel
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
171 (when (string-match "Posted" (car datel))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
172 (setq date (substring (car datel) (match-end 0))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
173 datel nil))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
174 (pop datel))
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
175 (when date
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
176 (setq date (delete "" (split-string
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
177 date "[-, \n\t\r    ]")))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
178 (if (or (member "AM" date)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
179 (member "PM" date))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
180 (setq date (format
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
181 "%s %s %s %s"
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
182 (nth 1 date)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
183 (if (and (>= (length (nth 0 date)) 3)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
184 (assoc (downcase
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
185 (substring (nth 0 date) 0 3))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
186 parse-time-months))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
187 (substring (nth 0 date) 0 3)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
188 (car (rassq (string-to-number (nth 0 date))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
189 parse-time-months)))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
190 (nth 2 date) (nth 3 date)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
191 (setq date (format "%s %s %s %s"
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
192 (car (rassq (string-to-number (nth 1 date))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
193 parse-time-months))
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
194 (nth 0 date) (nth 2 date) (nth 3 date)))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
195 (push
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
196 (cons
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
197 article
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
198 (make-full-mail-header
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
199 article subject
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
200 from (or date "")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
201 (concat "<" (number-to-string sid) "%"
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
202 (number-to-string article)
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
203 "@ultimate." server ">")
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
204 "" 0
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
205 (/ (length (mapconcat
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
206 'identity
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
207 (nnweb-text
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
208 (cdr (nth 2 (nth 1 (nth 2 contents)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
209 ""))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
210 70)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
211 nil nil))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
212 headers))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
213 (setq nnultimate-headers (sort headers 'car-less-than-car))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
214 (save-excursion
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
215 (set-buffer nntp-server-buffer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
216 (mm-with-unibyte-current-buffer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
217 (erase-buffer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
218 (dolist (header nnultimate-headers)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
219 (nnheader-insert-nov (cdr header))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
220 'nov)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
221
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
222 (defun nnultimate-topic-article-to-article (group topic article)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
223 (catch 'found
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
224 (dolist (elem (nth 5 (assoc group nnultimate-groups)))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
225 (when (and (= topic (nth 2 elem))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
226 (>= article (nth 3 elem))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
227 (< article (+ (- (nth 1 elem) (nth 0 elem)) 1
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
228 (nth 3 elem))))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
229 (throw 'found
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
230 (+ (nth 0 elem) (- article (nth 3 elem))))))))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
231
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
232 (deffoo nnultimate-request-group (group &optional server dont-check)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
233 (nnultimate-possibly-change-server nil server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
234 (when (not nnultimate-groups)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
235 (nnultimate-request-list))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
236 (unless dont-check
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
237 (nnultimate-create-mapping group))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
238 (let ((elem (assoc group nnultimate-groups)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
239 (cond
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
240 ((not elem)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
241 (nnheader-report 'nnultimate "Group does not exist"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
242 (t
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
243 (nnheader-report 'nnultimate "Opened group %s" group)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
244 (nnheader-insert
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
245 "211 %d %d %d %s\n" (cadr elem) 1 (cadr elem)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
246 (prin1-to-string group))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
247
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
248 (deffoo nnultimate-request-close ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
249 (setq nnultimate-groups-alist nil
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
250 nnultimate-groups nil))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
251
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
252 (deffoo nnultimate-request-article (article &optional group server buffer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
253 (nnultimate-possibly-change-server group server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
254 (let ((contents (cdr (assq article nnultimate-articles))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
255 (setq contents (cddr (nth 2 (nth 1 (nth 2 (car contents))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
256 (when contents
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
257 (save-excursion
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
258 (set-buffer (or buffer nntp-server-buffer))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
259 (erase-buffer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
260 (nnweb-insert-html (cons 'p (cons nil (list contents))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
261 (goto-char (point-min))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
262 (insert "Content-Type: text/html\nMIME-Version: 1.0\n")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
263 (let ((header (cdr (assq article nnultimate-headers))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
264 (mm-with-unibyte-current-buffer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
265 (nnheader-insert-header header)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
266 (nnheader-report 'nnultimate "Fetched article %s" article)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
267 (cons group article)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
268
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
269 (deffoo nnultimate-request-list (&optional server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
270 (nnultimate-possibly-change-server nil server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
271 (mm-with-unibyte-buffer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
272 (nnweb-insert
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
273 (if (string-match "/$" nnultimate-address)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
274 (concat nnultimate-address "Ultimate.cgi")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
275 nnultimate-address))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
276 (let ((contents (nth 2 (car (nth 2
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
277 (nnultimate-find-forum-table
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
278 (w3-parse-buffer (current-buffer)))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
279 sid elem description articles a href group forum
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
280 a1 a2)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
281 (dolist (row contents)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
282 (setq row (nth 2 row))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
283 (when (setq a (nnweb-parse-find 'a row))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
284 (setq group (car (last (nnweb-text a)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
285 href (cdr (assq 'href (nth 1 a))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
286 (setq description (car (last (nnweb-text (nth 1 row)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
287 (setq a1 (car (last (nnweb-text (nth 2 row)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
288 (setq a2 (car (last (nnweb-text (nth 3 row)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
289 (when (string-match "^[0-9]+$" a1)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
290 (setq articles (string-to-number a1)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
291 (when (and a2 (string-match "^[0-9]+$" a2))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
292 (setq articles (max articles (string-to-number a2))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
293 (when href
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
294 (string-match "number=\\([0-9]+\\)" href)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
295 (setq forum (string-to-number (match-string 1 href)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
296 (if (setq elem (assoc group nnultimate-groups))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
297 (setcar (cdr elem) articles)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
298 (push (list group articles forum description nil nil nil nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
299 nnultimate-groups))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
300 (nnultimate-write-groups)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
301 (nnultimate-generate-active)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
302 t))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
303
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
304 (deffoo nnultimate-request-newgroups (date &optional server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
305 (nnultimate-possibly-change-server nil server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
306 (nnultimate-generate-active)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
307 t)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
308
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
309 (nnoo-define-skeleton nnultimate)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
310
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
311 ;;; Internal functions
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
312
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
313 (defun nnultimate-prune-days (group time)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
314 "Compute the number of days to fetch info for."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
315 (let ((old-time (nth 7 (assoc group nnultimate-groups))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
316 (if (null old-time)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
317 1000
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
318 (- (time-to-days time) (time-to-days old-time)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
319
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
320 (defun nnultimate-create-mapping (group)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
321 (let* ((entry (assoc group nnultimate-groups))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
322 (sid (nth 2 entry))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
323 (topics (nth 4 entry))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
324 (mapping (nth 5 entry))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
325 (old-total (or (nth 6 entry) 1))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
326 (current-time (current-time))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
327 (furl
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
328 (concat "forumdisplay.cgi?action=topics&number=%d&DaysPrune="
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
329 (number-to-string
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
330 (nnultimate-prune-days group current-time))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
331 (furls (list (concat nnultimate-address (format furl sid))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
332 contents forum-contents furl-fetched a subject href
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
333 garticles topic tinfo old-max inc parse)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
334 (mm-with-unibyte-buffer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
335 (while furls
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
336 (erase-buffer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
337 (nnweb-insert (pop furls))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
338 (goto-char (point-min))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
339 (setq parse (w3-parse-buffer (current-buffer)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
340 (setq contents
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
341 (cdr (nth 2 (car (nth 2 (nnultimate-find-forum-table
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
342 parse))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
343 (setq forum-contents (nconc contents forum-contents))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
344 (unless furl-fetched
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
345 (setq furl-fetched t)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
346 ;; On the first time through this loop, we find all the
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
347 ;; forum URLs.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
348 (dolist (a (nnweb-parse-find-all 'a parse))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
349 (let ((href (cdr (assq 'href (nth 1 a)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
350 (when (and href
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
351 (string-match "forumdisplay.*startpoint" href))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
352 (push href furls))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
353 (setq furls (nreverse furls))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
354 ;; The main idea here is to map Gnus article numbers to
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
355 ;; nnultimate article numbers. Say there are three topics in
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
356 ;; this forum, the first with 4 articles, the seconds with 2,
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
357 ;; and the third with 1. Then this will translate into 7 Gnus
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
358 ;; article numbers, where 1-4 comes from the first topic, 5-6
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
359 ;; from the second and 7 from the third. Now, then next time
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
360 ;; the group is entered, there's 2 new articles in topic one
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
361 ;; and 1 in topic three. Then Gnus article number 8-9 be 5-6
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
362 ;; in topic one and 10 will be the 2 in topic three.
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
363 (dolist (row (nreverse forum-contents))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
364 (setq row (nth 2 row))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
365 (when (setq a (nnweb-parse-find 'a row))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
366 (setq subject (car (last (nnweb-text a)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
367 href (cdr (assq 'href (nth 1 a))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
368 (let ((artlist (nreverse (nnweb-text row)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
369 art)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
370 (while (and (not art)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
371 artlist)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
372 (when (string-match "^[0-9]+$" (car artlist))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
373 (setq art (1+ (string-to-number (car artlist)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
374 (pop artlist))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
375 (setq garticles art))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
376 (when garticles
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
377 (string-match "/\\([0-9]+\\).html" href)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
378 (setq topic (string-to-number (match-string 1 href)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
379 (if (setq tinfo (assq topic topics))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
380 (progn
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
381 (setq old-max (cadr tinfo))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
382 (setcar (cdr tinfo) garticles))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
383 (setq old-max 0)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
384 (push (list topic garticles subject href) topics)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
385 (setcar (nthcdr 4 entry) topics))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
386 (when (not (= old-max garticles))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
387 (setq inc (- garticles old-max))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
388 (setq mapping (nconc mapping
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
389 (list
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
390 (list
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
391 old-total (1- (incf old-total inc))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
392 topic (1+ old-max)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
393 (incf old-max inc)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
394 (setcar (nthcdr 5 entry) mapping)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
395 (setcar (nthcdr 6 entry) old-total))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
396 (setcar (nthcdr 7 entry) current-time)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
397 (setcar (nthcdr 1 entry) (1- old-total))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
398 (nnultimate-write-groups)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
399 mapping))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
400
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
401 (defun nnultimate-possibly-change-server (&optional group server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
402 (nnultimate-init server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
403 (when (and server
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
404 (not (nnultimate-server-opened server)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
405 (nnultimate-open-server server))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
406 (unless nnultimate-groups-alist
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
407 (nnultimate-read-groups)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
408 (setq nnultimate-groups (cdr (assoc nnultimate-address
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
409 nnultimate-groups-alist)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
410
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
411 (deffoo nnultimate-open-server (server &optional defs connectionless)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
412 (nnheader-init-server-buffer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
413 (if (nnultimate-server-opened server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
414 t
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
415 (unless (assq 'nnultimate-address defs)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
416 (setq defs (append defs (list (list 'nnultimate-address server)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
417 (nnoo-change-server 'nnultimate server defs)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
418
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
419 (defun nnultimate-read-groups ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
420 (setq nnultimate-groups-alist nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
421 (let ((file (expand-file-name "groups" nnultimate-directory)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
422 (when (file-exists-p file)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
423 (mm-with-unibyte-buffer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
424 (insert-file-contents file)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
425 (goto-char (point-min))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
426 (setq nnultimate-groups-alist (read (current-buffer)))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
427
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
428 (defun nnultimate-write-groups ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
429 (setq nnultimate-groups-alist
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
430 (delq (assoc nnultimate-address nnultimate-groups-alist)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
431 nnultimate-groups-alist))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
432 (push (cons nnultimate-address nnultimate-groups)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
433 nnultimate-groups-alist)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
434 (with-temp-file (expand-file-name "groups" nnultimate-directory)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
435 (prin1 nnultimate-groups-alist (current-buffer))))
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
436
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
437 (defun nnultimate-init (server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
438 "Initialize buffers and such."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
439 (unless (file-exists-p nnultimate-directory)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
440 (gnus-make-directory nnultimate-directory)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
441
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
442 (defun nnultimate-generate-active ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
443 (save-excursion
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
444 (set-buffer nntp-server-buffer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
445 (erase-buffer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
446 (dolist (elem nnultimate-groups)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
447 (insert (prin1-to-string (car elem))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
448 " " (number-to-string (cadr elem)) " 1 y\n"))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
449
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
450 (defun nnultimate-find-forum-table (contents)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
451 (catch 'found
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
452 (nnultimate-find-forum-table-1 contents)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
453
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
454 (defun nnultimate-find-forum-table-1 (contents)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
455 (dolist (element contents)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
456 (unless (stringp element)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
457 (when (and (eq (car element) 'table)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
458 (nnultimate-forum-table-p element))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
459 (throw 'found element))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
460 (when (nth 2 element)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
461 (nnultimate-find-forum-table-1 (nth 2 element))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
462
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
463 (defun nnultimate-forum-table-p (parse)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
464 (when (not (apply 'gnus-or
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
465 (mapcar
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
466 (lambda (p)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
467 (nnweb-parse-find 'table p))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
468 (nth 2 parse))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
469 (let ((href (cdr (assq 'href (nth 1 (nnweb-parse-find 'a parse 20)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
470 case-fold-search)
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 33374
diff changeset
471 (when (and href (string-match nnultimate-table-regexp href))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
472 t))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
473
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
474 (provide 'nnultimate)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
475
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
476 ;; Local Variables:
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
477 ;; coding: iso-8859-1
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
478 ;; End:
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
479
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
480 ;;; nnultimate.el ends here