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