X-Git-Url: https://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fnnslashdot.el;h=c28e35cc4a1b296ed7243d37ce9ad14c4207ad43;hb=65570b6780a379ac06efde3226f8c93c0139801e;hp=76c5891d44131873bb12f9dfabee7b9a6fa26203;hpb=0f6adbcf0995390662e0d05e0d7c6590b06b0ab3;p=gnus diff --git a/lisp/nnslashdot.el b/lisp/nnslashdot.el index 76c5891d4..c28e35cc4 100644 --- a/lisp/nnslashdot.el +++ b/lisp/nnslashdot.el @@ -1,4 +1,4 @@ -;;; nnslashdot.el --- interfacing with Slashdot +;;; nnslashdot.el --- interfacing with Slashdot ;; Copyright (C) 1999 Free Software Foundation, Inc. ;; Author: Lars Magne Ingebrigtsen @@ -69,9 +69,15 @@ (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) @@ -229,11 +235,13 @@ (format nnslashdot-comments-url sid nnslashdot-threshold 4 start)) (goto-char point) (while (re-search-forward - "\\([^<]+\\).*score\\([^)]+\\))" + "\\([^<]+\\).*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 ]+>\\([^<]+\\)[ \t\n]*.*(\\([^)]+\\))") @@ -319,7 +327,7 @@ (point) (progn (re-search-forward - "^

.*A href=http://slashdot.org/article.pl") + "

.*A href=http://slashdot.org/article.pl") (match-beginning 0))))) (search-forward (format "" (1- article))) (setq contents @@ -332,7 +340,12 @@ (erase-buffer) (insert contents) (goto-char (point-min)) + (while (search-forward "

" nil t) + (replace-match "

" 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) @@ -398,6 +411,52 @@ (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 "

\n")) + (setq quoted t)) + (when quoted + (insert "
\n") + (setq quoted nil))) + (forward-line 1)) + (widen) + (when (message-goto-signature) + (forward-line -1) + (insert "

\n") + (while (not (eobp)) + (end-of-line) + (insert "
") + (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