* elmo-vars.el (elmo-init-hook): New user option.
authorteranisi <teranisi>
Thu, 6 Nov 2003 14:15:47 +0000 (14:15 +0000)
committerteranisi <teranisi>
Thu, 6 Nov 2003 14:15:47 +0000 (14:15 +0000)
* elmo.el (elmo-init): Run the elmo-init-hook.

* elmo-flag.el (elmo-global-mark-migrate): New function.

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

index 42aeb1c..e8f8754 100644 (file)
@@ -1,3 +1,11 @@
+2003-11-06  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-vars.el (elmo-init-hook): New user option.
+
+       * elmo.el (elmo-init): Run the elmo-init-hook.
+
+       * elmo-flag.el (elmo-global-mark-migrate): New function.
+
 2003-11-06  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
 
        * modb-standard.el (elmo-msgdb-set-flag): Simplify;
index e3c3649..c1bb436 100644 (file)
@@ -372,6 +372,16 @@ the message is not flagged in any folder."
 (defvar elmo-global-mark-filename "global-mark"
   "Obsolete variable. (Just for migration)")
 
+(defun elmo-global-mark-migrate ()
+  "Migrate from 'mark to 'flag. For automatic migration."
+  (elmo-global-flag-initialize)
+  (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
+                                 (elmo-flag-get-folder 'important)))))
+    (elmo-global-mark-upgrade)))
+
 (defun elmo-global-mark-upgrade ()
   "Upgrade old `global-mark' structure."
   (interactive)
index 3d98591..c405355 100644 (file)
   :group 'elmo
   :group 'elmo-setting)
 
+(defcustom elmo-init-hook '(elmo-global-mark-migrate)
+  "*A hook called when elmo is initialized."
+  :type 'hook
+  :group 'elmo)
+
 (defvar elmo-msgdb-file-header-chop-length 2048
   "*Number of bytes to get header in one reading from file.")
 
index c76fdd5..70d1cc9 100644 (file)
@@ -1597,7 +1597,8 @@ Return a hashtable for newsgroups."
   (elmo-crosspost-message-alist-load)
   (elmo-resque-obsolete-variables)
   (elmo-global-flag-initialize)
-  (elmo-dop-queue-load))
+  (elmo-dop-queue-load)
+  (run-hooks 'elmo-init-hook))
 
 (defun elmo-quit ()
   "Quit and cleanup ELMO."