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