>From 25b742df574fc9ae8340a37409fc72ec2f40574b Mon Sep 17 00:00:00 2001 From: Thomas Fitzsimmons Date: Sun, 22 Nov 2015 11:29:13 -0500 Subject: [PATCH] Improve EUDC to BBDB 3 export * eudc-vars.el (eudc-ldap-bbdb-conversion-alist): Change phone entry to single item. Add company conversion. * eudc-export.el (eudc-bbdbify-company): New function. (eudc-bbdbify-phone): Add BBDB 3 support. (bug#21971) --- lisp/net/eudc-export.el | 8 +++++++- lisp/net/eudc-vars.el | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lisp/net/eudc-export.el b/lisp/net/eudc-export.el index a65f555..f91f4ae 100644 --- a/lisp/net/eudc-export.el +++ b/lisp/net/eudc-export.el @@ -169,6 +169,10 @@ eudc-bbdbify-address (string &optional number-type)) (declare-function bbdb-string-trim "ext:bbdb" (string)) +(defun eudc-bbdbify-company (&rest organizations) + "Return ORGANIZATIONS as a list compatible with BBDB." + organizations) + (defun eudc-bbdbify-phone (phone location) "Parse PHONE into a vector compatible with BBDB. PHONE is either a string supposedly containing a phone number or @@ -179,7 +183,9 @@ eudc-bbdbify-phone ((stringp phone) (let (phone-list) (condition-case err - (setq phone-list (bbdb-parse-phone-number phone)) + (setq phone-list (if (eudc--using-bbdb-3-or-newer-p) + (bbdb-parse-phone phone) + (bbdb-parse-phone-number phone))) (error (if (string= "phone number unparsable." (cadr err)) (if (not (y-or-n-p (format "BBDB claims %S to be unparsable--insert anyway? " phone))) diff --git a/lisp/net/eudc-vars.el b/lisp/net/eudc-vars.el index 8cffa8e..a08d175 100644 --- a/lisp/net/eudc-vars.el +++ b/lisp/net/eudc-vars.el @@ -369,7 +369,8 @@ eudc-ldap-bbdb-conversion-alist '((name . cn) (net . mail) (address . (eudc-bbdbify-address postaladdress "Address")) - (phone . ((eudc-bbdbify-phone telephonenumber "Phone")))) + (phone . (eudc-bbdbify-phone telephonenumber "Phone")) + (company . (eudc-bbdbify-company o))) "A mapping from BBDB to LDAP attributes. This is a list of cons cells (BBDB-FIELD . SPEC-OR-LIST) where BBDB-FIELD is the name of a field that must be defined in your BBDB -- 1.8.3.1