From: Teodor Zlatanov Date: Mon, 9 Feb 2004 20:51:44 +0000 (+0000) Subject: * spam-report.el (spam-report-unplug-agent) X-Git-Url: http://cgit.sxemacs.org/?a=commitdiff_plain;h=10356db2f24dcdc232c6c0e35ab79dfeeea9f5f2;p=gnus * 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 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9bababb79..c5a557e3c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,14 @@ +2004-02-09 Teodor Zlatanov + + * 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 * rfc2047.el (rfc2047-qp-or-base64): New function to reduce diff --git a/lisp/spam-report.el b/lisp/spam-report.el index 59ef414f0..fb0c8e43e 100644 --- a/lisp/spam-report.el +++ b/lisp/spam-report.el @@ -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. diff --git a/lisp/spam.el b/lisp/spam.el index 99a16db83..a97606c6e 100644 --- a/lisp/spam.el +++ b/lisp/spam.el @@ -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" "")