(elmo-folder-initialize): Use it.
(elmo-global-flag-replace-referrer): New function.
* elmo.el (toplevel): Added autoload setting for
`elmo-global-flag-replace-referrer'.
(elmo-folder-rename): Rewrite the last change use
`elmo-global-flag-replace-referrer'.
* elmo-pipe.el (elmo-folder-rename): Call
`elmo-global-flag-replace-referrer'.
+2006-08-12 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
+
+ * elmo-flag.el (elmo-flag-folder-set-minfo): New function.
+ (elmo-folder-initialize): Use it.
+ (elmo-global-flag-replace-referrer): New function.
+
+ * elmo.el (toplevel): Added autoload setting for
+ `elmo-global-flag-replace-referrer'.
+ (elmo-folder-rename): Rewrite the last change use
+ `elmo-global-flag-replace-referrer'.
+
+ * elmo-pipe.el (elmo-folder-rename): Call
+ `elmo-global-flag-replace-referrer'.
+
2006-08-09 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
* elmo.el (elmo-folder-rename): Set meta data for global flags
(elmo-flag-folder-set-max-number-internal
folder
(elmo-object-load (expand-file-name "max" msgdb-path))))
- (if (file-exists-p (expand-file-name ".minfo" msgdb-path))
- (elmo-flag-folder-set-minfo-internal
- folder
- (elmo-object-load (expand-file-name ".minfo" msgdb-path))))
- (elmo-flag-folder-set-minfo-hash-internal
+ (elmo-flag-folder-set-minfo
folder
- (elmo-make-hash (length (elmo-flag-folder-minfo-internal folder))))
- (dolist (elem (elmo-flag-folder-minfo-internal folder))
- (elmo-set-hash-val (nth 1 elem) elem
- (elmo-flag-folder-minfo-hash-internal folder))
- (elmo-set-hash-val (concat "#" (number-to-string (nth 2 elem)))
- elem
- (elmo-flag-folder-minfo-hash-internal folder))
- (dolist (pair (car elem))
- (elmo-set-hash-val (concat (number-to-string (cdr pair))
- ":" (car pair))
- elem
- (elmo-flag-folder-minfo-hash-internal folder))))
+ (and (file-exists-p (expand-file-name ".minfo" msgdb-path))
+ (elmo-object-load (expand-file-name ".minfo" msgdb-path))))
(setq elmo-global-flag-folder-alist
(cons (cons flag folder) elmo-global-flag-folder-alist))
folder)))
+(defun elmo-flag-folder-set-minfo (folder minfo)
+ (let ((hash (elmo-make-hash (length minfo))))
+ (dolist (elem minfo)
+ (elmo-set-hash-val (nth 1 elem) elem hash)
+ (elmo-set-hash-val (concat "#" (number-to-string (nth 2 elem)))
+ elem hash)
+ (dolist (pair (car elem))
+ (elmo-set-hash-val (concat (number-to-string (cdr pair))
+ ":" (car pair))
+ elem hash)))
+ (elmo-flag-folder-set-minfo-internal folder minfo)
+ (elmo-flag-folder-set-minfo-hash-internal folder hash)))
+
(luna-define-method elmo-folder-expand-msgdb-path ((folder elmo-flag-folder))
(expand-file-name (concat "flag/"
(elmo-replace-string-as-filename
(dolist (number numbers)
(elmo-global-flag-detach flag folder number delete-if-none)))))
+(defun elmo-global-flag-replace-referrer (old-folder new-folder)
+ (dolist (flag elmo-global-flags)
+ (let* ((folder (elmo-flag-get-folder flag))
+ (minfo (elmo-flag-folder-minfo-internal folder))
+ modified)
+ (dolist (entry minfo)
+ (let ((pair (assoc old-folder (nth 0 entry))))
+ (when pair
+ (setcar pair new-folder)
+ (setq modified t))))
+ (when modified
+ (elmo-flag-folder-set-minfo folder minfo)
+ (elmo-folder-commit folder)))))
+
(defun elmo-get-global-flags (&optional flags ignore-preserved)
"Get global flags.
Return value is a subset of optional argument FLAGS.
(elmo-folder-rename (elmo-pipe-folder-dst-internal folder)
(elmo-folder-name-internal
(elmo-pipe-folder-dst-internal new-folder)))
+ (elmo-global-flag-replace-referrer (elmo-folder-name-internal folder)
+ new-name)
(elmo-msgdb-rename-path folder new-folder)))
(luna-define-method elmo-folder-synchronize ((folder elmo-pipe-folder)
(autoload 'elmo-global-flag-detach "elmo-flag")
(autoload 'elmo-global-flag-detach-messages "elmo-flag")
(autoload 'elmo-global-flag-set "elmo-flag")
+ (autoload 'elmo-global-flag-replace-referrer "elmo-flag")
(autoload 'elmo-get-global-flags "elmo-flag")
(autoload 'elmo-global-flags-initialize "elmo-flag")
(autoload 'elmo-global-mark-migrate "elmo-flag")
(when (or (file-exists-p (elmo-folder-msgdb-path new-folder))
(elmo-folder-exists-p new-folder))
(error "Already exists folder: %s" new-name))
- (let ((global-flag-entries
- (mapcar (lambda (number)
- (list number
- (elmo-message-field folder number 'message-id)
- (elmo-message-flags folder number)))
- (elmo-folder-list-flagged folder 'digest 'in-msgdb))))
- (elmo-folder-send folder 'elmo-folder-rename-internal new-folder)
- (elmo-msgdb-rename-path folder new-folder)
- (dolist (entry global-flag-entries)
- (let ((number (nth 0 entry))
- (message-id (nth 1 entry)))
- (dolist (flag (nth 2 entry))
- (when (elmo-global-flag-p flag)
- (elmo-global-flag-set flag new-folder number message-id)
- (elmo-global-flag-detach flag folder number))))))))
+ (elmo-folder-send folder 'elmo-folder-rename-internal new-folder)
+ (elmo-global-flag-replace-referrer (elmo-folder-name-internal folder)
+ new-name)
+ (elmo-msgdb-rename-path folder new-folder)))
(luna-define-method elmo-folder-delete-messages ((folder elmo-folder)
numbers)