This file documents EUDC v1.09

EUDC is part of XEmacs.

EUDC is 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)

Copyright © 1998 Free Software Foundation, Inc.

Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.

Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying and the terms of the ``GNU General Public License'', and provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.

Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Free Software Foundation.

This manual documents EUDC v1.09, 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)

Overview
********

EUDC, the Emacs Unified Directory Client, provides a common user interface to access directory servers using different directory protocols.

Currently supported protocols are:

  * LDAP, Lightweight Directory Access Protocol

  * CCSO PH/QI

The main features of the EUDC interface are:

  * Queries using a customizable form

  * Inline query expansion (for instance you can expand a name to an e-mail address in a mail message buffer using a server as an address book)

  * Fast minibuffer queries for e-mail addresses and phone numbers

  * Interface to BBDB to let you insert server records into your own BBDB database (see BBDB (BBDB Manual))

LDAP
====

LDAP, Lightweight Directory Access Protocol, is a communication protocol for directory applications defined in RFC 1777.

Quoted from RFC 1777:

[LDAP] is designed to provide access to the X.500 Directory while not incurring the resource requirements of the Directory Access Protocol (DAP). This protocol is specifically targeted at simple management applications and browser applications that provide simple read/write interactive access to the X.500 Directory, and is intended to be a complement to the DAP itself.

LDAP servers usually store (but are not limited to) information about people such as their name, phone number, e-mail address, office location, etc... More information about LDAP can be found at http://www.umich.edu/~dirsvcs/ldap/

EUDC requires external support to access LDAP directory servers (see LDAP Requirements)

CCSO PH/QI
==========

The Central Computing Services Office (CCSO) of the University of Illinois at Urbana Champaign (UIUC) created and freely distributes a directory system that is currently in use in more than 300 organizations around the world. The system records information about people such as their address, phone number, e-mail, academic information or any other details it was configured to.

The system consists of two parts: a database server traditionally called qi and a command-line client called EUDC. ftp://uiarchive.cso.uiuc.edu/pub/packages/ph is the main distribution site. http://www.uiuc.edu/cgi-bin/ph/lookup?Query=. provides a listing of the QI servers in activity.

The original command-line ph client that comes with the ph/qi distribution provides additional features like the possibility to communicate with the server in login mode which makes it possible to change records in the database. This is not implemented in EUDC.

Installation
************

EUDC is distributed as an XEmacs package.  Follow the rules for the installation of XEmacs packages.

After installing EUDC as a package you will find (the next time you launch XEmacs) a new Directory submenu in the Tools menu that will give you access to EUDC.

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 (see Inline Query Expansion)

     (eval-after-load
      "message"
      '(define-key message-mode-map [(control ?c) (tab)] 'eudc-expand-inline))
     (eval-after-load
      "mail"
      '(define-key mail-mode-map [(control ?c) (tab)] 'eudc-expand-inline))

LDAP Requirements
=================

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: Cannot open load file: 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 (URLs are subject to change):

  * University of Michigan's LDAP Client software (http://www.umich.edu/~dirsvcs/ldap/)

  * Netscape's LDAP SDK (http://developer.netscape.com/one/directory/)

Usage
*****

This chapter describes the usage of EUDC. Most functions and customization options are available through the Directory sub-menu of the Tools sub-menu.

Querying Servers
================

EUDC's basic functionality is to let you query a directory server and return the results back to you. There are several things you may want to customize in this process.

Selecting a Server
------------------

Before doing any query you will need to set the directory server.  You need to specify the name of the host machine running the server software and the protocol to use. If you do not set the server in any fashion, EUDC will ask you for one when you make your first query.

You can set the server by selecting one from your hotlist of servers (see The Server Hotlist) available in the Server submenu or by selecting New Server in that same menu.

 -- Variable: eudc-server
     The name or IP address of the directory server. A TCP port number may be specified by appending a colon and a number to the name of the server. You will not need this unless your server runs on a port other than the default (which depends on the protocol).

 -- Variable: eudc-protocol
     The directory protocol to use to query the server.  Currently supported protocols in this version of EUDC are ph and ldap.

 -- Command: eudc-set-server
     This command accessible from Server submenu lets you specify a new directory server and protocol.

Return Attributes
-----------------

Directory servers may be configured to return a default set of attributes for each record matching a query if the query specifies none. The variable eudc-default-return-attributes controls the return attributes you want to see, if different from the server defaults.

 -- Variable: eudc-default-return-attributes
     A list of the default attributes to extract from directory entries.  If set to the symbol all then all available attributes are returned. nil returns the default attributes as configured in the server. Default is nil

The server may return several matching records to a query. Some of the records may however not contain all the attributes you requested. You can chose to discard those records.

 -- User Option: eudc-strict-return-matches
     If non-nil, entries that do not contain all the requested return attributes are ignored.  Default is t.

Duplicate Attributes
--------------------

Directory standards may authorize different instances of the same attribute in a record. For instance the record of a person may contain several e-mail fields containing different e-mail addresses. When using 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 consider the attribute be duplicated.

EUDC has several methods to deal with duplicated attributes. The available methods are:

list
     Makes a list with the different values of the duplicate attribute. The record is returned with only one instance of the attribute with a list of all the different values as a value. This is the default method that is used to handle duplicate fields for which no other method has been specified.

first
     Discards all the duplicate values of the field keeping only the first one.

concat
     Concatenates the different values using \n as a separator. The record keeps only one instance of the field the value of which is a single multi-line string.

duplicate
     Duplicates the whole record into as many instances as there are different values for the field. This is the default for the e-mail field. Thus a record containing 3 different e-mail addresses is duplicated into three different records each having a single e-mail address. This is particularly useful in combination with select as the method to handle multiple matches in inline expansion queries (see Inline Query Expansion) because you are presented with the 3 addresses in a selection buffer

Because a method may not be applicable to all fields, the variable eudc-duplicate-attribute-handling-method lets you specify either a default method for all fields or a method for each individual field.

 -- Variable: eudc-duplicate-attribute-handling-method
     A method to handle entries containing duplicate attributes.  This is either an alist (ATTR . METHOD) or a symbol METHOD. The alist form of the variable associates a method to an individual attribute name, the second form specifies a method applicable to all attribute names. Available methods are: list, first, concat, duplicate (see above).  Defaults to list.

Query Form
==========

The simplest way to query your directory server is to use the query form. You display the query form with the Query with Form menu item or by invoking the command eudc-query-form. The attribute names presented in this form are defined by the eudc-query-form-attributes variable (unless a non-nil argument is supplied to 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 eudc-protocol-attributes-translation-alist.  Names currently defined by EUDC are name, firstname, email and phone.

 -- Variable: eudc-query-form-attributes
     A list of attributes presented in the query form.  Attribut names in this list should be either EUDC attribute names or valid attribute names.  You can get a list of valid attribute names for the current protocol with the List Valid Attribute Names menu item or the eudc-get-attribute-list command. Defaults to name, email and phone.

 -- Command: eudc-query-form get-fields-from-server
     Display a form to query the directory server.  If given a non-nil argument the function first queries the server for the existing fields and displays a corresponding form.  All protocols may not support a non-nil argument here.

Since the names of the fields may not be explicit enough or adapted to be directly displayed as prompt strings in the form, the variable eudc-user-attribute-names-alist lets you define more explicit names for directory attribute names.  This variable is ignored if eudc-use-raw-directory-names is non-nil.

 -- Variable: eudc-user-attribute-names-alist
     This is an alist user-defined names for directory attributes used in query/response forms. Prompt strings for attributes that are not in this alist are derived by splitting the attribute name at underscores and capitalizing the individual words.

 -- Variable: eudc-use-raw-directory-names
     If non-nil, use attributes names as defined in the directory. Otherwise, directory query/response forms display the user attribute names defined in eudc-user-attribute-names-alist.

Upon successful completion the command will display a buffer containing the results of the query. The fields that are returned for each record are controlled by eudc-default-return-attributes (see Return Attributes)

Inline Query Expansion
======================

Inline query expansion is a powerful method to get completion from your directory server. The most common usage is for expanding names to e-mail addresses in mail message buffers. The expansion is performed by the command eudc-expand-inline which is available from the Directory menu but can also be conveniently bound to a key shortcut (see Installation)  The operation is controlled by the variables eudc-inline-expansion-format, eudc-inline-query-format-list, eudc-expanding-overwrites-query and eudc-multiple-match-handling-method

 -- Command: eudc-expand-inline replace-p
     Query the server and expand the query string before point.  The query string consists of the buffer substring from the point back to the preceding comma, colon or beginning of line. eudc-inline-query-format-list controls how individual words are mapped onto directory attribute names.  After querying the server for the given string, the expansion specified by eudc-inline-expansion-format is inserted in the buffer at point. If REPLACE-P is t then this expansion replaces the query string in the buffer.  If eudc-expanding-overwrites-query is non-nil then the meaning of REPLACE-P is negated.

 -- Variable: eudc-inline-query-format-list
     Format of an inline expansion query.  This list specifies how individual words in the inline query string are associated to directory attribute names.  If nil all the words will be mapped onto the server default attribute name (generally name). Default is nil.

 -- Variable: eudc-inline-expansion-format
     This variable lets you control what is exactly inserted into the buffer upon an inline expansion request. It is a list whose first element is a string passed to format. Remaining elements are symbols corresponding directory attribute names, corresponding attribute values are passed as additional arguments to format. Default is ("%s" email) but you may want to consider a value like ("%s <%s>" name email)

 -- Variable: eudc-multiple-match-handling-method
     This variable controls what to do when multiple entries match a query for an inline expansion.  Possible values are:

     first
          The first match is considered as being the only one, the others are discarded.

     select
          A selection buffer pops-up where you can choose a particular match. This is the default value of the variable.

     all
          The expansion uses all records successively

     abort
          An error is signaled. The expansion aborts.

     Defaults to select

The Server Hotlist
==================

EUDC lets you maintain a list of frequently used servers so that you can easily switch from one to another. This hotlist appears in the Server sub-menu. You select a server in this list by clicking on its name. You can add the current server to the list with the command eudc-bookmark-current-server. The list is contained in the variable eudc-server-hotlist which is stored in and retrieved from the file designated by eudc-options-file.  EUDC also provides a facility to edit the hotlist interactively (see The Hotlist Edit Buffer)

 -- Command: eudc-bookmark-server server
     Add SERVER to the hotlist of servers

 -- Command: eudc-bookmark-current-server
     Add the current server to the hotlist of servers

 -- Variable: eudc-options-file
     The name of a file where EUDC stores its internal variables (the hotlist and the current server). EUDC will try to load that file upon initialization so, if you choose a file name different from the defaults ~/.eudc-options, be sure to set this variable to the appropriate value before EUDC is itself loaded.

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.

 -- Command: eudc-hotlist-add-server
     Bound to a. Add a new server to the hotlist on the line after point

 -- Command: eudc-hotlist-delete-server
     Bound to d. Delete the server on the line point is on

 -- Command: eudc-hotlist-select-server
     Bound to s. Select the server the point is on as the current directory server for the next queries

 -- Command: eudc-hotlist-transpose-servers
     Bound to t. Bubble up the server the point is on to the top of the list

 -- Command: eudc-hotlist-quit-edit
     Bound to q. Save the changes and quit the hotlist edit buffer.  Use x or kill-buffer to exit without saving.

Creating BBDB Records
=====================

With EUDC, you can automatically create BBDB records (see BBDB (BBDB Manual)) from records you get from a directory server. You do this by moving the point to the appropriate record in a query result display buffer and invoking the command eudc-insert-record-at-point-into-bbdb with the corresponding keyboard binding, b  (This keybinding does not actually call eudc-insert-record-at-point-into-bbdb but uses eudc-try-bbdb-insert instead.) or with the menu. EUDC cannot update an existing BBDB record and will signal an error if you try to insert a record matching an existing one.

Because directory systems may not enforce a strict record format, local server installations may use different attribute names and have different ways to organize the information. Furthermore BBDB has its own record structure. For these reasons converting a record from its external directory format to the BBDB format is a highly customizable process.

 -- Variable: eudc-bbdb-conversion-alist
     The value of this variable should be a symbol naming an alist defining a mapping between BBDB field names onto directory attribute names records. This is a protocol-local variable and is initialized upon protocol switch (see Protocol Locals)  The alist is made of cells of the form (BBDB-FIELD . SPEC-OR-LIST). BBDB-FIELD is the name of a field that must be defined in your BBDB environment (standard field names are name, company, net, phone, address and notes). SPEC-OR-LIST is either a single mapping specification or a list of mapping specifications. Lists of mapping specifications are valid for the phone and address BBDB fields only. SPECs are actually s-expressions which are evaluated as follows:

     a string
          evaluates to itself

     a symbol
          evaluates to the symbol value. Symbols corresponding to directory attribute names present in the record evaluate to the value of the field in the record

     a form
          is evaluated as a function. The argument list may contain attribute names which evaluate to the corresponding values in the record. The form evaluation should return something appropriate for the particular BBDB-FIELD (see bbdb-create-internal). eudc-bbdbify-phone and eudc-bbdbify-address are provided as convenience functions to parse phones and addresses.

The default value of the PH-specific value of that variable is eudc-ph-bbdb-conversion-alist:

     ((name . name)
      (net . email)
      (address . (eudc-bbdbify-address address "Address"))
      (phone . ((eudc-bbdbify-phone phone "Phone")
                (eudc-bbdbify-phone office_phone "Office Phone"))))

This means that:

  * the name field of the BBDB record gets its value from the name attribute of the directory record

  * the net field of the BBDB record gets its value from the email attribute of the directory record

  * the address field of the BBDB record is obtained by parsing the address attribute of the directory record with the function eudc-bbdbify-address

  * two phone fields are created (when possible) in the BBDB record. The first one has "Phone" for location and its value is obtained by parsing the phone attribute of the PH/QI record with the function eudc-bbdbify-phone. The second one has "Office Phone" for location its value is obtained by parsing the office_phone attribute of the PH/QI record with the function eudc-bbdbify-phone.

 -- Function: eudc-bbdbify-phone PHONE LOCATION
     This is a convenience function provided for use in eudc-bbdb-conversion-alist. It parses PHONE into a vector compatible with bbdb-create-internal. PHONE is either a string supposedly containing a phone number or a list of such strings which are concatenated. LOCATION is used as the phone location for BBDB.

 -- Function: eudc-bbdbify-address ADDR LOCATION
     This is a convenience function provided for use in eudc-bbdb-conversion-alist. It parses ADDR into a vector compatible with bbdb-create-internal. ADDR should be an address string of no more than four lines or a list of lines. The last line is searched for the zip code, city and state name. LOCATION is used as the phone location for BBDB.

Note that only a subset of the attributes you selected with eudc-default-return-attributes and that are actually displayed may actually be inserted as part of the newly created BBDB record.

Protocol Locals
===============

EUDC can be customized independently for each directory protocol.  Each time you switch to another protocol, EUDC initializes some variables with their protocol specific values.

LDAP Locals
-----------

 -- Variable: eudc-ldap-bbdb-conversion-alist
     An alist defining the mapping from BBDB to LDAP attribute names. (see Creating BBDB Records)

PH Locals
---------

 -- Variable: eudc-ph-bbdb-conversion-alist
     An alist defining the mapping from BBDB to PH/QI attribute names. (see Creating BBDB Records)

Credits
*******

EUDC was written by Oscar Figueiredo based on ph.el by the same author.

Thanks to Soren Dayton for his suggestions, his enthusiasm and his help in testing and proofreading the code and docs of ph.el.