From: yamaoka Date: Fri, 31 Oct 2003 13:14:30 +0000 (+0000) Subject: Synch to Gnus 200310311301. X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=8d421640520a9d5d368b1f17308b197fe9cf455c;p=elisp%2Fgnus.git- Synch to Gnus 200310311301. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c72ff8d..71c3986 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,28 @@ +2003-10-31 Teodor Zlatanov + + * spam.el (autoload): autoload the gnus-registry functions we'll + need + (spam-log-to-registry): new variable for interfacing with the + gnus-registry + (spam-install-hooks): variable had the wrong customization group + (spam-fetch-field-message-id-fast): convenience function for fetch + a message ID quickly + (spam-log-processing-to-registry): new function + (spam-ifile-register-spam-routine) + (spam-ifile-register-ham-routine, spam-stat-register-spam-routine) + (spam-stat-register-ham-routine) + (spam-blacklist-register-routine) + (spam-whitelist-register-routine) + (spam-bogofilter-register-spam-routine) + (spam-bogofilter-register-ham-routine) + (spam-spamoracle-learn-ham, spam-spamoracle-learn-spam): add + spam-log-processing-to-registry invocations + + * gnus-registry.el: fixed docs in the preface to mention + gnus-registry-initialize + (gnus-registry-store-extra): remove cached extra entry + information when new extra entry is stored + 2003-10-29 Simon Josefsson * message.el (message-forward-make-body-plain): Fix ARG=1 mode diff --git a/lisp/gnus-registry.el b/lisp/gnus-registry.el index ec14c53..64040ae 100644 --- a/lisp/gnus-registry.el +++ b/lisp/gnus-registry.el @@ -37,11 +37,10 @@ ;; Put this in your startup file (~/.gnus.el for instance) -;; (setq gnus-registry-install t -;; gnus-registry-max-entries 2500 -;; gnus-registry-use-long-group-names t) +;; (setq gnus-registry-max-entries 2500 +;; gnus-registry-use-long-group-names t) -;; (require 'gnus-registry) +;; (gnus-registry-initialize) ;; Then use this in your fancy-split: @@ -480,10 +479,17 @@ The message must have at least one group name." (when (gnus-registry-group-count id) ;; we now know the trail has at least 1 group name, so it's not empty (let ((trail (gethash id gnus-registry-hashtb)) - (old-extra (gnus-registry-fetch-extra id))) + (old-extra (gnus-registry-fetch-extra id)) + entry-cache) + (dolist (crumb trail) + (unless (stringp crumb) + (dolist (entry crumb) + (setq entry-cache (gethash (car entry) gnus-registry-hashtb)) + (when entry-cache + (remhash id entry-cache)))) (puthash id (cons extra (delete old-extra trail)) gnus-registry-hashtb) - (setq gnus-registry-dirty t)))) + (setq gnus-registry-dirty t))))) (defun gnus-registry-store-extra-entry (id key value) "Put a specific entry in the extras field of the registry entry for id." diff --git a/lisp/spam.el b/lisp/spam.el index 0f13940..c835486 100644 --- a/lisp/spam.el +++ b/lisp/spam.el @@ -55,6 +55,11 @@ (eval-and-compile (autoload 'spam-report-gmane "spam-report")) +;; autoload gnus-registry +(eval-and-compile + (autoload 'gnus-registry-store-extra-entry "gnus-registry") + (autoload 'gnus-registry-fetch-extra "gnus-registry")) + ;; autoload query-dns (eval-and-compile (autoload 'query-dns "dns")) @@ -82,6 +87,11 @@ spam groups." :type 'boolean :group 'spam) +(defcustom spam-log-to-registry nil + "Whether spam/ham processing should be logged in the registry." + :type 'boolean + :group 'spam) + (defcustom spam-process-ham-in-spam-groups nil "Whether ham should be processed in spam groups." :type 'boolean @@ -218,7 +228,7 @@ considered spam." spam-use-spamoracle) "Whether the spam hooks should be installed, default to t if one of the spam-use-* variables is set." - :group 'gnus-registry + :group 'spam :type 'boolean) (defcustom spam-split-group "spam" @@ -687,6 +697,13 @@ spamoracle database." (mail-header-subject (gnus-data-header (assoc article (gnus-data-list nil)))) nil)) +(defun spam-fetch-field-message-id-fast (article) + "Fetch the `subject' field quickly, using the internal gnus-data-list function" + (if (and (numberp article) + (assoc article (gnus-data-list nil))) + (mail-header-message-id (gnus-data-header (assoc article (gnus-data-list nil)))) + nil)) + ;;;; Spam determination. @@ -759,7 +776,28 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." (if (eq decision t) nil decision))))))) - + +;;; log a spam-processor invocation to the registry +(defun spam-log-processing-to-registry (id type classification check group) + (when spam-log-to-registry + (if (and (stringp id) + (stringp group) + (or (eq type 'incoming) + (eq type 'process)) + (or (eq classification 'spam) + (eq classification 'ham)) + (assoc check spam-list-of-checks)) + (let ((cell-list (cdr-safe (gnus-registry-fetch-extra id type))) + (cell (list classification check group))) + (push cell cell-list) + (gnus-registry-store-extra-entry + id + type + cell-list)) + + (gnus-message 5 "spam-log-processing-to-registry called with bad ID, type, check, or group")))) + +;;; set up IMAP widening if it's necessary (defun spam-setup-widening () (dolist (check spam-list-of-statistical-checks) (when (symbol-value check) @@ -885,6 +923,12 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." nil ;; ham function (lambda (article) + (spam-log-processing-to-registry + (spam-fetch-field-message-id-fast article) + 'process + 'ham + 'spam-processing-use-BBDB + gnus-newsgroup-name) (spam-enter-ham-BBDB (spam-fetch-field-from-fast article))))) (defun spam-check-BBDB () @@ -962,6 +1006,12 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)." (defun spam-ifile-register-spam-routine () (spam-generic-register-routine (lambda (article) + (spam-log-processing-to-registry + (spam-fetch-field-message-id-fast article) + 'process + 'spam + 'spam-processing-use-ifile-spam + gnus-newsgroup-name) (spam-ifile-register-with-ifile (spam-get-article-as-string article) spam-ifile-spam-category)) nil)) @@ -970,6 +1020,12 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)." (spam-generic-register-routine nil (lambda (article) + (spam-log-processing-to-registry + (spam-fetch-field-message-id-fast article) + 'process + 'ham + 'spam-processing-use-ifile-ham + gnus-newsgroup-name) (spam-ifile-register-with-ifile (spam-get-article-as-string article) spam-ifile-ham-category)))) @@ -991,6 +1047,12 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)." (defun spam-stat-register-spam-routine () (spam-generic-register-routine (lambda (article) + (spam-log-processing-to-registry + (spam-fetch-field-message-id-fast article) + 'process + 'spam + 'spam-processing-use-stat-spam + gnus-newsgroup-name) (let ((article-string (spam-get-article-as-string article))) (with-temp-buffer (insert article-string) @@ -1001,6 +1063,12 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)." (spam-generic-register-routine nil (lambda (article) + (spam-log-processing-to-registry + (spam-fetch-field-message-id-fast article) + 'process + 'ham + 'spam-processing-use-stat-ham + gnus-newsgroup-name) (let ((article-string (spam-get-article-as-string article))) (with-temp-buffer (insert article-string) @@ -1108,6 +1176,12 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)." (spam-generic-register-routine ;; the spam function (lambda (article) + (spam-log-processing-to-registry + (spam-fetch-field-message-id-fast article) + 'process + 'spam + 'spam-processing-use-blacklist + gnus-newsgroup-name) (let ((from (spam-fetch-field-from-fast article))) (when (stringp from) (spam-enter-blacklist from)))) @@ -1120,6 +1194,12 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)." nil ;; the ham function (lambda (article) + (spam-log-processing-to-registry + (spam-fetch-field-message-id-fast article) + 'process + 'ham + 'spam-processing-use-whitelist + gnus-newsgroup-name) (let ((from (spam-fetch-field-from-fast article))) (when (stringp from) (spam-enter-whitelist from)))))) @@ -1194,6 +1274,12 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)." (defun spam-bogofilter-register-spam-routine () (spam-generic-register-routine (lambda (article) + (spam-log-processing-to-registry + (spam-fetch-field-message-id-fast article) + 'process + 'spam + 'spam-processing-use-bogofilter-spam + gnus-newsgroup-name) (spam-bogofilter-register-with-bogofilter (spam-get-article-as-string article) t)) nil)) @@ -1202,6 +1288,12 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)." (spam-generic-register-routine nil (lambda (article) + (spam-log-processing-to-registry + (spam-fetch-field-message-id-fast article) + 'process + 'ham + 'spam-processing-use-bogofilter-ham + gnus-newsgroup-name) (spam-bogofilter-register-with-bogofilter (spam-get-article-as-string article) nil)))) @@ -1254,11 +1346,23 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)." (spam-generic-register-routine nil (lambda (article) + (spam-log-processing-to-registry + (spam-fetch-field-message-id-fast article) + 'process + 'ham + 'spam-processing-use-spamoracle-ham + gnus-newsgroup-name) (spam-spamoracle-learn article nil)))) (defun spam-spamoracle-learn-spam () (spam-generic-register-routine (lambda (article) + (spam-log-processing-to-registry + (spam-fetch-field-message-id-fast article) + 'process + 'spam + 'spam-processing-use-spamoracle-spam + gnus-newsgroup-name) (spam-spamoracle-learn article t)) nil))