2004-05-23 Yoichi NAKAYAMA <yoichi@geiin.org>
+ * wl-vars.el (wl-user-mail-address-regexp): New variable.
+ * wl-address.el (wl-address-user-mail-address-p): Use it.
+ (wl-address-delete-user-mail-addresses): Ditto.
+ Suggested by David Bremner <bremner@unb.ca>, [wl-en:463]
+
* wl-address.el (wl-address-user-mail-address-p): defsubst->defun.
(wl-address-delete-user-mail-addresses): Ditto.
(defun 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))))))
+ (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'."
- (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)))))
+ (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
"*A list of user's mail addresses.
This list is used to judge whether an address is user's or not.
You should set this variable if you use multiple e-mail addresses.
-If you don't have multiple e-mail addresses, you don't have to set this."
+If you don't have multiple e-mail addresses, you don't have to set this.
+NOTE: Non-nil value of `wl-user-mail-address-regexp' supersede this."
:type '(repeat string)
:group 'wl
:group 'wl-setting)
+(defcustom wl-user-mail-address-regexp nil
+ "*A regexp for user's mail addresses.
+Supersede `wl-user-mail-address-list'."
+ :type '(choice (const :tag "Use wl-user-mail-address-list" nil)
+ string)
+ :group 'wl
+ :group 'wl-setting)
+
(defcustom wl-organization (getenv "ORGANIZATION")
"Organization name."
:type '(choice (const :tag "none" nil)