Simplify loading of password-cache or password.
[gnus] / lisp / nnwfm.el
index 5ec1a06..94a1abd 100644 (file)
@@ -1,5 +1,7 @@
 ;;; nnwfm.el --- interfacing with a web forum
 ;;; nnwfm.el --- interfacing with a web forum
-;; Copyright (C) 2000 Free Software Foundation, Inc.
+
+;; Copyright (C) 2000, 2002, 2003, 2004, 2005,
+;;   2006, 2007 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
@@ -8,7 +10,7 @@
 
 ;; 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
 
 ;; 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)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -18,8 +20,8 @@
 
 ;; 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
 
 ;; 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.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
 
 ;;; Commentary:
 
 (require 'gnus)
 (require 'nnmail)
 (require 'mm-util)
 (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)
+(require 'nnweb)
+(autoload 'w3-parse-buffer "w3-parse")
 
 (nnoo-declare nnwfm)
 
 
 (nnoo-declare nnwfm)
 
@@ -56,7 +56,7 @@
 (defvoo nnwfm-groups nil)
 (defvoo nnwfm-headers nil)
 (defvoo nnwfm-articles nil)
 (defvoo nnwfm-groups nil)
 (defvoo nnwfm-headers nil)
 (defvoo nnwfm-articles nil)
-(defvar nnwfm-table-regexp 
+(defvar nnwfm-table-regexp
   "postings.*editpost\\|forumdisplay\\|Forum[0-9]+/HTML\\|getbio")
 
 ;;; Interface functions
   "postings.*editpost\\|forumdisplay\\|Forum[0-9]+/HTML\\|getbio")
 
 ;;; Interface functions
            (erase-buffer)
            (setq subject (nth 2 (assq (car elem) topics))
                  thread-id (nth 0 (assq (car elem) topics)))
            (erase-buffer)
            (setq subject (nth 2 (assq (car elem) topics))
                  thread-id (nth 0 (assq (car elem) topics)))
-           (nnweb-insert
+           (mm-url-insert
             (concat nnwfm-address
                     (format "Item.asp?GroupID=%d&ThreadID=%d" sid
                             thread-id)))
            (goto-char (point-min))
             (concat nnwfm-address
                     (format "Item.asp?GroupID=%d&ThreadID=%d" sid
                             thread-id)))
            (goto-char (point-min))
-           (setq contents
-                 (ignore-errors (w3-parse-buffer (current-buffer))))
-           (setq tables (caddar (caddar (cdr (caddar (caddar contents))))))
+           (setq tables (caddar
+                         (caddar
+                          (cdr (caddar
+                                (caddar
+                                 (ignore-errors
+                                   (w3-parse-buffer (current-buffer)))))))))
            (setq tables (cdr (caddar (memq (assq 'div tables) tables))))
            (setq contents nil)
            (dolist (table tables)
            (setq tables (cdr (caddar (memq (assq 'div tables) tables))))
            (setq contents nil)
            (dolist (table tables)
-             (setq table (caddar (caddar (caddr table)))
-                   hstuff (delete ":link" (nnweb-text (car table)))
-                   bstuff (car (caddar (cdr table)))
-                   from (car hstuff))
-             (when (nth 2 hstuff)
-               (setq time (nnwfm-date-to-time (nth 2 hstuff)))
-               (push (list from time bstuff) contents)))
+             (when (eq (car table) 'table)
+               (setq table (caddar (caddar (caddr table)))
+                     hstuff (delete ":link" (nnweb-text (car table)))
+                     bstuff (car (caddar (cdr table)))
+                     from (car hstuff))
+               (when (nth 2 hstuff)
+                 (setq time (nnwfm-date-to-time (nth 2 hstuff)))
+                 (push (list from time bstuff) contents))))
            (setq contents (nreverse contents))
            (dolist (art (cdr elem))
                (push (list (car art)
            (setq contents (nreverse contents))
            (dolist (art (cdr elem))
                (push (list (car art)
 (deffoo nnwfm-request-list (&optional server)
   (nnwfm-possibly-change-server nil server)
   (mm-with-unibyte-buffer
 (deffoo nnwfm-request-list (&optional server)
   (nnwfm-possibly-change-server nil server)
   (mm-with-unibyte-buffer
-    (nnweb-insert
+    (mm-url-insert
      (if (string-match "/$" nnwfm-address)
         (concat nnwfm-address "Group.asp")
        nnwfm-address))
      (if (string-match "/$" nnwfm-address)
         (concat nnwfm-address "Group.asp")
        nnwfm-address))
          (setq description (car (last (nnweb-text (nth 1 row)))))
          (setq articles
                (string-to-number
          (setq description (car (last (nnweb-text (nth 1 row)))))
          (setq articles
                (string-to-number
-                (nnweb-replace-in-string
+                (gnus-replace-in-string
                  (car (last (nnweb-text (nth 3 row)))) "," "")))
          (when (and href
                     (string-match "GroupId=\\([0-9]+\\)" href))
                  (car (last (nnweb-text (nth 3 row)))) "," "")))
          (when (and href
                     (string-match "GroupId=\\([0-9]+\\)" href))
       (while furls
        (erase-buffer)
        (push (car furls) fetched-urls)
       (while furls
        (erase-buffer)
        (push (car furls) fetched-urls)
-       (nnweb-insert (pop furls))
+       (mm-url-insert (pop furls))
        (goto-char (point-min))
        (while (re-search-forward "  wr(" nil t)
          (forward-char -1)
          (setq elem (message-tokenize-header
        (goto-char (point-min))
        (while (re-search-forward "  wr(" nil t)
          (forward-char -1)
          (setq elem (message-tokenize-header
-                     (buffer-substring
-                      (1+ (point))
-                      (progn
-                        (forward-sexp 1)
-                        (1- (point))))))
+                     (gnus-replace-in-string
+                      (buffer-substring
+                       (1+ (point))
+                       (progn
+                         (forward-sexp 1)
+                         (1- (point))))
+                      "\\\\[\"\\\\]" "")))
          (push (list
                 (string-to-number (nth 1 elem))
          (push (list
                 (string-to-number (nth 1 elem))
-                (nnweb-replace-in-string (nth 2 elem) "\"" "")
+                (gnus-replace-in-string (nth 2 elem) "\"" "")
                 (string-to-number (nth 5 elem)))
                forum-contents))
        (when (re-search-forward "href=\"\\(Thread.*DateLast=\\([^\"]+\\)\\)"
                                 nil t)
          (setq url (match-string 1)
                 (string-to-number (nth 5 elem)))
                forum-contents))
        (when (re-search-forward "href=\"\\(Thread.*DateLast=\\([^\"]+\\)\\)"
                                 nil t)
          (setq url (match-string 1)
-               time (nnwfm-date-to-time (url-unhex-string (match-string 2))))
+               time (nnwfm-date-to-time (gnus-url-unhex-string
+                                         (match-string 2))))
          (when (and (nnwfm-new-threads-p group time)
                     (not (member
                           (setq url (concat
                                      nnwfm-address
          (when (and (nnwfm-new-threads-p group time)
                     (not (member
                           (setq url (concat
                                      nnwfm-address
-                                     (nnweb-decode-entities-string url)))
+                                     (mm-url-decode-entities-string url)))
                           fetched-urls)))
            (push url furls))))
       ;; The main idea here is to map Gnus article numbers to
                           fetched-urls)))
            (push url furls))))
       ;; The main idea here is to map Gnus article numbers to
        nnwfm-groups-alist)
   (with-temp-file (expand-file-name "groups" nnwfm-directory)
     (prin1 nnwfm-groups-alist (current-buffer))))
        nnwfm-groups-alist)
   (with-temp-file (expand-file-name "groups" nnwfm-directory)
     (prin1 nnwfm-groups-alist (current-buffer))))
-    
+
 (defun nnwfm-init (server)
   "Initialize buffers and such."
   (unless (file-exists-p nnwfm-directory)
 (defun nnwfm-init (server)
   "Initialize buffers and such."
   (unless (file-exists-p nnwfm-directory)
 ;; coding: iso-8859-1
 ;; End:
 
 ;; coding: iso-8859-1
 ;; End:
 
+;;; arch-tag: d813966a-4211-4557-ad11-d1ac2bc86536
 ;;; nnwfm.el ends here
 ;;; nnwfm.el ends here