summaryrefslogtreecommitdiff
path: root/lisp/net/eudcb-bbdb.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2007-12-04 03:55:40 +0000
committerGlenn Morris <rgm@gnu.org>2007-12-04 03:55:40 +0000
commitc52ae2bbad5814b5fba73e368d5c6b923067b816 (patch)
tree8ede9c33901b6fb009c0120165ca5c73a7939500 /lisp/net/eudcb-bbdb.el
parent3428c0e9db0fe85d8b4436d2f94cf9cff84346e7 (diff)
downloademacs-c52ae2bbad5814b5fba73e368d5c6b923067b816.tar.gz
(bbdb-address-streets): Declare as a function.
(eudc-bbdb-extract-addresses): Use bbdb-address-streets rather than bbdb-address-street1,2,3.
Diffstat (limited to 'lisp/net/eudcb-bbdb.el')
-rw-r--r--lisp/net/eudcb-bbdb.el40
1 files changed, 19 insertions, 21 deletions
diff --git a/lisp/net/eudcb-bbdb.el b/lisp/net/eudcb-bbdb.el
index 4a1b865736a..ef1379eee52 100644
--- a/lisp/net/eudcb-bbdb.el
+++ b/lisp/net/eudcb-bbdb.el
@@ -107,8 +107,7 @@
(declare-function bbdb-phone-location "ext:bbdb" t) ; via bbdb-defstruct
(declare-function bbdb-phone-string "ext:bbdb" (phone))
(declare-function bbdb-record-phones "ext:bbdb" t) ; via bbdb-defstruct
-;; FIXME: bbdb-address-street1/2/3 don't seem to exist in current
-;; bbdb, so this code is probably broken.
+(declare-function bbdb-address-streets "ext:bbdb" t) ; via bbdb-defstruct
(declare-function bbdb-address-city "ext:bbdb" t) ; via bbdb-defstruct
(declare-function bbdb-address-state "ext:bbdb" t) ; via bbdb-defstruct
(declare-function bbdb-address-zip "ext:bbdb" t) ; via bbdb-defstruct
@@ -130,25 +129,24 @@
(defun eudc-bbdb-extract-addresses (record)
(let (s c val)
- (mapcar (function
- (lambda (address)
- (setq val (concat (unless (= 0 (length (setq s (bbdb-address-street1 address))))
- (concat s "\n"))
- (unless (= 0 (length (setq s (bbdb-address-street2 address))))
- (concat s "\n"))
- (unless (= 0 (length (setq s (bbdb-address-street3 address))))
- (concat s "\n"))
- (progn
- (setq c (bbdb-address-city address))
- (setq s (bbdb-address-state address))
- (if (and (> (length c) 0) (> (length s) 0))
- (concat c ", " s " ")
- (concat c " ")))
- (bbdb-address-zip address)))
- (if eudc-bbdb-use-locations-as-attribute-names
- (cons (intern (bbdb-address-location address)) val)
- (cons 'addresses (concat (bbdb-address-location address) "\n" val)))))
- (bbdb-record-addresses record))))
+ (mapcar (lambda (address)
+ (setq c (bbdb-address-streets address))
+ (dotimes (n 3)
+ (unless (zerop (length (setq s (nth n c))))
+ (setq val (concat val s "\n"))))
+ (setq c (bbdb-address-city address)
+ s (bbdb-address-state address))
+ (setq val (concat val
+ (if (and (> (length c) 0) (> (length s) 0))
+ (concat c ", " s)
+ c)
+ " "
+ (bbdb-address-zip address)))
+ (if eudc-bbdb-use-locations-as-attribute-names
+ (cons (intern (bbdb-address-location address)) val)
+ (cons 'addresses (concat (bbdb-address-location address)
+ "\n" val))))
+ (bbdb-record-addresses record))))
(defun eudc-bbdb-format-record-as-result (record)
"Format the BBDB RECORD as a EUDC query result record.