*** empty log message ***
[emacs.git] / lisp / net / eudc-vars.el
blob29a04b0db44539cb25543077f919e01ab80d0659
1 ;;; eudc-vars.el --- Emacs Unified Directory Client
3 ;; Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
5 ;; Author: Oscar Figueiredo <oscar@xemacs.org>
6 ;; Maintainer: Oscar Figueiredo <oscar@xemacs.org>
7 ;; Keywords: help
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; any later version.
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
26 ;;; Code:
28 (require 'custom)
30 ;;{{{ EUDC Main Custom Group
32 (defgroup eudc nil
33 "Emacs Unified Directory Client."
34 :version "21.1"
35 :link '(info-link "(eudc)")
36 :group 'mail
37 :group 'comm)
39 (defcustom eudc-server nil
40 "*The name or IP address of the directory server.
41 A port number may be specified by appending a colon and a
42 number to the name of the server. Use `localhost' if the directory
43 server resides on your computer (BBDB backend)."
44 :type '(choice (string :tag "Server") (const :tag "None" nil))
45 :group 'eudc)
47 ;; Known protocols (used in completion)
48 ;; Not to be mistaken with `eudc-supported-protocols'
49 (defvar eudc-known-protocols '(bbdb ph ldap))
51 (defvar eudc-supported-protocols nil
52 "Protocols currently supported by EUDC.
53 This variable is updated when protocol-specific libraries
54 are loaded, *do not change manually*.")
56 (defcustom eudc-protocol nil
57 "*The directory protocol to use to query the server.
58 Supported protocols are specified by `eudc-supported-protocols'."
59 :type `(choice :menu-tag "Protocol"
60 ,@(mapcar (lambda (s)
61 (list 'const ':tag (symbol-name s) s))
62 eudc-known-protocols)
63 (const :tag "None" nil))
64 :group 'eudc)
67 (defcustom eudc-strict-return-matches t
68 "*Ignore or allow entries not containing all requested return attributes.
69 If non-nil, such entries are ignored."
70 :type 'boolean
71 :group 'eudc)
73 (defcustom eudc-default-return-attributes nil
74 "*A list of default attributes to extract from directory entries.
75 If set to the symbol `all', return all attributes.
76 A value of nil means return the default attributes as configured in the
77 server."
78 :type '(choice :menu-tag "Return Attributes"
79 (const :menu-tag "Server defaults (nil)" nil)
80 (const :menu-tag "All" all)
81 (repeat :menu-tag "Attribute list"
82 :tag "Attribute name"
83 :value (nil)
84 (symbol :tag "Attribute name")))
85 :group 'eudc)
87 (defcustom eudc-multiple-match-handling-method 'select
88 "*What to do when multiple entries match an inline expansion query.
89 Possible values are:
90 `first' (equivalent to nil) which means keep the first match only,
91 `select' pop-up a selection buffer,
92 `all' expand to all matches,
93 `abort' the operation is aborted, an error is signaled."
94 :type '(choice :menu-tag "Method"
95 (const :menu-tag "Use First"
96 :tag "Use First" first)
97 (const :menu-tag "Select Interactively"
98 :tag "Select Interactively" select)
99 (const :menu-tag "Use All"
100 :tag "Use All" all)
101 (const :menu-tag "Abort Operation"
102 :tag "Abort Operation" abort)
103 (const :menu-tag "Default (Use First)"
104 :tag "Default (Use First)" nil))
105 :group 'eudc)
107 (defcustom eudc-duplicate-attribute-handling-method '((email . duplicate))
108 "*A method to handle entries containing duplicate attributes.
109 This is either an alist (ATTR . METHOD) or a symbol METHOD.
110 The alist form of the variable associates a method to an individual attribute,
111 the second form specifies a method applicable to all attributes.
112 Available methods are:
113 `list' or nil lets the value of the attribute be a list of values,
114 `first' keeps the first value and discards the others,
115 `concat' concatenates the values into a single multiline string,
116 `duplicate' duplicates the entire entry into as many instances as
117 different values."
118 :type '(choice (const :menu-tag "List" list)
119 (const :menu-tag "First" first)
120 (const :menu-tag "Concat" concat)
121 (const :menu-tag "Duplicate" duplicate)
122 (repeat :menu-tag "Per Attribute Specification"
123 :tag "Per Attribute Specification"
124 (cons :tag "Attribute/Method"
125 :value (nil . list)
126 (symbol :tag "Attribute name")
127 (choice :tag "Method"
128 :menu-tag "Method"
129 (const :menu-tag "List" list)
130 (const :menu-tag "First" first)
131 (const :menu-tag "Concat" concat)
132 (const :menu-tag "Duplicate" duplicate)))))
133 :group 'eudc)
135 (defcustom eudc-inline-query-format '((name)
136 (firstname name))
137 "*Format of an inline expansion query.
138 This is a list of FORMATs. A FORMAT is itself a list of one or more
139 EUDC attribute names. A FORMAT applies if it contains as many attributes as
140 there are individual words in the inline query string.
141 If several FORMATs apply then they are tried in order until a match
142 is found.
143 If nil, all the words are mapped onto the default server or protocol
144 attribute name.
146 The attribute names in FORMATs are not restricted to EUDC attribute names
147 but can also be protocol/server specific names. In this case, this variable
148 must be set in a protocol/server-local fashion, see `eudc-server-set' and
149 `eudc-protocol-set'."
150 :tag "Format of Inline Expansion Queries"
151 :type '(repeat
152 (repeat
153 :menu-tag "Format"
154 :tag "Format"
155 (choice
156 :tag "Attribute"
157 (const :menu-tag "First Name" :tag "First Name" firstname)
158 (const :menu-tag "Surname" :tag "Surname" name)
159 (const :menu-tag "Email Address" :tag "Email Address" email)
160 (const :menu-tag "Phone" :tag "Phone" phone)
161 (symbol :menu-tag "Other" :tag "Attribute name"))))
162 :group 'eudc)
164 (defcustom eudc-expansion-overwrites-query t
165 "*If non nil, expanding a query overwrites the query string."
166 :type 'boolean
167 :group 'eudc)
169 (defcustom eudc-inline-expansion-format '("%s" email)
170 "*A list specifying the format of the expansion of inline queries.
171 This variable controls what `eudc-expand-inline' actually inserts in
172 the buffer. First element is a string passed to `format'. Remaining
173 elements are symbols indicating attribute names; the corresponding values
174 are passed as additional arguments to `format'."
175 :type '(list
176 (string :tag "Format String")
177 (repeat :inline t
178 :tag "Attributes"
179 (choice
180 :tag "Attribute"
181 (const :menu-tag "First Name" :tag "First Name" firstname)
182 (const :menu-tag "Surname" :tag "Surname" name)
183 (const :menu-tag "Email Address" :tag "Email Address" email)
184 (const :menu-tag "Phone" :tag "Phone" phone)
185 (symbol :menu-tag "Other")
186 (symbol :tag "Attribute name"))))
187 :group 'eudc)
189 (defcustom eudc-inline-expansion-servers 'server-then-hotlist
190 "*Which servers to contact for the expansion of inline queries.
191 Possible values are:
192 `current-server': the EUDC current server.
193 `hotlist': the servers of the hotlist in the order they appear,
194 `server-then-hotlist': the current server and then the servers of
195 the hotlist."
196 :type '(choice :tag "Servers"
197 :menu-tag "Servers"
198 (const :menu-tag "Current server" current-server)
199 (const :menu-tag "Servers in the hotlist" hotlist)
200 (const :menu-tag "Current server then hotlist" server-then-hotlist))
201 :group 'eudc)
203 (defcustom eudc-max-servers-to-query nil
204 "*Maximum number of servers to query for an inline expansion.
205 If nil, query all servers available from `eudc-inline-expansion-servers'."
206 :tag "Max Number of Servers to Query"
207 :type '(choice :tag "Max. Servers"
208 :menu-tag "Max. Servers"
209 (const :menu-tag "No limit" nil)
210 (const :menu-tag "1" 1)
211 (const :menu-tag "2" 2)
212 (const :menu-tag "3" 3)
213 (const :menu-tag "4" 4)
214 (const :menu-tag "5" 5)
215 (integer :menu-tag "Set"))
216 :group 'eudc)
218 (defcustom eudc-query-form-attributes '(name firstname email phone)
219 "*A list of attributes presented in the query form."
220 :tag "Attributes in Query Forms"
221 :type '(repeat
222 (choice
223 :tag "Attribute"
224 (const :menu-tag "First Name" :tag "First Name" firstname)
225 (const :menu-tag "Surname" :tag "Surname" name)
226 (const :menu-tag "Email Address" :tag "Email Address" email)
227 (const :menu-tag "Phone" :tag "Phone" phone)
228 (symbol :menu-tag "Other" :tag "Attribute name")))
229 :group 'eudc)
231 (defcustom eudc-user-attribute-names-alist '((url . "URL")
232 (callsign . "HAM Call Sign")
233 (id . "ID")
234 (email . "E-Mail")
235 (firstname . "First Name")
236 (cn . "Full Name")
237 (sn . "Surname")
238 (givenname . "First Name")
239 (ou . "Unit")
240 (labeledurl . "URL")
241 (postaladdress . "Address")
242 (postalcode . "Postal Code")
243 (l . "Location")
244 (c . "Country")
245 (o . "Organization")
246 (roomnumber . "Office")
247 (telephonenumber . "Phone")
248 (uniqueidentifier . "ID")
249 (objectclass . "Object Class"))
250 "*Alist of user-defined names for directory attributes.
251 These names are used as prompt strings in query/response forms
252 instead of the raw directory attribute names.
253 Prompt strings for attributes that are not listed here
254 are derived by splitting the attribute name
255 at `_' characters and capitalizing the individual words."
256 :tag "User-defined Names of Directory Attributes"
257 :type '(repeat (cons :tag "Field"
258 (symbol :tag "Directory attribute")
259 (string :tag "User friendly name ")))
260 :group 'eudc)
262 (defcustom eudc-use-raw-directory-names nil
263 "*If non-nil, use attributes names as defined in the directory.
264 Otherwise, directory query/response forms display the user attribute
265 names defined in `eudc-user-attribute-names-alist'."
266 :type 'boolean
267 :group 'eudc)
269 (defcustom eudc-attribute-display-method-alist nil
270 "*An alist specifying methods to display attribute values.
271 Each member of the list is of the form (NAME . FUNC) where NAME is a lowercased
272 string naming a directory attribute (translated according to
273 `eudc-user-attribute-names-alist' if `eudc-use-raw-directory-names' is
274 non-nil) and FUNC a function that will be passed the corresponding
275 attribute values for display."
276 :tag "Attribute Decoding Functions"
277 :type '(repeat (cons :tag "Attribute"
278 (symbol :tag "Name")
279 (symbol :tag "Display Function")))
280 :group 'eudc)
282 (defcustom eudc-external-viewers '(("XV" "xv" "-")
283 ("ImageMagick" "display" "-")
284 ("ShowAudio" "showaudio"))
285 "*A list of viewer program specifications.
286 Viewers are programs which can be piped a directory attribute value for
287 display or arbitrary processing. Each specification is a list whose
288 first element is a string naming the viewer. The second element is the
289 executable program which should be invoked, and following elements are
290 arguments that should be passed to the program."
291 :tag "External Viewer Programs"
292 :type '(repeat (list :tag "Viewer"
293 (string :tag "Name")
294 (string :tag "Executable program")
295 (repeat
296 :tag "Arguments"
297 :inline t
298 (string :tag "Argument"))))
299 :group 'eudc)
301 (defcustom eudc-options-file "~/.eudc-options"
302 "*A file where the `servers' hotlist is stored."
303 :type '(file :Tag "File Name:")
304 :group 'eudc)
306 (defcustom eudc-mode-hook nil
307 "*Normal hook run on entry to EUDC mode."
308 :type '(repeat (sexp :tag "Hook definition"))
309 :group 'eudc)
311 ;;}}}
313 ;;{{{ PH Custom Group
315 (defgroup eudc-ph nil
316 "Emacs Unified Directory Client - CCSO PH/QI Backend."
317 :group 'eudc)
319 (defcustom eudc-ph-bbdb-conversion-alist
320 '((name . name)
321 (net . email)
322 (address . (eudc-bbdbify-address address "Address"))
323 (phone . ((eudc-bbdbify-phone phone "Phone")
324 (eudc-bbdbify-phone office_phone "Office Phone"))))
325 "*A mapping from BBDB to PH/QI fields.
326 This is a list of cons cells (BBDB-FIELD . SPEC-OR-LIST) where
327 BBDB-FIELD is the name of a field that must be defined in your BBDB
328 environment (standard field names are `name', `company', `net', `phone',
329 `address' and `notes'). SPEC-OR-LIST is either a single SPEC or a list
330 of SPECs. Lists of specs are valid only for the `phone' and `address'
331 BBDB fields. SPECs are sexps which are evaluated:
332 a string evaluates to itself,
333 a symbol evaluates to the symbol value. Symbols naming PH/QI fields
334 present in the record evaluate to the value of the field in the record,
335 a form is evaluated as a function. The argument list may contain PH/QI
336 field names which eval to the corresponding values in the
337 record. The form evaluation should return something appropriate for
338 the particular BBDB-FIELD (see `bbdb-create-internal').
339 `eudc-bbdbify-phone' and `eudc-bbdbify-address' are provided as convenience
340 functions to parse phones and addresses."
341 :tag "BBDB to PH Field Name Mapping"
342 :type '(repeat (cons :tag "Field Name"
343 (symbol :tag "BBDB Field")
344 (sexp :tag "Conversion Spec")))
345 :group 'eudc-ph)
347 ;;}}}
349 ;;{{{ LDAP Custom Group
351 (defgroup eudc-ldap nil
352 "Emacs Unified Directory Client - LDAP Backend."
353 :group 'eudc)
355 (defcustom eudc-ldap-bbdb-conversion-alist
356 '((name . cn)
357 (net . mail)
358 (address . (eudc-bbdbify-address postaladdress "Address"))
359 (phone . ((eudc-bbdbify-phone telephonenumber "Phone"))))
360 "*A mapping from BBDB to LDAP attributes.
361 This is a list of cons cells (BBDB-FIELD . SPEC-OR-LIST) where
362 BBDB-FIELD is the name of a field that must be defined in your BBDB
363 environment (standard field names are `name', `company', `net', `phone',
364 `address' and `notes'). SPEC-OR-LIST is either a single SPEC or a list
365 of SPECs. Lists of specs are valid only for the `phone' and `address'
366 BBDB fields. SPECs are sexps which are evaluated:
367 a string evaluates to itself,
368 a symbol evaluates to the symbol value. Symbols naming LDAP attributes
369 present in the record evaluate to the value of the field in the record,
370 a form is evaluated as a function. The argument list may contain LDAP
371 field names which eval to the corresponding values in the
372 record. The form evaluation should return something appropriate for
373 the particular BBDB-FIELD (see `bbdb-create-internal').
374 `eudc-bbdbify-phone' and `eudc-bbdbify-address' are provided as convenience
375 functions to parse phones and addresses."
376 :tag "BBDB to LDAP Attribute Names Mapping"
377 :type '(repeat (cons :tag "Field Name"
378 (symbol :tag "BBDB Field")
379 (sexp :tag "Conversion Spec")))
380 :group 'eudc-ldap)
382 ;;}}}
384 ;;{{{ BBDB Custom Group
386 (defgroup eudc-bbdb nil
387 "Emacs Unified Directory Client - BBDB Backend."
388 :group 'eudc)
390 (defcustom eudc-bbdb-use-locations-as-attribute-names t
391 "If non-nil, BBDB address and phone locations are used as attribute names.
392 This has no effect on queries (you can't search for a specific location)
393 but influences the way records are displayed"
394 :type 'boolean
395 :group 'eudc-bbdb)
397 (defcustom eudc-bbdb-enable-substring-matches t
398 "If non-nil, authorize substring match in the same way BBDB does.
399 Otherwise records must match queries exactly."
400 :type 'boolean
401 :group 'eudc-bbdb)
403 ;;}}}
406 (provide 'eudc-vars)
408 ;;; eudc-vars.el ends here