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