[gnus git] branch master updated: n0-17-376-g98b834d =1= Fix spam.el to BBDB 2 and 3 glue.

Ted Zlatanov <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  98b834dda1a5e9951164a302b630a48cc4a84e20 (commit)
      from  775293ffb232e69b6bffc771e6e0924aa9969463 (commit)


- Log -----------------------------------------------------------------
commit 98b834dda1a5e9951164a302b630a48cc4a84e20
Author: Ted Zlatanov <[email protected]>
Date:   Wed Nov 9 07:54:09 2011 -0600

    Fix spam.el to BBDB 2 and 3 glue.
    
    * spam.el: Move BBDB autoloads.
    (spam-exists-in-BBDB-p): New function to do the BBDB search directly in BBDB 2 and 3.
    (spam-check-BBDB): Use it.
    (spam-enter-ham-BBDB): Use it.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e5c2419..6a7dc03 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2011-11-09  Teodor Zlatanov  <[email protected]>
+
+	* spam.el: Move BBDB autoloads.
+	(spam-exists-in-BBDB-p): New function to do the BBDB search directly in BBDB 2 and 3.
+	(spam-check-BBDB): Use it.
+	(spam-enter-ham-BBDB): Use it.
+
 2011-10-31  Peter Münster  <[email protected]>  (tiny change)
 
 	* gnus-group.el (gnus-group-get-new-news): New parameter `one-level'
diff --git a/lisp/spam.el b/lisp/spam.el
index fa152f6..f76046d 100644
--- a/lisp/spam.el
+++ b/lisp/spam.el
@@ -2088,11 +2088,6 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
 
 ;; all this is done inside a condition-case to trap errors
 
-(eval-when-compile
-  (autoload 'bbdb-buffer "bbdb")
-  (autoload 'bbdb-create-internal "bbdb")
-  (autoload 'bbdb-search-simple "bbdb"))
-
 ;; Autoloaded in message, which we require.
 (declare-function gnus-extract-address-components "gnus-util" (from))
 
@@ -2104,9 +2099,13 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
           (file-error
            ;; `bbdb-records' should not be bound as an autoload function
            ;; before loading bbdb because of `bbdb-hashtable-size'.
+           (defalias 'bbdb-buffer 'ignore)
+           (defalias 'bbdb-create-internal 'ignore)
            (defalias 'bbdb-records 'ignore)
            (defalias 'spam-BBDB-register-routine 'ignore)
            (defalias 'spam-enter-ham-BBDB 'ignore)
+           (defalias 'spam-exists-in-BBDB-p 'ignore)
+           (defalias 'bbdb-gethash 'ignore)
            nil))
 
     ;; when the BBDB changes, we want to clear out our cache
@@ -2126,7 +2125,7 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
                                     'ignore))
                  (net-address (nth 1 parsed-address))
                  (record (and net-address
-                              (bbdb-search-simple nil net-address))))
+                              (spam-exists-in-BBDB-p net-address))))
             (when net-address
               (gnus-message 6 "%s address %s %s BBDB"
                             (if remove "Deleting" "Adding")
@@ -2148,15 +2147,17 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
     (defun spam-BBDB-unregister-routine (articles)
       (spam-BBDB-register-routine articles t))
 
+    (defsubst spam-exists-in-BBDB-p (net)
+      (when (and (stringp net) (not (zerop (length net))))
+        (bbdb-records)
+        (bbdb-gethash (downcase net))))
+
     (defun spam-check-BBDB ()
       "Mail from people in the BBDB is classified as ham or non-spam"
-      (let ((who (message-fetch-field "from")))
-        (when who
-          (setq who (nth 1 (gnus-extract-address-components who)))
-          (if
-              (if (fboundp 'bbdb-search)
-                  (bbdb-search (bbdb-records) who) ;; v3
-                (bbdb-search-simple nil who)) ;; v2
+      (let ((net (message-fetch-field "from")))
+        (when net
+          (setq net (nth 1 (gnus-extract-address-components net)))
+          (if (spam-exists-in-BBDB-p net)
               t
             (if spam-use-BBDB-exclusive
                 spam-split-group

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog |    7 +++++++
 lisp/spam.el   |   27 ++++++++++++++-------------
 2 files changed, 21 insertions(+), 13 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.