From f3d636b9bda4acf5131c21741cc0d6940f591d7f Mon Sep 17 00:00:00 2001 From: teranisi Date: Thu, 10 Feb 2005 15:47:18 +0000 Subject: [PATCH] * elmo-imap4.el (elmo-imap4-decode-folder-string): Call `utf7-decode'. (elmo-imap4-encode-folder-string): Call `utf7-encode'. * elmo-maildir.el (elmo-maildir-separator): New user option. (elmo-maildir-adjust-separator): New macro. (elmo-maildir-list-location): Use it. (elmo-maildir-update-current): Ditto. (elmo-maildir-set-mark): Ditto. (elmo-maildir-delete-mark): Ditto. (Above changes are based on Hiroya Murata's patch [wl: 13437]) --- elmo/ChangeLog | 13 +++++++++++++ elmo/elmo-imap4.el | 4 ++-- elmo/elmo-maildir.el | 36 ++++++++++++++++++++++++++++++------ 3 files changed, 45 insertions(+), 8 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 472ec28..1723509 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,16 @@ +2005-02-10 Yuuichi Teranishi + + * elmo-imap4.el (elmo-imap4-decode-folder-string): Call `utf7-decode'. + (elmo-imap4-encode-folder-string): Call `utf7-encode'. + + * elmo-maildir.el (elmo-maildir-separator): New user option. + (elmo-maildir-adjust-separator): New macro. + (elmo-maildir-list-location): Use it. + (elmo-maildir-update-current): Ditto. + (elmo-maildir-set-mark): Ditto. + (elmo-maildir-delete-mark): Ditto. + (Above changes are based on Hiroya Murata's patch [wl: 13437]) + 2005-02-06 Hiroya Murata * elmo-nntp.el (elmo-nntp-server-command-index): Add entry `xhdr'. diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index cc1d40a..c3b88af 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -214,12 +214,12 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") (defsubst elmo-imap4-decode-folder-string (string) (if elmo-imap4-use-modified-utf7 - (utf7-decode-string string 'imap) + (utf7-decode string 'imap) string)) (defsubst elmo-imap4-encode-folder-string (string) (if elmo-imap4-use-modified-utf7 - (utf7-encode-string string 'imap) + (utf7-encode string 'imap) string)) ;;; Response diff --git a/elmo/elmo-maildir.el b/elmo/elmo-maildir.el index 4fb0dd0..29de0b7 100644 --- a/elmo/elmo-maildir.el +++ b/elmo/elmo-maildir.el @@ -45,6 +45,21 @@ (unread ?S 'remove) (answered ?R))) +;; Decided at compile time. +(defcustom elmo-maildir-separator + (if (memq system-type '(windows-nt)) ?\- ?:) + "Character separating the id section from the flags section. +According to the maildir specification, this should be a colon (?:), +but some file systems don't support colons in filenames." + :type 'character + :group 'elmo) + +(defmacro elmo-maildir-adjust-separator (string) + `(if (= elmo-maildir-separator ?:) + ,string + (elmo-replace-in-string + ,string ":" (char-to-string elmo-maildir-separator)))) + ;;; ELMO Maildir folder (eval-and-compile (luna-define-class elmo-maildir-folder @@ -101,7 +116,9 @@ LOCATION." (setq locations (mapcar (lambda (x) - (if (string-match "^\\([^:]+\\):\\([^:]+\\)$" x) + (if (string-match + (elmo-maildir-adjust-separator "^\\([^:]+\\):\\([^:]+\\)$") + x) (progn (setq sym (elmo-match-string 1 x) flag-list (string-to-char-list @@ -260,14 +277,18 @@ LOCATION." (expand-file-name (car news) (expand-file-name "new" maildir)) (expand-file-name (concat (car news) - (unless (string-match ":2,[A-Z]*$" (car news)) - ":2,")) + (unless (string-match + (elmo-maildir-adjust-separator ":2,[A-Z]*$") + (car news)) + (elmo-maildir-adjust-separator ":2,"))) (expand-file-name "cur" maildir))) (setq news (cdr news))))) (defun elmo-maildir-set-mark (filename mark) "Mark the FILENAME file in the maildir. MARK is a character." - (if (string-match "^\\([^:]+:[12],\\)\\(.*\\)$" filename) + (if (string-match + (elmo-maildir-adjust-separator "^\\([^:]+:[12],\\)\\(.*\\)$") + filename) (let ((flaglist (string-to-char-list (elmo-match-string 2 filename)))) (unless (memq mark flaglist) @@ -277,12 +298,15 @@ LOCATION." (char-list-to-string flaglist))))) ;; Rescue no info file in maildir. (rename-file filename - (concat filename ":2," (char-to-string mark)))) + (concat filename + (elmo-maildir-adjust-separator ":2,") + (char-to-string mark)))) t) (defun elmo-maildir-delete-mark (filename mark) "Mark the FILENAME file in the maildir. MARK is a character." - (if (string-match "^\\([^:]+:2,\\)\\(.*\\)$" filename) + (if (string-match (elmo-maildir-adjust-separator "^\\([^:]+:2,\\)\\(.*\\)$") + filename) (let ((flaglist (string-to-char-list (elmo-match-string 2 filename)))) (when (memq mark flaglist) -- 1.7.10.4