-;;; 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
(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))))))
;; 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
((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))))