Mercurial > emacs
annotate lisp/gnus/spam-report.el @ 62333:80f8fd5fdea6
(Completion Commands): Correct reference.
(Completion Options): Fix typo.
author | Luc Teirlinck <teirllm@auburn.edu> |
---|---|
date | Sat, 14 May 2005 14:05:59 +0000 |
parents | de8a95c880bd |
children | 9f49da4a429d |
rev | line source |
---|---|
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
1 ;;; spam-report.el --- Reporting spam |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
2 ;; Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
3 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
4 ;; Author: Teodor Zlatanov <tzz@lifelogs.com> |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
5 ;; Keywords: network |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
6 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
7 ;; This file is part of GNU Emacs. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
8 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
9 ;; GNU Emacs is free software; you can redistribute it and/or modify |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
10 ;; it under the terms of the GNU General Public License as published by |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
11 ;; the Free Software Foundation; either version 2, or (at your option) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
12 ;; any later version. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
13 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
14 ;; GNU Emacs is distributed in the hope that it will be useful, |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
17 ;; GNU General Public License for more details. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
18 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
19 ;; You should have received a copy of the GNU General Public License |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
22 ;; Boston, MA 02111-1307, USA. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
23 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
24 ;;; Commentary: |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
25 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
26 ;;; This module addresses a few aspects of spam reporting under Gnus. Page |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
27 ;;; breaks are used for grouping declarations and documentation relating to |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
28 ;;; each particular aspect. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
29 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
30 ;;; Code: |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
31 (require 'gnus) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
32 (require 'gnus-sum) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
33 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
34 (eval-and-compile |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
35 (autoload 'mm-url-insert "mm-url")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
36 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
37 (defgroup spam-report nil |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
38 "Spam reporting configuration.") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
39 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
40 (defcustom spam-report-gmane-regex nil |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
41 "Regexp matching Gmane newsgroups, e.g. \"^nntp\\+.*:gmane\\.\" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
42 If you are using spam.el, consider setting gnus-spam-process-newsgroups |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
43 or the gnus-group-spam-exit-processor-report-gmane group/topic parameter |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
44 instead." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
45 :type '(radio (const nil) |
58835
9bdd97960431
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-716
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
46 (regexp :value "^nntp\+.*:gmane\.")) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
47 :group 'spam-report) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
48 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
49 (defcustom spam-report-gmane-spam-header |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
50 "^X-Report-Spam: http://\\([^/]+\\)\\(.*\\)$" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
51 "String matching Gmane spam-reporting header. Two match groups are needed." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
52 :type 'regexp |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
53 :group 'spam-report) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
54 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
55 (defcustom spam-report-gmane-use-article-number t |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
56 "Whether the article number (faster!) or the header should be used." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
57 :type 'boolean |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
58 :group 'spam-report) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
59 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
60 (defcustom spam-report-url-ping-function |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
61 'spam-report-url-ping-plain |
61822
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
62 "Function to use for url ping spam reporting. |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
63 The function must accept the arguments `host' and `report'." |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
64 :type '(choice |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
65 (const :tag "Connect directly" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
66 spam-report-url-ping-plain) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
67 (const :tag "Use the external program specified in `mm-url-program'" |
61822
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
68 spam-report-url-ping-mm-url) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
69 (const :tag "Store request URLs in `spam-report-requests-file'" |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
70 spam-report-url-to-file) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
71 (function :tag "User defined function" nil)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
72 :group 'spam-report) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
73 |
61822
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
74 (defcustom spam-report-requests-file |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
75 (nnheader-concat gnus-directory "spam/" "spam-report-requests.url") |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
76 ;; Is there a convention for the extension of such a file? |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
77 ;; Should we use `spam-directory'? |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
78 "File where spam report request are stored." |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
79 :type 'file |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
80 :group 'spam-report) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
81 |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
82 (defvar spam-report-url-ping-temp-agent-function nil |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
83 "Internal variable for `spam-report-agentize' and `spam-report-deagentize'. |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
84 This variable will store the value of `spam-report-url-ping-function' from |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
85 before `spam-report-agentize' was run, so that `spam-report-deagentize' can |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
86 undo that change.") |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
87 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
88 (defun spam-report-gmane (&rest articles) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
89 "Report an article as spam through Gmane" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
90 (dolist (article articles) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
91 (when (and gnus-newsgroup-name |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
92 (or (null spam-report-gmane-regex) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
93 (string-match spam-report-gmane-regex gnus-newsgroup-name))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
94 (gnus-message 6 "Reporting spam article %d to spam.gmane.org..." article) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
95 (if spam-report-gmane-use-article-number |
61822
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
96 (spam-report-url-ping |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
97 "spam.gmane.org" |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
98 (format "/%s:%d" |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
99 (gnus-group-real-name gnus-newsgroup-name) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
100 article)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
101 (with-current-buffer nntp-server-buffer |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
102 (gnus-request-head article gnus-newsgroup-name) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
103 (goto-char (point-min)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
104 (if (re-search-forward spam-report-gmane-spam-header nil t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
105 (let* ((host (match-string 1)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
106 (report (match-string 2)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
107 (url (format "http://%s%s" host report))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
108 (gnus-message 7 "Reporting spam through URL %s..." url) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
109 (spam-report-url-ping host report)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
110 (gnus-message 3 "Could not find X-Report-Spam in article %d..." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
111 article))))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
112 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
113 (defun spam-report-url-ping (host report) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
114 "Ping a host through HTTP, addressing a specific GET resource using |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
115 the function specified by `spam-report-url-ping-function'." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
116 (funcall spam-report-url-ping-function host report)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
117 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
118 (defun spam-report-url-ping-plain (host report) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
119 "Ping a host through HTTP, addressing a specific GET resource." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
120 (let ((tcp-connection)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
121 (with-temp-buffer |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
122 (or (setq tcp-connection |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
123 (open-network-stream |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
124 "URL ping" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
125 (buffer-name) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
126 host |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
127 80)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
128 (error "Could not open connection to %s" host)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
129 (set-marker (process-mark tcp-connection) (point-min)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
130 (process-send-string |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
131 tcp-connection |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
132 (format "GET %s HTTP/1.1\nUser-Agent: %s (spam-report.el)\nHost: %s\n\n" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
133 report (gnus-emacs-version) host))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
134 |
61822
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
135 ;;;###autoload |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
136 (defun spam-report-process-queue (&optional file keep) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
137 "Report all queued requests from `spam-report-requests-file'. |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
138 |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
139 If FILE is given, use it instead of `spam-report-requests-file'. |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
140 If KEEP is t, leave old requests in the file. If KEEP is the |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
141 symbol `ask', query before flushing the queue file." |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
142 (interactive |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
143 (list (read-file-name |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
144 "File: " |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
145 (file-name-directory spam-report-requests-file) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
146 spam-report-requests-file |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
147 nil |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
148 (file-name-nondirectory spam-report-requests-file)) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
149 current-prefix-arg)) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
150 (if (eq spam-report-url-ping-function 'spam-report-url-to-file) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
151 (error (concat "Cannot process requests when " |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
152 "`spam-report-url-ping-function' is " |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
153 "`spam-report-url-to-file'.")) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
154 (gnus-message 7 "Processing requests using `%s'." |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
155 spam-report-url-ping-function)) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
156 (or file (setq file spam-report-requests-file)) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
157 (save-excursion |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
158 (set-buffer (find-file-noselect file)) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
159 (goto-char (point-min)) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
160 (while (and (not (eobp)) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
161 (re-search-forward |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
162 "http://\\([^/]+\\)\\(/.*\\) *$" (point-at-eol) t)) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
163 (funcall spam-report-url-ping-function (match-string 1) (match-string 2)) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
164 (forward-line 1)) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
165 (if (or (eq keep nil) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
166 (and (eq keep 'ask) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
167 (y-or-n-p |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
168 (format |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
169 "Flush requests from `%s'? " (current-buffer))))) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
170 (progn |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
171 (gnus-message 7 "Flushing request file `%s'" |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
172 spam-report-requests-file) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
173 (erase-buffer) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
174 (save-buffer) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
175 (kill-buffer (current-buffer))) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
176 (gnus-message 7 "Keeping requests in `%s'" spam-report-requests-file)))) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
177 |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
178 ;;;###autoload |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
179 (defun spam-report-url-ping-mm-url (host report) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
180 "Ping a host through HTTP, addressing a specific GET resource. Use |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
181 the external program specified in `mm-url-program' to connect to |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
182 server." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
183 (with-temp-buffer |
61822
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
184 (let ((url (concat "http://" host report))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
185 (mm-url-insert url t)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
186 |
61822
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
187 ;;;###autoload |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
188 (defun spam-report-url-to-file (host report) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
189 "Collect spam report requests in `spam-report-requests-file'. |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
190 Customize `spam-report-url-ping-function' to use this function." |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
191 (let ((url (concat "http://" host report)) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
192 (file spam-report-requests-file)) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
193 (gnus-make-directory (file-name-directory file)) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
194 (gnus-message 9 "Writing URL `%s' to file `%s'" url file) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
195 (with-temp-buffer |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
196 (insert url) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
197 (newline) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
198 (append-to-file (point-min) (point-max) file)))) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
199 |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
200 ;;;###autoload |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
201 (defun spam-report-agentize () |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
202 "Add spam-report support to the Agent. |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
203 Spam reports will be queued with \\[spam-report-url-to-file] when |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
204 the Agent is unplugged, and will be submitted in a batch when the |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
205 Agent is plugged." |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
206 (interactive) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
207 (add-hook 'gnus-agent-plugged-hook 'spam-report-plug-agent) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
208 (add-hook 'gnus-agent-unplugged-hook 'spam-report-unplug-agent)) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
209 |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
210 ;;;###autoload |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
211 (defun spam-report-deagentize () |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
212 "Remove spam-report support from the Agent. |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
213 Spam reports will be queued with the method used when |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
214 \\[spam-report-agentize] was run." |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
215 (interactive) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
216 (remove-hook 'gnus-agent-plugged-hook 'spam-report-plug-agent) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
217 (remove-hook 'gnus-agent-unplugged-hook 'spam-report-unplug-agent)) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
218 |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
219 (defun spam-report-plug-agent () |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
220 "Adjust spam report settings for plugged state. |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
221 Process queued spam reports." |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
222 ;; Process the queue, unless the user only wanted to report to a file |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
223 ;; anyway. |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
224 (unless (equal spam-report-url-ping-temp-agent-function |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
225 'spam-report-url-to-file) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
226 (spam-report-process-queue)) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
227 ;; Set the reporting function, if we have memorized something otherwise, |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
228 ;; stick with plain URL reporting. |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
229 (setq spam-report-url-ping-function |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
230 (or spam-report-url-ping-temp-agent-function |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
231 'spam-report-url-ping-plain))) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
232 |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
233 (defun spam-report-unplug-agent () |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
234 "Restore spam report settings for unplugged state." |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
235 ;; save the old value |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
236 (setq spam-report-url-ping-temp-agent-function |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
237 spam-report-url-ping-function) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
238 ;; store all reports to file |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
239 (setq spam-report-url-ping-function |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
240 'spam-report-url-to-file)) |
de8a95c880bd
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-277
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
241 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
242 (provide 'spam-report) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
243 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
244 ;;; arch-tag: f6683295-ec89-4ab5-8803-8cc842293022 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
245 ;;; spam-report.el ends here. |