+ (condition-case why
+ (unless gnus-nov-is-evil
+ (if nnslashdot-threaded
+ (nnslashdot-threaded-retrieve-headers articles group)
+ (nnslashdot-sane-retrieve-headers 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)
+ (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)
+ (goto-char (point-min))
+ (search-forward "Posted by ")
+ (when (looking-at "<a[^>]+>\\([^<]+\\)")
+ (setq from (nnweb-decode-entities-string (match-string 1))))
+ (search-forward " on ")
+ (setq date (nnslashdot-date-to-date
+ (buffer-substring (point) (1- (search-forward "<")))))
+ (setq lines (/ (- (point)
+ (progn (forward-line 1) (point)))
+ 60))
+ (push
+ (cons
+ 1
+ (make-full-mail-header
+ 1 group from date
+ (concat "<" (nnslashdot-sid-strip sid) "%1@slashdot>")
+ "" 0 lines nil nil))
+ headers))
+ (while (and (setq start (pop startats))
+ (< start last))
+ (setq point (goto-char (point-max)))
+ (nnweb-insert
+ (format nnslashdot-comments-url
+ (nnslashdot-sid-strip sid)
+ nnslashdot-threshold 0 start)
+ t)
+ (when first-comments
+ (setq first-comments nil)
+ (goto-char (point-max))
+ (while (re-search-backward "startat=\\([0-9]+\\)" nil t)
+ (setq s (string-to-number (match-string 1)))
+ (unless (memq s startats)
+ (push s startats)))
+ (setq startats (sort startats '<)))
+ (goto-char point)
+ (while (re-search-forward
+ "<a name=\"\\([0-9]+\\)\"><\\(b\\|H4\\)>\\([^<]+\\)</\\(b\\|H4\\)>.*score:\\([^)]+\\))"
+ nil t)
+ (setq article (string-to-number (match-string 1))
+ subject (match-string 3)
+ score (match-string 5))
+ (when (string-match "^Re: *" subject)
+ (setq subject (concat "Re: " (substring subject (match-end 0)))))
+ (setq subject (nnweb-decode-entities-string subject))
+ (forward-line 1)
+ (if (looking-at
+ "by <a[^>]+>\\([^<]+\\)</a>[ \t\n]*.*(\\([^)]+\\))")
+ (progn
+ (goto-char (- (match-end 0) 5))
+ (setq from (concat
+ (nnweb-decode-entities-string (match-string 1))
+ " <" (match-string 2) ">")))
+ (setq from "")
+ (when (looking-at "by \\(.+\\) on ")
+ (goto-char (- (match-end 0) 5))
+ (setq from (nnweb-decode-entities-string (match-string 1)))))
+ (search-forward " on ")
+ (setq date
+ (nnslashdot-date-to-date
+ (buffer-substring (point) (progn (end-of-line) (point)))))
+ (setq lines (/ (abs (- (search-forward "<td ")
+ (search-forward "</td>")))
+ 70))
+ (forward-line 4)
+ (setq parent
+ (if (looking-at ".*cid=\\([0-9]+\\)")
+ (match-string 1)
+ nil))
+ (setq did t)
+ (push
+ (cons
+ (1+ article)
+ (make-full-mail-header
+ (1+ article)
+ (concat subject " (" score ")")
+ from date
+ (concat "<" (nnslashdot-sid-strip sid) "%"
+ (number-to-string (1+ article))
+ "@slashdot>")
+ (if parent
+ (concat "<" (nnslashdot-sid-strip sid) "%"
+ (number-to-string (1+ (string-to-number parent)))
+ "@slashdot>")
+ "")
+ 0 lines nil nil))
+ headers)))))
+ (setq nnslashdot-headers (sort headers 'car-less-than-car))
+ (save-excursion
+ (set-buffer nntp-server-buffer)
+ (erase-buffer)
+ (mm-with-unibyte-current-buffer
+ (dolist (header nnslashdot-headers)
+ (nnheader-insert-nov (cdr header)))))
+ 'nov))
+
+(deffoo nnslashdot-sane-retrieve-headers (articles group)