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