* wl-address.el (wl-address-delete-user-mail-addresses): New
authoryoichi <yoichi>
Sun, 23 May 2004 05:52:22 +0000 (05:52 +0000)
committeryoichi <yoichi>
Sun, 23 May 2004 05:52:22 +0000 (05:52 +0000)
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
wl/wl-address.el
wl/wl-draft.el
wl/wl-refile.el

index 9a00d75..79a7ee5 100644 (file)
@@ -1,5 +1,11 @@
 2004-05-23  Yoichi NAKAYAMA  <yoichi@geiin.org>
 
+       * 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.
 
index dc62579..884a737 100644 (file)
@@ -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 <hoge@foo.com>\"
         (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)))
index 10e07bd..a736f84 100644 (file)
@@ -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)
index 7d9786c..f90af87 100644 (file)
@@ -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)