Synch to No Gnus 200402092051.
authoryamaoka <yamaoka>
Mon, 9 Feb 2004 21:54:10 +0000 (21:54 +0000)
committeryamaoka <yamaoka>
Mon, 9 Feb 2004 21:54:10 +0000 (21:54 +0000)
lisp/ChangeLog
lisp/spam-report.el
lisp/spam.el

index 9bababb..c5a557e 100644 (file)
@@ -1,3 +1,14 @@
+2004-02-09  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * spam-report.el (spam-report-unplug-agent)
+       (spam-report-plug-agent, spam-report-deagentize)
+       (spam-report-agentize, spam-report-url-ping-temp-agent-function):
+       support for the Agent in spam-report: when unplugged, report to a
+       file; when plugged, submit all the requests
+
+       * spam.el (spam-register-routine): improved message about
+       registration
+
 2004-02-09  Jesper Harder  <harder@ifa.au.dk>
 
        * rfc2047.el (rfc2047-qp-or-base64): New function to reduce
index 59ef414..fb0c8e4 100644 (file)
@@ -79,6 +79,11 @@ The function must accept the arguments `host' and `report'."
   :type 'file
   :group 'spam-report)
 
+(defvar spam-report-url-ping-temp-agent-function nil
+  "This variable will store the value of
+spam-report-url-ping-function from before spam-report-agentize
+was run, so that spam-report-deagentize can undo that change.")
+
 (defun spam-report-gmane (&rest articles)
   "Report an article as spam through Gmane"
   (dolist (article articles)
@@ -188,6 +193,42 @@ Customize `spam-report-url-ping-function' to use this function."
       (newline)
       (append-to-file (point-min) (point-max) file))))
 
+(defun spam-report-agentize ()
+  "Add spam-report support to the Agent.
+Spam reports will be queued with \\[spam-report-url-to-file] when
+the Agent is unplugged, and will be submitted in a batch when the
+Agent is plugged.."
+  (interactive)
+  (add-hook 'gnus-agent-plugged-hook 'spam-report-plug-agent)
+  (add-hook 'gnus-agent-unplugged-hook 'spam-report-unplug-agent))
+
+(defun spam-report-deagentize ()
+  "Remove spam-report support from the Agent.
+Spam reports will be queued with the method used when
+\\[spam-report-agentize] was run."
+  (interactive)
+  (remove-hook 'gnus-agent-plugged-hook 'spam-report-plug-agent)
+  (remove-hook 'gnus-agent-unplugged-hook 'spam-report-unplug-agent))
+
+(defun spam-report-plug-agent ()
+  ;; process the queue, unless the user only wanted to report to a file anyway
+  (unless (equal spam-report-url-ping-temp-agent-function 
+                spam-report-url-to-file)
+    (spam-report-process-queue))
+  ;; set the reporting function, if we have memorized something
+  ;; otherwise, stick with plain URL reporting
+  (setq spam-report-url-ping-function
+       (or spam-report-url-ping-temp-agent-function
+           spam-report-url-ping-plain)))
+
+(defun spam-report-unplug-agent ()
+  ;; save the old value
+  (setq spam-report-url-ping-temp-agent-function 
+       spam-report-url-ping-function)
+  ;; store all reports to file
+  (setq spam-report-url-ping-function
+       'spam-report-url-to-file))
+
 (provide 'spam-report)
 
 ;;; spam-report.el ends here.
index d28bc9d..2dec99b 100644 (file)
@@ -1248,7 +1248,7 @@ functions")
                            gnus-newsgroup-articles
                            classification)))
        ;; process them
-       (gnus-message 5 "%s %d %s articles: classification %s, spam-check %s"
+       (gnus-message 5 "%s %d %s articles as %s using backend %s"
                      (if unregister "Unregistering" "Registering")
                      (length articles)
                      (if specific-articles "specific" "")