annotate lisp/gnus/nnslashdot.el @ 109343:dad8b34145cb

* nxml-mode.texi (Limitations): Remove obsolete discussion (Bug#6708).
author Chong Yidong <cyd@stupidchicken.com>
date Fri, 23 Jul 2010 11:49:03 -0400
parents 1d1d5d9bd884
children 376148b31b5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1 ;;; nnslashdot.el --- interfacing with Slashdot
64754
fafd692d1e40 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64085
diff changeset
2
fafd692d1e40 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64085
diff changeset
3 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
4 ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
5
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
7 ;; Keywords: news
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 ;; This file is part of GNU Emacs.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
10
94662
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
94662
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
13 ;; the Free Software Foundation, either version 3 of the License, or
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
14 ;; (at your option) any later version.
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
15
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
20
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
94662
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
31717
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 ;;; Code:
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
27
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
28 (eval-when-compile (require 'cl))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
29
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
30 (require 'nnoo)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
31 (require 'message)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
32 (require 'gnus-util)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
33 (require 'gnus)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
34 (require 'nnmail)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
35 (require 'mm-util)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
36 (require 'mm-url)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
37
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
38 (nnoo-declare nnslashdot)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
39
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
40 (defvoo nnslashdot-directory (nnheader-concat gnus-directory "slashdot/")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
41 "Where nnslashdot will save its files.")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
42
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
43 (defvoo nnslashdot-active-url "http://slashdot.org/search.pl?section=&min=%d"
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
44 "Where nnslashdot will fetch the active file from.")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
45
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
46 (defvoo nnslashdot-comments-url "http://slashdot.org/comments.pl?sid=%s&threshold=%d&commentsort=%d&mode=flat&startat=%d"
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
47 "Where nnslashdot will fetch comments from.")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
48
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
49 (defvoo nnslashdot-article-url
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
50 "http://slashdot.org/article.pl?sid=%s&mode=nocomment"
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
51 "Where nnslashdot will fetch the article from.")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
52
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
53 (defvoo nnslashdot-backslash-url "http://slashdot.org/slashdot.xml"
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
54 "Where nnslashdot will fetch the stories from.")
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
55
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
56 (defvoo nnslashdot-use-front-page nil
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
57 "Use the front page in addition to the backslash page.")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
58
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
59 (defvoo nnslashdot-threshold -1
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
60 "The article threshold.")
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 (defvoo nnslashdot-threaded t
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
63 "Whether the nnslashdot groups should be threaded or not.")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
64
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
65 (defvoo nnslashdot-group-number 0
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
66 "The number of non-fresh groups to keep updated.")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
67
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
68 (defvoo nnslashdot-login-name ""
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
69 "The login name to use when posting.")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
70
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
71 (defvoo nnslashdot-password ""
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
72 "The password to use when posting.")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
73
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
74 ;;; Internal variables
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
75
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
76 (defvar nnslashdot-groups nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
77 (defvar nnslashdot-buffer nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
78 (defvar nnslashdot-headers nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
79
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
80 ;;; Interface functions
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
81
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
82 (nnoo-define-basics nnslashdot)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
83
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
84 (deffoo nnslashdot-retrieve-headers (articles &optional group server fetch-old)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
85 (nnslashdot-possibly-change-server group server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
86 (condition-case why
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
87 (unless gnus-nov-is-evil
66454
9082bf778ad8 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-621
Miles Bader <miles@gnu.org>
parents: 64754
diff changeset
88 (nnslashdot-retrieve-headers-1 articles group))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
89 (search-failed (nnslashdot-lose why))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
90
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
91 (deffoo nnslashdot-retrieve-headers-1 (articles group)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
92 (let* ((last (car (last articles)))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
93 (start (if nnslashdot-threaded 1 (pop articles)))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
94 (entry (assoc group nnslashdot-groups))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
95 (sid (nth 2 entry))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
96 (first-comments t)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 40542
diff changeset
97 headers article subject score from date lines parent point cid
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
98 s startats changed)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
99 (save-excursion
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
100 (set-buffer nnslashdot-buffer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
101 (let ((case-fold-search t))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
102 (erase-buffer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
103 (when (= start 1)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
104 (mm-url-insert (format nnslashdot-article-url sid) t)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
105 (goto-char (point-min))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
106 (if (eobp)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
107 (error "Couldn't open connection to slashdot"))
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
108 (re-search-forward "Posted by[ \t\r\n]+")
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
109 (when (looking-at "\\(<a[^>]+>\\)?[ \t\r\n]*\\([^<\r\n]+\\)")
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
110 (setq from (mm-url-decode-entities-string (match-string 2))))
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
111 (search-forward "on ")
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
112 (setq date (nnslashdot-date-to-date
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
113 (buffer-substring (point) (1- (search-forward "<")))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
114 (setq lines (/ (- (point)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
115 (progn (forward-line 1) (point)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
116 60))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
117 (push
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
118 (cons
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
119 1
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
120 (make-full-mail-header
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
121 1 group from date
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
122 (concat "<" sid "%1@slashdot>")
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
123 "" 0 lines nil nil))
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
124 headers)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
125 (setq start (if nnslashdot-threaded 2 (pop articles))))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
126 (while (and start (<= start last))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
127 (setq point (goto-char (point-max)))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
128 (mm-url-insert
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
129 (format nnslashdot-comments-url sid
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
130 nnslashdot-threshold 0 (- start 2))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
131 t)
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
132 (when (and nnslashdot-threaded first-comments)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
133 (setq first-comments nil)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
134 (goto-char (point-max))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
135 (while (re-search-backward "startat=\\([0-9]+\\)" nil t)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
136 (setq s (string-to-number (match-string 1)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
137 (unless (memq s startats)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
138 (push s startats)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
139 (setq startats (sort startats '<)))
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
140 (setq article (if (and article (< start article)) article start))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
141 (goto-char point)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
142 (while (re-search-forward
74090
e30f926d61f4 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 73007
diff changeset
143 "<a name=\"\\([0-9]+\\)\">\\([^<]+\\)\\(?:.*\n\\)\\{2,10\\}.*score:\\([^)]+\\))"
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
144 nil t)
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
145 (setq cid (match-string 1)
66454
9082bf778ad8 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-621
Miles Bader <miles@gnu.org>
parents: 64754
diff changeset
146 subject (match-string 2)
9082bf778ad8 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-621
Miles Bader <miles@gnu.org>
parents: 64754
diff changeset
147 score (match-string 3))
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
148 (unless (assq article (nth 4 entry))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
149 (setcar (nthcdr 4 entry) (cons (cons article cid) (nth 4 entry)))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
150 (setq changed t))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
151 (when (string-match "^Re: *" subject)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
152 (setq subject (concat "Re: " (substring subject (match-end 0)))))
66454
9082bf778ad8 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-621
Miles Bader <miles@gnu.org>
parents: 64754
diff changeset
153 (setq subject (mm-url-decode-entities-string subject)
9082bf778ad8 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-621
Miles Bader <miles@gnu.org>
parents: 64754
diff changeset
154 from "")
9082bf778ad8 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-621
Miles Bader <miles@gnu.org>
parents: 64754
diff changeset
155 (when (re-search-forward "by[ \t\n]+<[^>]+>\\([^<(]+\\)" nil t)
9082bf778ad8 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-621
Miles Bader <miles@gnu.org>
parents: 64754
diff changeset
156 (setq from
9082bf778ad8 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-621
Miles Bader <miles@gnu.org>
parents: 64754
diff changeset
157 (concat
9082bf778ad8 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-621
Miles Bader <miles@gnu.org>
parents: 64754
diff changeset
158 (mm-url-decode-entities-string (match-string 1))
9082bf778ad8 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-621
Miles Bader <miles@gnu.org>
parents: 64754
diff changeset
159 " <nobody@slashdot.org>")))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
160 (search-forward "on ")
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
161 (setq date
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
162 (nnslashdot-date-to-date
66454
9082bf778ad8 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-621
Miles Bader <miles@gnu.org>
parents: 64754
diff changeset
163 (buffer-substring
9082bf778ad8 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-621
Miles Bader <miles@gnu.org>
parents: 64754
diff changeset
164 (point) (progn (skip-chars-forward "^()<>\n\r") (point)))))
9082bf778ad8 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-621
Miles Bader <miles@gnu.org>
parents: 64754
diff changeset
165 (setq lines (/ (abs (- (search-forward "<div")
9082bf778ad8 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-621
Miles Bader <miles@gnu.org>
parents: 64754
diff changeset
166 (search-forward "</div>")))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
167 70))
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
168 (if (not
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
169 (re-search-forward ".*cid=\\([0-9]+\\)\">Parent</A>" nil t))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
170 (setq parent nil)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
171 (setq parent (match-string 1))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
172 (when (string= parent "0")
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
173 (setq parent nil)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
174 (push
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
175 (cons
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
176 article
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
177 (make-full-mail-header
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
178 article
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
179 (concat subject " (" score ")")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
180 from date
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
181 (concat "<" sid "%" cid "@slashdot>")
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
182 (if parent
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
183 (concat "<" sid "%" parent "@slashdot>")
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
184 "")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
185 0 lines nil nil))
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
186 headers)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
187 (while (and articles (<= (car articles) article))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
188 (pop articles))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
189 (setq article (1+ article)))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 40542
diff changeset
190 (if nnslashdot-threaded
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
191 (progn
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
192 (setq start (pop startats))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
193 (if start (setq start (+ start 2))))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
194 (setq start (pop articles))))))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
195 (if changed (nnslashdot-write-groups))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
196 (setq nnslashdot-headers (sort headers 'car-less-than-car))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
197 (save-excursion
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
198 (set-buffer nntp-server-buffer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
199 (erase-buffer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
200 (mm-with-unibyte-current-buffer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
201 (dolist (header nnslashdot-headers)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
202 (nnheader-insert-nov (cdr header)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
203 'nov))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
204
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
205 (deffoo nnslashdot-request-group (group &optional server dont-check)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
206 (nnslashdot-possibly-change-server nil server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
207 (let ((elem (assoc group nnslashdot-groups)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
208 (cond
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
209 ((not elem)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
210 (nnheader-report 'nnslashdot "Group does not exist"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
211 (t
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
212 (nnheader-report 'nnslashdot "Opened group %s" group)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
213 (nnheader-insert
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
214 "211 %d %d %d %s\n" (cadr elem) 1 (cadr elem)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
215 (prin1-to-string group))))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
216
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
217 (deffoo nnslashdot-close-group (group &optional server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
218 (nnslashdot-possibly-change-server group server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
219 (when (gnus-buffer-live-p nnslashdot-buffer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
220 (save-excursion
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
221 (set-buffer nnslashdot-buffer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
222 (kill-buffer nnslashdot-buffer)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
223 t)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
224
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
225 (deffoo nnslashdot-request-article (article &optional group server buffer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
226 (nnslashdot-possibly-change-server group server)
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
227 (let (contents cid)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
228 (condition-case why
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
229 (save-excursion
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
230 (set-buffer nnslashdot-buffer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
231 (let ((case-fold-search t))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
232 (goto-char (point-min))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
233 (when (and (stringp article)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
234 (string-match "%\\([0-9]+\\)@" article))
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
235 (setq cid (match-string 1 article))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
236 (let ((map (nth 4 (assoc group nnslashdot-groups))))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
237 (while map
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
238 (if (equal (cdar map) cid)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
239 (setq article (caar map)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
240 map nil)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
241 (setq map (cdr map))))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
242 (when (numberp article)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
243 (if (= article 1)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
244 (progn
66454
9082bf778ad8 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-621
Miles Bader <miles@gnu.org>
parents: 64754
diff changeset
245 (search-forward "Posted by")
9082bf778ad8 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-621
Miles Bader <miles@gnu.org>
parents: 64754
diff changeset
246 (search-forward "<div class=\"intro\">")
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
247 (setq contents
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
248 (buffer-substring
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
249 (point)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
250 (progn
66454
9082bf778ad8 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-621
Miles Bader <miles@gnu.org>
parents: 64754
diff changeset
251 (search-forward "commentwrap")
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
252 (match-beginning 0)))))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 40542
diff changeset
253 (setq cid (cdr (assq article
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
254 (nth 4 (assoc group nnslashdot-groups)))))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
255 (search-forward (format "<a name=\"%s\">" cid))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
256 (setq contents
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
257 (buffer-substring
66454
9082bf778ad8 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-621
Miles Bader <miles@gnu.org>
parents: 64754
diff changeset
258 (search-forward "<div class=\"commentBody\">")
73007
637b0854d9b5 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 69944
diff changeset
259 (progn
75555
d276dce1561f Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
260 (search-forward "<div class=\"commentSub\"")
73007
637b0854d9b5 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 69944
diff changeset
261 (match-beginning 0))))))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
262 (search-failed (nnslashdot-lose why)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
263
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
264 (when contents
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
265 (save-excursion
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
266 (set-buffer (or buffer nntp-server-buffer))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
267 (erase-buffer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
268 (mm-with-unibyte-current-buffer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
269 (insert contents)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
270 (goto-char (point-min))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
271 (while (re-search-forward "\\(<br>\r?\\)+" nil t)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
272 (replace-match "<p>" t t))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
273 (goto-char (point-min))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
274 (insert "Content-Type: text/html\nMIME-Version: 1.0\n")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
275 (insert "Newsgroups: " (caddr (assoc group nnslashdot-groups))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
276 "\n")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
277 (let ((header (cdr (assq article nnslashdot-headers))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
278 (nnheader-insert-header header))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
279 (nnheader-report 'nnslashdot "Fetched article %s" article))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
280 (cons group article)))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
281
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
282 (deffoo nnslashdot-close-server (&optional server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
283 (when (and (nnslashdot-server-opened server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
284 (gnus-buffer-live-p nnslashdot-buffer))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
285 (save-excursion
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
286 (set-buffer nnslashdot-buffer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
287 (kill-buffer nnslashdot-buffer)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
288 (nnoo-close-server 'nnslashdot server))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
289
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
290 (deffoo nnslashdot-request-list (&optional server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
291 (nnslashdot-possibly-change-server nil server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
292 (let ((number 0)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
293 (first nnslashdot-use-front-page)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
294 sid elem description articles gname)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
295 (condition-case why
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
296 ;; First we do the Ultramode to get info on all the latest groups.
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
297 (progn
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
298 (mm-with-unibyte-buffer
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
299 (mm-url-insert nnslashdot-backslash-url t)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
300 (goto-char (point-min))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
301 (if (eobp)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
302 (error "Couldn't open connection to slashdot"))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
303 (while (search-forward "<story>" nil t)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
304 (narrow-to-region (point) (search-forward "</story>"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
305 (goto-char (point-min))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
306 (re-search-forward "<title>\\([^<]+\\)</title>")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
307 (setq description
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
308 (mm-url-decode-entities-string (match-string 1)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
309 (re-search-forward "<url>\\([^<]+\\)</url>")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
310 (setq sid (match-string 1))
35453
26726eff41ca 2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 31717
diff changeset
311 (string-match "sid=\\([0-9/]+\\)\\(.shtml\\|$\\)" sid)
26726eff41ca 2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 31717
diff changeset
312 (setq sid (match-string 1 sid))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
313 (re-search-forward "<comments>\\([^<]+\\)</comments>")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
314 (setq articles (string-to-number (match-string 1)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
315 (setq gname (concat description " (" sid ")"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
316 (if (setq elem (assoc gname nnslashdot-groups))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
317 (setcar (cdr elem) articles)
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
318 (push (list gname articles sid (current-time) nil)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
319 nnslashdot-groups))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
320 (goto-char (point-max))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
321 (widen)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
322 ;; Then do the older groups.
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
323 (while (or first
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
324 (> (- nnslashdot-group-number number) 0))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
325 (setq first nil)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
326 (mm-with-unibyte-buffer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
327 (let ((case-fold-search t))
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
328 (mm-url-insert (format nnslashdot-active-url number) t)
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
329 (goto-char (point-min))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
330 (while (re-search-forward
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
331 "article.pl\\?sid=\\([^&]+\\).*>\\([^<]+\\)</a>"
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
332 nil t)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
333 (setq sid (match-string 1)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
334 description
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
335 (mm-url-decode-entities-string (match-string 2)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
336 (forward-line 1)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
337 (when (re-search-forward "with \\([0-9]+\\) comment" nil t)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
338 (setq articles (1+ (string-to-number (match-string 1)))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
339 (setq gname (concat description " (" sid ")"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
340 (if (setq elem (assoc gname nnslashdot-groups))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
341 (setcar (cdr elem) articles)
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
342 (push (list gname articles sid (current-time) nil)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
343 nnslashdot-groups)))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
344 (incf number 30)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
345 (search-failed (nnslashdot-lose why)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
346 (nnslashdot-write-groups)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
347 (nnslashdot-generate-active)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
348 t))
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
349
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
350 (deffoo nnslashdot-request-newgroups (date &optional server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
351 (nnslashdot-possibly-change-server nil server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
352 (nnslashdot-generate-active)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
353 t)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
354
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
355 (deffoo nnslashdot-request-post (&optional server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
356 (nnslashdot-possibly-change-server nil server)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
357 (let ((sid (message-fetch-field "newsgroups"))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
358 (subject (message-fetch-field "subject"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
359 (references (car (last (split-string
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
360 (message-fetch-field "references")))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
361 body quoted pid)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
362 (string-match "%\\([0-9]+\\)@slashdot" references)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
363 (setq pid (match-string 1 references))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
364 (message-goto-body)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
365 (narrow-to-region (point) (progn (message-goto-signature) (point)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
366 (goto-char (point-min))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
367 (while (not (eobp))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
368 (if (looking-at "> ")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
369 (progn
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
370 (delete-region (point) (+ (point) 2))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
371 (unless quoted
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
372 (insert "<blockquote>\n"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
373 (setq quoted t))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
374 (when quoted
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
375 (insert "</blockquote>\n")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
376 (setq quoted nil)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
377 (forward-line 1))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
378 (goto-char (point-min))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
379 (while (re-search-forward "^ *\n" nil t)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
380 (replace-match "<p>\n"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
381 (widen)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
382 (when (message-goto-signature)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
383 (forward-line -1)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
384 (insert "<p>\n")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
385 (while (not (eobp))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
386 (end-of-line)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
387 (insert "<br>")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
388 (forward-line 1)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
389 (message-goto-body)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
390 (setq body (buffer-substring (point) (point-max)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
391 (erase-buffer)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
392 (mm-url-fetch-form
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
393 "http://slashdot.org/comments.pl"
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
394 `(("sid" . ,sid)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
395 ("pid" . ,pid)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
396 ("rlogin" . "userlogin")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
397 ("unickname" . ,nnslashdot-login-name)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
398 ("upasswd" . ,nnslashdot-password)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
399 ("postersubj" . ,subject)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
400 ("op" . "Submit")
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
401 ("postercomment" . ,body)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
402 ("posttype" . "html")))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
403
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
404 (deffoo nnslashdot-request-delete-group (group &optional force server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
405 (nnslashdot-possibly-change-server group server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
406 (setq nnslashdot-groups (delq (assoc group nnslashdot-groups)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
407 nnslashdot-groups))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
408 (nnslashdot-write-groups))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
409
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
410 (deffoo nnslashdot-request-close ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
411 (setq nnslashdot-headers nil
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
412 nnslashdot-groups nil))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
413
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
414 (deffoo nnslashdot-request-expire-articles
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
415 (articles group &optional server force)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
416 (nnslashdot-possibly-change-server group server)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
417 (let ((item (assoc group nnslashdot-groups)))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
418 (when item
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
419 (if (fourth item)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
420 (when (and (>= (length articles) (cadr item)) ;; All are expirable.
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
421 (nnmail-expired-article-p
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
422 group
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
423 (fourth item)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
424 force))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
425 (setq nnslashdot-groups (delq item nnslashdot-groups))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
426 (nnslashdot-write-groups)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
427 (setq articles nil)) ;; all expired.
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
428 (setcdr (cddr item) (list (current-time)))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
429 (nnslashdot-write-groups))))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
430 articles)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
431
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
432 (nnoo-define-skeleton nnslashdot)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
433
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
434 ;;; Internal functions
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
435
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
436 (defun nnslashdot-possibly-change-server (&optional group server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
437 (nnslashdot-init server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
438 (when (and server
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
439 (not (nnslashdot-server-opened server)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
440 (nnslashdot-open-server server))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
441 (unless nnslashdot-groups
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
442 (nnslashdot-read-groups)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
443
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
444 (defun nnslashdot-make-tuple (tuple n)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
445 (prog1
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
446 tuple
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
447 (while (> n 1)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
448 (unless (cdr tuple)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
449 (setcdr tuple (list nil)))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
450 (setq tuple (cdr tuple)
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
451 n (1- n)))))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
452
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
453 (defun nnslashdot-read-groups ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
454 (let ((file (expand-file-name "groups" nnslashdot-directory)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
455 (when (file-exists-p file)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
456 (mm-with-unibyte-buffer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
457 (insert-file-contents file)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
458 (goto-char (point-min))
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
459 (setq nnslashdot-groups (read (current-buffer))))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
460 (when (and nnslashdot-groups (< (length (car nnslashdot-groups)) 5))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
461 (dolist (group nnslashdot-groups)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
462 (nnslashdot-make-tuple group 5))))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
463
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
464 (defun nnslashdot-write-groups ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
465 (with-temp-file (expand-file-name "groups" nnslashdot-directory)
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
466 (gnus-prin1 nnslashdot-groups)))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
467
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
468 (defun nnslashdot-init (server)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
469 "Initialize buffers and such."
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
470 (unless (file-exists-p nnslashdot-directory)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
471 (gnus-make-directory nnslashdot-directory))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
472 (unless (gnus-buffer-live-p nnslashdot-buffer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
473 (setq nnslashdot-buffer
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
474 (save-excursion
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
475 (nnheader-set-temp-buffer
40542
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
476 (format " *nnslashdot %s*" server))))
93f6c74a2f60 * mm-util.el, nnultimate.el, nnweb.el, nnslashdot.el: Sync with
ShengHuo ZHU <zsh@cs.rochester.edu>
parents: 35453
diff changeset
477 (push nnslashdot-buffer gnus-buffers)))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
478
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
479 (defun nnslashdot-date-to-date (sdate)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
480 (condition-case err
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
481 (let ((elem (delete "" (split-string sdate))))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
482 (concat (substring (nth 0 elem) 0 3) " "
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
483 (substring (nth 1 elem) 0 3) " "
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
484 (substring (nth 2 elem) 0 2) " "
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
485 (substring (nth 3 elem) 1 6) " "
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
486 (format-time-string "%Y") " "
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
487 (nth 4 elem)))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
488 (error "")))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
489
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
490 (defun nnslashdot-generate-active ()
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
491 (save-excursion
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
492 (set-buffer nntp-server-buffer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
493 (erase-buffer)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
494 (dolist (elem nnslashdot-groups)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
495 (when (numberp (cadr elem))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
496 (insert (prin1-to-string (car elem))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
497 " " (number-to-string (cadr elem)) " 1 y\n")))))
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
498
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
499 (defun nnslashdot-lose (why)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
500 (error "Slashdot HTML has changed; please get a new version of nnslashdot"))
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
501
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
502 (provide 'nnslashdot)
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
503
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
504 ;; arch-tag: aa73df7a-f7e6-4eef-bdea-5ce2f8c691b3
31717
6b20b7e85e3c *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
505 ;;; nnslashdot.el ends here