annotate lisp/gnus/gnus-nocem.el @ 102564:a96ffe85a853

Checked debugging.texi.
author Chong Yidong <cyd@stupidchicken.com>
date Sat, 14 Mar 2009 21:22:04 +0000
parents cbe2949923c1
children 1d1d5d9bd884
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1 ;;; gnus-nocem.el --- NoCeM pseudo-cancellation treatment
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
2
74547
183eba998a4d Update copyright years.
Glenn Morris <rgm@gnu.org>
parents: 69362
diff changeset
3 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
100908
a9dc0e7c3f2b Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 94662
diff changeset
4 ;; 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
5
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
7 ;; Keywords: news
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
8
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
10
94662
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
94662
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
13 ;; the Free Software Foundation, either version 3 of the License, or
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
14 ;; (at your option) any later version.
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
15
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
20
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
94662
f42ef85caf91 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
23
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
24 ;;; Commentary:
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
25
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
26 ;;; Code:
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
27
19539
0f90eb270fc7 Require cl at compile time.
Richard M. Stallman <rms@gnu.org>
parents: 17493
diff changeset
28 (eval-when-compile (require 'cl))
0f90eb270fc7 Require cl at compile time.
Richard M. Stallman <rms@gnu.org>
parents: 17493
diff changeset
29
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
30 (require 'gnus)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
31 (require 'nnmail)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
32 (require 'gnus-art)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
33 (require 'gnus-sum)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
34 (require 'gnus-range)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
35
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
36 (defgroup gnus-nocem nil
63976
0629e50e00f6 (gnus-nocem): Finish `defgroup' description with period.
Juanma Barranquero <lekktu@gmail.com>
parents: 63868
diff changeset
37 "NoCeM pseudo-cancellation treatment."
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
38 :group 'gnus-score)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
39
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
40 (defcustom gnus-nocem-groups
102204
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
41 '("news.lists.filters" "alt.nocem.misc")
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
42 "*List of groups that will be searched for NoCeM messages."
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
43 :group 'gnus-nocem
102204
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
44 :version "23.1"
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
45 :type '(repeat (string :tag "Group")))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
46
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
47 (defcustom gnus-nocem-issuers
102204
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
48 '("Adri Verhoef"
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
49 "alba-nocem@albasani.net"
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
50 "bleachbot@httrack.com"
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
51 "news@arcor-online.net"
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
52 "news@uni-berlin.de"
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
53 "nocem@arcor.de"
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
54 "pgpmoose@killfile.org"
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
55 "xjsppl@gmx.de")
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
56 "*List of NoCeM issuers to pay attention to.
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
57
32626
2724f978c9e2 (gnus-nocem-issuers): Update.
Dave Love <fx@gnu.org>
parents: 32599
diff changeset
58 This can also be a list of `(ISSUER CONDITION ...)' elements.
2724f978c9e2 (gnus-nocem-issuers): Update.
Dave Love <fx@gnu.org>
parents: 32599
diff changeset
59
2724f978c9e2 (gnus-nocem-issuers): Update.
Dave Love <fx@gnu.org>
parents: 32599
diff changeset
60 See <URL:http://www.xs4all.nl/~rosalind/nocemreg/nocemreg.html> for an
2724f978c9e2 (gnus-nocem-issuers): Update.
Dave Love <fx@gnu.org>
parents: 32599
diff changeset
61 issuer registry."
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
62 :group 'gnus-nocem
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
63 :link '(url-link "http://www.xs4all.nl/~rosalind/nocemreg/nocemreg.html")
102204
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
64 :version "23.1"
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
65 :type '(repeat (cons :format "%v" (string :tag "Issuer")
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
66 (repeat :tag "Condition"
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
67 (group (checklist :inline t (const not))
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
68 (regexp :tag "Type" :value ".*")))))
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
69 :get (lambda (symbol)
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
70 (mapcar (lambda (elem)
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
71 (if (consp elem)
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
72 (cons (car elem)
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
73 (mapcar (lambda (elt)
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
74 (if (consp elt) elt (list elt)))
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
75 (cdr elem)))
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
76 (list elem)))
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
77 (default-value symbol)))
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
78 :set (lambda (symbol value)
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
79 (custom-set-default
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
80 symbol
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
81 (mapcar (lambda (elem)
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
82 (if (consp elem)
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
83 (if (cdr elem)
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
84 (mapcar (lambda (elt)
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
85 (if (consp elt)
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
86 (if (cdr elt) elt (car elt))
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
87 elt))
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
88 elem)
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
89 (car elem))
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
90 elem))
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
91 value))))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
92
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
93 (defcustom gnus-nocem-directory
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
94 (nnheader-concat gnus-article-save-directory "NoCeM/")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
95 "*Directory where NoCeM files will be stored."
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
96 :group 'gnus-nocem
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
97 :type 'directory)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
98
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
99 (defcustom gnus-nocem-expiry-wait 15
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
100 "*Number of days to keep NoCeM headers in the cache."
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
101 :group 'gnus-nocem
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
102 :type 'integer)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
103
102204
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
104 (defcustom gnus-nocem-verifyer (if (locate-library "epg")
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
105 'gnus-nocem-epg-verify
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
106 'pgg-verify)
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
107 "*Function called to verify that the NoCeM message is valid.
102204
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
108 If the function in this variable isn't bound, the message will be used
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
109 unconditionally."
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
110 :group 'gnus-nocem
102204
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
111 :version "23.1"
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
112 :type '(radio (function-item gnus-nocem-epg-verify)
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
113 (function-item pgg-verify)
63868
e903f947651d Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-458
Miles Bader <miles@gnu.org>
parents: 56927
diff changeset
114 (function-item mc-verify)
102204
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
115 (function :tag "other"))
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
116 :set (lambda (symbol value)
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
117 (custom-set-default symbol
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
118 (if (and (eq value 'gnus-nocem-epg-verify)
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
119 (not (locate-library "epg")))
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
120 'pgg-verify
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
121 value))))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
122
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
123 (defcustom gnus-nocem-liberal-fetch nil
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
124 "*If t try to fetch all messages which have @@NCM in the subject.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
125 Otherwise don't fetch messages which have references or whose message-id
47936
54348dbd8b9c (gnus-nocem-liberal-fetch): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 33178
diff changeset
126 matches a previously scanned and verified nocem message."
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
127 :group 'gnus-nocem
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
128 :type 'boolean)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
129
33178
23d4e36c09fc (gnus-nocem-check-article-limit): Default to 500.
Dave Love <fx@gnu.org>
parents: 32626
diff changeset
130 (defcustom gnus-nocem-check-article-limit 500
32599
0db9e380f3ec (gnus-nocem-check-article-limit): New variable.
Miles Bader <miles@gnu.org>
parents: 31716
diff changeset
131 "*If non-nil, the maximum number of articles to check in any NoCeM group."
0db9e380f3ec (gnus-nocem-check-article-limit): New variable.
Miles Bader <miles@gnu.org>
parents: 31716
diff changeset
132 :group 'gnus-nocem
32626
2724f978c9e2 (gnus-nocem-issuers): Update.
Dave Love <fx@gnu.org>
parents: 32599
diff changeset
133 :version "21.1"
32599
0db9e380f3ec (gnus-nocem-check-article-limit): New variable.
Miles Bader <miles@gnu.org>
parents: 31716
diff changeset
134 :type '(choice (const :tag "unlimited" nil)
0db9e380f3ec (gnus-nocem-check-article-limit): New variable.
Miles Bader <miles@gnu.org>
parents: 31716
diff changeset
135 (integer 1000)))
0db9e380f3ec (gnus-nocem-check-article-limit): New variable.
Miles Bader <miles@gnu.org>
parents: 31716
diff changeset
136
32626
2724f978c9e2 (gnus-nocem-issuers): Update.
Dave Love <fx@gnu.org>
parents: 32599
diff changeset
137 (defcustom gnus-nocem-check-from t
2724f978c9e2 (gnus-nocem-issuers): Update.
Dave Love <fx@gnu.org>
parents: 32599
diff changeset
138 "Non-nil means check for valid issuers in message bodies.
2724f978c9e2 (gnus-nocem-issuers): Update.
Dave Love <fx@gnu.org>
parents: 32599
diff changeset
139 Otherwise don't bother fetching articles unless their author matches a
2724f978c9e2 (gnus-nocem-issuers): Update.
Dave Love <fx@gnu.org>
parents: 32599
diff changeset
140 valid issuer, which is much faster if you are selective about the issuers."
2724f978c9e2 (gnus-nocem-issuers): Update.
Dave Love <fx@gnu.org>
parents: 32599
diff changeset
141 :group 'gnus-nocem
2724f978c9e2 (gnus-nocem-issuers): Update.
Dave Love <fx@gnu.org>
parents: 32599
diff changeset
142 :version "21.1"
2724f978c9e2 (gnus-nocem-issuers): Update.
Dave Love <fx@gnu.org>
parents: 32599
diff changeset
143 :type 'boolean)
2724f978c9e2 (gnus-nocem-issuers): Update.
Dave Love <fx@gnu.org>
parents: 32599
diff changeset
144
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
145 ;;; Internal variables
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
146
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
147 (defvar gnus-nocem-active nil)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
148 (defvar gnus-nocem-alist nil)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
149 (defvar gnus-nocem-touched-alist nil)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
150 (defvar gnus-nocem-hashtb nil)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
151 (defvar gnus-nocem-seen-message-ids nil)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
152
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
153 ;;; Functions
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
154
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
155 (defun gnus-nocem-active-file ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
156 (concat (file-name-as-directory gnus-nocem-directory) "active"))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
157
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
158 (defun gnus-nocem-cache-file ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
159 (concat (file-name-as-directory gnus-nocem-directory) "cache"))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
160
19969
5f1ab3dd344d *** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19539
diff changeset
161 ;;
5f1ab3dd344d *** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19539
diff changeset
162 ;; faster lookups for group names:
5f1ab3dd344d *** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19539
diff changeset
163 ;;
5f1ab3dd344d *** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19539
diff changeset
164
5f1ab3dd344d *** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19539
diff changeset
165 (defvar gnus-nocem-real-group-hashtb nil
5f1ab3dd344d *** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19539
diff changeset
166 "Real-name mappings of subscribed groups.")
5f1ab3dd344d *** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19539
diff changeset
167
5f1ab3dd344d *** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19539
diff changeset
168 (defun gnus-fill-real-hashtb ()
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
169 "Fill up a hash table with the real-name mappings from the user's active file."
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
170 (if (hash-table-p gnus-nocem-real-group-hashtb)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
171 (clrhash gnus-nocem-real-group-hashtb)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
172 (setq gnus-nocem-real-group-hashtb (make-hash-table :test 'equal)))
19969
5f1ab3dd344d *** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19539
diff changeset
173 (mapcar (lambda (group)
5f1ab3dd344d *** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19539
diff changeset
174 (setq group (gnus-group-real-name (car group)))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
175 (puthash group t gnus-nocem-real-group-hashtb))
19969
5f1ab3dd344d *** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19539
diff changeset
176 gnus-newsrc-alist))
5f1ab3dd344d *** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19539
diff changeset
177
69362
29fe34ec2296 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-147
Miles Bader <miles@gnu.org>
parents: 68633
diff changeset
178 ;;;###autoload
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
179 (defun gnus-nocem-scan-groups ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
180 "Scan all NoCeM groups for new NoCeM messages."
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
181 (interactive)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
182 (let ((groups gnus-nocem-groups)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
183 (gnus-inhibit-demon t)
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
184 group active gactive articles check-headers)
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
185 (gnus-make-directory gnus-nocem-directory)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
186 ;; Load any previous NoCeM headers.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
187 (gnus-nocem-load-cache)
19969
5f1ab3dd344d *** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19539
diff changeset
188 ;; Get the group name mappings:
5f1ab3dd344d *** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19539
diff changeset
189 (gnus-fill-real-hashtb)
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
190 ;; Read the active file if it hasn't been read yet.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
191 (and (file-exists-p (gnus-nocem-active-file))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
192 (not gnus-nocem-active)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
193 (ignore-errors
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
194 (load (gnus-nocem-active-file) t t t)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
195 ;; Go through all groups and see whether new articles have
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
196 ;; arrived.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
197 (while (setq group (pop groups))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
198 (if (not (setq gactive (gnus-activate-group group)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
199 () ; This group doesn't exist.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
200 (setq active (nth 1 (assoc group gnus-nocem-active)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
201 (when (and (not (< (cdr gactive) (car gactive))) ; Empty group.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
202 (or (not active)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
203 (< (cdr active) (cdr gactive))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
204 ;; Ok, there are new articles in this group, se we fetch the
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
205 ;; headers.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
206 (save-excursion
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
207 (let ((dependencies (make-vector 10 nil))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
208 headers header)
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
209 (with-temp-buffer
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
210 (setq headers
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
211 (if (eq 'nov
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
212 (gnus-retrieve-headers
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
213 (setq articles
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
214 (gnus-uncompress-range
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
215 (cons
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
216 (if active (1+ (cdr active))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
217 (car gactive))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
218 (cdr gactive))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
219 group))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
220 (gnus-get-newsgroup-headers-xover
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
221 articles nil dependencies)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
222 (gnus-get-newsgroup-headers dependencies)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
223 (while (setq header (pop headers))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
224 ;; We take a closer look on all articles that have
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
225 ;; "@@NCM" in the subject. Unless we already read
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
226 ;; this cross posted message. Nocem messages
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
227 ;; are not allowed to have references, so we can
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
228 ;; ignore scanning followups.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
229 (and (string-match "@@NCM" (mail-header-subject header))
32626
2724f978c9e2 (gnus-nocem-issuers): Update.
Dave Love <fx@gnu.org>
parents: 32599
diff changeset
230 (and gnus-nocem-check-from
2724f978c9e2 (gnus-nocem-issuers): Update.
Dave Love <fx@gnu.org>
parents: 32599
diff changeset
231 (let ((case-fold-search t))
2724f978c9e2 (gnus-nocem-issuers): Update.
Dave Love <fx@gnu.org>
parents: 32599
diff changeset
232 (catch 'ok
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
233 (mapc
32626
2724f978c9e2 (gnus-nocem-issuers): Update.
Dave Love <fx@gnu.org>
parents: 32599
diff changeset
234 (lambda (author)
2724f978c9e2 (gnus-nocem-issuers): Update.
Dave Love <fx@gnu.org>
parents: 32599
diff changeset
235 (if (consp author)
2724f978c9e2 (gnus-nocem-issuers): Update.
Dave Love <fx@gnu.org>
parents: 32599
diff changeset
236 (setq author (car author)))
2724f978c9e2 (gnus-nocem-issuers): Update.
Dave Love <fx@gnu.org>
parents: 32599
diff changeset
237 (if (string-match
2724f978c9e2 (gnus-nocem-issuers): Update.
Dave Love <fx@gnu.org>
parents: 32599
diff changeset
238 author (mail-header-from header))
2724f978c9e2 (gnus-nocem-issuers): Update.
Dave Love <fx@gnu.org>
parents: 32599
diff changeset
239 (throw 'ok t)))
2724f978c9e2 (gnus-nocem-issuers): Update.
Dave Love <fx@gnu.org>
parents: 32599
diff changeset
240 gnus-nocem-issuers)
2724f978c9e2 (gnus-nocem-issuers): Update.
Dave Love <fx@gnu.org>
parents: 32599
diff changeset
241 nil)))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
242 (or gnus-nocem-liberal-fetch
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
243 (and (or (string= "" (mail-header-references
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
244 header))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
245 (null (mail-header-references header)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
246 (not (member (mail-header-message-id header)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
247 gnus-nocem-seen-message-ids))))
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
248 (push header check-headers)))
69362
29fe34ec2296 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-147
Miles Bader <miles@gnu.org>
parents: 68633
diff changeset
249 (setq check-headers (last (nreverse check-headers)
29fe34ec2296 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-147
Miles Bader <miles@gnu.org>
parents: 68633
diff changeset
250 gnus-nocem-check-article-limit))
29fe34ec2296 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-147
Miles Bader <miles@gnu.org>
parents: 68633
diff changeset
251 (let ((i 0)
29fe34ec2296 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-147
Miles Bader <miles@gnu.org>
parents: 68633
diff changeset
252 (len (length check-headers)))
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
253 (dolist (h check-headers)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
254 (gnus-message
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
255 7 "Checking article %d in %s for NoCeM (%d of %d)..."
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
256 (mail-header-number h) group (incf i) len)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
257 (gnus-nocem-check-article group h)))))))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
258 (setq gnus-nocem-active
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
259 (cons (list group gactive)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
260 (delq (assoc group gnus-nocem-active)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
261 gnus-nocem-active)))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
262 ;; Save the results, if any.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
263 (gnus-nocem-save-cache)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
264 (gnus-nocem-save-active)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
265
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
266 (defun gnus-nocem-check-article (group header)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
267 "Check whether the current article is an NCM article and that we want it."
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
268 ;; Get the article.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
269 (let ((date (mail-header-date header))
32626
2724f978c9e2 (gnus-nocem-issuers): Update.
Dave Love <fx@gnu.org>
parents: 32599
diff changeset
270 (gnus-newsgroup-name group)
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
271 issuer b e type)
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
272 (when (or (not date)
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
273 (time-less-p
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
274 (time-since (date-to-time date))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
275 (days-to-time gnus-nocem-expiry-wait)))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
276 (gnus-request-article-this-buffer (mail-header-number header) group)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
277 (goto-char (point-min))
69362
29fe34ec2296 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-147
Miles Bader <miles@gnu.org>
parents: 68633
diff changeset
278 (when (re-search-forward
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
279 "-----BEGIN PGP\\(?: SIGNED\\)? MESSAGE-----"
69362
29fe34ec2296 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-147
Miles Bader <miles@gnu.org>
parents: 68633
diff changeset
280 nil t)
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
281 (delete-region (point-min) (match-beginning 0)))
69362
29fe34ec2296 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-147
Miles Bader <miles@gnu.org>
parents: 68633
diff changeset
282 (when (re-search-forward
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
283 "-----END PGP \\(?:MESSAGE\\|SIGNATURE\\)-----\n?"
69362
29fe34ec2296 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-147
Miles Bader <miles@gnu.org>
parents: 68633
diff changeset
284 nil t)
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
285 (delete-region (match-end 0) (point-max)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
286 (goto-char (point-min))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
287 ;; The article has to have proper NoCeM headers.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
288 (when (and (setq b (search-forward "\n@@BEGIN NCM HEADERS\n" nil t))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
289 (setq e (search-forward "\n@@BEGIN NCM BODY\n" nil t)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
290 ;; We get the name of the issuer.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
291 (narrow-to-region b e)
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
292 (setq issuer (mail-fetch-field "issuer")
63868
e903f947651d Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-458
Miles Bader <miles@gnu.org>
parents: 56927
diff changeset
293 type (mail-fetch-field "type"))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
294 (widen)
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
295 (if (not (gnus-nocem-message-wanted-p issuer type))
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
296 (message "invalid NoCeM issuer: %s" issuer)
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
297 (and (gnus-nocem-verify-issuer issuer) ; She is who she says she is.
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
298 (gnus-nocem-enter-article) ; We gobble the message.
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
299 (push (mail-header-message-id header) ; But don't come back for
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
300 gnus-nocem-seen-message-ids))))))) ; second helpings.
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
301
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
302 (defun gnus-nocem-message-wanted-p (issuer type)
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
303 (let ((issuers gnus-nocem-issuers)
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
304 wanted conditions condition)
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
305 (cond
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
306 ;; Do the quick check first.
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
307 ((member issuer issuers)
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
308 t)
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
309 ((setq conditions (cdr (assoc issuer issuers)))
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
310 ;; Check whether we want this type.
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
311 (while (setq condition (pop conditions))
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
312 (cond
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
313 ((stringp condition)
63868
e903f947651d Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-458
Miles Bader <miles@gnu.org>
parents: 56927
diff changeset
314 (when (string-match condition type)
e903f947651d Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-458
Miles Bader <miles@gnu.org>
parents: 56927
diff changeset
315 (setq wanted t)))
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
316 ((and (consp condition)
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
317 (eq (car condition) 'not)
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
318 (stringp (cadr condition)))
63868
e903f947651d Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-458
Miles Bader <miles@gnu.org>
parents: 56927
diff changeset
319 (when (string-match (cadr condition) type)
e903f947651d Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-458
Miles Bader <miles@gnu.org>
parents: 56927
diff changeset
320 (setq wanted nil)))
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
321 (t
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
322 (error "Invalid NoCeM condition: %S" condition))))
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
323 wanted))))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
324
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
325 (defun gnus-nocem-verify-issuer (person)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
326 "Verify using PGP that the canceler is who she says she is."
63868
e903f947651d Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-458
Miles Bader <miles@gnu.org>
parents: 56927
diff changeset
327 (if (functionp gnus-nocem-verifyer)
19969
5f1ab3dd344d *** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19539
diff changeset
328 (ignore-errors
5f1ab3dd344d *** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19539
diff changeset
329 (funcall gnus-nocem-verifyer))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
330 ;; If we don't have Mailcrypt, then we use the message anyway.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
331 t))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
332
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
333 (defun gnus-nocem-enter-article ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
334 "Enter the current article into the NoCeM cache."
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
335 (goto-char (point-min))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
336 (let ((b (search-forward "\n@@BEGIN NCM BODY\n" nil t))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
337 (e (search-forward "\n@@END NCM BODY\n" nil t))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
338 (buf (current-buffer))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
339 ncm id group)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
340 (when (and b e)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
341 (narrow-to-region b (1+ (match-beginning 0)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
342 (goto-char (point-min))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
343 (while (search-forward "\t" nil t)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
344 (cond
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
345 ((not (ignore-errors
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
346 (setq group (gnus-group-real-name (symbol-name (read buf))))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
347 (gethash group gnus-nocem-real-group-hashtb)))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
348 ;; An error.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
349 )
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
350 (t
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
351 ;; Valid group.
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
352 (beginning-of-line)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
353 (while (eq (char-after) ?\t)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
354 (forward-line -1))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
355 (setq id (buffer-substring (point) (1- (search-forward "\t"))))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
356 (unless (if (hash-table-p gnus-nocem-hashtb)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
357 (gethash id gnus-nocem-hashtb)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
358 (setq gnus-nocem-hashtb (make-hash-table :test 'equal))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
359 nil)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
360 ;; only store if not already present
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
361 (puthash id t gnus-nocem-hashtb)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
362 (push id ncm))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
363 (forward-line 1)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
364 (while (eq (char-after) ?\t)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
365 (forward-line 1)))))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
366 (when ncm
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
367 (setq gnus-nocem-touched-alist t)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
368 (push (cons (let ((time (current-time))) (setcdr (cdr time) nil) time)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
369 ncm)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
370 gnus-nocem-alist))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
371 t)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
372
69362
29fe34ec2296 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-147
Miles Bader <miles@gnu.org>
parents: 68633
diff changeset
373 ;;;###autoload
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
374 (defun gnus-nocem-load-cache ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
375 "Load the NoCeM cache."
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
376 (interactive)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
377 (unless gnus-nocem-alist
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
378 ;; The buffer doesn't exist, so we create it and load the NoCeM
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
379 ;; cache.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
380 (when (file-exists-p (gnus-nocem-cache-file))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
381 (load (gnus-nocem-cache-file) t t t)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
382 (gnus-nocem-alist-to-hashtb))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
383
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
384 (defun gnus-nocem-save-cache ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
385 "Save the NoCeM cache."
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
386 (when (and gnus-nocem-alist
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
387 gnus-nocem-touched-alist)
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
388 (with-temp-file (gnus-nocem-cache-file)
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
389 (gnus-prin1 `(setq gnus-nocem-alist ',gnus-nocem-alist)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
390 (setq gnus-nocem-touched-alist nil)))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
391
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
392 (defun gnus-nocem-save-active ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
393 "Save the NoCeM active file."
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
394 (with-temp-file (gnus-nocem-active-file)
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
395 (gnus-prin1 `(setq gnus-nocem-active ',gnus-nocem-active))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
396
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
397 (defun gnus-nocem-alist-to-hashtb ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
398 "Create a hashtable from the Message-IDs we have."
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
399 (let* ((alist gnus-nocem-alist)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
400 (pprev (cons nil alist))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
401 (prev pprev)
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
402 (expiry (days-to-time gnus-nocem-expiry-wait))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
403 entry)
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
404 (if (hash-table-p gnus-nocem-hashtb)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
405 (clrhash gnus-nocem-hashtb)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
406 (setq gnus-nocem-hashtb (make-hash-table :test 'equal)))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
407 (while (setq entry (car alist))
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
408 (if (not (time-less-p (time-since (car entry)) expiry))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
409 ;; This entry has expired, so we remove it.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
410 (setcdr prev (cdr alist))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
411 (setq prev alist)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
412 ;; This is ok, so we enter it into the hashtable.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
413 (setq entry (cdr entry))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
414 (while entry
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
415 (puthash (car entry) t gnus-nocem-hashtb)
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
416 (setq entry (cdr entry))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
417 (setq alist (cdr alist)))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
418
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
419 (gnus-add-shutdown 'gnus-nocem-close 'gnus)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
420
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
421 (defun gnus-nocem-close ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
422 "Clear internal NoCeM variables."
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
423 (setq gnus-nocem-alist nil
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
424 gnus-nocem-hashtb nil
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
425 gnus-nocem-active nil
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
426 gnus-nocem-touched-alist nil
19969
5f1ab3dd344d *** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19539
diff changeset
427 gnus-nocem-seen-message-ids nil
5f1ab3dd344d *** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19539
diff changeset
428 gnus-nocem-real-group-hashtb nil))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
429
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
430 (defun gnus-nocem-unwanted-article-p (id)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
431 "Say whether article ID in the current group is wanted."
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 19969
diff changeset
432 (and gnus-nocem-hashtb
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
433 (gethash id gnus-nocem-hashtb)))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
434
102204
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
435 (autoload 'epg-make-context "epg")
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
436 (eval-when-compile
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
437 (autoload 'epg-verify-string "epg")
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
438 (autoload 'epg-context-result-for "epg")
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
439 (autoload 'epg-signature-status "epg"))
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
440
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
441 (defun gnus-nocem-epg-verify ()
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
442 "Return t if EasyPG verifies a signed message in the current buffer."
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
443 (let ((context (epg-make-context 'OpenPGP))
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
444 result)
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
445 (epg-verify-string context (buffer-string))
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
446 (and (setq result (epg-context-result-for context 'verify))
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
447 (not (cdr result))
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
448 (eq (epg-signature-status (car result)) 'good))))
cbe2949923c1 Merge from gnus--devo--0
Miles Bader <miles@gnu.org>
parents: 100908
diff changeset
449
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
450 (provide 'gnus-nocem)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
451
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
452 ;; arch-tag: 0e0c74ea-2f8e-4f3e-8fff-09f767c1adef
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
453 ;;; gnus-nocem.el ends here