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