(require 'wl-vars)
(require 'std11)
-(defvar wl-address-complete-header-list
+(defvar wl-address-complete-header-list
'("To:" "From:" "Cc:" "Bcc:" "Mail-Followup-To:" "Reply-To:"
"Return-Receipt-To:"))
(defvar wl-address-complete-header-regexp nil) ; auto-generated.
(defconst wl-ldap-alias-sep "/")
(defconst wl-ldap-search-attribute-type-list
- '("sn" "cn" "mail" "email" "displayName" "gecos"))
+ '("sn" "cn" "mail" "email"))
(defun wl-ldap-get-value (type entry)
""
(ldap-default-base (or wl-ldap-base ldap-default-base))
(dnhash (elmo-make-hash))
cache len sym tmpl regexp entries ent values dn dnstr alias
- result fullname mails)
+ result cn mails)
;; check cache
(mapatoms (lambda (atom)
(if (and (string-match
ent)
mails (or (wl-ldap-get-value-list "mail" ent)
(wl-ldap-get-value-list "email" ent))
- fullname (or (wl-ldap-get-value "displayName" ent)
- (wl-ldap-get-value "gecos" ent)
- (wl-ldap-get-value "cn" ent))
+ cn (wl-ldap-get-value "cn" ent)
dn (car (car entries))
dnstr (elmo-get-hash-val (upcase dn) dnhash))
;; make alias list generated from LDAP data.
(when (not (boundp sym))
(set sym alias)
(setq result (cons (cons alias
- (concat fullname " <" (car mails) ">"))
+ (concat cn " <" (car mails) ">"))
result)))
(setq values (cdr values)))
;; make mail addrses list
;; (string-match regexp (car mails))
;; add mail address itself to completion list
(setq result (cons (cons (car mails)
- (concat fullname " <" (car mails) ">"))
+ (concat cn " <" (car mails) ">"))
result)))
(setq mails (cdr mails)))
(setq entries (cdr entries)))
(wl-address-init)
(list (or new-addr address) the-petname the-realname)))))
+;; Read addresses from minibuffer with completion.
+(defvar wl-address-minibuffer-history nil)
+(defvar wl-address-minibuffer-local-map nil
+ "Keymap to use when reading address from the minibuffer.")
+
+(unless wl-address-minibuffer-local-map
+ (let ((map (make-sparse-keymap)))
+ (set-keymap-parent map minibuffer-local-map)
+ (define-key map "\C-i"
+ (lambda ()
+ (interactive)
+ (wl-complete-field-body wl-address-completion-list
+ ?@ nil wl-use-ldap)))
+ (setq wl-address-minibuffer-local-map map)))
+
+(defun wl-address-read-from-minibuffer (prompt &optional
+ initial-contents
+ default-value)
+ (read-from-minibuffer prompt
+ initial-contents
+ wl-address-minibuffer-local-map
+ nil
+ 'wl-address-minibuffer-history
+ default-value))
+
(require 'product)
(product-provide (provide 'wl-address) (require 'wl-version))