]> code.delx.au - gnu-emacs/blobdiff - lisp/net/eudcb-bbdb.el
Fix some oddities in Tramp's rsync and smb methods
[gnu-emacs] / lisp / net / eudcb-bbdb.el
index 5be2bec0c5da3ee5896673d0147cd0a4be82ccd4..796391be2dec8579aa8e0ef57f31f89096bf1f2b 100644 (file)
@@ -1,6 +1,6 @@
-;;; eudcb-bbdb.el --- Emacs Unified Directory Client - BBDB Backend -*- coding: utf-8 -*-
+;;; eudcb-bbdb.el --- Emacs Unified Directory Client - BBDB Backend
 
-;; Copyright (C) 1998-2015 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2016 Free Software Foundation, Inc.
 
 ;; Author: Oscar Figueiredo <oscar@cpe.fr>
 ;;         Pavel Janík <Pavel@Janik.cz>
 (defvar eudc-bbdb-current-query nil)
 (defvar eudc-bbdb-current-return-attributes nil)
 
+(defun eudc-bbdb-field (field-symbol)
+  "Convert FIELD-SYMBOL so that it is recognized by the current BBDB version.
+BBDB < 3 used `net'; BBDB >= 3 uses `mail'."
+  ;; This just-in-time translation permits upgrading from BBDB 2 to
+  ;; BBDB 3 without restarting Emacs.
+  (if (and (eq field-symbol 'net)
+          (eudc--using-bbdb-3-or-newer-p))
+      'mail
+    field-symbol))
+
 (defvar eudc-bbdb-attributes-translation-alist
   '((name . lastname)
     (email . net)
@@ -85,7 +95,9 @@
                    (progn
                      (setq bbdb-val
                            (eval (list (intern (concat "bbdb-record-"
-                                                       (symbol-name attr)))
+                                                       (symbol-name
+                                                        (eudc-bbdb-field
+                                                         attr))))
                                        'record)))
                      (if (listp bbdb-val)
                          (if eudc-bbdb-enable-substring-matches
@@ -168,7 +180,7 @@ The record is filtered according to `eudc-bbdb-current-return-attributes'"
        (setq val (eval
                   (list (intern
                          (concat "bbdb-record-"
-                                 (symbol-name attr)))
+                                 (symbol-name (eudc-bbdb-field attr))))
                         'record))))
        (t
        (error "Unknown BBDB attribute")))