* elmo-imap4.el (elmo-imap4-decode-folder-string): Call `utf7-decode'.
authorteranisi <teranisi>
Thu, 10 Feb 2005 15:47:18 +0000 (15:47 +0000)
committerteranisi <teranisi>
Thu, 10 Feb 2005 15:47:18 +0000 (15:47 +0000)
(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
elmo/elmo-imap4.el
elmo/elmo-maildir.el

index 472ec28..1723509 100644 (file)
@@ -1,3 +1,16 @@
+2005-02-10  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * 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  <lapis-lazuli@pop06.odn.ne.jp>
 
        * elmo-nntp.el (elmo-nntp-server-command-index): Add entry `xhdr'.
index cc1d40a..c3b88af 100644 (file)
@@ -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
index 4fb0dd0..29de0b7 100644 (file)
                                    (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)