[mew-dist 24791] Re: mew 10 周年飲み会ログ
Kazu Yamamoto ( 山本和彦 )
kazu at example.com
2004年 3月 26日 (金) 00:16:05 JST
From: Shigeru Yasuda <yasuda at example.com>
Subject: [mew-dist 24787] Re: mew 10 周年飲み会ログ
> ですが、MH folder を使っていない UW-imap ユーザにとっては、アクセス
> できないフォルダ(#mhinbox)が folder-alist に入ることになります。それは
> ちょっと問題かなぁと思ったので。
mew-imap-prefix-list を導入しました。
mew-imap-prefix-list が nil であれば、NAMESPACE が返したユーザフォルダ
群の最初を使います。
mew-imap-prefix-list がリストの場合:NAMESPACE が返したユーザフォルダプ
レフィックス群の内、このリストに合致するものを探します。separator が
NIL でないものの LIST を取り、NIL なものは alist に追加されます。
WU だと、
・"" の場合
(setq mew-imap-prefix-list '(""))
・#mh/ の場合
(setq mew-imap-prefix-list '("#mh/" "#mhinbox"))
と書きます。
環境がないので、separator が NIL なものを alist にちゃんと追加できるか
試していません。
恐いので、とりあえずパッチで送ります。
なお、僕は明日から旅に出ますので、このコードにバグがあっても対応できる
のは早くて 4/1 になります。
--かず
-------------- next part --------------
? LOG
Index: mew-imap.el
===================================================================
RCS file: /cvsroot/mew/mew/mew-imap.el,v
retrieving revision 1.215
diff -c -r1.215 mew-imap.el
*** mew-imap.el 24 Mar 2004 07:28:59 -0000 1.215
--- mew-imap.el 25 Mar 2004 15:09:12 -0000
***************
*** 37,43 ****
"case" "mailbox" "msgid" "max" "tag"
"wrk" "jobs" "namespace" "authl"
"spam" "spam-field" "spam-word" "new-mailbox"
! "my-prefix"))
(mew-info-defun "mew-imap-" mew-imap-info-list)
--- 37,43 ----
"case" "mailbox" "msgid" "max" "tag"
"wrk" "jobs" "namespace" "authl"
"spam" "spam-field" "spam-word" "new-mailbox"
! "my-prefix" "specials"))
(mew-info-defun "mew-imap-" mew-imap-info-list)
***************
*** 661,671 ****
(read (current-buffer))
(error ())))
(defun mew-imap-command-post-namespace (pro pnm)
(when (looking-at "\\* NAMESPACE ")
! (let ((beg (match-end 0))
! (my-prefix "")
! user-prefix sexp sep sharp namespace ent)
(goto-char (point-max))
(forward-line -1)
(save-restriction
--- 661,678 ----
(read (current-buffer))
(error ())))
+ (defvar mew-imap-prefix-list nil)
+
+ (defun mew-imap-prefix-list (&optional case)
+ (mew-cfent-value case "imap-prefix-list" mew-imap-prefix-list))
+
(defun mew-imap-command-post-namespace (pro pnm)
(when (looking-at "\\* NAMESPACE ")
! (let* ((beg (match-end 0))
! (case (mew-imap-get-case pnm))
! (prefix-list (mew-imap-prefix-list case))
! (my-prefix "")
! user-prefix sexp sep sharp namespace ent my sp specials)
(goto-char (point-max))
(forward-line -1)
(save-restriction
***************
*** 675,690 ****
(replace-match "nil" t t))
(goto-char (point-min))
(setq sexp (mew-imap-read-sexp))
! (catch 'loop
(while sexp
(setq ent (car sexp))
(setq sexp (cdr sexp))
! (if (and (nth 1 ent) ;; separator
! (nth 0 ent) ;; prefix
! (not (string= (nth 0 ent) "")))
! (throw 'loop (setq my-prefix (nth 0 ent))))))
(mew-imap-set-my-prefix pnm my-prefix)
! (setq sep (nth 1 (car sexp)))
(setq sexp (mew-imap-read-sexp))
(setq user-prefix (or (nth 0 (car sexp)) ""))
(setq sexp (mew-imap-read-sexp))
--- 682,707 ----
(replace-match "nil" t t))
(goto-char (point-min))
(setq sexp (mew-imap-read-sexp))
! (cond
! ((null prefix-list)
! (setq ent (car sexp))
! (setq my-prefix (nth 0 ent))
! (setq sep (nth 1 ent)))
! (t
(while sexp
(setq ent (car sexp))
(setq sexp (cdr sexp))
! (setq my (nth 0 ent))
! (setq sp (nth 1 ent))
! (when (member my prefix-list)
! (cond
! (sp
! (setq my-prefix my)
! (setq sep sp))
! (t
! (setq specials (cons (cons (concat mew-folder-imap my) my) specials))))))))
(mew-imap-set-my-prefix pnm my-prefix)
! (mew-imap-set-specials pnm specials)
(setq sexp (mew-imap-read-sexp))
(setq user-prefix (or (nth 0 (car sexp)) ""))
(setq sexp (mew-imap-read-sexp))
***************
*** 707,720 ****
(let* ((case (mew-imap-get-case pnm))
(queue (mew-imap-queue-folder case))
(namespace (mew-imap-get-namespace pnm))
ret mailboxes friends)
(mew-eol-fix-for-read)
(unless namespace
! (setq namespace (mew-imap-namespace-create nil "" "" nil))
(mew-imap-set-namespace pnm namespace))
(setq ret (mew-imap-command-post-list-tree namespace case))
(setq mailboxes (nth 0 ret) friends (nth 1 ret))
(unless case (setq case mew-case-default))
(if queue (mew-folder-insert queue mailboxes nil))
(mew-imap-folder-set case mailboxes friends)
(mew-imap-set-status pnm "logout")
--- 724,739 ----
(let* ((case (mew-imap-get-case pnm))
(queue (mew-imap-queue-folder case))
(namespace (mew-imap-get-namespace pnm))
+ (specials (mew-imap-get-specials pnm))
ret mailboxes friends)
(mew-eol-fix-for-read)
(unless namespace
! (setq namespace (mew-imap-namespace-create nil "" "" nil)) ;; xxx separator?
(mew-imap-set-namespace pnm namespace))
(setq ret (mew-imap-command-post-list-tree namespace case))
(setq mailboxes (nth 0 ret) friends (nth 1 ret))
(unless case (setq case mew-case-default))
+ (if specials (setq mailboxes (nconc specials mailboxes)))
(if queue (mew-folder-insert queue mailboxes nil))
(mew-imap-folder-set case mailboxes friends)
(mew-imap-set-status pnm "logout")
***************
*** 727,734 ****
(user (format "^%s" (regexp-quote
(mew-imap-namespace-user-prefix namespace))))
(sep (mew-imap-namespace-sep namespace))
! subfolder friendp
! mbx mailbox mailboxes subnm friends)
(when sep
(setq subfolder (format "\\([^%s\n]+\\)$" sep))
(setq friendp (mew-imap-friend-regex sep case)))
--- 746,752 ----
(user (format "^%s" (regexp-quote
(mew-imap-namespace-user-prefix namespace))))
(sep (mew-imap-namespace-sep namespace))
! subfolder friendp mbx mailbox mailboxes subnm friends)
(when sep
(setq subfolder (format "\\([^%s\n]+\\)$" sep))
(setq friendp (mew-imap-friend-regex sep case)))
Mew-dist メーリングリストの案内