Gnus development mailing list
 help / color / mirror / Atom feed
* "url ping" spam reporting with wget
@ 2003-09-09  6:47 Eric Knauel
  2003-09-09 16:51 ` Reiner Steib
  2003-09-09 18:16 ` Ted Zlatanov
  0 siblings, 2 replies; 8+ messages in thread
From: Eric Knauel @ 2003-09-09  6:47 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 292 bytes --]


Hi,

here is a little patch for spam-report.el that provides a function
`spam-report-url-ping-wget' that calls wget to report a spam message
to gmane. I found that convenient because the orginal
`spam-report-url-ping' (now `spam-report-url-ping-plain') didn't obey
the http proxy settings.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: make spam-report.el use wget to report spam --]
[-- Type: text/x-patch, Size: 2658 bytes --]

Index: spam-report.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/spam-report.el,v
retrieving revision 6.4
diff -c -r6.4 spam-report.el
*** spam-report.el	7 Aug 2003 05:02:03 -0000	6.4
--- spam-report.el	9 Sep 2003 06:51:32 -0000
***************
*** 54,59 ****
--- 54,72 ----
    :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 "Using (X)Emacs (ignore proxy settings)" spam-report-url-ping-plain)
+ 	  (const :tag "Using wget" spam-report-url-ping-wget))
+   :group 'spam-report)
+ 
+ (defcustom spam-report-url-ping-wget-options
+   '("--proxy=on" "-O-" "-q")
+   "Options for the wget command issued by spam-report-url-ping-wget"
+   :group 'spam-report)
+ 
  (defun spam-report-gmane (article)
    "Report an article as spam through Gmane"
    (interactive "nEnter the article number: ")
***************
*** 78,85 ****
  	    (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"
    (let ((tcp-connection))
      (with-temp-buffer
--- 91,105 ----
  	    (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. Use
+ the function specified in `spam-report-url-ping-function' for actually
+ doing this."
+   (if (functionp spam-report-url-ping-function)
+       (funcall spam-report-url-ping-function host report)
+     (spam-report-url-ping-plain 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
***************
*** 94,99 ****
--- 114,132 ----
        (process-send-string tcp-connection
  			   (format "GET %s HTTP/1.1\nHost: %s\n\n"
  				   report host)))))
+ 
+ (defun spam-report-url-ping-wget (host report)
+   "Ping a host through HTTP, addressing a specific GET resource. Use
+ wget to submit the report."
+   (let ((wget (executable-find "wget")))
+     (if wget
+ 	(let ((status (apply 'call-process wget 
+ 			     nil nil nil 
+ 			     (append spam-report-url-ping-wget-options
+ 				     (list (concat host "/" report))))))
+ 	  (if (not (zerop status))
+ 	      (message "Error submitting spam report")))
+       (message "Can't find executable `wget'"))))
  
  (provide 'spam-report)
  

[-- Attachment #3: Type: text/plain, Size: 82 bytes --]


-Eric
-- 
"Excuse me --- Di Du Du Duuuuh Di Dii --- Huh Weeeheeee" (Albert King)

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-09-10 10:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-09  6:47 "url ping" spam reporting with wget Eric Knauel
2003-09-09 16:51 ` Reiner Steib
2003-09-09 18:13   ` Ted Zlatanov
2003-09-09 18:19     ` Ted Zlatanov
2003-09-09 19:50       ` Reiner Steib
2003-09-09 18:16 ` Ted Zlatanov
2003-09-10  6:52   ` Eric Knauel
2003-09-10 10:18     ` Ted Zlatanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).