(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.
(forward-line))
(nreverse ret)))))
-(defun wl-address-get-petname-1 (string)
- (let ((address (downcase (wl-address-header-extract-address string))))
- (elmo-get-hash-val address wl-address-petname-hash)))
-
-(defsubst wl-address-get-petname (string)
- (or (wl-address-get-petname-1 string)
- string))
-
-(defsubst wl-address-user-mail-address-p (address)
- "Judge whether ADDRESS is user's or not."
- (member (downcase (wl-address-header-extract-address address))
- (or (mapcar 'downcase wl-user-mail-address-list)
- (list (downcase
- (wl-address-header-extract-address
- wl-from))))))
(defsubst wl-address-header-extract-address (str)
"Extracts a real e-mail address from STR and return it.
(wl-match-string 1 str))
(t "")))
+
+(defun wl-address-get-petname-1 (string)
+ (let ((address (downcase (wl-address-header-extract-address string))))
+ (elmo-get-hash-val address wl-address-petname-hash)))
+
+(defsubst wl-address-get-petname (string)
+ (or (wl-address-get-petname-1 string)
+ string))
+
+(defun wl-address-user-mail-address-p (address)
+ "Judge whether ADDRESS is user's or not."
+ (if wl-user-mail-address-regexp
+ (string-match wl-user-mail-address-regexp
+ (wl-address-header-extract-address address))
+ (member (downcase (wl-address-header-extract-address address))
+ (or (mapcar 'downcase wl-user-mail-address-list)
+ (list (downcase
+ (wl-address-header-extract-address
+ wl-from)))))))
+
+(defun wl-address-delete-user-mail-addresses (address-list)
+ "Delete user mail addresses from list by side effect.
+Deletion is done by using `elmo-list-delete'."
+ (if wl-user-mail-address-regexp
+ (elmo-list-delete (list wl-user-mail-address-regexp) address-list
+ (lambda (elem list)
+ (elmo-delete-if
+ (lambda (item) (string-match elem item))
+ list)))
+ (let ((myself (or wl-user-mail-address-list
+ (list (wl-address-header-extract-address wl-from)))))
+ (elmo-list-delete myself address-list
+ (lambda (elem list)
+ (elmo-delete-if
+ (lambda (item) (string= (downcase elem)
+ (downcase item)))
+ list))))))
+
(defmacro wl-address-concat-token (string token)
(` (cond
((eq 'quoted-string (car (, token)))
(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))