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