From aeaa40abb6c18db02a90e67abf707e6f2c88b9c8 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Mon, 9 Feb 2004 21:54:10 +0000 Subject: [PATCH] Synch to No Gnus 200402092051. --- lisp/ChangeLog | 11 +++++++++++ lisp/spam-report.el | 41 +++++++++++++++++++++++++++++++++++++++++ lisp/spam.el | 2 +- 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9bababb..c5a557e 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 59ef414..fb0c8e4 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 d28bc9d..2dec99b 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" "") -- 1.7.10.4