(spam-report-gmane-internal): Speed up spam reporting
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Mon, 8 Jan 2007 17:57:19 +0000 (17:57 +0000)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Mon, 8 Jan 2007 17:57:19 +0000 (17:57 +0000)
from nnweb groups.

lisp/ChangeLog
lisp/nnweb.el
lisp/spam-report.el

index 3bf4bfe..306df10 100644 (file)
@@ -1,3 +1,13 @@
+2007-01-08  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * spam-report.el (spam-report-gmane-internal): Speed up spam reporting
+       from nnweb groups.
+
+2006-12-31  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * spam-report.el (spam-report-gmane-internal): Add necessary "/" to
+       Xref urls.  Erase buffer before requesting head.
+
 2007-01-07  Reiner Steib  <Reiner.Steib@gmx.de>
 
        * gnus-soup.el (gnus-soup): New custom group.  Make user variables
index bbade23..4a1d753 100644 (file)
@@ -523,7 +523,7 @@ Valid types include `google', `dejanews', and `gmane'.")
     (mm-url-encode-www-form-urlencoded
      `(("query" . ,search)
        ("HITSPERPAGE" . ,(number-to-string nnweb-max-hits))
-       ;;("TOPDOC" . "500")
+       ;;("TOPDOC" . "1000")
        ))))
   (setq buffer-file-name nil)
   (set-buffer-multibyte t)
index bbd80a5..c45728e 100644 (file)
@@ -142,13 +142,30 @@ Reports is as ham when HAM is set."
                 (string-match spam-report-gmane-regex gnus-newsgroup-name)))
     (let ((rpt-host (if unspam "unspam.gmane.org" "spam.gmane.org")))
       (gnus-message 6 "Reporting article %d to %s..." article rpt-host)
-      (if spam-report-gmane-use-article-number
-         (spam-report-url-ping
-          rpt-host
-          (format "/%s:%d"
-                  (gnus-group-real-name gnus-newsgroup-name)
-                  article))
+      (cond
+       ;; Special-case nnweb groups -- these have the URL to use in
+       ;; the Xref headers.
+       ((eq (car (gnus-find-method-for-group gnus-newsgroup-name)) 'nnweb)
+       (spam-report-url-ping
+        rpt-host
+        (concat
+         "/"
+         (gnus-replace-in-string
+          (gnus-replace-in-string
+           (gnus-replace-in-string
+            (mail-header-xref (gnus-summary-article-header article))
+            "/raw" ":silent")
+           "^.*article.gmane.org/" "")
+          "/" ":"))))
+       (spam-report-gmane-use-article-number
+       (spam-report-url-ping
+        rpt-host
+        (format "/%s:%d"
+                (gnus-group-real-name gnus-newsgroup-name)
+                article)))
+       (t
        (with-current-buffer nntp-server-buffer
+         (erase-buffer)
          (gnus-request-head article gnus-newsgroup-name)
          (let ((case-fold-search t)
                field host report url)
@@ -165,7 +182,7 @@ Reports is as ham when HAM is set."
            (if (not (stringp field))
                (if (and (setq field (gnus-fetch-field "Xref"))
                         (string-match "[^ ]+ +\\([^ ]+\\)" field))
-                   (setq report (match-string 1 field)
+                   (setq report (concat "/" (match-string 1 field))
                          host rpt-host))
              (setq host
                    (progn
@@ -186,7 +203,7 @@ Reports is as ham when HAM is set."
                 3 "Could not find a spam report header in article %d..."
                 article)
              (gnus-message 7 "Reporting article through URL %s..." url)
-             (spam-report-url-ping host report))))))))
+             (spam-report-url-ping host report)))))))))
 
 (defun spam-report-url-ping (host report)
   "Ping a host through HTTP, addressing a specific GET resource using