-;;; nnslashdot.el --- interfacing with Slashdot
+;;; nnslashdot.el --- interfacing with Slashdot
;; Copyright (C) 1999 Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
(defvoo nnslashdot-threaded t
"Whether the nnslashdot groups should be threaded or not.")
-(defvoo nnslashdot-group-number 30
+(defvoo nnslashdot-group-number 0
"The number of non-fresh groups to keep updated.")
+(defvoo nnslashdot-login-name ""
+ "The login name to use when posting.")
+
+(defvoo nnslashdot-password ""
+ "The password to use when posting.")
+
;;; Internal variables
(defvar nnslashdot-groups nil)
(format nnslashdot-comments-url sid nnslashdot-threshold 4 start))
(goto-char point)
(while (re-search-forward
- "<a name=\"\\([0-9]+\\)\"><b>\\([^<]+\\)</b>.*score\\([^)]+\\))"
+ "<a name=\"\\([0-9]+\\)\"><b>\\([^<]+\\)</b>.*score:\\([^)]+\\))"
nil t)
(setq article (string-to-number (match-string 1))
subject (match-string 2)
score (match-string 3))
+ (when (string-match "^Re: *" subject)
+ (setq subject (concat "Re: " (substring subject (match-end 0)))))
(forward-line 1)
(if (looking-at
"by <a[^>]+>\\([^<]+\\)</a>[ \t\n]*.*(\\([^)]+\\))")
(point)
(progn
(re-search-forward
- "^<p>.*A href=http://slashdot.org/article.pl")
+ "<p>.*A href=http://slashdot.org/article.pl")
(match-beginning 0)))))
(search-forward (format "<a name=\"%d\">" (1- article)))
(setq contents
(erase-buffer)
(insert contents)
(goto-char (point-min))
+ (while (search-forward "<br><br>" nil t)
+ (replace-match "<p>" t t))
+ (goto-char (point-min))
(insert "Content-Type: text/html\nMIME-Version: 1.0\n")
+ (insert "Newsgroups: " (caddr (assoc group nnslashdot-groups))
+ "\n")
(let ((header (cdr (assq article nnslashdot-headers))))
(nnheader-insert-header header))
(nnheader-report 'nnslashdot "Fetched article %s" article)
(nnslashdot-generate-active)
t)
+(deffoo nnslashdot-request-post (&optional server)
+ (nnslashdot-possibly-change-server nil server)
+ (let ((sid (message-fetch-field "newsgroups"))
+ (subject (message-fetch-field "subject"))
+ (references (car (last (split-string
+ (message-fetch-field "references")))))
+ body quoted pid)
+ (string-match "%\\([0-9]+\\)@slashdot" references)
+ (setq pid (match-string 1 references))
+ (message-goto-body)
+ (narrow-to-region (point) (progn (message-goto-signature) (point)))
+ (goto-char (point-min))
+ (while (not (eobp))
+ (if (looking-at "> ")
+ (progn
+ (delete-region (point) (+ (point) 2))
+ (unless quoted
+ (insert "<blockquote>\n"))
+ (setq quoted t))
+ (when quoted
+ (insert "</blockquote>\n")
+ (setq quoted nil)))
+ (forward-line 1))
+ (widen)
+ (when (message-goto-signature)
+ (forward-line -1)
+ (insert "<p>\n")
+ (while (not (eobp))
+ (end-of-line)
+ (insert "<br>")
+ (forward-line 1)))
+ (message-goto-body)
+ (setq body (buffer-substring (point) (point-max)))
+ (erase-buffer)
+ (nnweb-fetch-form
+ "http://slashdot.org/comments.pl"
+ `(("sid" . ,sid)
+ ("pid" . ,pid)
+ ("rlogin" . "userlogin")
+ ("unickname" . ,nnslashdot-login-name)
+ ("upasswd" . ,nnslashdot-password)
+ ("postersubj" . ,subject)
+ ("op" . "Submit")
+ ("postercomment" . ,body)
+ ("posttype" . "html")))))
+
(nnoo-define-skeleton nnslashdot)
;;; Internal functions