* elmo.el (toplevel): Added autoload setting for `md5'.
authorhmurata <hmurata>
Sat, 12 Feb 2005 06:05:15 +0000 (06:05 +0000)
committerhmurata <hmurata>
Sat, 12 Feb 2005 06:05:15 +0000 (06:05 +0000)
(elmo-msgdb-path-encode-threshold): New use option.
(elmo-folder-msgdb-path): Encode msgdb path if its length is
longer than `elmo-msgdb-path-encode-threshold'.

* elmo-flag.el (elmo-global-mark-migrate): Use
`elmo-folder-expand-msgdb-path' instead of
`elmo-folder-msgdb-path'.

elmo/ChangeLog
elmo/elmo-flag.el
elmo/elmo.el

index 396bc35..63e646d 100644 (file)
@@ -1,3 +1,14 @@
+2005-02-12  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
+
+       * elmo.el (toplevel): Added autoload setting for `md5'.
+       (elmo-msgdb-path-encode-threshold): New use option.
+       (elmo-folder-msgdb-path): Encode msgdb path if its length is
+       longer than `elmo-msgdb-path-encode-threshold'.
+
+       * elmo-flag.el (elmo-global-mark-migrate): Use
+       `elmo-folder-expand-msgdb-path' instead of
+       `elmo-folder-msgdb-path'.
+
 2005-02-11  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
 
        * elmo-multi.el (elmo-multi-folder-diff): Fixed problem when the
index c3ae100..e83fbe8 100644 (file)
@@ -454,7 +454,7 @@ If optional IGNORE-PRESERVED is non-nil, preserved flags
   (when (and (file-exists-p (expand-file-name elmo-global-mark-filename
                                              elmo-msgdb-directory))
             (elmo-global-flag-p 'important)
-            (not (file-exists-p (elmo-folder-expand-msgdb-path
+            (not (file-exists-p (elmo-folder-msgdb-path
                                  (elmo-flag-get-folder 'important)))))
     (elmo-global-mark-upgrade)))
 
index 58f65b6..b7be6fb 100644 (file)
@@ -68,6 +68,12 @@ Otherwise, entire fetching of the message is aborted without confirmation."
   :type 'boolean
   :group 'elmo)
 
+(defcustom elmo-msgdb-path-encode-threshold nil
+  "*Encode msgdb path if its length is longer than this value."
+  :type '(choice (const :tag "No encode" nil)
+                number)
+  :group 'elmo)
+
 (defvar elmo-message-displaying nil
   "A global switch to indicate message is displaying or not.")
 
@@ -83,6 +89,7 @@ Otherwise, entire fetching of the message is aborted without confirmation."
 
 ;; autoloads
 (eval-and-compile
+  (autoload 'md5 "md5")
   (autoload 'elmo-dop-queue-flush "elmo-dop")
   (autoload 'elmo-nntp-post "elmo-nntp")
   (autoload 'elmo-global-flag-p "elmo-flag")
@@ -1127,7 +1134,19 @@ If optional argument IF-EXISTS is nil, load on demand.
   (or (elmo-folder-path-internal folder)
       (elmo-folder-set-path-internal
        folder
-       (elmo-folder-expand-msgdb-path folder))))
+       (if (null elmo-msgdb-path-encode-threshold)
+          (elmo-folder-expand-msgdb-path folder)
+        (let* ((path (directory-file-name
+                      (elmo-folder-expand-msgdb-path folder)))
+               (dirname (file-name-nondirectory path)))
+          (if (<= (length dirname) elmo-msgdb-path-encode-threshold)
+              path
+            (require 'md5)
+            (setq dirname (md5 dirname))
+            (when (> (length dirname) elmo-msgdb-path-encode-threshold)
+              (error "Cannot shrink msgdb path for `%s'"
+                     (elmo-folder-name-internal folder)))
+            (expand-file-name dirname (file-name-directory path))))))))
 
 (luna-define-generic elmo-message-cached-p (folder number)
   "Return non-nil if the message is cached.")