;;; nnslashdot.el --- interfacing with Slashdot
-;; Copyright (C) 1999 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
;; Keywords: news
(require 'gnus)
(require 'nnmail)
(require 'mm-util)
-(require 'nnweb)
(eval-when-compile
(ignore-errors
- (require 'w3)
- (require 'url)
- (require 'w3-forms)))
+ (require 'nnweb)))
;; Report failure to find w3 at load time if appropriate.
-(eval '(progn
- (require 'w3)
- (require 'url)
- (require 'w3-forms)))
+(eval '(require 'nnweb))
(nnoo-declare nnslashdot)
"http://slashdot.org/article.pl?sid=%s&mode=nocomment"
"Where nnslashdot will fetch the article from.")
+(defvoo nnslashdot-backslash-url "http://slashdot.org/slashdot.xml"
+ "Where nnslashdot will fetch the stories from.")
+
(defvoo nnslashdot-threshold -1
"The article threshold.")
(deffoo nnslashdot-retrieve-headers (articles &optional group server fetch-old)
(nnslashdot-possibly-change-server group server)
- (unless gnus-nov-is-evil
- (if nnslashdot-threaded
- (nnslashdot-threaded-retrieve-headers articles group)
- (nnslashdot-sane-retrieve-headers articles group))))
-
-(deffoo nnslashdot-threaded-retrieve-headers (articles group)
- (let ((last (car (last articles)))
- (did nil)
- (start 1)
- (sid (caddr (assoc group nnslashdot-groups)))
- (first-comments t)
- (startats '(1))
- headers article subject score from date lines parent point s)
+ (condition-case why
+ (unless gnus-nov-is-evil
+ (nnslashdot-retrieve-headers-1 articles group))
+ (search-failed (nnslashdot-lose why))))
+
+(deffoo nnslashdot-retrieve-headers-1 (articles group)
+ (let* ((last (car (last articles)))
+ (start (if nnslashdot-threaded 1 (pop articles)))
+ (entry (assoc group nnslashdot-groups))
+ (sid (nth 2 entry))
+ (first-comments t)
+ headers article subject score from date lines parent point cid
+ s startats changed)
(save-excursion
(set-buffer nnslashdot-buffer)
(let ((case-fold-search t))
(erase-buffer)
(when (= start 1)
- (nnweb-insert (format nnslashdot-article-url sid))
+ (nnweb-insert (format nnslashdot-article-url
+ (nnslashdot-sid-strip sid)) t)
(goto-char (point-min))
- (search-forward "Posted by ")
- (when (looking-at "<a[^>]+>\\([^<]+\\)")
- (setq from (match-string 1)))
- (search-forward " on ")
+ (re-search-forward "Posted by[ \t\r\n]+")
+ (when (looking-at "\\(<a[^>]+>\\)?[ \t\r\n]*\\([^<\r\n]+\\)")
+ (setq from (nnweb-decode-entities-string (match-string 2))))
+ (search-forward "on ")
(setq date (nnslashdot-date-to-date
(buffer-substring (point) (1- (search-forward "<")))))
- (forward-line 2)
- (setq lines (count-lines
- (point)
- (search-forward
- "A href=http://slashdot.org/article.pl")))
+ (setq lines (/ (- (point)
+ (progn (forward-line 1) (point)))
+ 60))
(push
(cons
1
(make-full-mail-header
- 1 group from date (concat "<" sid "%1@slashdot>")
+ 1 group from date
+ (concat "<" (nnslashdot-sid-strip sid) "%1@slashdot>")
"" 0 lines nil nil))
- headers))
-