Anonymous avatar Anonymous committed 20f2b70

EUDC 1.32

Comments (0)

Files changed (9)

+2001-07-28  Oscar Figueiredo  <oscar@xemacs.org>
+
+	* eudc: EUDC 1.32 is released
+	
+	* eudcb-bbdb.el: Patch from David S Goldberg <dsg@mitre.org> for
+	compatibility with BBDB 2.32
+
+	* eudc-bob.el: 
+	* eudc-export.el:
+	* eudc-hotlist.el:
+	* eudc-vars.el: Pavel Janik's patch adding documentation sections
+	required by the Emacs Lisp Coding Conventions
+
+2001-07-09  Oscar Figueiredo  <oscar@xemacs.org>
+
+	* eudc.el (eudc-multi-query): Changed parameter semantics to
+	distinguish behavior when called for inline expansion or to
+	process query form data (need to process
+	`eudc-inline-expansion-format' and `eudc-inline-query-format' in
+	the former case).  Bug identified by David Goldberg <dsg@mitre.org>
+	(eudc-multi-query): Do not save options file on temporary server
+	switch
+	(eudc-expand-inline): Pass query words directly to
+	`eudc-multi-query'
+	(eudc-process-form): Call `eudc-multi-query' according to its new
+	semantics
+
 2000-10-05  Martin Buchholz  <martin@xemacs.org>
 
 	* *: Mega typo fix.
 # Boston, MA 02111-1307, USA.
 
 VERSION = 1.33
-AUTHOR_VERSION = 1.31
+AUTHOR_VERSION = 1.32
 MAINTAINER = Oscar Figueiredo <oscar@xemacs.org>
 PACKAGE = eudc
 PKG_TYPE = regular
 
 
 
+* Release 1.32
+  ------------
+
+** Bugfix release, no new features
+
 * Release 1.31
   ------------
 
 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
+;;; Commentary:
+
 ;;; Usage:
 ;;    See the corresponding info file
 
-;;; eudc-export.el --- Functions to export EUDC qeuery results
+;;; eudc-export.el --- functions to export EUDC query results
 
 ;; Copyright (C) 1998 Free Software Foundation, Inc.
 
-;;; eudc-hotlist.el --- Hotlist Management for EUDC
+;;; eudc-hotlist.el --- hotlist management for EUDC
 
 ;; Copyright (C) 1998 Free Software Foundation, Inc.
 
 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
+;;; Commentary:
+
 ;;; Code:
 
 (require 'custom)
 	     (t
 	      eudc-default-return-attributes))))
 
-
-(defun eudc-multi-query (queries 
-			 &optional sentinel return-attributes try-all)
-  "Query one or several directory servers with a list of QUERIES.
+(defun eudc-multi-query (queries-or-words sentinel for-inline-expansion try-all)
+  "Query one or several directory servers.
 The servers that are queried are determined by `eudc-multi-query-policy' 
 and `eudc-max-servers-to-query'.
-QUERIES is a list of individual queries. An individual query is a list
-of cons cells (ATTR . VALUE) where ATTR is an attribute name and VALUE 
-is the corresponding value.
+If FOR-INLINE-EXPANSION is non-nil, the function is called for inline
+expansion and QUERIES-OR-WORDS is expected to be a list of individual
+words which are mapped onto `eudc-inline-query-format' to build the
+directory queries. If FOR-INLINE-EXPANSION is nil, QUERIES-OR-WORDS is
+expected to be a list of individual queries. An individual query is a
+list of cons cells (ATTR . VALUE) where ATTR is an attribute name and
+VALUE is the corresponding value.
 SENTINEL is a symbol naming a sentinel function which is called
 for each new server tried.
-RETURN-ATTRIBUTES is a list of attributes to return defaulting to 
-`eudc-default-return-attributes'.
 If TRY-ALL is non-nil then all servers are tried in order, otherwise
 search stops when at leasta match is found on a server.
-The value is a list of server matches. Each server match is itself a 
-list of the form ((SERVER .PROTO) MATCH1 MATCH2 ...) where MATCHn is
-a matching record found on this server.  A matching record is a list
-of cons cells (ATTR . VALUE) where ATTR is an attribute name and VALUE 
-is the corresponding value"
+The returned value is a list of server matches. Each server match is
+itself a list of the form ((SERVER .PROTO) MATCH1 MATCH2 ...) where
+MATCHn is a matching record found on this server.  A matching record is
+a list of cons cells (ATTR . VALUE) where ATTR is an attribute name and
+VALUE is the corresponding value"
   (if (memq eudc-multi-query-policy 
 	    '(current-server server-then-hotlist))
       (or eudc-server
 	  (call-interactively 'eudc-set-server))
     (or eudc-server-hotlist
 	(error "No server in the hotlist")))
-  (let (servers response found)
+  (let (servers response found query-formats queries return-attributes)
     ;; Prepare the list of servers to query
     (setq servers
 	  (cond 
 		      (eudc-caar servers) 
 		      (eudc-cdar servers)))
 	 
+	 (if (null for-inline-expansion)
+	     (setq queries queries-or-words
+		   return-attributes nil)
+	   ;; Determine which formats apply in the query-format list
+	   (setq query-formats
+		 (eudc-extract-n-word-formats eudc-inline-query-format
+					      (length queries-or-words)))
+	   ;; Build the queries
+	   (setq queries 
+		 (if query-formats
+		     (mapcar '(lambda (format)
+				(eudc-build-query-with-words-on-format
+				 queries-or-words 
+				 format))
+			     query-formats)
+		   queries-or-words))
+	   ;; Get the return attributes from the inline expansion format
+	   (setq return-attributes (cdr eudc-inline-expansion-format)))
+
 	 ;; Loop on queries
 	 (mapcar 
 	  (function 
     ;; Since eudc-protocol-attributes-translation-alist is server-dependent we
     ;; need to switch servers temporarily
     (eudc-server-protect
-     (eudc-set-server (caar record) (cdar record))
+     (eudc-set-server (caar record) (cdar record) t)
      (setq mail (cdr (assq 
 		      (or 
 		       (cdr (assq 'email 
 		    (goto-char (match-end 0)))
 		(point)))
 	 (query-words (split-string (buffer-substring beg end) "[ \t]+"))
-	 query-formats
-	 queries
 	 response
 	 response-string
 	 response-strings)
-
-    ;; Determine which formats apply in the query-format list
-    (setq query-formats
-	  (eudc-extract-n-word-formats eudc-inline-query-format
-					(length query-words)))
-	
-    (setq queries 
-	  (if query-formats
-	      (mapcar '(lambda (format)
-			 (eudc-build-query-with-words-on-format query-words format))
-		      query-formats)
-	    query-words))
 				
     (setq response
-	  (car (eudc-multi-query queries nil (cdr eudc-inline-expansion-format))))
+	  (car (eudc-multi-query query-words nil t nil)))
 	    
-    ;; Process response through eudc-inline-expansion-format. We need to switch
-    ;; to the context of the server where a match was found
+    ;; Process response through eudc-inline-expansion-format. We need
+    ;; to switch to the context of the server where a match was found
     (if response
 	(eudc-server-protect
 	  ;; Switch to the context of the server where a match was found
-	 (eudc-set-server (caar response) (cdar response))
+	 (eudc-set-server (caar response) (cdar response) t)
 	 (setq response (cdr response))	; Drop the server/protocol part
 
 	 ;; Loop over the matches found on the server
   (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"))
+	       (cond ((>= bbdb-file-format 6)
+		      (setq val (concat
+				 (bbdb-join
+				  (bbdb-address-streets address) "\n")
+				 "\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-string address)))
+					(bbdb-address-zip-string address))))
+		     (t
+		      (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-string 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)))))
 	  (setq eudc-rec (cons (cons attr (car val)) eudc-rec)))
 	 ((> (length val) 0)
 	  (setq eudc-rec (cons (cons attr val) eudc-rec)))
+	 ((and (>= bbdb-file-format 6) (= (length val) 0)))
 	 (t
 	  (error "Unexpected attribute value")))))
     (nreverse eudc-rec)))
 
 (provide 'eudcb-bbdb)
 
-;;; eudcb-bbdb.el ends here
+;;; eudcb-bbdb.el ends here
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.