use mm-url.el functions for external URL
authorTeodor Zlatanov <tzz@lifelogs.com>
Wed, 10 Sep 2003 10:24:12 +0000 (10:24 +0000)
committerTeodor Zlatanov <tzz@lifelogs.com>
Wed, 10 Sep 2003 10:24:12 +0000 (10:24 +0000)
loading when the built-in HTTP GET is insufficient (e.g. proxies
are in the way).  From Eric Knauel
<knauel@informatik.uni-tuebingen.de>.
(spam-report-url-ping-function): new option, defaults to the
built-in HTTP GET (spam-report-url-ping-plain)
(spam-report-url-ping): calls spam-report-url-ping-function now
(spam-report-url-ping-plain): new function, does what
spam-report-url-ping used to do
(spam-report-url-ping-mm-url): function that delegates to
mm-url.el (autoloaded)

lisp/ChangeLog
lisp/spam-report.el

index 3ea365c..90aaa65 100644 (file)
@@ -1,3 +1,17 @@
+2003-09-10  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * spam-report.el: use mm-url.el functions for external URL
+       loading when the built-in HTTP GET is insufficient (e.g. proxies
+       are in the way).  From Eric Knauel
+       <knauel@informatik.uni-tuebingen.de>.
+       (spam-report-url-ping-function): new option, defaults to the
+       built-in HTTP GET (spam-report-url-ping-plain)
+       (spam-report-url-ping): calls spam-report-url-ping-function now
+       (spam-report-url-ping-plain): new function, does what
+       spam-report-url-ping used to do
+       (spam-report-url-ping-mm-url): function that delegates to
+       mm-url.el (autoloaded)
+
 2003-09-08  Teodor Zlatanov  <tzz@lifelogs.com>
 
        * gnus-registry.el (gnus-registry-delete-id): function to
index 288a05e..0f546aa 100644 (file)
@@ -31,6 +31,9 @@
 (require 'gnus)
 (require 'gnus-sum)
 
+(eval-and-compile
+  (autoload 'mm-url-insert "mm-url"))
+
 (defgroup spam-report nil
   "Spam reporting configuration.")
 
@@ -54,6 +57,16 @@ instead."
   :type 'boolean
   :group 'spam-report)
 
+(defcustom spam-report-url-ping-function
+  'spam-report-url-ping-plain
+  "Function to use for url ping spam reporting."
+  :type '(choice
+         (const :tag "Connect directly" 
+                spam-report-url-ping-plain)
+         (const :tag "Use the external program specified in `mm-url-program'" 
+                spam-report-url-ping-mm-url))
+  :group 'spam-report)
+
 (defun spam-report-gmane (article)
   "Report an article as spam through Gmane"
   (interactive "nEnter the article number: ")
@@ -78,9 +91,13 @@ instead."
            (gnus-message 10 "Could not find X-Report-Spam in article %d..."
                          article))))))
 
-
 (defun spam-report-url-ping (host report)
-  "Ping a host through HTTP, addressing a specific GET resource"
+  "Ping a host through HTTP, addressing a specific GET resource using
+the function specified by `spam-report-url-ping-function'."
+  (funcall spam-report-url-ping-function host report))
+
+(defun spam-report-url-ping-plain (host report)
+  "Ping a host through HTTP, addressing a specific GET resource."
   (let ((tcp-connection))
     (with-temp-buffer
       (or (setq tcp-connection
@@ -95,6 +112,14 @@ instead."
                           (format "GET %s HTTP/1.1\nHost: %s\n\n"
                                   report host)))))
 
+(defun spam-report-url-ping-mm-url (host report)
+  "Ping a host through HTTP, addressing a specific GET resource. Use
+the external program specified in `mm-url-program' to connect to
+server."
+  (with-temp-buffer
+    (let ((url (concat "http://" host "/" report)))
+      (mm-url-insert url t))))
+
 (provide 'spam-report)
 
 ;;; spam-report.el ends here.