* doc/misc/eudc.texi (CCSO PH/QI): Remove defunct URL.
[bpt/emacs.git] / doc / misc / eudc.texi
CommitLineData
4009494e
GM
1\input texinfo.tex
2@c %**start of header
db78a8cb 3@setfilename ../../info/eudc
4009494e
GM
4@settitle Emacs Unified Directory Client (EUDC) Manual
5@afourpaper
6@c %**end of header
7
8@copying
9This file documents EUDC v1.30b.
10
11EUDC is the Emacs Unified Directory Client, a common interface to
12directory servers using various protocols such as LDAP or the CCSO white
13pages directory system (PH/QI)
14
ab422c4d 15Copyright @copyright{} 1998, 2000--2013 Free Software Foundation, Inc.
4009494e
GM
16
17@quotation
18Permission is granted to copy, distribute and/or modify this document
6a2c4aec 19under the terms of the GNU Free Documentation License, Version 1.3 or
4009494e 20any later version published by the Free Software Foundation; with no
debf4439
GM
21Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
22and with the Back-Cover Texts as in (a) below. A copy of the license
23is included in the section entitled ``GNU Free Documentation License''.
4009494e 24
6f093307 25(a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
6bf430d1 26modify this GNU manual.''
4009494e
GM
27@end quotation
28@end copying
29
0c973505 30@dircategory Emacs network features
4009494e 31@direntry
62e034c2 32* EUDC: (eudc). Emacs client for directory servers (LDAP, PH).
4009494e
GM
33@end direntry
34
35@footnotestyle end
36
37@titlepage
db671917
AS
38@title EUDC Manual
39@subtitle The Emacs Unified Directory Client
4009494e
GM
40@author by Oscar Figueiredo
41@code{1.30b}
42
43@page
44@vskip 0pt plus 1fill
45@insertcopying
46@end titlepage
47
5dc584b5
KB
48@contents
49
4009494e
GM
50@ifnottex
51@node Top, Overview, (dir), (dir)
8a36c07f 52@top Emacs Unified Directory Client
4009494e
GM
53@comment node-name, next, previous, up
54
5dc584b5 55@insertcopying
4009494e
GM
56@end ifnottex
57
58@menu
59* Overview:: Summary of EUDC features
60* Installation:: How to install EUDC
61* Usage:: The various usage possibilities explained
62* Credits:: Who's done what
63* GNU Free Documentation License:: The license for this documentation.
64* Command and Function Index::
65* Variables Index::
66@end menu
67
68
69
70
71
72@node Overview, Installation, Top, Top
73@comment node-name, next, previous, up
74@chapter Overview
75
76EUDC, the @dfn{Emacs Unified Directory Client}, provides a common user
77interface to access directory servers using different directory
78protocols.
79
80Currently supported back-ends are:
81
82@itemize @bullet
83@item
84LDAP, Lightweight Directory Access Protocol
85@item
86CCSO PH/QI
87@item
88BBDB, Big Brother's Insidious Database
89@end itemize
90
91The main features of the EUDC interface are:
92
93@itemize @bullet
94@item
95Queries using a customizable form
96@item
97Inline query expansion (for instance you can expand a name
98to an email address in a mail message buffer using a server as an
99address book)
100@item
101Multiple servers can be tried in turn until a match is found for an
102inline query
103@item
104Fast minibuffer queries for email addresses and phone numbers
105@item
106Interface to BBDB to let you insert server records into your own BBDB database
107(@pxref{Top,,BBDB,bbdb,BBDB Manual})
108@end itemize
109
110@menu
111* LDAP:: What is LDAP ?
112* CCSO PH/QI:: What is CCSO, PH, QI ?
113* BBDB:: What is BBDB ?
114@end menu
115
116
117
118@node LDAP, CCSO PH/QI, Overview, Overview
119@comment node-name, next, previous, up
120@section LDAP
121
122LDAP, @dfn{the Lightweight Directory Access Protocol}, is a communication
123protocol for directory applications defined in RFC 1777.
124
125Quoted from RFC 1777:
126
127@quotation
128[LDAP] is designed to provide access to the X.500 Directory while not
129incurring the resource requirements of the Directory Access Protocol
130(DAP). This protocol is specifically targeted at simple management
131applications and browser applications that provide simple read/write
132interactive access to the X.500 Directory, and is intended to be a
133complement to the DAP itself.
134@end quotation
135
136LDAP servers usually store (but are not limited to) information about
137people such as their name, phone number, email address, office
138location, etc@enddots{} More information about LDAP can be found at
e1a8c4c0 139@url{http://www.openldap.org/}.
4009494e
GM
140
141EUDC requires external support to access LDAP directory servers
142(@pxref{LDAP Requirements})
143
144
145@node CCSO PH/QI, BBDB, LDAP, Overview
146@comment node-name, next, previous, up
147@section CCSO PH/QI
148
149The Central Computing Services Office (CCSO) of the University of
e1a8c4c0
GM
150Illinois at Urbana Champaign created and freely distributed a
151directory system that was used by many organizations in the 1990s.
152The system records information about people such as their address,
153phone number, email, academic information or any other details it was
154configured to. Nowadays this system is not widely used.
4009494e
GM
155
156The system consists of two parts: a database server traditionally called
6338a049
GM
157@samp{qi} and a command-line client called @samp{ph}.
158@ignore
159Until 2010, the code could be downloaded from
160@url{http://www-dev.cites.uiuc.edu/ph/}.
161@end ignore
162
163The original command-line @samp{ph} client that came with the
164@samp{ph/qi} distribution provided additional features that are
165not implemented in EUDC, like the possibility to communicate with the
166server in login-mode, which made it possible to change records in the
167database.
4009494e
GM
168
169
170@node BBDB, , CCSO PH/QI, Overview
171@comment node-name, next, previous, up
172@section BBDB
173
174BBDB is the @dfn{Big Brother's Insidious Database}, a package for Emacs
175originally written by Jamie Zawinski which provides rolodex-like
176database functionality featuring tight integration with the Emacs mail
177and news readers.
178
179It is often used as an enhanced email address book.
180
181EUDC considers BBDB as a directory server back end just like LDAP or
182PH/QI servers, though BBDB has no client/server protocol and thus always
183resides locally on your machine. The point in this is not to offer an
184alternate way to query your BBDB database (BBDB itself provides much
185more flexible ways to do that), but rather to offer an interface to your
186local directory that is consistent with the interface to external
187directories (LDAP, PH/QI). This is particularly interesting when
188performing queries on multiple servers.
189
190EUDC also offers a means to insert results from directory queries into
191your own local BBDB (@pxref{Creating BBDB Records})
192
193@node Installation, Usage, Overview, Top
194@comment node-name, next, previous, up
195@chapter Installation
196
197Add the following to your @file{.emacs} init file:
198@lisp
199(require 'eudc)
200@end lisp
201This will install EUDC at startup.
202
203After installing EUDC you will find (the next time you launch Emacs) a
204new @code{Directory Search} submenu in the @samp{Tools} menu that will
205give you access to EUDC.
206
207You may also find it useful to add the following to your @file{.emacs}
208initialization file to add a shortcut for email address expansion in
209email composition buffers (@pxref{Inline Query Expansion})
210
211@lisp
212(eval-after-load
213 "message"
214 '(define-key message-mode-map [(control ?c) (tab)] 'eudc-expand-inline))
215(eval-after-load
216 "sendmail"
217 '(define-key mail-mode-map [(control ?c) (tab)] 'eudc-expand-inline))
218@end lisp
219
220@menu
221* LDAP Requirements:: EUDC needs external support for LDAP
222@end menu
223
224@node LDAP Requirements, , Installation, Installation
225@comment node-name, next, previous, up
226@section LDAP Requirements
227
e1a8c4c0 228LDAP support is added by means of @file{ldap.el}, which is part of Emacs.
4009494e 229@file{ldap.el} needs an external command line utility named
e1a8c4c0
GM
230@file{ldapsearch}, available as part of Open LDAP
231(@url{http://www.openldap.org/}).
4009494e
GM
232
233
234@node Usage, Credits, Installation, Top
235@comment node-name, next, previous, up
236@chapter Usage
237
1df7defd 238This chapter describes the usage of EUDC@. Most functions and
4009494e
GM
239customization options are available through the @samp{Directory Search}
240submenu of the @samp{Tools} submenu.
241
242@menu
243* Querying Servers:: How queries are performed and handled
244* Query Form:: How to use and customize the query form
245* Display of Query Results:: Controlling how query results are presented
246* Inline Query Expansion:: How to use and customize inline queries
247* The Server Hotlist:: How to use and manage the server hotlist
248* Multi-server Queries:: How to query multiple servers successively
249* Creating BBDB Records:: How to insert query results into your BBDB
250* Server/Protocol Locals:: Customizing on a per server/protocol basis
251@end menu
252
253
254@node Querying Servers, Query Form, Usage, Usage
255@comment node-name, next, previous, up
256@section Querying Servers
257
258EUDC's basic functionality is to let you query a directory server and
259return the results back to you. There are several things you may want
260to customize in this process.
261
262
263@menu
264* Selecting a Server:: The first thing to do
265* Return Attributes:: Configuring what the server should return
266* Duplicate Attributes:: What to do when records have duplicate attributes
267@end menu
268
269@node Selecting a Server, Return Attributes, Querying Servers, Querying Servers
270@subsection Selecting a Server
271
272Before doing any query you will need to set the directory server. You
273need to specify the name of the host machine running the server software
274and the protocol to use. If you do not set the server in any fashion,
275EUDC will ask you for one when you make your first query.
276
277You can set the server by selecting one from your hotlist of servers
278(@pxref{The Server Hotlist}) available in the @samp{Server} submenu or
279by selecting @samp{New Server} in that same menu.
280
281LDAP servers generally require some configuration before you can perform
282queries on them. In particular, the @dfn{search base} must be
283configured. If the server you select has no configured search base then
284EUDC will propose you to configure it at this point. A customization
285buffer will be displayed where you can edit the search base and other
286parameters for the server.
287
288@defvar eudc-server
289The name or IP address of the remote directory server. A TCP port number
290may be specified by appending a colon and a number to the name of the
291server. You will not need this unless your server runs on a port other
292than the default (which depends on the protocol).
293If the directory server resides on your own computer (which is the case
294if you use the BBDB back end) then `localhost' is a reasonable value but
295it will be ignored anyway.
296@end defvar
297
298@defvar eudc-protocol
299The directory protocol to use to query the server. Currently supported
300protocols in this version of EUDC are @code{ph}, @code{ldap} and @code{bbdb}.
301@end defvar
302
303@deffn Command eudc-set-server
304This command accessible from @samp{New Server} submenu lets you specify a
305new directory server and protocol.
306@end deffn
307
308@node Return Attributes, Duplicate Attributes, Selecting a Server, Querying Servers
309@subsection Return Attributes
310
311Directory servers may be configured to return a default set of
312attributes for each record matching a query if the query specifies none.
313The variable @code{eudc-default-return-attributes} controls the return
314attributes you want to see, if different from the server defaults.
315
316@defvar eudc-default-return-attributes
317A list of the default attributes to extract from directory entries. If
318set to the symbol @code{all} then all available attributes are
319returned. A value of @code{nil}, the default, means to return the
320default attributes as configured in the server.
321@end defvar
322
323The server may return several matching records to a query. Some of the
324records may however not contain all the attributes you requested. You can
325discard those records.
326
327@defopt eudc-strict-return-matches
328If non-@code{nil}, entries that do not contain all the requested return
329attributes are ignored. Default is @code{t}.
330@end defopt
331
332@node Duplicate Attributes, , Return Attributes, Querying Servers
333@subsection Duplicate Attributes
334
335Directory standards may authorize different instances of the same
336attribute in a record. For instance the record of a person may contain
337several email fields containing different email addresses. When using
338a QI directory server this is difficult to distinguish from attributes
339having multi-line values such as the postal address that may contain a
340line for the street and another one for the zip code and city name. In
341both cases, EUDC will consider the attribute duplicated.
342
343EUDC has several methods to deal with duplicated attributes. The
344available methods are:
345
346@table @code
347@item list
348Makes a list with the different values of the duplicate attribute. The
349record is returned with only one instance of the attribute with a list
350of all the different values as a value. This is the default method that
351is used to handle duplicate fields for which no other method has been
352specified.
353@item first
354Discards all the duplicate values of the field keeping only the first
355one.
356@item concat
357Concatenates the different values using a newline as a separator. The
358record keeps only one instance of the field the value of which is a
359single multi-line string.
360@item duplicate
361Duplicates the whole record into as many instances as there are different
362values for the field. This is the default for the email field. Thus a
363record containing 3 different email addresses is duplicated into three
364different records each having a single email address. This is
365particularly useful in combination with @code{select} as the method to
366handle multiple matches in inline expansion queries (@pxref{Inline Query
367Expansion}) because you are presented with the 3 addresses in a
368selection buffer
369@end table
370
371Because a method may not be applicable to all fields, the variable
372@code{eudc-duplicate-attribute-handling-method} lets you specify either a
373default method for all fields or a method for each individual field.
374
375@defvar eudc-duplicate-attribute-handling-method
376A method to handle entries containing duplicate attributes. This is
377either an alist of elements @code{(@var{attr} . @var{method})}, or a symbol
378@var{method}. The alist form of the variable associates a method to an
379individual attribute name; the second form specifies a method applicable
380to all attribute names. Available methods are: @code{list},
381@code{first}, @code{concat}, and @code{duplicate} (see above). The default is
382@code{list}.
383@end defvar
384
385
386
387@node Query Form, Display of Query Results, Querying Servers, Usage
388@comment node-name, next, previous, up
389@section Query Form
390
391The simplest way to query your directory server is to use the query
392form. You display the query form with the @samp{Query with Form} menu
393item or by invoking the command @kbd{M-x eudc-query-form}. The attribute
394names presented in this form are defined by the
395@code{eudc-query-form-attributes} variable (unless a non-@code{nil}
396argument is supplied to @code{eudc-query-form}).
397
398Since the different directory protocols to which EUDC interfaces may
399use different names for equivalent attributes, EUDC defines its own set
400of attribute names and a mapping between these names and their
401protocol-specific equivalent through the variable
402@code{eudc-protocol-attributes-translation-alist}. Names currently
403defined by EUDC are @code{name}, @code{firstname}, @code{email} and
404@code{phone}.
405
406@defvar eudc-query-form-attributes
407@findex eudc-get-attribute-list
408A list of attributes presented in the query form. Attribute names in
409this list should be either EUDC attribute names or valid attribute
410names. You can get a list of valid attribute names for the current
411protocol with the @samp{List Valid Attribute Names} menu item or the
412@kbd{M-x eudc-get-attribute-list} command. Defaults to @code{name},
413@code{email} and @code{phone}.
414@end defvar
415
416@deffn Command eudc-query-form get-fields-from-server
417Display a form to query the directory server. If given a non-@code{nil}
418argument the function first queries the server for the existing fields
419and displays a corresponding form. Not all protocols may support a
420non-@code{nil} argument here.
421@end deffn
422
423Since the names of the fields may not be explicit enough or adapted to
424be directly displayed as prompt strings in the form, the variable
425@code{eudc-user-attribute-names-alist} lets you define more explicit
426names for directory attribute names. This variable is ignored if
427@code{eudc-use-raw-directory-names} is non-@code{nil}.
428
429@defvar eudc-user-attribute-names-alist
430This is an alist of user-defined names for the directory attributes used in
431query/response forms. Prompt strings for attributes that are not in this
432alist are derived by splitting the attribute name at underscores and
433capitalizing the individual words.
434@end defvar
435
436@defvar eudc-use-raw-directory-names
437If non-@code{nil}, use attributes names as defined in the directory.
438Otherwise, directory query/response forms display the user attribute
439names defined in @code{eudc-user-attribute-names-alist}.
440@end defvar
441
442@node Display of Query Results, Inline Query Expansion, Query Form, Usage
443@comment node-name, next, previous, up
444@section Display of Query Results
445
446Upon successful completion of a form query, EUDC will display a buffer
447containing the results of the query.
448
449The fields that are returned for each record
450are controlled by @code{eudc-default-return-attributes} (@pxref{Return
451Attributes}).
452
453The display of each individual field can be performed by an arbitrary
454function which allows specific processing for binary values, such as
455images or audio samples, as well as values with semantics, such as
456URLs.
457
458@defvar eudc-attribute-display-method-alist
459An alist specifying methods to display attribute values. Each member of
460the list is of the form @code{(@var{name} . @var{func})} where
461@var{name} is a lowercased string naming a directory attribute
462(translated according to @code{eudc-user-attribute-names-alist} if
463@code{eudc-use-raw-directory-names} is non-@code{nil}) and @var{func} a
464function that will be passed the corresponding attribute values for
465display.
466@end defvar
467
468This variable has protocol-local definitions (see @pxref{Server/Protocol
469Locals}). For instance, it is defined as follows for LDAP:
470
471@lisp
472(eudc-protocol-set 'eudc-attribute-display-method-alist
473 '(("jpegphoto" . eudc-display-jpeg-inline)
474 ("labeledurl" . eudc-display-url)
475 ("audio" . eudc-display-sound)
476 ("labeledurl" . eudc-display-url)
477 ("url" . eudc-display-url))
478 'ldap)
479@end lisp
480
481EUDC provides a set of built-in functions to display binary value types:
482
483@defun eudc-display-generic-binary data
484Display a button for unidentified binary @var{data}.
485@end defun
486
487@defun eudc-display-url url
488Display URL and make it clickable.
489@end defun
490
491@defun eudc-display-sound data
492Display a button to play the sound @var{data}.
493@end defun
494
495@defun eudc-display-jpeg-inline data
496Display the JPEG @var{data} inline at point if possible.
497@end defun
498
499@defun eudc-display-jpeg-as-button data
500Display a button for the JPEG @var{data}.
501@end defun
502
503Right-clicking on a binary value button pops up a contextual menu with
504options to process the value. Among these are saving the attribute
505value to a file or sending it to an external viewer command. External
506viewers should expect the value on their standard input and should
507display it or perform arbitrary processing on it. Messages sent to
508standard output are discarded. External viewers are listed in the
509variable @code{eudc-external-viewers} which you can customize.
510
511@defvar eudc-external-viewers
512This is a list of viewer program specifications. Each specification is
513a list whose first element is a string naming the viewer for unique
514identification, the second element is the executable program which
515should be invoked and the following elements are arguments that should
516be passed to the program.
517@end defvar
518
519
520@node Inline Query Expansion, The Server Hotlist, Display of Query Results, Usage
521@comment node-name, next, previous, up
522@section Inline Query Expansion
523
524Inline query expansion is a powerful method to get completion from your
525directory server. The most common usage is for expanding names to email
526addresses in mail message buffers. The expansion is performed by the
527command @kbd{M-x eudc-expand-inline} which is available from the
528@samp{Expand Inline Query} menu item but can also be conveniently
529bound to a key shortcut (@pxref{Installation}). The operation is
530controlled by the variables @code{eudc-inline-expansion-format},
531@code{eudc-inline-query-format},
532@code{eudc-expanding-overwrites-query} and
533@code{eudc-multiple-match-handling-method}.
534
535If the query fails for a server, other servers may be tried successively
536until one of them finds a match (@pxref{Multi-server Queries}).
537
538@deffn Command eudc-expand-inline replace-p
539Query the server and expand the query string before point. The query
540string consists of the buffer substring from the point back to the
541preceding comma, colon or beginning of
542line. @code{eudc-inline-query-format} controls how individual words
543are mapped onto directory attribute names. After querying the server
544for the given string, the expansion specified by
545@code{eudc-inline-expansion-format} is inserted in the buffer at
546point. If @var{replace-p} is @code{t} then this expansion replaces the
547query string in the buffer. If @code{eudc-expanding-overwrites-query}
548is non-@code{nil} then the meaning of @var{replace-p} is negated.
549@end deffn
550
551@defvar eudc-inline-query-format
552Format of an inline expansion query.
553This is actually a list of @var{format}s. A @var{format} is a list of
554one or more EUDC attribute names. A @var{format} applies if it contains
555as many attributes as individual words in the inline query string. If
556several @var{format}s apply then they are tried in order until a match
557is found. If @code{nil} all the words will be mapped onto the default
558server/protocol attribute name (generally @code{name}).
559
560For instance, use the following
561@lisp
562(setq eudc-inline-query-format '((name)
563 (firstname)
564 (firstname name)))
565@end lisp
566@noindent
567to indicate that single word expansion queries are to be considered as
568surnames and if no match is found then they should be tried as first
569names. Inline queries consisting of two words are considered as
570consisting of a first name followed by a surname. If the query consists
571of more than two words, then the first one is considered as the first
572name and the remaining words are all considered as surname constituents.
573
574@var{format}s are in fact not limited to EUDC attribute names, you can
575use server or protocol specific names in them. It may be safer if you
576do so, to set the variable @code{eudc-inline-query-format} in a protocol
577or server local fashion (see @pxref{Server/Protocol Locals}).
578
579For instance you could use the following to match up to three words
580against the @code{cn} attribute of LDAP servers:
581@lisp
582(eudc-protocol-set 'eudc-inline-query-format
583 '((cn)
584 (cn cn)
585 (cn cn cn))
586 'ldap)
587@end lisp
588@end defvar
589
590@defvar eudc-inline-expansion-format
591This variable lets you control exactly what is inserted into the buffer
592upon an inline expansion request. It is a list whose first element is a
593string passed to @code{format}. Remaining elements are symbols
594corresponding to directory attribute names. The corresponding attribute
595values are passed as additional arguments to @code{format}. Default is
596@code{("%s" email)} but you may want to consider a value like @code{("%s
597<%s>" name email)}
598@end defvar
599
600@defvar eudc-multiple-match-handling-method
601This variable controls what to do when multiple entries match a query
602for an inline expansion. Possible values are:
603@table @code
604@item first
605The first match is considered as being the only one, the others are
606discarded.
607@item select
608A selection buffer pops up where you can choose a particular match. This
609is the default value of the variable.
610@item all
611The expansion uses all records successively
612@item abort
613An error is signaled. The expansion aborts.
614@end table
615
616Default is @code{select}
617@end defvar
618
619
620
621@node The Server Hotlist, Multi-server Queries, Inline Query Expansion, Usage
622@comment node-name, next, previous, up
623@section The Server Hotlist
624
625EUDC lets you maintain a list of frequently used servers so that you
626can easily switch from one to another. This hotlist appears in the
627@samp{Server} submenu. You select a server in this list by clicking on
628its name. You can add the current server to the list with the command
629@kbd{M-x eudc-bookmark-current-server}. The list is contained in the variable
630@code{eudc-server-hotlist} which is stored in and retrieved from the file
631designated by @code{eudc-options-file}. EUDC also provides a facility to
632edit the hotlist interactively (@pxref{The Hotlist Edit Buffer}).
633
634The hotlist is also used to make queries on multiple servers
635successively (@pxref{Multi-server Queries}). The order in which the
636servers are tried is the order they appear in the hotlist, therefore it
637is important to sort the hotlist appropriately.
638
639@deffn Command eudc-bookmark-server server
640Add @var{server} to the hotlist of servers
641@end deffn
642
643@deffn Command eudc-bookmark-current-server
644Add the current server to the hotlist of servers
645@end deffn
646
647@defvar eudc-options-file
648The name of a file where EUDC stores its internal variables
649(the hotlist and the current server). EUDC will try to load
650that file upon initialization so, if you choose a file name
651different from the defaults @file{~/.eudc-options}, be sure to set this
652variable to the appropriate value @emph{before} EUDC is itself
653loaded.
654@end defvar
655
656@menu
657* The Hotlist Edit Buffer:: An interactive hotlist editing facility
658@end menu
659
660@node The Hotlist Edit Buffer, , The Server Hotlist, The Server Hotlist
661@comment node-name, next, previous, up
662@subsection The Hotlist Edit Buffer
663
664The hotlist edit buffer offers a means to manage a list of frequently
665used servers. Commands are available in the context pop-up menu
666generally bound to the right mouse button. Those commands also have
667equivalent key bindings.
668
669@deffn Command eudc-hotlist-add-server
670Bound to @kbd{a}.
671Add a new server to the hotlist on the line after point
672@end deffn
673
674@deffn Command eudc-hotlist-delete-server
675Bound to @kbd{d}.
676Delete the server on the line point is on
677@end deffn
678
679@deffn Command eudc-hotlist-select-server
680Bound to @kbd{s}.
681Select the server the point is on as the current directory server for
682the next queries
683@end deffn
684
685@deffn Command eudc-hotlist-transpose-servers
686Bound to @kbd{t}.
687Bubble up the server the point is on to the top of the list
688@end deffn
689
690@deffn Command eudc-hotlist-quit-edit
691Bound to @kbd{q}.
692Save the changes and quit the hotlist edit buffer. Use @kbd{x} or
693@kbd{M-x kill-buffer} to exit without saving.
694@end deffn
695
696
697@node Multi-server Queries, Creating BBDB Records, The Server Hotlist, Usage
698@comment node-name, next, previous, up
699@section Multi-server Queries
700
701When using inline query expansion (@pxref{Inline Query Expansion}), EUDC
702can try to query successively a sequence of directory servers until one
703of them successfully finds a match for the query.
704
705@defvar eudc-inline-expansion-servers
706This variable controls which servers are tried and in which order when
707trying to perform an inline query. Possible values are:
708@table @code
709@item current-server
710Only the current directory server is tried
711@item hotlist
712The servers in the hotlist are tried in order until one finds a match
713for the query or `eudc-max-servers-to-query' is reached
714@item server-then-hotlist
715The current server then the servers in the hotlist are tried in the
716order they appear in the hotlist until one of them finds a match or
717`eudc-max-servers-to-query' is reached. This is the default.
718@end table
719@end defvar
720
721@defvar eudc-max-servers-to-query
722This variable indicates the maximum number of servers to query when
723performing a multi-server query. The default, @code{nil}, indicates
724that all available servers should be tried.
725@end defvar
726
727
728
729@node Creating BBDB Records, Server/Protocol Locals, Multi-server Queries, Usage
730@comment node-name, next, previous, up
731@section Creating BBDB Records
732
733@findex eudc-insert-record-at-point-into-bbdb
734@findex eudc-try-bbdb-insert
735With EUDC, you can automatically create BBDB records
8009a04a 736(@pxref{Top,,BBDB,bbdb,BBDB Manual}) from records you get from a
4009494e
GM
737directory server. You do this by moving point to the appropriate
738record in a query result display buffer and invoking the command
739@kbd{M-x eudc-insert-record-at-point-into-bbdb} with the
740keyboard binding @kbd{b}@footnote{This key binding does not actually
741call @code{eudc-insert-record-at-point-into-bbdb} but uses
742@code{eudc-try-bbdb-insert} instead.}, or with the menu. EUDC
743cannot update an existing BBDB record and will signal an error if you
744try to insert a record matching an existing one.
745
746@findex eudc-batch-export-records-to-bbdb
747It is also possible to export to BBDB the whole batch of records
748contained in the directory query result with the command
749@kbd{M-x eudc-batch-export-records-to-bbdb}.
750
751Because directory systems may not enforce a strict record format, local
752server installations may use different attribute names and have
753different ways to organize the information. Furthermore BBDB has its own
754record structure. For these reasons converting a record from its
755external directory format to the BBDB format is a highly customizable
756process.
757
758@defvar eudc-bbdb-conversion-alist
759The value of this variable should be a symbol naming an alist defining a
760mapping between BBDB field names onto directory attribute names records.
761This is a protocol-local variable and is initialized upon protocol
762switch (@pxref{Server/Protocol Locals}). The alist is made of cells of the
763form @code{(@var{bbdb-field} . @var{spec-or-list})}.
764@var{bbdb-field} is the name of a field
765that must be defined in your BBDB environment (standard field names are
766@code{name}, @code{company}, @code{net}, @code{phone}, @code{address}
767and @code{notes}).
768@var{spec-or-list} is either a single mapping specification or a list of
769mapping specifications. Lists of mapping specifications are valid for
770the @code{phone} and @code{address} BBDB fields only. @var{spec}s are
771actually s-expressions which are evaluated as follows:
772
773@table @asis
774@item a string
775evaluates to itself
776@item a symbol
777evaluates to the symbol value. Symbols corresponding to directory
778attribute names present in the record evaluate to the value of the field
779in the record
780@item a form
781is evaluated as a function. The argument list may contain attribute
782names which evaluate to the corresponding values in the record. The form
783evaluation should return something appropriate for the particular
784@var{bbdb-field} (see @code{bbdb-create-internal}).
785@code{eudc-bbdbify-phone} and @code{eudc-bbdbify-address} are provided as
786convenience functions to parse phones and addresses.
787@end table
788@end defvar
789
790The default value of the PH-specific value of that variable is
791@code{eudc-ph-bbdb-conversion-alist}:
792
793@lisp
794((name . name)
795 (net . email)
796 (address . (eudc-bbdbify-address address "Address"))
797 (phone . ((eudc-bbdbify-phone phone "Phone")
798 (eudc-bbdbify-phone office_phone "Office Phone"))))
799@end lisp
800
801This means that:
802
803@itemize @bullet
804@item
805the @code{name} field of the BBDB record gets its value
806from the @code{name} attribute of the directory record
807@item
808the @code{net} field of the BBDB record gets its value
809from the @code{email} attribute of the directory record
810@item
811the @code{address} field of the BBDB record is obtained by parsing the
812@code{address} attribute of the directory record with the function
813@code{eudc-bbdbify-address}
814@item
815two @code{phone} fields are created (when possible) in the BBDB record.
816The first one has @cite{Phone} for location and its value is obtained by
817parsing the @code{phone} attribute of the PH/QI record with the function
818@code{eudc-bbdbify-phone}. The second one has @cite{Office Phone} for location
819its value is obtained by parsing the @code{office_phone} attribute of the
820PH/QI record with the function @code{eudc-bbdbify-phone}.
821@end itemize
822
823@defun eudc-bbdbify-phone phone location
824This is a convenience function provided for use in
825@code{eudc-bbdb-conversion-alist}. It parses @var{phone} into a vector
826compatible with @code{bbdb-create-internal}. @var{phone} is either a string
827supposedly containing a phone number or a list of such strings which are
828concatenated. @var{location} is used as the phone location for BBDB.
829@end defun
830
831@defun eudc-bbdbify-address addr location
832This is a convenience function provided for use in
833@code{eudc-bbdb-conversion-alist}. It parses @var{addr} into a vector
834compatible with @code{bbdb-create-internal}. @var{addr} should be an
835address string of no more than four lines or a list of lines. The last
836line is searched for the zip code, city and state name. @var{location}
837is used as the phone location for BBDB.
838@end defun
839
840Note that only a subset of the attributes you selected with
841@code{eudc-default-return-attributes} and that are actually displayed may
842actually be inserted as part of the newly created BBDB record.
843
844
845@node Server/Protocol Locals, , Creating BBDB Records, Usage
846@comment node-name, next, previous, up
847@section Server/Protocol Locals
848
849EUDC can be customized independently for each server or directory
850protocol. All variables can be given local bindings that are activated
851when a particular server and/or protocol becomes active. This is much
852like buffer-local bindings but on a per server or per protocol basis.
853
854@menu
855* Manipulating local bindings:: Functions to set and query local bindings
856@end menu
857
858@node Manipulating local bindings, , Server/Protocol Locals, Server/Protocol Locals
859@comment node-name, next, previous, up
860@subsection Manipulating local bindings
861
862EUDC offers functions that let you set and query variables on a per
863server or per protocol basis.
864
865The following predicates allow you to test the existence of
866server/protocol local bindings for a particular variable.
867
868@defun eudc-server-local-variable-p var
869Return non-@code{nil} if @var{var} has server-local bindings
870@end defun
871
872@defun eudc-protocol-local-variable-p var
873Return non-@code{nil} if @var{var} has protocol-local bindings
874@end defun
875
876The following functions allow you to set the value of a variable with
877various degrees of locality.
878
879@defun eudc-default-set var val
880Set the EUDC default value of @var{var} to @var{val}.
881The current binding of @var{var} (if local to the current server or
882protocol) is not changed.
883@end defun
884
885@defun eudc-protocol-set var val &optional protocol
886Set the binding of @var{var} local to @var{protocol} to @var{val}. If
887omitted, @var{protocol} defaults to the current value of
888@code{eudc-protocol}. The current binding of @var{var} is changed only
889if @var{protocol} is omitted.
890@end defun
891
892@defun eudc-server-set var val &optional server
893Set the binding of @var{var} local to @var{server} to @var{val}. If
894omitted, @var{server} defaults to the current value of
895@code{eudc-server}. The current binding of @var{var} is changed only if
896@var{server} is omitted.
897@end defun
898
899@defun eudc-set var val
900Set the most local (server, protocol or default) binding of @var{var} to
901@var{val}. The current binding of @var{var} is also set to @var{val}.
902@end defun
903
904The following variables allow you to query the various bindings of a
905variable (local or non-local).
906
907@defun eudc-variable-default-value var
908Return the default binding of @var{var} (outside of a particular server
909or protocol local binding).
910Return @code{unbound} if @var{var} has no EUDC default value.
911@end defun
912
913@defun eudc-variable-protocol-value var &optional protocol
914Return the value of @var{var} local to @var{protocol}. Return
915@code{unbound} if @var{var} has no value local to @var{protocol}.
916@var{protocol} defaults to @code{eudc-protocol}.
917@end defun
918
919@defun eudc-variable-server-value var [server]
920Return the value of @var{var} local to @var{server}.
921Return @code{unbound} if @var{var} has no value local to @var{server}.
922@var{server} defaults to @code{eudc-server}.
923@end defun
924
925Changing a protocol-local or server-local value of a variable has no
926effect on its current value. The following command is used to
927synchronize the current values of variables with their local values
928given the current @code{eudc-server} and @code{eudc-protocol}:
929
930@defun eudc-update-local-variables
931Update all EUDC variables according to their local settings.
932@end defun
933
934
935
936@node Credits, GNU Free Documentation License, Usage, Top
937@comment node-name, next, previous, up
938@chapter Credits
939
940EUDC was written by Oscar Figueiredo based on @file{ph.el} by the
941same author.
942
943Thanks to Soren Dayton for his suggestions, his enthusiasm and his help
944in testing and proofreading the code and docs of @file{ph.el}.
945
946@node GNU Free Documentation License, Command and Function Index, Credits, Top
947@appendix GNU Free Documentation License
948@include doclicense.texi
949
950@node Command and Function Index, Variables Index, GNU Free Documentation License, Top
951@comment node-name, next, previous, up
952@unnumbered Command and Function Index
953
954@printindex fn
955
956@node Variables Index, , Command and Function Index, Top
957@comment node-name, next, previous, up
958@unnumbered Variables Index
959
960@printindex vr
961
4009494e 962@bye