From 4c24e5e78f1d740f9a6f2c1e94634502dd92a01e Mon Sep 17 00:00:00 2001 From: Teodor Zlatanov Date: Wed, 10 Sep 2003 10:24:12 +0000 Subject: [PATCH] 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 . (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 | 14 ++++++++++++++ lisp/spam-report.el | 29 +++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3ea365cf0..90aaa654c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,17 @@ +2003-09-10 Teodor Zlatanov + + * 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 + . + (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 * gnus-registry.el (gnus-registry-delete-id): function to diff --git a/lisp/spam-report.el b/lisp/spam-report.el index 288a05e32..0f546aa36 100644 --- a/lisp/spam-report.el +++ b/lisp/spam-report.el @@ -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. -- 2.25.1