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