(define-ccl-program): Add `doc-string' declaration.
[emacs.git] / lisp / net / eudc-vars.el
blob286cb092a5c140e7fd5cfadb27a4e8ab7b43c2ab
1 ;;; eudc-vars.el --- Emacs Unified Directory Client
3 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
6 ;; Author: Oscar Figueiredo <oscar@cpe.fr>
7 ;; Maintainer: Pavel Janík <Pavel@Janik.cz>
8 ;; Keywords: comm
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
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.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25 ;;; Commentary:
27 ;;; Code:
29 (require 'custom)
31 ;;{{{ EUDC Main Custom Group
33 (defgroup eudc nil
34 "Emacs Unified Directory Client."
35 :version "21.1"
36 :link '(info-link "(eudc)")
37 :group 'mail
38 :group 'comm)
40 (defcustom eudc-server nil
41 "*The name or IP address of the directory server.
42 A port number may be specified by appending a colon and a
43 number to the name of the server. Use `localhost' if the directory
44 server resides on your computer (BBDB backend)."
45 :type '(choice (string :tag "Server") (const :tag "None" nil))
46 :group 'eudc)
48 ;; Known protocols (used in completion)
49 ;; Not to be mistaken with `eudc-supported-protocols'
50 (defvar eudc-known-protocols '(bbdb ph ldap))
52 (defvar eudc-supported-protocols nil
53 "Protocols currently supported by EUDC.
54 This variable is updated when protocol-specific libraries
55 are loaded, *do not change manually*.")
57 (defcustom eudc-protocol nil
58 "*The directory protocol to use to query the server.
59 Supported protocols are specified by `eudc-supported-protocols'."
60 :type `(choice :menu-tag "Protocol"
61 ,@(mapcar (lambda (s)
62 (list 'const ':tag (symbol-name s) s))
63 eudc-known-protocols)
64 (const :tag "None" nil))
65 :group 'eudc)
68 (defcustom eudc-strict-return-matches t
69 "*Ignore or allow entries not containing all requested return attributes.
70 If non-nil, such entries are ignored."
71 :type 'boolean
72 :group 'eudc)
74 (defcustom eudc-default-return-attributes nil
75 "*A list of default attributes to extract from directory entries.
76 If set to the symbol `all', return all attributes.
77 A value of nil means return the default attributes as configured in the
78 server."
79 :type '(choice :menu-tag "Return Attributes"
80 (const :menu-tag "Server defaults (nil)" nil)
81 (const :menu-tag "All" all)
82 (repeat :menu-tag "Attribute list"
83 :tag "Attribute name"
84 :value (nil)
85 (symbol :tag "Attribute name")))
86 :group 'eudc)
88 (defcustom eudc-multiple-match-handling-method 'select
89 "*What to do when multiple entries match an inline expansion query.
90 Possible values are:
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"
96 (const :menu-tag "Use First"
97 :tag "Use First" first)
98 (const :menu-tag "Select Interactively"
99 :tag "Select Interactively" select)
100 (const :menu-tag "Use All"
101 :tag "Use All" all)
102 (const :menu-tag "Abort Operation"
103 :tag "Abort Operation" abort)
104 (const :menu-tag "Default (Use First)"
105 :tag "Default (Use First)" nil))
106 :group 'eudc)
108 (defcustom eudc-duplicate-attribute-handling-method '((email . duplicate))
109 "*A method to handle entries containing duplicate attributes.
110 This is either an alist (ATTR . METHOD) or a symbol METHOD.
111 The alist form of the variable associates a method to an individual attribute,
112 the second form specifies a method applicable to all attributes.
113 Available 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,
117 `duplicate' duplicates the entire entry into as many instances as
118 different 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)
136 (defcustom eudc-inline-query-format '((name)
137 (firstname name))
138 "*Format of an inline expansion query.
139 This is a list of FORMATs. A FORMAT is itself a list of one or more
140 EUDC attribute names. A FORMAT applies if it contains as many attributes as
141 there are individual words in the inline query string.
142 If several FORMATs apply then they are tried in order until a match
143 is found.
144 If nil, all the words are mapped onto the default server or protocol
145 attribute name.
147 The attribute names in FORMATs are not restricted to EUDC attribute names
148 but can also be protocol/server specific names. In this case, this variable
149 must 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)
165 (defcustom eudc-expansion-overwrites-query t
166 "*If non-nil, expanding a query overwrites the query string."
167 :type 'boolean
168 :group 'eudc)
170 (defcustom eudc-inline-expansion-format '("%s" email)
171 "*A list specifying the format of the expansion of inline queries.
172 This variable controls what `eudc-expand-inline' actually inserts in
173 the buffer. First element is a string passed to `format'. Remaining
174 elements are symbols indicating attribute names; the corresponding values
175 are passed as additional arguments to `format'."
176 :type '(list
177 (string :tag "Format String")
178 (repeat :inline t
179 :tag "Attributes"
180 (choice
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)
190 (defcustom eudc-inline-expansion-servers 'server-then-hotlist
191 "*Which servers to contact for the expansion of inline queries.
192 Possible values are:
193 `current-server': the EUDC current server.
194 `hotlist': the servers of the hotlist in the order they appear,
195 `server-then-hotlist': the current server and then the servers of
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)
204 (defcustom eudc-max-servers-to-query nil
205 "*Maximum number of servers to query for an inline expansion.
206 If 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)
219 (defcustom eudc-query-form-attributes '(name firstname email phone)
220 "*A list of attributes presented in the query form."
221 :tag "Attributes in Query Forms"
222 :type '(repeat
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)
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"))
251 "*Alist of user-defined names for directory attributes.
252 These names are used as prompt strings in query/response forms
253 instead of the raw directory attribute names.
254 Prompt strings for attributes that are not listed here
255 are derived by splitting the attribute name
256 at `_' 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)
263 (defcustom eudc-use-raw-directory-names nil
264 "*If non-nil, use attributes names as defined in the directory.
265 Otherwise, directory query/response forms display the user attribute
266 names defined in `eudc-user-attribute-names-alist'."
267 :type 'boolean
268 :group 'eudc)
270 (defcustom eudc-attribute-display-method-alist nil
271 "*An alist specifying methods to display attribute values.
272 Each member of the list is of the form (NAME . FUNC) where NAME is a lowercased
273 string naming a directory attribute (translated according to
274 `eudc-user-attribute-names-alist' if `eudc-use-raw-directory-names' is
275 non-nil) and FUNC a function that will be passed the corresponding
276 attribute 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)
283 (defcustom eudc-external-viewers '(("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 ;; arch-tag: 80050575-b838-4246-8ebc-b2d7c5a2e482
409 ;;; eudc-vars.el ends here