Gnus development mailing list
 help / color / mirror / Atom feed
* [spam-report.el] Offline Gmane spam reporting
@ 2004-02-01 14:35 Reiner Steib
  2004-02-01 21:39 ` Kai Grossjohann
  2004-02-02 20:10 ` Ted Zlatanov
  0 siblings, 2 replies; 10+ messages in thread
From: Reiner Steib @ 2004-02-01 14:35 UTC (permalink / raw)


Hi,

when I'm reading Gmane groups offline, I cannot use the spam-report
functions.  Wouldn't it be nice to collect the requests (the URLs) in
a file and use them later when online?

The new function `spam-report-url-to-file' collects the request in a
file, see the attached patch[1].  I also added a custom choice in
`spam-report-url-ping-function' to insert a user defined function and
tried to improve the doc-string of this variable.

I'm not sure if we should use `spam-directory' or `gnus-directory' in
the default value of `spam-report-requests-file'.  Is `spam-report.el'
supposed to be independent from `spam.el'?  At least it doesn't
require it.  Somehow related to this: I think `spam.el' should _not_
hard-code "~/News/spam/" as `spam-directory' but use
`gnus-directory'[2] instead, see its doc-string.

I didn't care about code for using the requests file when being online
(yet).  Personally, I would just use...

  file=~/News/spam-report-requests.url
  GET `cat file` && : > file

... from the shell (or some ip-up script).  But we may also add an
interactive lisp function for that (loop over all lines in the file,
use `spam-report-url-ping-plain' and erase the file when done).

Unless there are objections, I will commit both patches along with an
update for the manual.

Bye, Reiner.

[1]
--8<---------------cut here---------------start------------->8---
--- spam-report.el.~6.7.~	Mon Jan  5 11:58:59 2004
+++ spam-report.el	Sun Feb  1 15:08:22 2004
@@ -59,12 +59,24 @@
 
 (defcustom spam-report-url-ping-function
   'spam-report-url-ping-plain
-  "Function to use for url ping spam reporting."
+  "Function to use for url ping spam reporting.
+The function must accept the arguments `host' and `report'."
   :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))
+		 spam-report-url-ping-mm-url)
+	  (const :tag "Store request URLs in `spam-report-requests-file'"
+		 spam-report-url-to-file)
+	  (function :tag "User defined function" nil))
+  :group 'spam-report)
+
+(defcustom spam-report-requests-file
+  (nnheader-concat gnus-directory "spam-report-requests.url")
+  ;; Is there a convention for the extension of such a file?
+  ;; Should we use `spam-directory'?
+  "File where spam report request are stored."
+  :type 'file
   :group 'spam-report)
 
 (defun spam-report-gmane (&rest articles)
@@ -121,6 +133,17 @@
     (let ((url (concat "http://" host "/" report)))
       (mm-url-insert url t))))
 
+(defun spam-report-url-to-file (host report)
+  "Collect spam report requests in `spam-report-requests-file'.
+Customize `spam-report-url-ping-function' to use this function."
+  (let ((url (concat "http://" host "/" report))
+	(file spam-report-requests-file))
+    (gnus-message 9 "Writing URL `%s' to file `%s'" url file)
+    (with-temp-buffer
+      (insert url)
+      (newline)
+      (append-to-file (point-min) (point-max) file))))
+
 (provide 'spam-report)
 
 ;;; spam-report.el ends here.
--8<---------------cut here---------------end--------------->8---

[2]
--8<---------------cut here---------------start------------->8---
--- spam.el.~6.142.~	Mon Jan 26 21:06:50 2004
+++ spam.el	Sun Feb  1 15:02:00 2004
@@ -73,7 +73,7 @@
 (defgroup spam nil
   "Spam configuration.")
 
-(defcustom spam-directory "~/News/spam/"
+(defcustom spam-directory (nnheader-concat gnus-directory "spam/")
   "Directory for spam whitelists and blacklists."
   :type 'directory
   :group 'spam)
--8<---------------cut here---------------end--------------->8---
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo--- PGP key available via WWW   http://rsteib.home.pages.de/




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

end of thread, other threads:[~2004-02-24 14:05 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-01 14:35 [spam-report.el] Offline Gmane spam reporting Reiner Steib
2004-02-01 21:39 ` Kai Grossjohann
2004-02-01 23:40   ` Reiner Steib
2004-02-02 14:46     ` Kai Grossjohann
2004-02-02 20:10 ` Ted Zlatanov
2004-02-03 22:59   ` Reiner Steib
2004-02-05 20:30     ` Ted Zlatanov
2004-02-05 22:07       ` Reiner Steib
2004-02-09 20:51         ` Ted Zlatanov
2004-02-24 14:05           ` Reiner Steib

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).