bogofilter, spamoracle): rewrite registration/unregistration
functions to take a list of articles and the unregister option.
Much hilarity ensues.
+ (spam-initialize): spam-stat-maybe-{save,load} already respect spam-use-stat
+ (spam-stat-register-ham-routine, spam-stat-register-spam-routine):
+ don't load and save unnecessarily
* spam-stat.el (spam-stat-dirty): new variable, set when the stats
database is modified
(spam-stat-split-fancy)))
(defun spam-stat-register-spam-routine (articles &optional unregister)
- (spam-stat-load)
(dolist (article articles)
(let ((article-string (spam-get-article-as-string article)))
(with-temp-buffer
(insert article-string)
(if unregister
(spam-stat-buffer-change-to-non-spam)
- (spam-stat-buffer-is-spam)))))
- (spam-stat-save))
+ (spam-stat-buffer-is-spam))))))
(defun spam-stat-unregister-spam-routine (articles)
(spam-stat-register-spam-routine articles t))
(defun spam-stat-register-ham-routine (articles &optional unregister)
- (spam-stat-load)
(dolist (article articles)
(let ((article-string (spam-get-article-as-string article)))
(with-temp-buffer
(insert article-string)
(if unregister
(spam-stat-buffer-change-to-spam)
- (spam-stat-buffer-is-non-spam)))))
- (spam-stat-save))
+ (spam-stat-buffer-is-non-spam))))))
(defun spam-stat-unregister-ham-routine (articles)
(spam-stat-register-ham-routine articles t))
(when spam-use-stat (spam-stat-save))))
(file-error (progn
+ (defalias 'spam-stat-load 'ignore)
+ (defalias 'spam-stat-save 'ignore)
(defalias 'spam-maybe-spam-stat-load 'ignore)
(defalias 'spam-maybe-spam-stat-save 'ignore)
(defalias 'spam-stat-register-ham-routine 'ignore)
(defalias 'spam-stat-buffer-is-non-spam 'ignore)
(defalias 'spam-stat-buffer-change-to-non-spam 'ignore)
(defalias 'spam-stat-split-fancy 'ignore)
- (defalias 'spam-stat-load 'ignore)
- (defalias 'spam-stat-save 'ignore)
(defalias 'spam-check-stat 'ignore))))
\f
(push '((eq mark gnus-spam-mark) . spam-face)
gnus-summary-highlight)
;; Add hooks for loading and saving the spam stats
- (when spam-use-stat
- (add-hook 'gnus-save-newsrc-hook 'spam-maybe-spam-stat-save)
- (add-hook 'gnus-get-top-new-news-hook 'spam-maybe-spam-stat-load)
- (add-hook 'gnus-startup-hook 'spam-maybe-spam-stat-load))
+ (add-hook 'gnus-save-newsrc-hook 'spam-maybe-spam-stat-save)
+ (add-hook 'gnus-get-top-new-news-hook 'spam-maybe-spam-stat-load)
+ (add-hook 'gnus-startup-hook 'spam-maybe-spam-stat-load)
(add-hook 'gnus-summary-prepare-exit-hook 'spam-summary-prepare-exit)
(add-hook 'gnus-summary-prepare-hook 'spam-summary-prepare)
(add-hook 'gnus-get-new-news-hook 'spam-setup-widening))