* spam.el (spam-directory): Derive from `gnus-directory'.
authorReiner Steib <Reiner.Steib@gmx.de>
Tue, 3 Feb 2004 20:42:58 +0000 (20:42 +0000)
committerReiner Steib <Reiner.Steib@gmx.de>
Tue, 3 Feb 2004 20:42:58 +0000 (20:42 +0000)
* spam-report.el (spam-report-url-to-file)
(spam-report-requests-file): New function and variable for offline reporting.
(spam-report-url-ping-function): Add `spam-report-url-to-file' and user
defined function.
(spam-report-url-ping-mm-url): Remove doubled slash.

lisp/ChangeLog
lisp/spam-report.el
lisp/spam.el

index bba89cc..04c67f2 100644 (file)
@@ -1,3 +1,14 @@
+2004-02-03  Reiner Steib  <Reiner.Steib@gmx.de>
+
+       * spam.el (spam-directory): Derive from `gnus-directory'.
+
+       * spam-report.el (spam-report-url-to-file)
+       (spam-report-requests-file): New function and variable for offline
+       reporting.
+       (spam-report-url-ping-function): Add `spam-report-url-to-file'
+       and user defined function.
+       (spam-report-url-ping-mm-url): Remove doubled slash.
+
 2004-02-03  Teodor Zlatanov  <tzz@lifelogs.com>
 
        * spam.el (spam-list-of-processors): fixed spamassassin variable names
index efd6778..2307cc8 100644 (file)
@@ -59,12 +59,24 @@ instead."
 
 (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/" "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)
@@ -118,9 +130,21 @@ the function specified by `spam-report-url-ping-function'."
 the external program specified in `mm-url-program' to connect to
 server."
   (with-temp-buffer
-    (let ((url (concat "http://" host "/" report)))
+    (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-make-directory (file-name-directory 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.
index 00d091a..8a22abf 100644 (file)
@@ -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)