aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeodor Zlatanov2011-10-11 14:24:55 +0000
committerKatsumi Yamaoka2011-10-11 14:24:55 +0000
commit128f4b895f4755f062484547bb0bf6d4a89b6ffe (patch)
tree867ed2c526edafc55b32ab860713bf7bdd69e930
parentb3c0dbfdcbabe36dda0cc878cc3e2262583d63d9 (diff)
downloademacs-128f4b895f4755f062484547bb0bf6d4a89b6ffe.tar.gz
emacs-128f4b895f4755f062484547bb0bf6d4a89b6ffe.zip
spam.el (spam-check-BBDB): Simplify and support BBDB 3.x when searching. Drop `bbdb-cache'.
-rw-r--r--lisp/gnus/ChangeLog5
-rw-r--r--lisp/gnus/spam.el24
2 files changed, 9 insertions, 20 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index a4c2d97403b..dbdaa5820f9 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,8 @@
12011-10-11 Teodor Zlatanov <tzz@lifelogs.com>
2
3 * spam.el (spam-check-BBDB): Simplify and support BBDB 3.x when
4 searching. Drop `bbdb-cache'.
5
12011-10-11 Katsumi Yamaoka <yamaoka@jpl.org> 62011-10-11 Katsumi Yamaoka <yamaoka@jpl.org>
2 7
3 * message.el (message-signed-or-encrypted-p): Exclude header when 8 * message.el (message-signed-or-encrypted-p): Exclude header when
diff --git a/lisp/gnus/spam.el b/lisp/gnus/spam.el
index c7f993d7293..fa152f688c4 100644
--- a/lisp/gnus/spam.el
+++ b/lisp/gnus/spam.el
@@ -2150,29 +2150,13 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
2150 2150
2151 (defun spam-check-BBDB () 2151 (defun spam-check-BBDB ()
2152 "Mail from people in the BBDB is classified as ham or non-spam" 2152 "Mail from people in the BBDB is classified as ham or non-spam"
2153 (let ((who (message-fetch-field "from")) 2153 (let ((who (message-fetch-field "from")))
2154 bbdb-cache bbdb-hashtable)
2155 (when spam-cache-lookups
2156 (setq bbdb-cache (gethash 'spam-use-BBDB spam-caches))
2157 (unless bbdb-cache
2158 (setq bbdb-cache (make-vector 17 0)) ; a good starting hash value
2159 ;; this is based on the expanded (bbdb-hashtable) macro
2160 ;; without the debugging support
2161 (with-current-buffer (bbdb-buffer)
2162 (save-excursion
2163 (save-window-excursion
2164 (bbdb-records nil t)
2165 (mapatoms
2166 (lambda (symbol)
2167 (intern (downcase (symbol-name symbol)) bbdb-cache))
2168 bbdb-hashtable))))
2169 (puthash 'spam-use-BBDB bbdb-cache spam-caches)))
2170 (when who 2154 (when who
2171 (setq who (nth 1 (gnus-extract-address-components who))) 2155 (setq who (nth 1 (gnus-extract-address-components who)))
2172 (if 2156 (if
2173 (if spam-cache-lookups 2157 (if (fboundp 'bbdb-search)
2174 (intern-soft (downcase who) bbdb-cache) 2158 (bbdb-search (bbdb-records) who) ;; v3
2175 (bbdb-search-simple nil who)) 2159 (bbdb-search-simple nil who)) ;; v2
2176 t 2160 t
2177 (if spam-use-BBDB-exclusive 2161 (if spam-use-BBDB-exclusive
2178 spam-split-group 2162 spam-split-group