From 71235bebcb97ee9cf73cd3d545ce6e1ef5b75b35 Mon Sep 17 00:00:00 2001 From: yoichi Date: Sun, 23 May 2004 05:52:22 +0000 Subject: [PATCH] * wl-address.el (wl-address-delete-user-mail-addresses): New function. * wl-refile.el (wl-refile-guess-by-history): Use it. * wl-draft.el (wl-draft-delete-myself-from-cc): Ditto. (wl-draft-make-mail-followup-to): Ditto and fix logic. --- wl/ChangeLog | 6 ++++++ wl/wl-address.el | 44 +++++++++++++++++++++++++++++--------------- wl/wl-draft.el | 49 ++++++++++++------------------------------------- wl/wl-refile.el | 5 +---- 4 files changed, 48 insertions(+), 56 deletions(-) diff --git a/wl/ChangeLog b/wl/ChangeLog index 9a00d75..79a7ee5 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,5 +1,11 @@ 2004-05-23 Yoichi NAKAYAMA + * wl-address.el (wl-address-delete-user-mail-addresses): New + function. + * wl-refile.el (wl-refile-guess-by-history): Use it. + * wl-draft.el (wl-draft-delete-myself-from-cc): Ditto. + (wl-draft-make-mail-followup-to): Ditto and fix logic. + * wl-draft.el (wl-draft-edit-string): To judge sender address, use wl-address-user-mail-address-p. diff --git a/wl/wl-address.el b/wl/wl-address.el index dc62579..884a737 100644 --- a/wl/wl-address.el +++ b/wl/wl-address.el @@ -560,21 +560,6 @@ Refresh `wl-address-list', `wl-address-completion-list', and (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. @@ -596,6 +581,35 @@ e.g. \"Mr. bar \" (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)) + +(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-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))))) + (defmacro wl-address-concat-token (string token) (` (cond ((eq 'quoted-string (car (, token))) diff --git a/wl/wl-draft.el b/wl/wl-draft.el index 10e07bd..a736f84 100644 --- a/wl/wl-draft.el +++ b/wl/wl-draft.el @@ -224,45 +224,20 @@ e.g. (list (concat wl-draft-mime-bcc-field-name ":"))))))) (defun wl-draft-make-mail-followup-to (recipients) - (if (elmo-list-member - (or wl-user-mail-address-list - (list (wl-address-header-extract-address wl-from))) - recipients) - (let ((rlist (elmo-list-delete - (or wl-user-mail-address-list - (list (wl-address-header-extract-address wl-from))) - recipients - (lambda (elem list) - (elmo-delete-if - (lambda (item) (string= (downcase elem) - (downcase item))) - list))))) - (if (elmo-list-member rlist (mapcar 'downcase - wl-subscribed-mailing-list)) - rlist - (append rlist (list (wl-address-header-extract-address - wl-from))))) - recipients)) + (let ((rlist (wl-address-delete-user-mail-addresses recipients))) + (if (elmo-list-member rlist (mapcar 'downcase + wl-subscribed-mailing-list)) + rlist + (append rlist (list (wl-address-header-extract-address + wl-from)))))) (defun wl-draft-delete-myself-from-cc (to cc) - (let ((myself (or wl-user-mail-address-list - (list (wl-address-header-extract-address wl-from))))) - (cond (wl-draft-always-delete-myself ; always-delete option - (elmo-list-delete myself cc - (lambda (elem list) - (elmo-delete-if - (lambda (item) (string= (downcase elem) - (downcase item))) - list)))) - ((elmo-list-member (append to cc) ; subscribed mailing-list - (mapcar 'downcase wl-subscribed-mailing-list)) - (elmo-list-delete myself cc - (lambda (elem list) - (elmo-delete-if - (lambda (item) (string= (downcase elem) - (downcase item))) - list)))) - (t cc)))) + (cond (wl-draft-always-delete-myself ; always-delete option + (wl-address-delete-user-mail-addresses cc)) + ((elmo-list-member (append to cc) ; subscribed mailing-list + (mapcar 'downcase wl-subscribed-mailing-list)) + (wl-address-delete-user-mail-addresses cc)) + (t cc))) (defun wl-draft-forward (original-subject summary-buf) (let (references parent-folder) diff --git a/wl/wl-refile.el b/wl/wl-refile.el index 7d9786c..f90af87 100644 --- a/wl/wl-refile.el +++ b/wl/wl-refile.el @@ -220,10 +220,7 @@ If RULE does not match ENTITY, returns nil." (elmo-message-entity-field entity 'to) "," (elmo-message-entity-field entity 'cc))))) ret-val) - (setq tocc-list (elmo-list-delete - (or wl-user-mail-address-list - (list (wl-address-header-extract-address wl-from))) - tocc-list)) + (setq tocc-list (wl-address-delete-user-mail-addresses tocc-list)) (while tocc-list (if (setq ret-val (cdr (assoc (car tocc-list) wl-refile-alist))) (setq tocc-list nil) -- 1.7.10.4