[Mew-dist 08980] Re: +fromへのrefile

Yoshinari NOMURA nom at example.com
1999年 5月 26日 (水) 00:58:35 JST


mew-refile 0.67 から 0.68 へのパッチです。

On Tue, 25 May 1999 19:17:14 +0900,
	Kazu Yamamoto (山本和彦) <kazu at example.com> said:

> alice at example.comalice at example.com がいたとしましょう。
> 
> (1) +from/alice at example.com と +from/alice at example.com があれば、それぞれにマッチ。
> 
> (2) +from/alice と +from/alice at example.com があるなら、
> 	alice@* は +from/alice にマッチ
> 	alice at example.com は +from/alice at example.com にマッチ
> 
> (3) +from/alice しかないなら、
> 	alice@* は +from/alice にマッチ

これに加えて

(4) +from/alice すらないなら、

        +from/alice
        +from/alice at example.com

    のどちらをデフォルトにするかを 
    mew-refile-guess-strip-domainpart で決める。

を mew-guess-by-default に実装しました。
--
nom

--- mew-refile.el.orig	Tue May 25 23:52:52 1999
+++ mew-refile.el	Wed May 26 00:51:08 1999
@@ -3,11 +3,11 @@
 ;; Author:  Yoshinari NOMURA <nom at example.com>
 ;;          Kazu Yamamoto <Kazu at example.com>
 ;; Created: Jun 11, 1994
-;; Revised: May 25, 1999
+;; Revised: May 26, 1999
 
 ;;; Code:
 
-(defconst mew-refile-version "mew-refile.el version 0.67")
+(defconst mew-refile-version "mew-refile.el version 0.68")
 
 (require 'mew)
 
@@ -247,9 +247,12 @@
 ;; by from returns: guess1
 ;;
 (defun mew-refile-guess-by-from (&optional addr)
-  (let ((from (or addr (mew-header-parse-address mew-from:) "")))
-    ;; search from alist
-    (cdr (assoc from mew-refile-from-alist))))
+  (let* ((from   (or addr (mew-header-parse-address mew-from:) ""))
+	 (folder (cdr (assoc from mew-refile-from-alist)))) ;; search from alist
+    (if (and folder (mew-folder-member folder mew-folder-list))
+	folder ;; return value
+      nil      ;; return value
+      )))
 
 ;;
 ;; by To: or Cc: when From: is mine. (Undocumented)
@@ -274,13 +277,24 @@
 ;; by default returns: guess1
 ;;
 (defun mew-refile-guess-by-default (&optional addr)
-  (let ((from (downcase (or addr (mew-header-parse-address mew-from:) ""))))
-    (if mew-refile-guess-strip-domainpart
-	(setq from (mew-addrstr-extract-user from)))
-    (if (and mew-folders-default-folder
-	     (not (equal "" mew-folders-default-folder)))
-	(concat (file-name-as-directory mew-folders-default-folder) from)
-      (concat "+" from))))
+  (let* ((from (downcase (or addr (mew-header-parse-address mew-from:))))
+	 (user (mew-addrstr-extract-user from))
+	 (prefix (if (or (equal ""  mew-folders-default-folder)
+			 (equal nil mew-folders-default-folder)
+			 (equal "+" mew-folders-default-folder))
+		     "+"
+		   (file-name-as-directory mew-folders-default-folder))))
+    (setq from (concat prefix from)
+	  user (concat prefix user))
+    (cond
+     ((mew-folder-member from mew-folder-list)
+      from)
+     ((mew-folder-member user mew-folder-list)
+      user)
+     (mew-refile-guess-strip-domainpart
+      user)
+     (t
+      from))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;



Mew-dist メーリングリストの案内