Commits

Anonymous committed 57dbcb7

Synch with v1.04

Comments (0)

Files changed (6)

+1998-04-21  Oscar Figueiredo  <Oscar.Figueiredo@di.epfl.ch>
+
+	* eudc: Released 1.04
+
+	* eudc.texi: Documented hotlist edit mode.  Minor fixes.
+
+	* eudc.el: (eudc-hotlist-mode): Doc fix
+
+1998-04-19  Oscar Figueiredo  <Oscar.Figueiredo@di.epfl.ch>
+
+	* eudc.el: Added server hotlist editing facilities
+
+1998-04-18  Oscar Figueiredo  <Oscar.Figueiredo@di.epfl.ch>
+
+	* eudc-ldap.el: (eudc-ldap-attributes-translation-alist): Added
+	`firstname'
+
+	* eudc-ph.el: (eudc-ph-get-field-list): New parameter
+
+	* eudc.el: (eudc-query-form-attributes): Added `firstname'
+	(eudc-get-attribute-list): Bug fix
+	
 1998-04-05  Oscar Figueiredo  <Oscar.Figueiredo@di.epfl.ch>
 
 	* eudc: Released 1.03
 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
 
-VERSION = 1.03
-AUTHOR_VERSION = 1.03
+VERSION = 1.04
+AUTHOR_VERSION = 1.04
 MAINTAINER = Oscar Figueiredo <Oscar.Figueiredo@epfl.ch>
 PACKAGE = eudc
 PKG_TYPE = regular
 ;; Author: Oscar Figueiredo <Oscar.Figueiredo@epfl.ch>
 ;; Maintainer: Oscar Figueiredo <Oscar.Figueiredo@epfl.ch>
 ;; Created: Feb 1998
-;; Version: 1.5
+;; Version: 1.6
 ;; Keywords: help
 
 ;; This file is part of XEmacs
 
 (defvar eudc-ldap-attributes-translation-alist
   '((name . sn)
+    (firstname . givenname)
     (email . mail)
     (phone . telephonenumber))
   "Alist mapping EUDC attribute names to LDAP names.")
 ;; Author: Oscar Figueiredo <Oscar.Figueiredo@epfl.ch>
 ;; Maintainer: Oscar Figueiredo <Oscar.Figueiredo@epfl.ch>
 ;; Created: Feb 1998
-;; Version: $Revision$
+;; Version: 1.5
 ;; Keywords: help
 
 ;; This file is part of XEmacs
 	 (eudc-ph-do-request request)
 	 (eudc-ph-parse-query-result return-fields))))
 
-(defun eudc-ph-get-field-list ()
-  "Return a list of valid field names for the current server."
+(defun eudc-ph-get-field-list (full-records)
+  "Return a list of valid field names for the current server.
+If FULL-RECORDS is non-nil, full records including field description
+are returned"
   (interactive)
   (eudc-ph-do-request "fields")
-  (mapcar 'eudc-caar (eudc-ph-parse-query-result)))
+  (if full-records
+      (eudc-ph-parse-query-result)
+    (mapcar 'eudc-caar (eudc-ph-parse-query-result))))
 
 
 (defun eudc-ph-parse-query-result (&optional fields)
 ;; Author: Oscar Figueiredo <Oscar.Figueiredo@epfl.ch>
 ;; Maintainer: Oscar Figueiredo <Oscar.Figueiredo@epfl.ch>
 ;; Created: Feb 1998
-;; Version: 1.13
+;; Version: 1.16
 ;; Keywords: help
 
 ;; This file is part of XEmacs
 			(symbol :tag "")))
   :group 'eudc)
 
-(defcustom eudc-query-form-attributes '(name email phone)
+(defcustom eudc-query-form-attributes '(name firstname email phone)
   "*A list of attributes presented in the query form."
   :tag   "Attributes in Query Forms"
   :type  '(repeat (symbol :tag "Attribute name"))
 
 (defvar eudc-form-widget-list nil)
 (defvar eudc-mode-map nil)
+(defvar eudc-hotlist-mode-map nil)
+(defvar eudc-hotlist-list-beginning nil)
 
 ;; Used by the selection insertion mechanism
 (defvar eudc-pre-select-window-configuration nil)
 ;; A mapping between EUDC attribute names and corresponding
 ;; protocol specific names
 ;; The following names are defined by EUDC and may be included 
-;; in that list: `name' , `email', `phone'
+;; in that list: `name' , `firstname', `email', `phone'
 (defvar eudc-protocol-attributes-translation-alist nil)
 
 ;; A function called each time EUDC switches to a protocol
   (run-hooks 'eudc-mode-hook)
   )
 
+(defun eudc-hotlist-mode ()
+  "Major mode used to edit the hotlist of servers.
+
+These are the special commands of this mode:
+    a -- Add a new server to the list.
+    d -- Delete the server at point from the list.
+    s -- Select the server at point.
+    t -- Transpose the server at point and the previous one
+    q -- Commit the changes and quit.
+    x -- Quit without commiting the changes."
+  (interactive)
+  (kill-all-local-variables)
+  (setq major-mode 'eudc-hotlist-mode)
+  (setq mode-name "EUDC-Servers")
+  (use-local-map eudc-hotlist-mode-map)
+  (setq mode-popup-menu eudc-hotlist-menu)
+  (setq buffer-read-only t))
+
 ;;}}}        
 
 ;;{{{      High-level interfaces (interactive functions)
 otherwise a list of symbols is returned."
   (interactive)
   (if eudc-list-attributes-function
-      (let ((entries (funcall eudc-list-attributes-function)))
+      (let ((entries (funcall eudc-list-attributes-function (interactive-p))))
 	(if entries 
 	    (if (interactive-p)
 		(eudc-display-records entries t)
     (widget-setup))
   )
 
+(defun eudc-edit-hotlist ()
+  "Edit the hotlist of directory servers in a specialized buffer"
+  (interactive)
+  (switch-to-buffer (get-buffer-create "*EUDC Servers*"))
+  (setq buffer-read-only nil)
+  (erase-buffer)
+  (insert "              EUDC Servers\n"
+	  "              ============\n"
+	  "\n"
+	  "Server                        Protocol\n"
+	  "------                        --------\n"
+	  "\n")
+  (setq eudc-hotlist-list-beginning (point))
+  (mapcar '(lambda (entry)
+	     (insert (car entry))
+	     (indent-to 30)
+	     (insert (symbol-name (cdr entry)) "\n"))
+	  eudc-server-hotlist)
+  (eudc-hotlist-mode))
+
+(defun eudc-hotlist-add-server ()
+  "Add a new server to the list after current one"
+  (interactive)
+  (if (not (eq major-mode 'eudc-hotlist-mode))
+      (error "Not in a EUDC hotlist edit buffer"))
+  (let ((server (read-from-minibuffer "Server: "))
+	(protocol (completing-read "Protocol: "
+				   (mapcar '(lambda (elt)
+					      (cons (symbol-name elt)
+						    elt))
+					   eudc-supported-protocols)))
+	(buffer-read-only nil))
+    (if (not (eobp))
+	(forward-line 1))
+    (insert server)
+    (indent-to 30)
+    (insert protocol "\n")))
+
+(defun eudc-hotlist-delete-server ()
+  "Delete the server at point from the list"
+  (interactive)
+  (if (not (eq major-mode 'eudc-hotlist-mode))
+      (error "Not in a EUDC hotlist edit buffer"))
+  (let ((buffer-read-only nil))
+    (save-excursion
+      (beginning-of-line)
+      (if (and (>= (point) eudc-hotlist-list-beginning)     
+	       (looking-at "^\\([.a-zA-Z:0-9]+\\)[ \t]+\\([a-zA-Z]+\\)"))
+	  (kill-line 1)
+	(error "No server on this line")))))
+
+(defun eudc-hotlist-quit-edit ()
+  "Quit the hotlist editing mode and save changes to the hotlist"
+  (interactive)
+  (if (not (eq major-mode 'eudc-hotlist-mode))
+      (error "Not in a EUDC hotlist edit buffer"))
+  (let (hotlist)
+    (goto-char eudc-hotlist-list-beginning)
+    (while (looking-at "^\\([.a-zA-Z:0-9]+\\)[ \t]+\\([a-zA-Z]+\\)")
+      (setq hotlist (cons (cons (match-string 1)
+				(intern (match-string 2)))
+			  hotlist))
+      (forward-line 1))
+    (setq eudc-server-hotlist (nreverse hotlist))
+    (eudc-install-menu)
+    (kill-this-buffer)))
+
+(defun eudc-hotlist-select-server ()
+  "Select the server at point as the current server"
+  (interactive)
+  (if (not (eq major-mode 'eudc-hotlist-mode))
+      (error "Not in a EUDC hotlist edit buffer"))
+  (save-excursion
+    (beginning-of-line)
+    (if (and (>= (point) eudc-hotlist-list-beginning)
+	     (looking-at "^\\([.a-zA-Z:0-9]+\\)[ \t]+\\([a-zA-Z]+\\)"))
+	(progn
+	  (eudc-set-server (match-string 1) (intern (match-string 2)))
+	  (message "Current directory server is %s (%s)" eudc-server eudc-protocol))
+      (error "No server on this line"))))
+      
+(defun eudc-hotlist-transpose-servers ()
+  "Swap the order of the server with the previous one in the list"
+  (interactive)
+  (if (not (eq major-mode 'eudc-hotlist-mode))
+      (error "Not in a EUDC hotlist edit buffer"))
+  (let ((buffer-read-only nil))
+    (save-excursion
+      (beginning-of-line)
+      (if (and (>= (point) eudc-hotlist-list-beginning)
+	       (looking-at "^\\([.a-zA-Z:0-9]+\\)[ \t]+\\([a-zA-Z]+\\)")
+	       (progn 
+		 (forward-line -1)
+		 (looking-at "^\\([.a-zA-Z:0-9]+\\)[ \t]+\\([a-zA-Z]+\\)")))
+	  (progn
+	    (forward-line 1)
+	    (transpose-lines 1))))))
+  
 (defun eudc-bookmark-server (server protocol)
   "Add SERVER to the EUDC `servers' hotlist."
   (interactive "sDirectory server: \nsProtocol: ")
 	map))
 (set-keymap-parent eudc-mode-map widget-keymap)
 
+(setq eudc-hotlist-mode-map
+      (let ((map (make-sparse-keymap)))
+	(define-key map "a" 'eudc-hotlist-add-server)
+	(define-key map "d" 'eudc-hotlist-delete-server)
+	(define-key map "s" 'eudc-hotlist-select-server)
+	(define-key map "t" 'eudc-hotlist-transpose-servers)
+	(define-key map "q" 'eudc-hotlist-quit-edit)
+	(define-key map "x" 'kill-this-buffer)
+	map))
+	
 (defconst eudc-tail-menu 
   `(["---" nil nil]
     ["Query with Form" eudc-query-form t]
 (defconst eudc-server-menu 
   '(["---" nil nil]
     ["Bookmark Current Server" eudc-bookmark-current-server t]
+    ["Edit Server List" eudc-edit-hotlist t]
     ["New Server" eudc-set-server t]))
 
+(defconst eudc-hotlist-menu
+  '("EUDC Hotlist Edit"
+    ["---" nil nil]
+    ["Add New Server" eudc-hotlist-add-server t]
+    ["Delete Server" eudc-hotlist-delete-server t]
+    ["Select Server" eudc-hotlist-select-server t]
+    ["Transpose Servers" eudc-hotlist-transpose-servers t]
+    ["Save and Quit" eudc-hotlist-quit-edit t]
+    ["Exit without Saving" kill-this-buffer t]))
 
 (defun eudc-menu ()
   (let (command)
     (append '("Directory")
 	    (list
-	     (append '("Server")
-		     (mapcar (function 
-			      (lambda (servspec)
-				(let* ((server (car servspec))
-				       (protocol (cdr servspec))
-				       (proto-name (symbol-name protocol)))
-				  (setq command (intern (concat "eudc-set-server-" server "-" proto-name)))
-				  (if (not (fboundp command))
-				      (fset command `(lambda ()
-						       (interactive)
-						       (eudc-set-server ,server (quote ,protocol))
-						       (message "Selected directory server is now %s (%s)" ,server ,proto-name))))
-				  (vector (format "%s (%s)" server proto-name) command t))))
-			     eudc-server-hotlist)
-		     eudc-server-menu))
+	     (append 
+	      '("Server")
+	      (mapcar 
+	       (function 
+		(lambda (servspec)
+		  (let* ((server (car servspec))
+			 (protocol (cdr servspec))
+			 (proto-name (symbol-name protocol)))
+		    (setq command (intern (concat "eudc-set-server-" 
+						  server 
+						  "-" 
+						  proto-name)))
+		    (if (not (fboundp command))
+			(fset command 
+			      `(lambda ()
+				 (interactive)
+				 (eudc-set-server ,server (quote ,protocol))
+				 (message "Selected directory server is now %s (%s)" 
+					  ,server 
+					  ,proto-name))))
+		    (vector (format "%s (%s)" server proto-name) command t))))
+	       eudc-server-hotlist)
+	      eudc-server-menu))
 	    eudc-tail-menu)))
 
 (defun eudc-install-menu ()
 
 @ifinfo
 @direntry
-*eudc::   A client for directory servers (LDAP, PH)
+* EUDC::   A client for directory servers (LDAP, PH)
 @end direntry
 
-This file documents EUDC v1.02
+This file documents EUDC v1.04
 
 EUDC is part of XEmacs.
 
 @comment  node-name,  next,         previous, up
 
 
-This manual documents EUDC v1.02, the Emacs Unified Directory Client
+This manual documents EUDC v1.04, the Emacs Unified Directory Client.
+
 A common interface interface to directory servers using various
 protocols such as LDAP or the CCSO white pages directory system (PH/QI)
 
 protocols. 
 
 Currently supported protocols are:
+
 @itemize @bullet
 @item
 LDAP, Lightweight Directory Access Protocol
 CCSO PH/QI
 @end itemize
 
-EUDC provides a client interface to directory servers running one 
-of these protocols.  Its main features are:
+The main features of the EUDC interface are:
 
 @itemize @bullet
 @item 
 
 After installing EUDC as a package you will find (the next time
 you launch XEmacs) a new @code{Directory} submenu in the @code{Tools}
-menu that will let you access EUDC.
+menu that will give you access to EUDC.
 
-You may find useful to add the following to your individual
+You may find also useful to add the following to your individual
 initialization file to add a shortcut for e-mail address expansion in
 e-mail composition buffers (@pxref{Inline Query Expansion})
 
 EUDC requires LDAP support to be compiled in XEmacs to access
 LDAP servers.  If LDAP support has not been compiled in your XEmacs
 executable you will get that error message: @samp{Cannot open load file:
-ldap-internal} 
+ldap} 
 
 LDAP support is automatically compiled in when you build XEmacs provided
 appropriate LDAP libraries are installed on your system.  As of this
-writing you can use either:
+writing you can use either (URLs are subject to change):
 
 @itemize @bullet
 @item
-University of Michingan's LDAP Client software
+University of Michigan's LDAP Client software
 (@url{http://www.umich.edu/~dirsvcs/ldap/})
 @item
 Netscape's LDAP SDK (@url{http://developer.netscape.com/one/directory/})
 a QI directory server this is difficult to distinguish from attributes
 having multi-line values such as the postal address that may contain a
 line for the street and another one for the zip code and city name. In
-both cases, EUDC will considers the attribute be duplicated.
+both cases, EUDC will consider the attribute be duplicated.
 
 EUDC has several methods to deal with duplicated attributes. The
 available methods are:
 argument is supplied to @code{eudc-query-form}).
 
 Since the different directory protocols to which eudc interfaces may
-have different names for equivalent attributes, EUDC defines its
-own set of attribute names and a mapping between these names and
-their protocol-specific equivalent through the variable
+have different names for equivalent attributes, EUDC defines its own set
+of attribute names and a mapping between these names and their
+protocol-specific equivalent through the variable
 @code{eudc-protocol-attributes-translation-alist}.  Names currently
-defined by EUDC are @samp{name}, @samp{email} and @samp{phone}. 
+defined by EUDC are @samp{name}, @samp{firstname}, @samp{email} and
+@samp{phone}.
 
 @defvar eudc-query-form-attributes
 A list of attributes presented in the query form.  Attribut names in
 @end defvar
 
 @deffn Command eudc-query-form get-fields-from-server
-Display a form to query the CCSO PH/QI Nameserver.
-If given a non-nil argument the function first queries the  server 
-for the existing fields and displays a corresponding form.
+Display a form to query the directory server.  If given a non-@code{nil}
+argument the function first queries the server for the existing fields
+and displays a corresponding form.  All protocols may not support a
+non-@code{nil} argument here.
 @end deffn
 
 Since the names of the fields may not be explicit enough or adapted to
 its name. You can add the current server to the list with the command
 @code{eudc-bookmark-current-server}. The list is contained in the variable
 @code{eudc-server-hotlist} which is stored in and retrieved from the file
-designated by @code{eudc-options-file}.
+designated by @code{eudc-options-file}.  EUDC also provides a facility to
+edit the hotlist interactively (@pxref{The Hotlist Edit Buffer})
 
 @deffn Command eudc-bookmark-server server
 Add @var{server} to the hotlist of servers
 loaded.
 @end defvar
 
-There is currently no way to remove a server from the list other than
-editing directly the @code{eudc-options-file}.
+@menu
+* The Hotlist Edit Buffer::  An interactive hotlist editing facility
+@end menu
+
+@node The Hotlist Edit Buffer
+@comment  node-name,  next,  previous,  up
+@subsection The Hotlist Edit Buffer
+
+The hotlist edit buffer offers a means to manage a list of frequently
+used servers.  Commands are available in the context pop-up menu
+generally bound to the right mouse button.  Those commands also have
+equivalent keybindings.
+
+@deffn Command eudc-hotlist-add-server
+Bound to @kbd{a}.
+Add a new server to the hotlist on the line after point
+@end deffn
+
+@deffn Command eudc-hotlist-delete-server
+Bound to @kbd{d}.
+Delete the server on the line point is on
+@end deffn
+
+@deffn Command eudc-hotlist-select-server
+Bound to @kbd{s}.
+Select the server the point is on as the current directory server for
+the next queries
+@end deffn
+
+@deffn Command eudc-hotlist-transpose-servers
+Bound to @kbd{t}.
+Bubble up the server the point is on to the top of the list
+@end deffn
+
+@deffn Command eudc-hotlist-quit-edit
+Bound to @kbd{q}.
+Save the changes and quit the hotlist edit buffer.  Use @kbd{x} or
+@code{kill-buffer} to exit without saving.
+@end deffn
+
 
 
 @node Creating BBDB Records, Protocol Locals, The Server Hotlist, Usage