(spam-summary-prepare-exit): use spam-process-ham-in-spam-groups
[gnus] / lisp / spam-stat.el
index 66d4ff3..dcebb70 100644 (file)
@@ -238,12 +238,6 @@ This uses `gnus-article-buffer'."
     (set-buffer gnus-original-article-buffer)
     (spam-stat-store-current-buffer)))
 
-(when spam-stat-install-hooks
-  (add-hook 'nnmail-prepare-incoming-message-hook
-           'spam-stat-store-current-buffer)
-  (add-hook 'gnus-select-article-hook
-           'spam-stat-store-gnus-article-buffer))
-
 ;; Data -- not using defstruct in order to save space and time
 
 (defvar spam-stat (make-hash-table :test 'equal)
@@ -542,7 +536,7 @@ You can use this to determine error rates."
       (dolist (f files)
        (when (and (file-readable-p f)
                   (file-regular-p f)
-                   (> (nth 7 (file-attributes f))))
+                   (> (nth 7 (file-attributes f)) 0))
          (setq count (1+ count))
          (message "Reading %.2f%%, score %.2f%%"
                   (/ count max) (/ score count))
@@ -567,6 +561,25 @@ COUNT defaults to 5"
               (remhash key spam-stat)))
           spam-stat))
 
+(defun spam-stat-install-hooks-function ()
+  "Install the spam-stat function hooks"
+  (interactive)
+  (add-hook 'nnmail-prepare-incoming-message-hook
+           'spam-stat-store-current-buffer)
+  (add-hook 'gnus-select-article-hook
+           'spam-stat-store-gnus-article-buffer))
+
+(when spam-stat-install-hooks
+  (spam-stat-install-hooks-function))
+
+(defun spam-stat-unload-hook ()
+  "Uninstall the spam-stat function hooks"
+  (interactive)
+  (remove-hook 'nnmail-prepare-incoming-message-hook
+              'spam-stat-store-current-buffer)
+  (remove-hook 'gnus-select-article-hook
+              'spam-stat-store-gnus-article-buffer))
+
 (provide 'spam-stat)
 
 ;;; spam-stat.el ends here