(spam-log-processing-to-registry): improved message and comments
authorTeodor Zlatanov <tzz@lifelogs.com>
Fri, 31 Oct 2003 20:28:20 +0000 (20:28 +0000)
committerTeodor Zlatanov <tzz@lifelogs.com>
Fri, 31 Oct 2003 20:28:20 +0000 (20:28 +0000)
(spam-log-unregistration-needed-p): 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): change
spam-log-processing-to-registry invocations appropriately

lisp/ChangeLog
lisp/spam.el

index ac6699d..66a0623 100644 (file)
@@ -1,3 +1,18 @@
+2003-10-31  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * spam.el
+       (spam-log-processing-to-registry): improved message and comments
+       (spam-log-unregistration-needed-p): 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): change
+       spam-log-processing-to-registry invocations appropriately
+
 2003-10-31  Simon Josefsson  <jas@extundo.com>
 
        * imap.el (imap-kerberos4-open): Ignore output from ATHENA imtest.
@@ -5,7 +20,7 @@
        (imap-process-connection-type): Improve docstring.  Suggested by
        Derek Atkins <warlord@MIT.EDU>.
 
-2003-10-31  Teodor Zlatanov  <tzz@beld.net>
+2003-10-31  Teodor Zlatanov  <tzz@lifelogs.com>
 
        * spam.el (autoload): autoload the gnus-registry functions we'll
        need
index 28450dc..52d6acb 100644 (file)
@@ -780,7 +780,7 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
                nil
              decision)))))))
 
-;;; log a spam-processor invocation to the registry
+;;; log a ham- or 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)
@@ -798,7 +798,30 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
           type
           cell-list))
 
-      (gnus-message 5 "spam-log-processing-to-registry called with bad ID, type, check, or group"))))
+      (gnus-message 5 (format "%s called with bad ID, type, check, or group"
+                             "spam-log-processing-to-registry")))))
+
+;;; check if a ham- or spam-processor registration needs to be undone
+(defun spam-log-unregistration-needed-p (id type classification check)
+  (when spam-log-to-registry
+    (if (and (stringp id)
+            (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)))
+             found)
+         (dolist (cell cell-list)
+           (unless found
+             (when (and (eq classification (nth 0 cell))
+                        (eq check (nth 1 cell)))
+               (setq found t))))
+         found)
+      (progn 
+       (gnus-message 5 (format "%s called with bad ID, type, check, or group"
+                               "spam-log-unregistration-needed-p"))
+       nil))))
 
 ;;; set up IMAP widening if it's necessary  
 (defun spam-setup-widening ()
@@ -930,7 +953,7 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
        (spam-fetch-field-message-id-fast article)
        'process
        'ham
-       'spam-processing-use-BBDB 
+       'spam-use-BBDB 
        gnus-newsgroup-name)
        (spam-enter-ham-BBDB (spam-fetch-field-from-fast article)))))
 
@@ -1013,7 +1036,7 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)."
       (spam-fetch-field-message-id-fast article)
       'process
       'spam
-      'spam-processing-use-ifile-spam
+      'spam-use-ifile
       gnus-newsgroup-name)
      (spam-ifile-register-with-ifile 
       (spam-get-article-as-string article) spam-ifile-spam-category))
@@ -1027,7 +1050,7 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)."
       (spam-fetch-field-message-id-fast article)
       'process
       'ham
-      'spam-processing-use-ifile-ham
+      'spam-use-ifile
       gnus-newsgroup-name)
      (spam-ifile-register-with-ifile 
       (spam-get-article-as-string article) spam-ifile-ham-category))))
@@ -1054,7 +1077,7 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)."
            (spam-fetch-field-message-id-fast article)
            'process
            'spam
-           'spam-processing-use-stat-spam
+           'spam-use-stat
            gnus-newsgroup-name)
           (let ((article-string (spam-get-article-as-string article)))
             (with-temp-buffer
@@ -1070,7 +1093,7 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)."
            (spam-fetch-field-message-id-fast article)
            'process
            'ham
-           'spam-processing-use-stat-ham
+           'spam-use-stat
            gnus-newsgroup-name)
           (let ((article-string (spam-get-article-as-string article)))
             (with-temp-buffer
@@ -1183,7 +1206,7 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)."
       (spam-fetch-field-message-id-fast article)
       'process
       'spam
-      'spam-processing-use-blacklist
+      'spam-use-blacklist
       gnus-newsgroup-name)
      (let ((from (spam-fetch-field-from-fast article)))
        (when (stringp from)
@@ -1201,7 +1224,7 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)."
       (spam-fetch-field-message-id-fast article)
       'process
       'ham
-      'spam-processing-use-whitelist
+      'spam-use-whitelist
       gnus-newsgroup-name)
      (let ((from (spam-fetch-field-from-fast article)))
        (when (stringp from)
@@ -1281,7 +1304,7 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)."
       (spam-fetch-field-message-id-fast article)
       'process
       'spam
-      'spam-processing-use-bogofilter-spam
+      'spam-use-bogofilter
       gnus-newsgroup-name)
      (spam-bogofilter-register-with-bogofilter
       (spam-get-article-as-string article) t))
@@ -1295,7 +1318,7 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)."
       (spam-fetch-field-message-id-fast article)
       'process
       'ham
-      'spam-processing-use-bogofilter-ham
+      'spam-use-bogofilter
       gnus-newsgroup-name)
      (spam-bogofilter-register-with-bogofilter
       (spam-get-article-as-string article) nil))))
@@ -1353,7 +1376,7 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)."
       (spam-fetch-field-message-id-fast article)
       'process
       'ham
-      'spam-processing-use-spamoracle-ham
+      'spam-use-spamoracle
       gnus-newsgroup-name)
      (spam-spamoracle-learn article nil))))
 
@@ -1364,7 +1387,7 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)."
       (spam-fetch-field-message-id-fast article)
       'process
       'spam
-      'spam-processing-use-spamoracle-spam
+      'spam-use-spamoracle
       gnus-newsgroup-name)
      (spam-spamoracle-learn article t))
    nil))