Gnus development mailing list
 help / color / mirror / Atom feed
From: Eric Knauel <knauel@informatik.uni-tuebingen.de>
Subject: "url ping" spam reporting with wget
Date: Tue, 09 Sep 2003 08:47:06 +0200	[thread overview]
Message-ID: <vw3k78i31cl.fsf@informatik.uni-tuebingen.de> (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)

             reply	other threads:[~2003-09-09  6:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-09  6:47 Eric Knauel [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=vw3k78i31cl.fsf@informatik.uni-tuebingen.de \
    --to=knauel@informatik.uni-tuebingen.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).