;;; nnslashdot.el --- interfacing with Slashdot
-;; Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
;; Keywords: news
;; This file is part of GNU Emacs.
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
-;; Note: You need to have `url' and `w3' installed for this
-;; backend to work.
-
;;; Code:
(eval-when-compile (require 'cl))
(require 'gnus)
(require 'nnmail)
(require 'mm-util)
-(eval-when-compile
- (ignore-errors
- (require 'nnweb)))
-;; Report failure to find w3 at load time if appropriate.
-(eval '(require 'nnweb))
+(require 'mm-url)
(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-use-front-page nil
+ "Use the front page in addition to the backslash page.")
+
(defvoo nnslashdot-threshold -1
"The article threshold.")
(nnslashdot-possibly-change-server group server)
(condition-case why
(unless gnus-nov-is-evil
- (if nnslashdot-threaded
- (nnslashdot-threaded-retrieve-headers articles group)
- (nnslashdot-sane-retrieve-headers articles group)))
+ (nnslashdot-retrieve-headers-1 articles group))
(search-failed (nnslashdot-lose why))))
-
-(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)
+
+(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
- (nnslashdot-sid-strip sid)) t)
+ (mm-url-insert (format nnslashdot-article-url sid) t)
(goto-char (point-min))
- (search-forward "Posted by ")
- (when (looking-at "<a[^>]+>\\([^<]+\\)")
- (setq from (nnweb-decode-entities-string (match-string 1))))
- (search-forward " on ")
+ (if (eobp)
+ (error "Couldn't open connection to slashdot"))
+ (re-search-forward "Posted by[ \t\r\n]+")
+ (when (looking-at "\\(<a[^>]+>\\)?[ \t\r\n]*\\([^<\r\n]+\\)")
+ (setq from (mm-url-decode-entities-string (match-string 2))))
+ (search-forward "on ")