]> code.delx.au - gnu-emacs/blobdiff - lisp/net/eudc-export.el
Ibuffer: Mark buffers by content
[gnu-emacs] / lisp / net / eudc-export.el
index bbdb294da7f9ae78a696af1aa021962e08ad9f6b..a50892d94d480ab5ed36a046f8cf55ae92adef84 100644 (file)
@@ -1,9 +1,10 @@
-;;; eudc-export.el --- functions to export EUDC query results -*- coding: utf-8 -*-
+;;; eudc-export.el --- functions to export EUDC query results
 
-;; Copyright (C) 1998-2015 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2016 Free Software Foundation, Inc.
 
 ;; Author: Oscar Figueiredo <oscar@cpe.fr>
-;; Maintainer: Pavel Janík <Pavel@Janik.cz>
+;;         Pavel Janík <Pavel@Janik.cz>
+;; Maintainer: Thomas Fitzsimmons <fitzsim@fitzsim.org>
 ;; Keywords: comm
 ;; Package: eudc
 
@@ -85,12 +86,19 @@ If SILENT is non-nil then the created BBDB record is not displayed."
                                              (cons (car mapping) value))))
                                       conversion-alist)))
       (setq bbdb-notes (delq nil bbdb-notes))
-      (setq bbdb-record (bbdb-create-internal bbdb-name
-                                             bbdb-company
-                                             bbdb-net
-                                             bbdb-address
-                                             bbdb-phones
-                                             bbdb-notes))
+      (setq bbdb-record (bbdb-create-internal
+                        bbdb-name
+                        ,@(when (eudc--using-bbdb-3-or-newer-p)
+                            '(nil
+                              nil))
+                        bbdb-company
+                        bbdb-net
+                        ,@(if (eudc--using-bbdb-3-or-newer-p)
+                              '(bbdb-phones
+                                bbdb-address)
+                            '(bbdb-address
+                              bbdb-phones))
+                        bbdb-notes))
       (or silent
          (bbdb-display-records (list bbdb-record))))))
 
@@ -159,8 +167,13 @@ LOCATION is used as the address location for bbdb."
 ;; External.
 (declare-function bbdb-parse-phone-number "ext:bbdb-com"
                   (string &optional number-type))
+(declare-function bbdb-parse-phone "ext:bbdb-com" (string &optional style))
 (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
@@ -171,9 +184,11 @@ LOCATION is used as the phone location for BBDB."
    ((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." (eudc-cadr err))
+        (if (string= "phone number unparsable." (cadr err))
             (if (not (y-or-n-p (format "BBDB claims %S to be unparsable--insert anyway? " phone)))
                 (error "Phone number unparsable")
               (setq phone-list (list (bbdb-string-trim phone))))