Merge from gnus--rel--5.10
[gnus] / lisp / nnweb.el
index 00e4631..56a287e 100644 (file)
@@ -1,7 +1,7 @@
 ;;; nnweb.el --- retrieving articles via web search engines
 
 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-;;   2004, 2005, 2006 Free Software Foundation, Inc.
+;;   2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
@@ -10,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
-;; 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,
@@ -360,23 +360,24 @@ Valid types include `google', `dejanews', and `gmane'.")
       (goto-char (point-max))
       (widen)
       (narrow-to-region (point)
-                       (search-forward "</td" nil t))
+                       (search-forward "</table" nil t))
 
       (mm-url-remove-markup)
       (mm-url-decode-entities)
-      (search-backward " - ")
-      (when (looking-at
-            "\\W+\\(\\w+\\) \\([0-9]+\\)\\(?: \\([0-9]\\{4\\}\\)\\)?")
-       (setq Date (format "%s %s 00:00:00 %s"
-                          (match-string 1)
-                          (match-string 2)
-                          (or (match-string 3)
-                              (substring (current-time-string) -4))))
-       (goto-char (match-end 0)))
-      (when (looking-at "[^b]+by\\W+\\([^<\n]+\\)")
-       (setq From (match-string 1)))
+      (goto-char (point-max))
+      (when
+         (re-search-backward
+          "^\\(?:\\(\\w+\\) \\([0-9]+\\)\\|\\S-+\\)\\(?: \\([0-9]\\{4\\}\\)\\)? by ?\\(.*\\)"
+          nil t)
+       (setq Date (if (match-string 1)
+                      (format "%s %s 00:00:00 %s"
+                              (match-string 1)
+                              (match-string 2)
+                              (or (match-string 3)
+                                  (substring (current-time-string) -4)))
+                    (current-time-string)))
+       (setq From (match-string 4)))
       (widen)
-      (forward-line 1)
       (incf i)
       (unless (nnweb-get-hashtb url)
        (push
@@ -480,7 +481,7 @@ Valid types include `google', `dejanews', and `gmane'.")
                    (from (mail-header-from header))
                    (subject (mail-header-subject header))
                    (rfc2047-encoding-type 'mime))
-               (when (string-match " \\([^:]+\\):\\([0-9]+\\)" xref)
+               (when (string-match " \\([^:]+\\)[:/]\\([0-9]+\\)" xref)
                  (mail-header-set-xref
                   header
                   (format "http://article.gmane.org/%s/%s/raw"
@@ -496,11 +497,8 @@ Valid types include `google', `dejanews', and `gmane'.")
                                         (rfc2047-encode-string subject))
 
                (unless (nnweb-get-hashtb (mail-header-xref header))
-                 (push
-                  (list
-                   (incf (cdr active))
-                   header)
-                  map)
+                 (mail-header-set-number header (incf (cdr active)))
+                 (push (list (mail-header-number header) header) map)
                  (nnweb-set-hashtb (cadar map) (car map))))))
          (forward-line 1)))
       (nnheader-message 7 "Searching Gmane...done")
@@ -525,7 +523,9 @@ Valid types include `google', `dejanews', and `gmane'.")
     "?"
     (mm-url-encode-www-form-urlencoded
      `(("query" . ,search)
-       ("HITSPERPAGE" . ,(number-to-string nnweb-max-hits))))))
+       ("HITSPERPAGE" . ,(number-to-string nnweb-max-hits))
+       ;;("TOPDOC" . "1000")
+       ))))
   (setq buffer-file-name nil)
   (set-buffer-multibyte t)
   (mm-decode-coding-region (point-min) (point-max) 'utf-8)