* "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
* Re: "url ping" spam reporting with wget
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:16 ` Ted Zlatanov
1 sibling, 1 reply; 8+ messages in thread
From: Reiner Steib @ 2003-09-09 16:51 UTC (permalink / raw)
On Tue, Sep 09 2003, Eric Knauel wrote:
> 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.
Can't we use the functionality already present in `mm-url.el' in
`spam-report.el' instead of duplicating very similar variables?
(`mm-url-use-external', `mm-url-program', ... [1])
> + (defcustom spam-report-url-ping-wget-options
See also `mm-url-predefined-programs'.
> + '("--proxy=on" "-O-" "-q")
I think "--proxy=on" isn't useful here. I'd recommend to use
"use_proxy = on" in ~/.wgetrc instead.
Bye, Reiner.
[1] E.g. I use the following:
(setq
;; Use wget instead of url.el (for nnweb-type google), seems to work more
;; reliable.
mm-url-use-external t
mm-url-program 'wget)
--
,,,
(o o)
---ooO-(_)-Ooo--- PGP key available via WWW http://rsteib.home.pages.de/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: "url ping" spam reporting with wget
2003-09-09 16:51 ` Reiner Steib
@ 2003-09-09 18:13 ` Ted Zlatanov
2003-09-09 18:19 ` Ted Zlatanov
0 siblings, 1 reply; 8+ messages in thread
From: Ted Zlatanov @ 2003-09-09 18:13 UTC (permalink / raw)
On Tue, 09 Sep 2003, 4.uce.03.r.s@nurfuerspam.de wrote:
> Can't we use the functionality already present in `mm-url.el' in
> `spam-report.el' instead of duplicating very similar variables?
> (`mm-url-use-external', `mm-url-program', ... [1])
Have you looked at spam-report.el? It does not depend on any other
packages or external programs, unlike mm-url.el which seems to need
url.el and one of w3, wget, curl, etc. installed. Am I
misunderstanding something?
Ted
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: "url ping" spam reporting with wget
2003-09-09 6:47 "url ping" spam reporting with wget Eric Knauel
2003-09-09 16:51 ` Reiner Steib
@ 2003-09-09 18:16 ` Ted Zlatanov
2003-09-10 6:52 ` Eric Knauel
1 sibling, 1 reply; 8+ messages in thread
From: Ted Zlatanov @ 2003-09-09 18:16 UTC (permalink / raw)
Cc: ding
On Tue, 09 Sep 2003, knauel@informatik.uni-tuebingen.de wrote:
> 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.
I like the patch, but wouldn't it make sense, as Reiner said, to use
a mm-url.el function as the alternative, instead of crafting our own
replacements for it?
Ted
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: "url ping" spam reporting with wget
2003-09-09 18:13 ` Ted Zlatanov
@ 2003-09-09 18:19 ` Ted Zlatanov
2003-09-09 19:50 ` Reiner Steib
0 siblings, 1 reply; 8+ messages in thread
From: Ted Zlatanov @ 2003-09-09 18:19 UTC (permalink / raw)
On Tue, 09 Sep 2003, tzz@lifelogs.com wrote:
On Tue, 09 Sep 2003, 4.uce.03.r.s@nurfuerspam.de wrote:
>
>> Can't we use the functionality already present in `mm-url.el' in
>> `spam-report.el' instead of duplicating very similar variables?
>> (`mm-url-use-external', `mm-url-program', ... [1])
>
> Have you looked at spam-report.el? It does not depend on any other
> packages or external programs, unlike mm-url.el which seems to need
> url.el and one of w3, wget, curl, etc. installed. Am I
> misunderstanding something?
I think I definitely misunderstood, you must mean to make mm-url.el
the alternative to the plain HTTP ping, but leave that in place. I'm
happy with that, if Eric wants to provide the patch.
Ted
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: "url ping" spam reporting with wget
2003-09-09 18:19 ` Ted Zlatanov
@ 2003-09-09 19:50 ` Reiner Steib
0 siblings, 0 replies; 8+ messages in thread
From: Reiner Steib @ 2003-09-09 19:50 UTC (permalink / raw)
On Tue, Sep 09 2003, Ted Zlatanov wrote:
> On Tue, 09 Sep 2003, tzz@lifelogs.com wrote:
> On Tue, 09 Sep 2003, 4.uce.03.r.s@nurfuerspam.de wrote:
>>
>>> Can't we use the functionality already present in `mm-url.el' in
>>> `spam-report.el' instead of duplicating very similar variables?
>>> (`mm-url-use-external', `mm-url-program', ... [1])
>>
>> Have you looked at spam-report.el? It does not depend on any other
>> packages or external programs, unlike mm-url.el which seems to need
>> url.el and one of w3, wget, curl, etc. installed. Am I
>> misunderstanding something?
>
> I think I definitely misunderstood, you must mean to make mm-url.el
> the alternative to the plain HTTP ping, but leave that in place.
Yes, this is what I had in mind. Sorry if my wording wasn't clear.
> I'm happy with that, if Eric wants to provide the patch.
When using `mm-url-...', `autoload' statements could be used instead
of "(require 'mm-url)", so that mm-url isn't loaded unless an
alternative (to the plain HTTP ping) is used.
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- PGP key available via WWW http://rsteib.home.pages.de/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: "url ping" spam reporting with wget
2003-09-09 18:16 ` Ted Zlatanov
@ 2003-09-10 6:52 ` Eric Knauel
2003-09-10 10:18 ` Ted Zlatanov
0 siblings, 1 reply; 8+ messages in thread
From: Eric Knauel @ 2003-09-10 6:52 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 750 bytes --]
Ted Zlatanov <tzz@lifelogs.com> writes:
> On Tue, 09 Sep 2003, knauel@informatik.uni-tuebingen.de wrote:
>> 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.
>
> I like the patch, but wouldn't it make sense, as Reiner said, to use
> a mm-url.el function as the alternative, instead of crafting our own
> replacements for it?
That makes perfect sense to me, I simply wasn't aware that mm-url.el
is already doing this for me. ;-) Here is an updated version of the
patch, autoloading mm-url if needed:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 2505 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 10 Sep 2003 06:46:22 -0000
***************
*** 31,36 ****
--- 31,39 ----
(require 'gnus)
(require 'gnus-sum)
+ (eval-and-compile
+ (autoload 'mm-url-insert "mm-url"))
+
(defgroup spam-report nil
"Spam reporting configuration.")
***************
*** 54,59 ****
--- 57,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 "Connect directly"
+ spam-report-url-ping-plain)
+ (const :tag "Using 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,86 ****
(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
(or (setq tcp-connection
--- 91,104 ----
(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 using
! the method specified in `spam-report-url-ping-function' for actually
! doing this."
! (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
***************
*** 94,99 ****
--- 112,125 ----
(process-send-string tcp-connection
(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)
[-- 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
* Re: "url ping" spam reporting with wget
2003-09-10 6:52 ` Eric Knauel
@ 2003-09-10 10:18 ` Ted Zlatanov
0 siblings, 0 replies; 8+ messages in thread
From: Ted Zlatanov @ 2003-09-10 10:18 UTC (permalink / raw)
Cc: ding
On Wed, 10 Sep 2003, knauel@informatik.uni-tuebingen.de wrote:
> That makes perfect sense to me, I simply wasn't aware that mm-url.el
> is already doing this for me. ;-) Here is an updated version of the
> patch, autoloading mm-url if needed:
Applied with some minor wording changes. Thanks!
Ted
^ 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).