Mercurial > emacs
comparison lisp/mh-e/mh-junk.el @ 90228:fa0da9b57058
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-82
Merge from emacs--cvs-trunk--0
Patches applied:
* emacs--cvs-trunk--0 (patch 542-553)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 116-121)
- Merge from emacs--cvs-trunk--0
- Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Mon, 19 Sep 2005 10:20:33 +0000 |
parents | f9a65d7ebd29 8e711c68e4ff |
children | 5e2d3828e89f |
comparison
equal
deleted
inserted
replaced
90227:10fe5fadaf89 | 90228:fa0da9b57058 |
---|---|
61 ((eq (aref mh-junk-disposition 0) ?@) | 61 ((eq (aref mh-junk-disposition 0) ?@) |
62 (concat mh-current-folder "/" | 62 (concat mh-current-folder "/" |
63 (substring mh-junk-disposition 1))) | 63 (substring mh-junk-disposition 1))) |
64 (t (concat "+" mh-junk-disposition))))) | 64 (t (concat "+" mh-junk-disposition))))) |
65 (mh-iterate-on-range msg range | 65 (mh-iterate-on-range msg range |
66 (message (format "Blacklisting message %d..." msg)) | 66 (message "Blacklisting message %d..." msg) |
67 (funcall (symbol-function blacklist-func) msg) | 67 (funcall (symbol-function blacklist-func) msg) |
68 (message (format "Blacklisting message %d...done" msg)) | 68 (message "Blacklisting message %d...done" msg) |
69 (if (not (memq msg mh-seen-list)) | 69 (if (not (memq msg mh-seen-list)) |
70 (setq mh-seen-list (cons msg mh-seen-list))) | 70 (setq mh-seen-list (cons msg mh-seen-list))) |
71 (if dest | 71 (if dest |
72 (mh-refile-a-msg nil (intern dest)) | 72 (mh-refile-a-msg nil (intern dest)) |
73 (mh-delete-a-msg nil))) | 73 (mh-delete-a-msg nil))) |
85 (interactive (list (mh-interactive-range "Whitelist"))) | 85 (interactive (list (mh-interactive-range "Whitelist"))) |
86 (let ((whitelist-func (nth 2 (assoc mh-junk-choice mh-junk-function-alist)))) | 86 (let ((whitelist-func (nth 2 (assoc mh-junk-choice mh-junk-function-alist)))) |
87 (unless whitelist-func | 87 (unless whitelist-func |
88 (error "Customize `mh-junk-program' appropriately")) | 88 (error "Customize `mh-junk-program' appropriately")) |
89 (mh-iterate-on-range msg range | 89 (mh-iterate-on-range msg range |
90 (message (format "Whitelisting message %d..." msg)) | 90 (message "Whitelisting message %d..." msg) |
91 (funcall (symbol-function whitelist-func) msg) | 91 (funcall (symbol-function whitelist-func) msg) |
92 (message (format "Whitelisting message %d...done" msg)) | 92 (message "Whitelisting message %d...done" msg) |
93 (mh-refile-a-msg nil (intern mh-inbox))) | 93 (mh-refile-a-msg nil (intern mh-inbox))) |
94 (mh-next-msg))) | 94 (mh-next-msg))) |
95 | 95 |
96 | 96 |
97 | 97 |
177 (error "Unable to find the spamassassin executable")) | 177 (error "Unable to find the spamassassin executable")) |
178 (let ((current-folder mh-current-folder) | 178 (let ((current-folder mh-current-folder) |
179 (msg-file (mh-msg-filename msg mh-current-folder)) | 179 (msg-file (mh-msg-filename msg mh-current-folder)) |
180 (sender)) | 180 (sender)) |
181 (save-excursion | 181 (save-excursion |
182 (message (format "Reporting message %d..." msg)) | 182 (message "Reporting message %d..." msg) |
183 (mh-truncate-log-buffer) | 183 (mh-truncate-log-buffer) |
184 (call-process mh-spamassassin-executable msg-file mh-log-buffer nil | 184 (call-process mh-spamassassin-executable msg-file mh-log-buffer nil |
185 ;;"--report" "--remove-from-whitelist" | 185 ;;"--report" "--remove-from-whitelist" |
186 "-r" "-R") ; spamassassin V2.20 | 186 "-r" "-R") ; spamassassin V2.20 |
187 (when mh-sa-learn-executable | 187 (when mh-sa-learn-executable |
188 (message "Recategorizing this message as spam...") | 188 (message "Recategorizing this message as spam...") |
189 (call-process mh-sa-learn-executable msg-file mh-log-buffer nil | 189 (call-process mh-sa-learn-executable msg-file mh-log-buffer nil |
190 "--single" "--spam" "--local" "--no-rebuild")) | 190 "--single" "--spam" "--local" "--no-rebuild")) |
191 (message (format "Blacklisting message %d..." msg)) | 191 (message "Blacklisting message %d..." msg) |
192 (set-buffer (get-buffer-create mh-temp-buffer)) | 192 (set-buffer (get-buffer-create mh-temp-buffer)) |
193 (erase-buffer) | 193 (erase-buffer) |
194 (call-process (expand-file-name mh-scan-prog mh-progs) | 194 (call-process (expand-file-name mh-scan-prog mh-progs) |
195 nil mh-junk-background nil | 195 nil mh-junk-background nil |
196 (format "%s" msg) current-folder | 196 (format "%s" msg) current-folder |
198 (goto-char (point-min)) | 198 (goto-char (point-min)) |
199 (if (search-forward-regexp "^\\(.+\\)$" nil t) | 199 (if (search-forward-regexp "^\\(.+\\)$" nil t) |
200 (progn | 200 (progn |
201 (setq sender (match-string 0)) | 201 (setq sender (match-string 0)) |
202 (mh-spamassassin-add-rule "blacklist_from" sender) | 202 (mh-spamassassin-add-rule "blacklist_from" sender) |
203 (message (format "Blacklisting message %d...done" msg))) | 203 (message "Blacklisting message %d...done" msg)) |
204 (message (format "Blacklisting message %d...not done (from my address)" msg)))))) | 204 (message "Blacklisting message %d...not done (from my address)" msg))))) |
205 | 205 |
206 (defun mh-spamassassin-whitelist (msg) | 206 (defun mh-spamassassin-whitelist (msg) |
207 "Whitelist MSG with SpamAssassin. | 207 "Whitelist MSG with SpamAssassin. |
208 | 208 |
209 The \\[mh-junk-whitelist] command adds a `whitelist_from' rule to the | 209 The \\[mh-junk-whitelist] command adds a `whitelist_from' rule to the |
228 (write-file msg-file) | 228 (write-file msg-file) |
229 (when mh-sa-learn-executable | 229 (when mh-sa-learn-executable |
230 (message "Recategorizing this message as ham...") | 230 (message "Recategorizing this message as ham...") |
231 (call-process mh-sa-learn-executable msg-file mh-temp-buffer nil | 231 (call-process mh-sa-learn-executable msg-file mh-temp-buffer nil |
232 "--single" "--ham" "--local --no-rebuild")) | 232 "--single" "--ham" "--local --no-rebuild")) |
233 (message (format "Whitelisting message %d..." msg)) | 233 (message "Whitelisting message %d..." msg) |
234 (setq from | 234 (setq from |
235 (car (mh-funcall-if-exists | 235 (car (mh-funcall-if-exists |
236 ietf-drums-parse-address (mh-get-header-field "From:")))) | 236 ietf-drums-parse-address (mh-get-header-field "From:")))) |
237 (kill-buffer nil) | 237 (kill-buffer nil) |
238 (unless (or (null from) (equal from "")) | 238 (unless (or (null from) (equal from "")) |
239 (mh-spamassassin-add-rule "whitelist_from" from)) | 239 (mh-spamassassin-add-rule "whitelist_from" from)) |
240 (message (format "Whitelisting message %d...done" msg))))) | 240 (message "Whitelisting message %d...done" msg)))) |
241 | 241 |
242 (defun mh-spamassassin-add-rule (rule body) | 242 (defun mh-spamassassin-add-rule (rule body) |
243 "Add a new rule to `~/.spamassassin/user_prefs'. | 243 "Add a new rule to `~/.spamassassin/user_prefs'. |
244 The name of the rule is RULE and its body is BODY." | 244 The name of the rule is RULE and its body is BODY." |
245 (save-window-excursion | 245 (save-window-excursion |