[Mew-dist 04054] Re: Can't expand IMAP folder name

若宮賢二 wkenji at example.com
1998年 3月 2日 (月) 14:37:04 JST


¼ãµÜ¡÷ÉÙ»ÎÄ̸¦¤Ç¤¹¡£

»ûÀ¾¤µ¤ó¤¬½ñ¤«¤ì¤Æ¤¤¤¿¡¢

> ImapAccount ¤¬ teranisi/AUTH at example.com ¤Î»þ
> %foo                -> %foo:teranisi/AUTH at example.com 
> %foo at example.com        -> %foo:teranisi/AUTH at example.com
> %foo:teranisi       -> %foo:teranisi/AUTH at example.com
> %foo:teranisi/LOGIN -> %foo:teranisi/LOGIN at example.com

¤È¤¤¤¦»ÅÍͤ˹ç¤ï¤»¤Æ IMAP ¥Õ¥©¥ë¥À̾¤ÎÀµµ¬²½¤ò elisp ¤Ç¹Ô¤Ê¤¦¤è¤¦¤Ë¤·
¤Þ¤·¤¿ (mew-imap-folder-fullspec)¡£¤Þ¤¿¡¢¤³¤ì¤ËÁêÅö¤¹¤ë IM ¦¤Ç¤Î¥µ¥Ö
¥ë¡¼¥Á¥ó &imap_folder_regname ¤â¿·»ÅÍͤ˹ç¤ï¤»¤Æñ½ã²½¤·¤Þ¤·¤¿¡£ÊÑ¿ô 
mew-use-imap ¤ò non-nil ¤ËÀßÄꤹ¤ì¤Ð¡¢b22 ¤Ç IMAP ¤¬»È¤¨¤ë¤È»×¤¤¤Þ¤¹¡£

immv/imrm Æâ¤Ë¤¢¤ë IMAP ÍÑ¥µ¥Ö¥ë¡¼¥Á¥ó¤Î Imap.pm ¤Ø¤Î½¸Ìó¤Î·ï¤Ç¤¹¤¬¡¢
»ÈÍѤ·¤Æ¤¤¤ëÂç°èÊÑ¿ô¤Î´Ø·¸¤Ç¾¯¤·ÌÌÅݤǡ¢¤Þ¤À immv/imrm Æâ¤ËÃÖ¤¤¤¿¤Þ¤Þ
¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹(_ _)¡£

// Kenji    | mailto:wkenji at example.com (office)
// Wakamiya | mailto:wkenji at example.com (private)
-------------- next part --------------
diff -aruN mew-1.93b22-/mew-func.el mew-1.93b22/mew-func.el
--- mew-1.93b22-/mew-func.el	Wed Feb 25 00:04:57 1998
+++ mew-1.93b22/mew-func.el	Mon Mar  2 02:46:09 1998
@@ -258,32 +258,50 @@
 
 (defun mew-expand-folder (folder &optional message)
   (let ((subdir (substring folder 1 nil))
-	dir rfold)
+	dir)
     (cond
      ((mew-folder-mailp folder)
       (setq dir (expand-file-name subdir mew-mail-path)))
      ((mew-folder-local-newsp folder)
       (setq dir (expand-file-name subdir mew-news-path)))
      ((mew-folder-imapp folder)
-      (setq rfold (mew-folder-impath folder))
-      (string-match
-       "^%\\([^:]+\\):\\([^/]+\\)/\\([^@]+\\)@\\([^/]+\\).*$" rfold)
-      (setq dir
-	    (expand-file-name
-	     (concat "@" (substring rfold (match-beginning 4) (match-end 4))
-		     "#" (substring rfold (match-beginning 2) (match-end 2))
-		     mew-path-separator
-		     (substring rfold (match-beginning 1) (match-end 1)))
-	     mew-mail-path))
-      ))
+      (let ((spec (mew-imap-folder-fullspec folder)))
+	(string-match
+	 "^%\\([^:]+\\):\\([^/]+\\)/\\([^@]+\\)@\\([^/]+\\).*$" spec)
+	(setq dir
+	      (expand-file-name
+	       (concat "@" (mew-match 4 spec)
+		       "#" (mew-match 2 spec)
+		       mew-path-separator (mew-match 1 spec))
+	       mew-mail-path))
+	)))
     (if message
 	(expand-file-name message dir)
       dir)
     ))
 
-(defun mew-folder-impath (folder)
-  ;; MUST use mew-imap-account
-  )
+(defun mew-imap-folder-fullspec (folder)
+  "Make full-spec IMAP folder name of FOLDER."
+  (let ((fold nil)
+	(user (or (getenv "USER") (getenv "LOGNAME") (user-login-name)))
+	(auth "/AUTH")
+	(host "@localhost"))
+    (if mew-imap-account
+	(progn
+	  (string-match
+	   "^\\([^/@]+\\)?\\(/[^@]+\\)?\\(@.+\\)?$" mew-imap-account)
+	  (if (match-beginning 1) (setq user (mew-match 1 mew-imap-account)))
+	  (if (match-beginning 2) (setq auth (mew-match 2 mew-imap-account)))
+	  (if (match-beginning 3) (setq host (mew-match 3 mew-imap-account)))
+	  ))
+    (string-match
+     "^\\([^:/@]+\\)\\(:\\([^/@]+\\)\\)?\\(/[^@]+\\)?\\(@.+\\)?$" folder)
+    (setq fold (mew-match 1 folder))
+    (if (match-beginning 3) (setq user (mew-match 3 folder)))
+    (if (match-beginning 4) (setq auth (mew-match 4 folder)))
+    (if (match-beginning 5) (setq host (mew-match 5 folder)))
+    (concat fold ":" user auth host)
+    ))
 
 (defun mew-folder-check (folder)
   "A function to see if FOLDER exists.
-------------- next part --------------
diff -aruN im-86-/IM.in/Imap.pm.in im-86/IM.in/Imap.pm.in
--- im-86-/IM.in/Imap.pm.in	Tue Jan 27 19:26:49 1998
+++ im-86/IM.in/Imap.pm.in	Mon Mar  2 11:54:46 1998
@@ -735,13 +735,9 @@
     my $folder = shift;		# %...
     my ($auth, $user, $host);
 
-    if ($folder !~ /[:\@]/) {
-	# Use ImapAccount spec, unless user or host is specified.
-	(my $dummy, $auth, $user, $host) = imap_spec('');
-    } else {
-	($folder, $auth, $user, $host) = imap_spec($folder);
-	$folder =~ s/^/%/;
-    }
+    ($folder, $auth, $user, $host) = imap_spec($folder);
+    $folder =~ s/^/%/;
+
     return "$folder:$user/$auth\@$host"; # may be appended '/port'
 }
 


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