* wl-vars.el (wl-folder-sync-range-alist): Set default range for
authorteranisi <teranisi>
Thu, 18 Sep 2003 04:41:04 +0000 (04:41 +0000)
committerteranisi <teranisi>
Thu, 18 Sep 2003 04:41:04 +0000 (04:41 +0000)
'flag as all.
(wl-use-flag-folder-help-echo): New user option.

* wl-summary.el (wl-summary-detect-mark-position): Bind
wl-summary-highlight as nil.
(wl-summary-set-mark-modified): Follow the API change.
(wl-summary-mark-modified-p): Ditto.
(wl-summary-mark-as-read-all): Ditto.
(wl-summary-sync-marks): Don't call
elmo-folder-list-messages-with-global-mark.
(wl-summary-mark-as-read-internal): Follow the API change.
(wl-summary-mark-as-answered-internal): Ditto.
(wl-summary-mark-as-important): Cause an error when 'flag folder;
Follow the API change.
(wl-summary-create-line): Call with number argument.
(wl-summary-reply): Follow the API change.

* wl-highlight.el (wl-highlight-summary-line-flag-folder): New
function.
(wl-highlight-summary-line-string): Call it when
wl-use-flag-folder-help-echo is non-nil.
(wl-highlight-summary-current-line): Ditto.
(elmo-flag-folder-referrer): Added autoload setting.

* wl-draft.el (wl-draft-kill): Follow the API change.

* elmo-flag.el: New file.

* elmo-mark.el: Removed.

* modb-legacy.el (modb-legacy-new-mark,
modb-legacy-unread-uncached-mark,
modb-legacy-unread-cached-mark,
modb-legacy-read-uncached-mark,
modb-legacy-answered-cached-mark,
modb-legacy-answered-uncached-mark,
modb-legacy-important-mark): New constants (Moved from elmo-msgdb.el);
All other related portions are changed.

* elmo.el (luna-define-class): Changed mark-modified to flag-modified.
(elmo-folder-list-messages-with-global-mark): Abolish.
(elmo-folder-unflag-important): Renamed from `mark' to `flag'.
(elmo-folder-flag-as-important): Ditto.
(elmo-folder-unflag-read): Ditto.
(elmo-folder-flag-as-read): Ditto.
(elmo-folder-unflag-answered): Ditto.
(elmo-folder-flag-as-answered): Ditto.
(elmo-message-encache): Return the cache path.
(elmo-folder-move-messages): Call elmo-global-flag-detach-messages.
(elmo-message-set-flag): Transitional implementation.
(elmo-message-unset-flag): Ditto.
(elmo-folder-unflag-important): Call elmo-global-flag-detach.
(elmo-folder-flag-as-important): Call elmo-global-flag-set.
(elmo-init): Call elmo-global-flag-initialize.
(toplevel): Added autoload settings for elmo-flag.

* elmo-vars.el (elmo-msgdb-global-mark-filename): Abolished.

* elmo-util.el: Removed all elmo-msgdb-global-mark stuff.
(elmo-file-cache-delete): Don't treat global-mark.

* elmo-shimbun.el (elmo-folder-msgdb-create): Ditto.

* elmo-sendlog.el (elmo-folder-msgdb-create): Ditto.

* elmo-pop3.el (elmo-pop3-msgdb-create-message): Call
`elmo-global-flags-set'.

* elmo-pipe.el (elmo-folder-flag-as-read): Renamed from `mark' to
`flag'.
(elmo-folder-unflag-read): Ditto.
(elmo-folder-unflag-important): Ditto.
(elmo-folder-flag-as-important): Ditto.
(elmo-folder-unflag-answered): Ditto.
(elmo-folder-flag-as-answered): Ditto.

* elmo-nntp.el (elmo-nntp-create-msgdb-from-overview-string): Call
`elmo-global-flags-set'.
(elmo-folder-flag-as-read): Renamed from `mark' to `flag'.

* elmo-nmz.el (elmo-folder-msgdb-create): Always put `new' flag.

* elmo-net.el (elmo-folder-unflag-important): Renamed from `mark' to
`flag'.
(elmo-folder-flag-as-important): Ditto.
(elmo-folder-unflag-important): Ditto.
(elmo-folder-flag-as-important): Ditto.
(elmo-folder-unflag-read): Ditto.
(elmo-folder-flag-as-read): Ditto.
(elmo-folder-unflag-answered): Ditto.
(elmo-folder-flag-as-answered): Ditto.

* elmo-multi.el (elmo-folder-list-importants): Don't call
elmo-folder-list-messages-with-global-mark.
(elmo-folder-flag-as-important): Renamed from `mark' to `flag'.
(elmo-folder-unflag-important): Ditto.
(elmo-folder-flag-as-read): Ditto.
(elmo-folder-unflag-read): Ditto.
(elmo-folder-flag-as-answered): Ditto.
(elmo-folder-unflag-answered): Ditto.

* elmo-msgdb.el (elmo-msgdb-new-mark,
elmo-msgdb-unread-uncached-mark, elmo-msgdb-unread-cached-mark,
elmo-msgdb-read-uncached-mark, elmo-msgdb-answered-cached-mark,
elmo-msgdb-answered-uncached-mark, elmo-msgdb-important-mark): Removed
(Moved to modb-legacy.el).
(elmo-flag-table-get): Treat important flag too.

* elmo-map.el (elmo-map-folder-unflag-important): Renamed from
`mark' to `flag'.
(elmo-map-folder-flag-as-important): Ditto.
(elmo-map-folder-unflag-read): Ditto.
(elmo-map-folder-flag-as-read): Ditto.
(elmo-map-folder-unflag-answered): Ditto.
(elmo-map-folder-flag-as-answered): Ditto.
(elmo-folder-unflag-important): Ditto.
(elmo-folder-flag-as-important): Ditto.
(elmo-folder-unflag-read): Ditto.
(elmo-folder-flag-as-read): Ditto.
(elmo-folder-unflag-answered): Ditto.
(elmo-folder-flag-as-answered): Ditto.

* elmo-maildir.el (elmo-folder-msgdb-create): Ditto.
(elmo-map-folder-flag-as-important): Renamed from `mark' to
`flag'.
(elmo-map-folder-unflag-important): Ditto.
(elmo-map-folder-flag-as-read): Ditto.
(elmo-map-folder-unflag-read): Ditto.
(elmo-map-folder-flag-as-answered): Ditto.
(elmo-map-folder-unflag-answered): Ditto.

* elmo-localdir.el (elmo-folder-msgdb-create):  Call
`elmo-global-flags-set'.
(elmo-global-flags-set): Added autoload setting.

* elmo-internal.el (elmo-internal-folder-list): Changed `mark' to
`flag'.

* elmo-imap4.el (elmo-imap4-fetch-callback-1-subr): Don't call
`elmo-msgdb-global-mark-set'.
(elmo-folder-msgdb-create-plugged): Changed callback-data structure;
Call `elmo-global-flags-set'.
(elmo-folder-unflag-important-plugged): Renamed from `mark' to
`flag'.
(elmo-folder-flag-as-important-plugged): Ditto.
(elmo-folder-unflag-read-plugged): Ditto.
(elmo-folder-flag-as-read-plugged): Ditto.
(elmo-folder-unflag-answered-plugged): Ditto.
(elmo-folder-flag-as-answered-plugged): Ditto.
(elmo-global-flags-set): Added autoload setting.

* elmo-filter.el (elmo-folder-flag-as-read): Renamed from `mark' to
`flag'.
(elmo-folder-unflag-read): Ditto.
(elmo-folder-flag-as-important): Ditto.
(elmo-folder-unflag-important): Ditto.
(elmo-folder-flag-as-answered): Ditto.
(elmo-folder-unflag-answered): Ditto.

* elmo-dop.el (elmo-dop-queue-merge-method-list): Follow the API
change of `mark'->`flag'.
(elmo-dop-queue-method-name-alist): Ditto.
(elmo-folder-flag-as-read-dop): Renamed from `mark' to `flag'.
(elmo-folder-unflag-read-dop): Ditto.
(elmo-folder-flag-as-important-dop): Ditto.
(elmo-folder-unflag-important-dop): Ditto.
(elmo-folder-flag-as-answered-dop): Ditto.
(elmo-folder-unflag-answered-dop): Ditto.

* elmo-cache.el (elmo-folder-msgdb-create): Call
`elmo-global-flags-set'.

* elmo-archive.el (elmo-archive-msgdb-create-as-numlist-subr1):
Call `elmo-global-flags-set'.
(elmo-archive-msgdb-create-as-numlist-subr2): Call
elmo-archive-parse-mmdf with argument `folder'.
(elmo-archive-parse-mmdf): Added argument `folder';
Call `elmo-global-flags-set'.

* WL-ELS (ELMO-MODULES): Removed elmo-mark and added elmo-flag.

33 files changed:
ChangeLog
WL-ELS
elmo/ChangeLog
elmo/elmo-archive.el
elmo/elmo-cache.el
elmo/elmo-dop.el
elmo/elmo-filter.el
elmo/elmo-flag.el [new file with mode: 0644]
elmo/elmo-imap4.el
elmo/elmo-internal.el
elmo/elmo-localdir.el
elmo/elmo-maildir.el
elmo/elmo-map.el
elmo/elmo-mark.el [deleted file]
elmo/elmo-msgdb.el
elmo/elmo-multi.el
elmo/elmo-net.el
elmo/elmo-nmz.el
elmo/elmo-nntp.el
elmo/elmo-pipe.el
elmo/elmo-pop3.el
elmo/elmo-sendlog.el
elmo/elmo-shimbun.el
elmo/elmo-util.el
elmo/elmo-vars.el
elmo/elmo.el
elmo/modb-legacy.el
elmo/modb.el
wl/ChangeLog
wl/wl-draft.el
wl/wl-highlight.el
wl/wl-summary.el
wl/wl-vars.el

index 0df88b4..c89cdb8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2003-09-18  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * WL-ELS (ELMO-MODULES): Removed elmo-mark and added elmo-flag.
+
 2003-09-17  TAKAHASHI Kaoru  <kaoru@kaisei.org>
 
        * doc/.cvsignore: Added makeinfo stuff.
diff --git a/WL-ELS b/WL-ELS
index 71f27d3..1ec7ce4 100644 (file)
--- a/WL-ELS
+++ b/WL-ELS
@@ -20,7 +20,7 @@
    elmo-localdir elmo-localnews elmo-map elmo-maildir
    elmo-multi elmo-filter
    elmo-archive elmo-pipe elmo-cache
-   elmo-internal elmo-mark elmo-sendlog
+   elmo-internal elmo-flag elmo-sendlog
    elmo-dop elmo-nmz elmo-split
    modb modb-entity modb-legacy
    ))
index f2dcf40..9435a9d 100644 (file)
@@ -1,5 +1,158 @@
 2003-09-18  Yuuichi Teranishi  <teranisi@gohome.org>
 
+       * elmo-flag.el: New file.
+       
+       * elmo-mark.el: Removed.
+
+       * modb-legacy.el (modb-legacy-new-mark,
+       modb-legacy-unread-uncached-mark,
+       modb-legacy-unread-cached-mark,
+       modb-legacy-read-uncached-mark,
+       modb-legacy-answered-cached-mark,
+       modb-legacy-answered-uncached-mark,
+       modb-legacy-important-mark): New constants (Moved from elmo-msgdb.el);
+       All other related portions are changed.
+
+       * elmo.el (luna-define-class): Changed mark-modified to flag-modified.
+       (elmo-folder-list-messages-with-global-mark): Abolish.
+       (elmo-folder-unflag-important): Renamed from `mark' to `flag'.
+       (elmo-folder-flag-as-important): Ditto.
+       (elmo-folder-unflag-read): Ditto.
+       (elmo-folder-flag-as-read): Ditto.
+       (elmo-folder-unflag-answered): Ditto.
+       (elmo-folder-flag-as-answered): Ditto.
+       (elmo-message-encache): Return the cache path.
+       (elmo-folder-move-messages): Call elmo-global-flag-detach-messages.
+       (elmo-message-set-flag): Transitional implementation.
+       (elmo-message-unset-flag): Ditto.
+       (elmo-folder-unflag-important): Call elmo-global-flag-detach.
+       (elmo-folder-flag-as-important): Call elmo-global-flag-set.
+       (elmo-init): Call elmo-global-flag-initialize.
+       (toplevel): Added autoload settings for elmo-flag.
+
+       * elmo-vars.el (elmo-msgdb-global-mark-filename): Abolished.
+
+       * elmo-util.el: Removed all elmo-msgdb-global-mark stuff.
+       (elmo-file-cache-delete): Don't treat global-mark.
+
+       * elmo-shimbun.el (elmo-folder-msgdb-create): Ditto.
+
+       * elmo-sendlog.el (elmo-folder-msgdb-create): Ditto.
+
+       * elmo-pop3.el (elmo-pop3-msgdb-create-message): Call
+       `elmo-global-flags-set'.
+
+       * elmo-pipe.el (elmo-folder-flag-as-read): Renamed from `mark' to
+       `flag'.
+       (elmo-folder-unflag-read): Ditto.
+       (elmo-folder-unflag-important): Ditto.
+       (elmo-folder-flag-as-important): Ditto.
+       (elmo-folder-unflag-answered): Ditto.
+       (elmo-folder-flag-as-answered): Ditto.
+
+       * elmo-nntp.el (elmo-nntp-create-msgdb-from-overview-string): Call
+       `elmo-global-flags-set'.
+       (elmo-folder-flag-as-read): Renamed from `mark' to `flag'.
+
+       * elmo-nmz.el (elmo-folder-msgdb-create): Always put `new' flag.
+
+       * elmo-net.el (elmo-folder-unflag-important): Renamed from `mark' to
+       `flag'.
+       (elmo-folder-flag-as-important): Ditto.
+       (elmo-folder-unflag-important): Ditto.
+       (elmo-folder-flag-as-important): Ditto.
+       (elmo-folder-unflag-read): Ditto.
+       (elmo-folder-flag-as-read): Ditto.
+       (elmo-folder-unflag-answered): Ditto.
+       (elmo-folder-flag-as-answered): Ditto.  
+
+       * elmo-multi.el (elmo-folder-list-importants): Don't call
+       elmo-folder-list-messages-with-global-mark.
+       (elmo-folder-flag-as-important): Renamed from `mark' to `flag'.
+       (elmo-folder-unflag-important): Ditto.
+       (elmo-folder-flag-as-read): Ditto.
+       (elmo-folder-unflag-read): Ditto.
+       (elmo-folder-flag-as-answered): Ditto.
+       (elmo-folder-unflag-answered): Ditto.
+
+       * elmo-msgdb.el (elmo-msgdb-new-mark,
+       elmo-msgdb-unread-uncached-mark, elmo-msgdb-unread-cached-mark,
+       elmo-msgdb-read-uncached-mark, elmo-msgdb-answered-cached-mark,
+       elmo-msgdb-answered-uncached-mark, elmo-msgdb-important-mark): Removed
+       (Moved to modb-legacy.el).
+       (elmo-flag-table-get): Treat important flag too.
+
+       * elmo-map.el (elmo-map-folder-unflag-important): Renamed from
+       `mark' to `flag'.
+       (elmo-map-folder-flag-as-important): Ditto.
+       (elmo-map-folder-unflag-read): Ditto.
+       (elmo-map-folder-flag-as-read): Ditto.
+       (elmo-map-folder-unflag-answered): Ditto.
+       (elmo-map-folder-flag-as-answered): Ditto.
+       (elmo-folder-unflag-important): Ditto.
+       (elmo-folder-flag-as-important): Ditto.
+       (elmo-folder-unflag-read): Ditto.
+       (elmo-folder-flag-as-read): Ditto.
+       (elmo-folder-unflag-answered): Ditto.
+       (elmo-folder-flag-as-answered): Ditto.
+
+       * elmo-maildir.el (elmo-folder-msgdb-create): Ditto.
+       (elmo-map-folder-flag-as-important): Renamed from `mark' to
+       `flag'.
+       (elmo-map-folder-unflag-important): Ditto.
+       (elmo-map-folder-flag-as-read): Ditto.
+       (elmo-map-folder-unflag-read): Ditto.
+       (elmo-map-folder-flag-as-answered): Ditto.
+       (elmo-map-folder-unflag-answered): Ditto.
+
+       * elmo-localdir.el (elmo-folder-msgdb-create):  Call
+       `elmo-global-flags-set'.
+       (elmo-global-flags-set): Added autoload setting.
+
+       * elmo-internal.el (elmo-internal-folder-list): Changed `mark' to
+       `flag'.
+
+       * elmo-imap4.el (elmo-imap4-fetch-callback-1-subr): Don't call
+       `elmo-msgdb-global-mark-set'.
+       (elmo-folder-msgdb-create-plugged): Changed callback-data structure;
+       Call `elmo-global-flags-set'.
+       (elmo-folder-unflag-important-plugged): Renamed from `mark' to
+       `flag'.
+       (elmo-folder-flag-as-important-plugged): Ditto.
+       (elmo-folder-unflag-read-plugged): Ditto.
+       (elmo-folder-flag-as-read-plugged): Ditto.
+       (elmo-folder-unflag-answered-plugged): Ditto.
+       (elmo-folder-flag-as-answered-plugged): Ditto.
+       (elmo-global-flags-set): Added autoload setting.
+
+       * elmo-filter.el (elmo-folder-flag-as-read): Renamed from `mark' to
+       `flag'.
+       (elmo-folder-unflag-read): Ditto.
+       (elmo-folder-flag-as-important): Ditto.
+       (elmo-folder-unflag-important): Ditto.
+       (elmo-folder-flag-as-answered): Ditto.
+       (elmo-folder-unflag-answered): Ditto.
+
+       * elmo-dop.el (elmo-dop-queue-merge-method-list): Follow the API
+       change of `mark'->`flag'.
+       (elmo-dop-queue-method-name-alist): Ditto.
+       (elmo-folder-flag-as-read-dop): Renamed from `mark' to `flag'.
+       (elmo-folder-unflag-read-dop): Ditto.
+       (elmo-folder-flag-as-important-dop): Ditto.
+       (elmo-folder-unflag-important-dop): Ditto.
+       (elmo-folder-flag-as-answered-dop): Ditto.
+       (elmo-folder-unflag-answered-dop): Ditto.
+
+       * elmo-cache.el (elmo-folder-msgdb-create): Call
+       `elmo-global-flags-set'.
+
+       * elmo-archive.el (elmo-archive-msgdb-create-as-numlist-subr1):
+       Call `elmo-global-flags-set'.
+       (elmo-archive-msgdb-create-as-numlist-subr2): Call
+       elmo-archive-parse-mmdf with argument `folder'.
+       (elmo-archive-parse-mmdf): Added argument `folder';
+       Call `elmo-global-flags-set'.
+
        * elmo-version.el (elmo-version): Up to 2.11.14.
 
 2003-09-17  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
index e8c631c..e610f4d 100644 (file)
@@ -931,7 +931,7 @@ TYPE specifies the archiver's symbol."
         (file (elmo-archive-get-archive-name folder))
         (method (elmo-archive-get-method type 'cat))
         (new-msgdb (elmo-make-msgdb))
-        entity i percent num message-id)
+        entity i percent num message-id flags)
     (with-temp-buffer
       (setq num (length numlist))
       (setq i 0)
@@ -943,11 +943,10 @@ TYPE specifies the archiver's symbol."
               method file (car numlist) type
               (elmo-archive-folder-archive-prefix-internal folder)))
        (when entity
-         (setq message-id (elmo-msgdb-overview-entity-get-id entity))
-         (elmo-msgdb-append-entity
-          new-msgdb
-          entity
-          (elmo-flag-table-get flag-table message-id)))
+         (setq message-id (elmo-msgdb-overview-entity-get-id entity)
+               flags (elmo-flag-table-get flag-table message-id))
+         (elmo-global-flags-set flags folder (car numlist) message-id)
+         (elmo-msgdb-append-entity new-msgdb entity flags))
        (when (> num elmo-display-progress-threshold)
          (setq i (1+ i))
          (setq percent (/ (* i 100) num))
@@ -996,7 +995,7 @@ TYPE specifies the archiver's symbol."
         ((looking-at delim1)   ;; MMDF
          (elmo-msgdb-append
           new-msgdb
-          (elmo-archive-parse-mmdf msgs flag-table)))
+          (elmo-archive-parse-mmdf folder msgs flag-table)))
 ;;;     ((looking-at delim2)   ;; UNIX MAIL
 ;;;      (elmo-msgdb-append
 ;;;       new-msgdb
@@ -1011,11 +1010,11 @@ TYPE specifies the archiver's symbol."
           percent))))
     new-msgdb))
 
-(defun elmo-archive-parse-mmdf (msgs flag-table)
+(defun elmo-archive-parse-mmdf (folder msgs flag-table)
   (let ((delim elmo-mmdf-delimiter)
        (new-msgdb (elmo-make-msgdb))
        number sp ep rest entity
-       message-id)
+       message-id flags)
     (goto-char (point-min))
     (setq rest msgs)
     (while (and rest (re-search-forward delim nil t)
@@ -1028,12 +1027,11 @@ TYPE specifies the archiver's symbol."
          ()                            ; nop
        (save-excursion
          (narrow-to-region sp ep)
-         (setq entity (elmo-archive-msgdb-create-entity-subr number))
-         (setq message-id (elmo-msgdb-overview-entity-get-id entity))
-         (elmo-msgdb-append-entity
-          new-msgdb
-          entity
-          (elmo-flag-table-get flag-table message-id))
+         (setq entity (elmo-archive-msgdb-create-entity-subr number)
+               message-id (elmo-msgdb-overview-entity-get-id entity)
+               flags (elmo-flag-table-get flag-table message-id))
+         (elmo-global-flags-set flags folder number message-id)
+         (elmo-msgdb-append-entity new-msgdb entity flags)
          (widen)))
       (forward-line 1)
       (setq rest (cdr rest)))
index 34fa4cc..850382e 100644 (file)
   (let ((i 0)
        (len (length numbers))
        (new-msgdb (elmo-make-msgdb))
-       entity message-id)
+       entity message-id flags)
     (message "Creating msgdb...")
     (while numbers
       (setq entity
            (elmo-msgdb-create-overview-entity-from-file
             (car numbers) (elmo-message-file-name folder (car numbers))))
       (when entity
-       (setq message-id (elmo-msgdb-overview-entity-get-id entity))
-       (elmo-msgdb-append-entity new-msgdb entity
-                                 (elmo-flag-table-get flag-table message-id)))
+       (setq message-id (elmo-msgdb-overview-entity-get-id entity)
+             flags (elmo-flag-table-get flag-table message-id))
+       (elmo-global-flags-set flags folder (car numbers) message-id)
+       (elmo-msgdb-append-entity new-msgdb entity flags))
       (when (> len elmo-display-progress-threshold)
        (setq i (1+ i))
        (elmo-display-progress
index 4d543ca..0286fc0 100644 (file)
@@ -63,24 +63,24 @@ Automatically loaded/saved.")
     (setq elmo-dop-queue (nconc elmo-dop-queue (list queue)))))
 
 (defvar elmo-dop-queue-merge-method-list
-  '(elmo-folder-mark-as-read
-    elmo-folder-unmark-read
-    elmo-folder-mark-as-important
-    elmo-folder-unmark-important
-    elmo-folder-mark-as-answered
-    elmo-folder-unmark-answered))
+  '(elmo-folder-flag-as-read
+    elmo-folder-unflag-read
+    elmo-folder-flag-as-important
+    elmo-folder-unflag-important
+    elmo-folder-flag-as-answered
+    elmo-folder-unflag-answered))
 
 (defvar elmo-dop-queue-method-name-alist
   '((elmo-folder-append-buffer-dop-delayed . "Append")
     (elmo-folder-delete-messages-dop-delayed . "Delete")
     (elmo-message-encache . "Encache")
     (elmo-folder-create-dop-delayed . "Create")
-    (elmo-folder-mark-as-read . "Read")
-    (elmo-folder-unmark-read . "Unread")
-    (elmo-folder-mark-as-answered . "Answered")
-    (elmo-folder-unmark-answered . "Unanswered")    
-    (elmo-folder-mark-as-important . "Important")
-    (elmo-folder-unmark-important . "Unimportant")))
+    (elmo-folder-flag-as-read . "Read")
+    (elmo-folder-unflag-read . "Unread")
+    (elmo-folder-flag-as-answered . "Answered")
+    (elmo-folder-unflag-answered . "Unanswered")    
+    (elmo-folder-flag-as-important . "Important")
+    (elmo-folder-unflag-important . "Unimportant")))
 
 (defmacro elmo-dop-queue-method-name (queue)
   `(cdr (assq (elmo-dop-queue-method ,queue)
@@ -266,23 +266,23 @@ FOLDER is the folder structure."
 (defsubst elmo-folder-create-dop (folder)
   (elmo-dop-queue-append folder 'elmo-folder-create-dop-delayed nil))
 
-(defsubst elmo-folder-mark-as-read-dop (folder numbers)
-  (elmo-dop-queue-append folder 'elmo-folder-mark-as-read (list numbers)))
+(defsubst elmo-folder-flag-as-read-dop (folder numbers)
+  (elmo-dop-queue-append folder 'elmo-folder-flag-as-read (list numbers)))
 
-(defsubst elmo-folder-unmark-read-dop (folder numbers)
-  (elmo-dop-queue-append folder 'elmo-folder-unmark-read (list numbers)))
+(defsubst elmo-folder-unflag-read-dop (folder numbers)
+  (elmo-dop-queue-append folder 'elmo-folder-unflag-read (list numbers)))
 
-(defsubst elmo-folder-mark-as-important-dop (folder numbers)
-  (elmo-dop-queue-append folder 'elmo-folder-mark-as-important (list numbers)))
+(defsubst elmo-folder-flag-as-important-dop (folder numbers)
+  (elmo-dop-queue-append folder 'elmo-folder-flag-as-important (list numbers)))
 
-(defsubst elmo-folder-unmark-important-dop (folder numbers)
-  (elmo-dop-queue-append folder 'elmo-folder-unmark-important (list numbers)))
+(defsubst elmo-folder-unflag-important-dop (folder numbers)
+  (elmo-dop-queue-append folder 'elmo-folder-unflag-important (list numbers)))
 
-(defsubst elmo-folder-mark-as-answered-dop (folder numbers)
-  (elmo-dop-queue-append folder 'elmo-folder-mark-as-answered (list numbers)))
+(defsubst elmo-folder-flag-as-answered-dop (folder numbers)
+  (elmo-dop-queue-append folder 'elmo-folder-flag-as-answered (list numbers)))
 
-(defsubst elmo-folder-unmark-answered-dop (folder numbers)
-  (elmo-dop-queue-append folder 'elmo-folder-unmark-answered (list numbers)))
+(defsubst elmo-folder-unflag-answered-dop (folder numbers)
+  (elmo-dop-queue-append folder 'elmo-folder-unflag-answered (list numbers)))
 
 ;;; Execute as subsutitute for plugged operation.
 (defun elmo-folder-status-dop (folder)
index 9061389..923ae8c 100644 (file)
   (elmo-message-file-name (elmo-filter-folder-target-internal folder)
                          number))
 
-(luna-define-method elmo-folder-mark-as-read :around ((folder
+(luna-define-method elmo-folder-flag-as-read :around ((folder
                                                       elmo-filter-folder)
                                                      numbers
-                                                     &optional ignore-flag)
-  (elmo-folder-mark-as-read (elmo-filter-folder-target-internal folder)
-                           numbers ignore-flag)
+                                                     &optional is-local)
+  (elmo-folder-flag-as-read (elmo-filter-folder-target-internal folder)
+                           numbers is-local)
   (luna-call-next-method))
 
-(luna-define-method elmo-folder-unmark-read :around ((folder
+(luna-define-method elmo-folder-unflag-read :around ((folder
                                                      elmo-filter-folder)
                                                     numbers
-                                                    &optional ignore-flag)
-  (elmo-folder-unmark-read (elmo-filter-folder-target-internal folder)
-                          numbers ignore-flag)
+                                                    &optional is-local)
+  (elmo-folder-unflag-read (elmo-filter-folder-target-internal folder)
+                          numbers is-local)
   (luna-call-next-method))
 
-(luna-define-method elmo-folder-mark-as-important :around ((folder
+(luna-define-method elmo-folder-flag-as-important :around ((folder
                                                            elmo-filter-folder)
                                                           numbers
                                                           &optional
-                                                          ignore-flag)
-  (elmo-folder-mark-as-important (elmo-filter-folder-target-internal folder)
-                                numbers ignore-flag)
+                                                          is-local)
+  (elmo-folder-flag-as-important (elmo-filter-folder-target-internal folder)
+                                numbers is-local)
     (luna-call-next-method))
 
-(luna-define-method elmo-folder-unmark-important :around ((folder
+(luna-define-method elmo-folder-unflag-important :around ((folder
                                                           elmo-filter-folder)
                                                          numbers
                                                          &optional
-                                                         ignore-flag)
-  (elmo-folder-unmark-important (elmo-filter-folder-target-internal folder)
-                               numbers ignore-flag)
+                                                         is-local)
+  (elmo-folder-unflag-important (elmo-filter-folder-target-internal folder)
+                               numbers is-local)
   (luna-call-next-method))
 
-(luna-define-method elmo-folder-mark-as-answered :around ((folder
+(luna-define-method elmo-folder-flag-as-answered :around ((folder
                                                           elmo-filter-folder)
-                                                         numbers)
-  (elmo-folder-mark-as-answered (elmo-filter-folder-target-internal folder)
-                               numbers)
+                                                         numbers
+                                                         &optional
+                                                         is-local)
+  (elmo-folder-flag-as-answered (elmo-filter-folder-target-internal folder)
+                               numbers is-local)
   (luna-call-next-method))
 
 
-(luna-define-method elmo-folder-unmark-answered :around ((folder
+(luna-define-method elmo-folder-unflag-answered :around ((folder
                                                          elmo-filter-folder)
-                                                        numbers)
-  (elmo-folder-unmark-answered (elmo-filter-folder-target-internal folder)
-                              numbers)
+                                                        numbers
+                                                        &optional
+                                                        is-local)
+  (elmo-folder-unflag-answered (elmo-filter-folder-target-internal folder)
+                              numbers is-local)
   (luna-call-next-method))
 
 (require 'product)
diff --git a/elmo/elmo-flag.el b/elmo/elmo-flag.el
new file mode 100644 (file)
index 0000000..7c13b4c
--- /dev/null
@@ -0,0 +1,367 @@
+;;; elmo-flag.el --- global flag handling.
+
+;; Copyright (C) 2003 Yuuichi Teranishi <teranisi@gohome.org>
+
+;; Author: Yuuichi Teranishi <teranisi@gohome.org>
+;; Keywords: mail, net news
+
+;; This file is part of ELMO (Elisp Library for Message Orchestration).
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+;;
+
+;;; Commentary:
+;;
+(require 'elmo-util)
+(require 'elmo-localdir)
+(eval-when-compile (require 'cl))
+
+;;; Code:
+(defcustom elmo-global-flag-list '(important)
+  "A list of flag symbol which is managed globally by the flag folder."
+  :type '(repeat symbol)
+  :group 'elmo)
+
+(defvar elmo-global-flag-folder-alist nil
+  "Internal variable to hold global-flag-folder structures.")
+
+(eval-and-compile
+  (luna-define-class elmo-flag-folder (elmo-localdir-folder)
+                    (flag minfo minfo-hash))
+  (luna-define-internal-accessors 'elmo-flag-folder))
+
+(luna-define-method elmo-folder-initialize ((folder
+                                            elmo-flag-folder)
+                                           name)
+  (if (string-match "flag/\\([a-z]+\\)" name)
+      (setq name (match-string 1 name))
+    (setq name (symbol-name (car elmo-global-flag-list))))
+  (or (cdr (assq (intern name) elmo-global-flag-folder-alist))
+      (progn
+       (unless (file-directory-p (expand-file-name (concat "flag/" name)
+                                               elmo-msgdb-directory))
+         (elmo-make-directory (expand-file-name (concat "flag/" name)
+                                                elmo-msgdb-directory)))
+       (elmo-localdir-folder-set-dir-name-internal
+        folder (expand-file-name (concat "flag/" name)
+                                 elmo-msgdb-directory))
+       (elmo-localdir-folder-set-directory-internal
+        folder
+        (expand-file-name (concat "flag/" name)
+                          elmo-msgdb-directory))
+       (if (file-exists-p (expand-file-name
+                           (concat "flag/" name "/.minfo")
+                           elmo-msgdb-directory))
+           (elmo-flag-folder-set-minfo-internal
+            folder
+            (elmo-object-load (expand-file-name
+                               (concat "flag/" name "/.minfo")
+                               elmo-msgdb-directory))))
+       (elmo-flag-folder-set-minfo-hash-internal
+        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))))
+       (elmo-flag-folder-set-flag-internal folder (intern name))
+       (setq elmo-global-flag-folder-alist
+             (cons (cons (intern name) folder) elmo-global-flag-folder-alist))
+       folder)))
+
+(luna-define-method elmo-folder-commit :after ((folder
+                                               elmo-flag-folder))
+  (elmo-object-save
+   (expand-file-name (concat "flag/"
+                            (symbol-name
+                             (elmo-flag-folder-flag-internal folder))
+                            "/.minfo") elmo-msgdb-directory)
+   (elmo-flag-folder-minfo-internal folder)))
+
+(defun elmo-flag-folder-delete-message (folder number
+                                              &optional keep-referrer)
+  (let* ((elem (elmo-get-hash-val (concat "#" (number-to-string number))
+                                 (elmo-flag-folder-minfo-hash-internal
+                                  folder)))
+        target-folder key)
+    (dolist (pair (car elem))
+      (when (and (car pair) (cdr pair))
+       (unless keep-referrer
+         (setq target-folder (elmo-make-folder (car pair)))
+         (elmo-folder-open target-folder 'load-msgdb)
+         ;; Unset the flag of the original folder.
+         ;; (XXX Should the message-id checked?)
+         (elmo-message-unset-flag target-folder (cdr pair)
+                                  (elmo-flag-folder-flag-internal folder))
+         (elmo-folder-close target-folder))
+       (elmo-clear-hash-val (concat (number-to-string (cdr pair)) ":"
+                                    (car pair))
+                            (elmo-flag-folder-minfo-hash-internal
+                             folder))))
+    (elmo-clear-hash-val (concat "#" (number-to-string number))
+                        (elmo-flag-folder-minfo-hash-internal
+                         folder))
+    (elmo-clear-hash-val (nth 1 elem) (elmo-flag-folder-minfo-hash-internal
+                                      folder))
+    (elmo-flag-folder-set-minfo-internal
+     folder
+     (delq elem (elmo-flag-folder-minfo-internal folder))))
+  t)
+
+(luna-define-method elmo-folder-delete-messages ((folder
+                                                 elmo-flag-folder)
+                                                numbers)
+  (dolist (number numbers)
+    (elmo-flag-folder-delete-message folder number)
+    (elmo-localdir-delete-message folder number))
+  (elmo-folder-commit folder)
+  t)
+
+;; Same as localdir except that the flag is always the flag.
+(luna-define-method elmo-folder-msgdb-create ((folder elmo-flag-folder)
+                                             numbers
+                                             flag-table)
+  (when numbers
+    (let ((dir (elmo-localdir-folder-directory-internal folder))
+         (new-msgdb (elmo-make-msgdb))
+         entity (i 0)
+         (len (length numbers)))
+      (message "Creating msgdb...")
+      (while numbers
+       (when (setq entity (elmo-localdir-msgdb-create-entity
+                           dir (car numbers)))
+         (elmo-msgdb-append-entity new-msgdb entity
+                                   (list (elmo-flag-folder-flag-internal
+                                          folder))))
+       (when (> len elmo-display-progress-threshold)
+         (setq i (1+ i))
+         (elmo-display-progress
+          'elmo-flag-folder-msgdb-create "Creating msgdb..."
+          (/ (* i 100) len)))
+       (setq numbers (cdr numbers)))
+      (message "Creating msgdb...done")
+      new-msgdb)))
+
+(luna-define-method elmo-folder-append-buffer ((folder elmo-flag-folder)
+                                              unread
+                                              &optional number)
+  (error "Cannot append to the flag folder"))
+
+;;; Utilities
+
+(defmacro elmo-flag-get-folder (flag)
+  "Get the flag folder structure for FLAG."
+  `(when (memq ,flag elmo-global-flag-list)
+     (elmo-make-folder (concat  "'flag/" (symbol-name ,flag)))))
+
+(defun elmo-flag-folder-referrer (folder number)
+  "Return a list of referrer message information.
+Each element is a cons cell like following:
+\(FNAME . NUMBER\)
+FNAME is the name of the folder which the message is contained.
+NUMBER is the number of the message."
+  (when (eq (elmo-folder-type-internal folder) 'flag)
+    (car (elmo-get-hash-val (concat "#" (number-to-string number))
+                           (elmo-flag-folder-minfo-hash-internal
+                            folder)))))
+
+;;; Global-Flag API
+(defun elmo-global-flag-initialize ()
+  "Initialize flag folders.
+This function is necessary to be called before using `elmo-flag-folder'."
+  (unless elmo-global-flag-folder-alist
+    (dolist (flag elmo-global-flag-list)
+      (setq elmo-global-flag-folder-alist
+           (cons (elmo-make-folder
+                  (concat "'flag/" (symbol-name flag)))
+                 elmo-global-flag-folder-alist)))))
+
+(defun elmo-global-flag-p (flag)
+  "Return non-nil when FLAG is global."
+  (memq flag elmo-global-flag-list))
+
+(defun elmo-global-flags (fname number)
+  "Return a list of global flags for the message.
+FNAME is the name string of the folder.
+NUMBER is the number of the message."
+  (let ((flag-list elmo-global-flag-list)
+       folder matches)
+    (while flag-list
+      (setq folder (elmo-flag-get-folder (car flag-list)))
+      (when (elmo-get-hash-val
+            (concat (number-to-string number) ":" fname)
+            (elmo-flag-folder-minfo-hash-internal folder))
+       (setq matches (cons (elmo-flag-folder-flag-internal folder)
+                           matches)))
+      (setq flag-list (cdr flag-list)))
+    matches))
+
+;;;
+;; minfo is a list of following cell.
+;; ((((FNAME . NUMBER)...(FNAME . NUMBER)) MESSAGE-ID NUMBER-IN-FLAG-FOLDER)
+;; minfo-index is the hash table of above with following indice;
+(defun elmo-global-flags-set (flags folder number message-id)
+  "Set global flags to the message.
+FLAGS is a list of symbol of the flag.
+FOLDER is the elmo folder structure.
+NUMBER is the message number."
+  (dolist (flag flags)
+    (elmo-global-flag-set flag folder number message-id)))
+
+(defsubst elmo-global-flag-set-internal (flag folder number message-id)
+  (when message-id
+    (let ((flag-folder (elmo-flag-get-folder flag))
+         cache new-file new-number elem)
+      (if (setq elem (elmo-get-hash-val
+                     message-id
+                     (elmo-flag-folder-minfo-hash-internal
+                      flag-folder)))
+         ;; Same ID already exists.
+         (when (and folder number
+                    (not (member (cons (elmo-folder-name-internal folder)
+                                       number) (car elem))))
+           (setcar elem
+                   (cons (cons (elmo-folder-name-internal folder)
+                               number) (car elem)))
+           (setq new-number (nth 2 elem))
+           (elmo-set-hash-val (concat (number-to-string number)
+                                      ":" (elmo-folder-name-internal
+                                           folder))
+                              elem
+                              (elmo-flag-folder-minfo-hash-internal
+                               flag-folder)))
+       ;; Append new element.
+       (setq new-file
+             (expand-file-name
+              (int-to-string
+               (setq new-number (1+ (car (elmo-folder-status flag-folder)))))
+              (elmo-localdir-folder-directory-internal flag-folder)))
+       (with-temp-buffer
+         (setq cache (and message-id (elmo-file-cache-get message-id)))
+         (if (and cache (eq (elmo-file-cache-status cache) 'entire))
+             (elmo-copy-file (elmo-file-cache-path cache)
+                             new-file)
+           (when (and folder number)
+             (elmo-message-fetch folder number (elmo-make-fetch-strategy
+                                                'entire)
+                                 nil (current-buffer))
+             (write-region-as-binary (point-min) (point-max) new-file nil
+                                     'no-msg))))
+       (elmo-flag-folder-set-minfo-internal
+        flag-folder
+        (cons
+         (setq elem (list
+                     (when (and folder number)
+                       (list (cons (elmo-folder-name-internal folder)
+                                   number)))
+                     message-id
+                     new-number))
+         (elmo-flag-folder-minfo-internal flag-folder)))
+       (when (and folder number)
+         (elmo-set-hash-val (concat (number-to-string number)
+                                    ":" (elmo-folder-name-internal
+                                         folder))
+                            elem
+                            (elmo-flag-folder-minfo-hash-internal
+                             flag-folder)))
+       (elmo-set-hash-val message-id elem
+                          (elmo-flag-folder-minfo-hash-internal
+                           flag-folder))
+       (elmo-set-hash-val (concat "#" (number-to-string new-number)) elem
+                          (elmo-flag-folder-minfo-hash-internal
+                           flag-folder)))
+      (elmo-folder-commit flag-folder)
+      new-number)))
+
+(defun elmo-global-flag-set (flag folder number message-id)
+  "Set global flag to the message.
+FLAG is a symbol of the flag.
+FOLDER is the elmo folder structure.
+NUMBER is the message number.
+MESSAGE-ID is the message-id of the message."
+  (when (elmo-global-flag-p flag)
+    (elmo-global-flag-set-internal flag folder number message-id)))
+
+(defun elmo-global-flag-detach (flag folder number &optional delete-if-none)
+  "Detach the message from the global flag.
+FOLDER is the folder structure.
+NUMBERS is the message number.
+If optional DELETE-IF-NONE is non-nil, delete message from flag folder when
+the message is not flagged in any folder."
+  (unless (eq (elmo-folder-type-internal folder) 'flag)
+    (let ((flag-folder (elmo-flag-get-folder flag))
+         elem key)
+      (when flag-folder
+       (setq key (concat (number-to-string number) ":"
+                         (elmo-folder-name-internal folder))
+             elem (elmo-get-hash-val
+                   key
+                   (elmo-flag-folder-minfo-hash-internal flag-folder)))
+       (when elem
+         (setcar elem (delete (cons (elmo-folder-name-internal folder)
+                                    number) (car elem)))
+         (elmo-clear-hash-val key (elmo-flag-folder-minfo-hash-internal
+                                   flag-folder))
+         ;; Does not have any referrer, remove.
+         (when (and delete-if-none (null (car elem)))
+           (elmo-flag-folder-delete-message flag-folder (nth 2 elem) 'keep)
+           (elmo-localdir-delete-message flag-folder (nth 2 elem))
+           (elmo-folder-commit flag-folder)))))))
+
+(defun elmo-global-flag-detach-messages (folder numbers)
+  "Detach all messages specified from all global flags.
+FOLDER is the folder structure.
+NUMBERS is the message number list."
+  (unless (eq (elmo-folder-type-internal folder) 'flag)
+    (dolist (flag elmo-global-flag-list)
+      (dolist (number numbers)
+       (elmo-global-flag-detach flag folder number)))))
+
+;;; To migrate from global mark folder
+(defvar elmo-global-mark-filename "global-mark"
+  "Obsolete variable. (Just for migration)")
+
+(defun elmo-global-mark-upgrade ()
+  "Upgrade old `global-mark' structure."
+  (interactive)
+  (when (file-exists-p (expand-file-name
+                       elmo-global-mark-filename elmo-msgdb-directory))
+    (message "Upgrading flag structure...")
+    (elmo-global-flag-initialize)
+    (when (elmo-global-flag-p 'important)
+      (let ((global-marks
+            (elmo-object-load
+             (expand-file-name
+              elmo-global-mark-filename elmo-msgdb-directory)))
+           (folder (elmo-flag-get-folder 'important))
+           file-cache)
+       (dolist (elem global-marks)
+         (setq file-cache (elmo-file-cache-get (car elem)))
+         (when (eq (elmo-file-cache-status file-cache) 'entire)
+           (elmo-global-flag-set 'important nil nil (car elem))))))
+    (message "Upgrading flag structure...done")))
+
+(require 'product)
+(product-provide (provide 'elmo-flag) (require 'elmo-version))
+
+;;; elmo-flag.el ends here
index 19b000a..207f1f2 100644 (file)
@@ -773,15 +773,15 @@ If CHOP-LENGTH is not specified, message set is not chopped."
 
 ;;
 ;; app-data:
-;; cons of flag-table and result of use-flag-p.
+;; cons of flag-table and folder structure
 (defsubst elmo-imap4-fetch-callback-1-subr (entity flags app-data)
   "A msgdb entity callback function."
-  (let ((use-flag (cdr app-data))
+  (let ((use-flag (elmo-folder-use-flag-p (cdr app-data)))
        (flag-table (car app-data))
        (msg-id (elmo-msgdb-overview-entity-get-id entity))
        saved-flags flag-list)
-    (when (elmo-string-member-ignore-case "\\Flagged" flags)
-      (elmo-msgdb-global-mark-set msg-id elmo-msgdb-important-mark))
+;;    (when (elmo-string-member-ignore-case "\\Flagged" flags)
+;;      (elmo-msgdb-global-mark-set msg-id elmo-msgdb-important-mark))
     (setq saved-flags (elmo-flag-table-get flag-table msg-id)
          flag-list
          (if use-flag
@@ -2096,7 +2096,7 @@ If optional argument REMOVE is non-nil, remove FLAG."
 (defun elmo-imap4-search-internal-primitive (folder session filter from-msgs)
   (let ((search-key (elmo-filter-key filter))
        (imap-search-keys '("bcc" "body" "cc" "from" "subject" "to"
-                           "larger" "smaller" "mark"))
+                           "larger" "smaller" "flag"))
        (total 0)
        (length (length from-msgs))
        charset set-list end results)
@@ -2279,9 +2279,7 @@ If optional argument REMOVE is non-nil, remove FLAG."
        (setq elmo-imap4-current-msgdb (elmo-make-msgdb)
              elmo-imap4-seen-messages nil
              elmo-imap4-fetch-callback 'elmo-imap4-fetch-callback-1
-             elmo-imap4-fetch-callback-data (cons flag-table
-                                                  (elmo-folder-use-flag-p
-                                                   folder)))
+             elmo-imap4-fetch-callback-data (cons flag-table folder))
        (while set-list
          (elmo-imap4-send-command-wait
           session
@@ -2301,29 +2299,38 @@ If optional argument REMOVE is non-nil, remove FLAG."
        (message "Getting overview...done")
        (when elmo-imap4-seen-messages
          (elmo-imap4-set-flag folder elmo-imap4-seen-messages "\\Seen"))
+       ;; cannot setup the global flag while retrieval.
+       (dolist (number (elmo-msgdb-list-messages elmo-imap4-current-msgdb))
+         (elmo-global-flags-set (elmo-msgdb-flags elmo-imap4-current-msgdb
+                                                  number)
+                                folder number
+                                (elmo-msgdb-message-entity-field
+                                 (elmo-msgdb-message-entity
+                                  elmo-imap4-current-msgdb number)
+                                 'message-id)))
        elmo-imap4-current-msgdb))))
 
-(luna-define-method elmo-folder-unmark-important-plugged
+(luna-define-method elmo-folder-unflag-important-plugged
   ((folder elmo-imap4-folder) numbers)
   (elmo-imap4-set-flag folder numbers "\\Flagged" 'remove))
 
-(luna-define-method elmo-folder-mark-as-important-plugged
+(luna-define-method elmo-folder-flag-as-important-plugged
   ((folder elmo-imap4-folder) numbers)
   (elmo-imap4-set-flag folder numbers "\\Flagged"))
 
-(luna-define-method elmo-folder-unmark-read-plugged
+(luna-define-method elmo-folder-unflag-read-plugged
   ((folder elmo-imap4-folder) numbers)
   (elmo-imap4-set-flag folder numbers "\\Seen" 'remove))
 
-(luna-define-method elmo-folder-mark-as-read-plugged
+(luna-define-method elmo-folder-flag-as-read-plugged
   ((folder elmo-imap4-folder) numbers)
   (elmo-imap4-set-flag folder numbers "\\Seen"))
 
-(luna-define-method elmo-folder-unmark-answered-plugged
+(luna-define-method elmo-folder-unflag-answered-plugged
   ((folder elmo-imap4-folder) numbers)
   (elmo-imap4-set-flag folder numbers "\\Answered" 'remove))
 
-(luna-define-method elmo-folder-mark-as-answered-plugged
+(luna-define-method elmo-folder-flag-as-answered-plugged
   ((folder elmo-imap4-folder) numbers)
   (elmo-imap4-set-flag folder numbers "\\Answered"))
 
@@ -2651,6 +2658,8 @@ If optional argument REMOVE is non-nil, remove FLAG."
                                                         condition)
   nil)
 
+(autoload 'elmo-global-flags-set "elmo-flag")
+
 (require 'product)
 (product-provide (provide 'elmo-imap4) (require 'elmo-version))
 
index 5cd1fec..feb3be1 100644 (file)
@@ -38,7 +38,7 @@
                                            name)
   (elmo-internal-folder-initialize folder name))
 
-(defvar elmo-internal-folder-list '(mark cache sendlog))
+(defvar elmo-internal-folder-list '(flag cache sendlog))
 
 (defun elmo-internal-folder-initialize (folder name)
   (let ((fsyms elmo-internal-folder-list)
index a313c5d..06d0d06 100644 (file)
     (let ((dir (elmo-localdir-folder-directory-internal folder))
          (new-msgdb (elmo-make-msgdb))
          entity message-id
+         flags
          (i 0)
          (len (length numbers)))
       (message "Creating msgdb...")
              (elmo-localdir-msgdb-create-entity
               dir (car numbers)))
        (when entity
-         (setq message-id (elmo-msgdb-overview-entity-get-id entity))
-         (elmo-msgdb-append-entity
-          new-msgdb
-          entity
-          (elmo-flag-table-get flag-table message-id)))
+         (setq message-id (elmo-msgdb-overview-entity-get-id entity)
+               flags (elmo-flag-table-get flag-table message-id))
+         (elmo-global-flags-set flags folder (car numbers) message-id)
+         (elmo-msgdb-append-entity new-msgdb entity flags))
        (when (> len elmo-display-progress-threshold)
          (setq i (1+ i))
          (elmo-display-progress
                (throw 'found t))
            (setq lock (cdr lock)))))))
 
+(autoload 'elmo-global-flags-set "elmo-flag")
+
 (require 'product)
 (product-provide (provide 'elmo-localdir) (require 'elmo-version))
 
index 4c22d9a..017ad3f 100644 (file)
@@ -209,6 +209,7 @@ LOCATION."
                    folder))))
        (unless (memq 'unread flags)
          (setq flags (delq 'new flags)))
+       (elmo-global-flags-set flags folder number message-id)
        (elmo-msgdb-append-entity new-msgdb entity flags)
        (when (> len elmo-display-progress-threshold)
          (setq i (1+ i))
@@ -299,28 +300,28 @@ LOCATION."
      mark))
   t)
 
-(luna-define-method elmo-map-folder-mark-as-important ((folder elmo-maildir-folder)
+(luna-define-method elmo-map-folder-flag-as-important ((folder elmo-maildir-folder)
                                                       locs)
   (elmo-maildir-set-mark-msgs folder locs ?F))
   
-(luna-define-method elmo-map-folder-unmark-important ((folder elmo-maildir-folder)
+(luna-define-method elmo-map-folder-unflag-important ((folder elmo-maildir-folder)
                                                      locs)
   (elmo-maildir-delete-mark-msgs folder locs ?F))
 
-(luna-define-method elmo-map-folder-mark-as-read ((folder elmo-maildir-folder)
+(luna-define-method elmo-map-folder-flag-as-read ((folder elmo-maildir-folder)
                                                  locs)
   (elmo-maildir-set-mark-msgs folder locs ?S))
 
-(luna-define-method elmo-map-folder-unmark-read ((folder elmo-maildir-folder)
+(luna-define-method elmo-map-folder-unflag-read ((folder elmo-maildir-folder)
                                                 locs)
   (elmo-maildir-delete-mark-msgs folder locs ?S))
 
-(luna-define-method elmo-map-folder-mark-as-answered ((folder
+(luna-define-method elmo-map-folder-flag-as-answered ((folder
                                                       elmo-maildir-folder)
                                                      locs)
   (elmo-maildir-set-mark-msgs folder locs ?R))
 
-(luna-define-method elmo-map-folder-unmark-answered ((folder
+(luna-define-method elmo-map-folder-unflag-answered ((folder
                                                      elmo-maildir-folder)
                                                     locs)
   (elmo-maildir-delete-mark-msgs folder locs ?R))
index 6a383d4..f6aa4ff 100644 (file)
 (luna-define-generic elmo-map-folder-list-message-locations (folder)
   "Return a location list of the FOLDER.")
 
-(luna-define-generic elmo-map-folder-unmark-important (folder locations)
+(luna-define-generic elmo-map-folder-unflag-important (folder locations)
   "")
 
-(luna-define-generic elmo-map-folder-mark-as-important (folder locations)
+(luna-define-generic elmo-map-folder-flag-as-important (folder locations)
   "")
 
-(luna-define-generic elmo-map-folder-unmark-read (folder locations)
+(luna-define-generic elmo-map-folder-unflag-read (folder locations)
   "")
 
-(luna-define-generic elmo-map-folder-mark-as-read (folder locations)
+(luna-define-generic elmo-map-folder-flag-as-read (folder locations)
   "")
 
-(luna-define-generic elmo-map-folder-unmark-answered (folder locations)
+(luna-define-generic elmo-map-folder-unflag-answered (folder locations)
   "")
 
-(luna-define-generic elmo-map-folder-mark-as-answered (folder locations)
+(luna-define-generic elmo-map-folder-flag-as-answered (folder locations)
   "")
 
 (luna-define-generic elmo-map-message-fetch (folder location
   ((folder elmo-map-folder) &optional nohide)
   (mapcar 'car (elmo-map-folder-location-alist-internal folder)))
 
-(luna-define-method elmo-folder-unmark-important :before ((folder
+(luna-define-method elmo-folder-unflag-important :before ((folder
                                                           elmo-map-folder)
                                                          numbers
                                                          &optional
-                                                         ignore-flags)
-  (unless ignore-flags
-    (elmo-map-folder-unmark-important
+                                                         is-local)
+  (unless is-local
+    (elmo-map-folder-unflag-important
      folder
      (elmo-map-folder-numbers-to-locations folder numbers))))
 
-(luna-define-method elmo-folder-mark-as-important :before ((folder
+(luna-define-method elmo-folder-flag-as-important :before ((folder
                                                            elmo-map-folder)
                                                           numbers
                                                           &optional
-                                                          ignore-flags)
-  (unless ignore-flags
-    (elmo-map-folder-mark-as-important
+                                                          is-local)
+  (unless is-local
+    (elmo-map-folder-flag-as-important
      folder
      (elmo-map-folder-numbers-to-locations folder numbers))))
 
-(luna-define-method elmo-folder-unmark-read :before ((folder elmo-map-folder)
+(luna-define-method elmo-folder-unflag-read :before ((folder elmo-map-folder)
                                                     numbers
-                                                    &optional ignore-flags)
-  (unless ignore-flags
-    (elmo-map-folder-unmark-read
+                                                    &optional is-local)
+  (unless is-local
+    (elmo-map-folder-unflag-read
      folder
      (elmo-map-folder-numbers-to-locations folder numbers))))
 
-(luna-define-method elmo-folder-mark-as-read :before ((folder
+(luna-define-method elmo-folder-flag-as-read :before ((folder
                                                       elmo-map-folder)
                                                      numbers
-                                                     &optional ignore-flags)
-  (unless ignore-flags
-    (elmo-map-folder-mark-as-read
+                                                     &optional is-local)
+  (unless is-local
+    (elmo-map-folder-flag-as-read
      folder
      (elmo-map-folder-numbers-to-locations folder numbers))))
 
-(luna-define-method elmo-folder-unmark-answered :before ((folder
+(luna-define-method elmo-folder-unflag-answered :before ((folder
                                                          elmo-map-folder)
                                                         numbers)
-  (elmo-map-folder-unmark-answered
+  (elmo-map-folder-unflag-answered
    folder
    (elmo-map-folder-numbers-to-locations folder numbers)))
 
-(luna-define-method elmo-folder-mark-as-answered :before ((folder
+(luna-define-method elmo-folder-flag-as-answered :before ((folder
                                                          elmo-map-folder)
                                                         numbers)
-  (elmo-map-folder-mark-as-answered
+  (elmo-map-folder-flag-as-answered
    folder
    (elmo-map-folder-numbers-to-locations folder numbers)))
 
diff --git a/elmo/elmo-mark.el b/elmo/elmo-mark.el
deleted file mode 100644 (file)
index beb9873..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-;;; elmo-mark.el --- Global mark folder for ELMO.
-
-;; Copyright (C) 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org>
-
-;; Author: Yuuichi Teranishi <teranisi@gohome.org>
-;; Keywords: mail, net news
-
-;; This file is part of ELMO (Elisp Library for Message Orchestration).
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
-;;
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-;;
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-;;
-
-;;; Commentary:
-;;
-
-;;; Code:
-;;
-(require 'elmo)
-(require 'elmo-map)
-
-(defcustom elmo-mark-default-mark "$"
-  "*Default global-mark for mark-folder."
-  :type 'string
-  :group 'elmo)
-
-;;; ELMO mark folder
-(eval-and-compile
-  (luna-define-class elmo-mark-folder (elmo-map-folder) (mark))
-  (luna-define-internal-accessors 'elmo-mark-folder))
-
-(luna-define-method elmo-folder-initialize ((folder
-                                            elmo-mark-folder)
-                                           name)
-  (elmo-mark-folder-set-mark-internal
-   folder
-   elmo-mark-default-mark)
-  folder)
-
-(luna-define-method elmo-folder-have-subfolder-p ((folder elmo-mark-folder))
-  nil)
-
-(luna-define-method elmo-folder-expand-msgdb-path ((folder
-                                                   elmo-mark-folder))
-  (expand-file-name "mark"
-                   (expand-file-name "internal"
-                                     elmo-msgdb-directory)))
-
-(luna-define-method elmo-map-folder-list-message-locations
-  ((folder elmo-mark-folder))
-  (elmo-mark-folder-list-message-locations folder))
-
-(defun elmo-mark-folder-list-message-locations (folder)
-  (let (result)
-    (dolist (pair (or elmo-msgdb-global-mark-alist
-                     (setq elmo-msgdb-global-mark-alist
-                           (elmo-object-load
-                            (expand-file-name
-                             elmo-msgdb-global-mark-filename
-                             elmo-msgdb-directory)))))
-      (if (string= (elmo-mark-folder-mark-internal folder)
-                  (cdr pair))
-         (setq result (cons (car pair) result))))
-    (nreverse result)))
-
-(luna-define-method elmo-folder-message-file-p ((folder elmo-mark-folder))
-  t)
-
-(luna-define-method elmo-message-file-name ((folder elmo-mark-folder)
-                                           number)
-  (elmo-file-cache-get-path
-   (elmo-map-message-location folder number)))
-
-(luna-define-method elmo-folder-msgdb-create ((folder elmo-mark-folder)
-                                             numbers flag-table)
-  (elmo-mark-folder-msgdb-create folder numbers))
-
-(defun elmo-mark-folder-msgdb-create (folder numbers)
-  (let ((i 0)
-       (len (length numbers))
-       (new-msgdb (elmo-make-msgdb))
-       entity message-id)
-    (message "Creating msgdb...")
-    (while numbers
-      (setq entity
-           (elmo-msgdb-create-overview-entity-from-file
-            (car numbers) (elmo-message-file-name folder (car numbers))))
-      (when entity
-       (elmo-msgdb-append-entity new-msgdb
-                                 entity
-                                 '(important cached)))
-      (when (> len elmo-display-progress-threshold)
-       (setq i (1+ i))
-       (elmo-display-progress
-        'elmo-mark-folder-msgdb-create "Creating msgdb..."
-        (/ (* i 100) len)))
-      (setq numbers (cdr numbers)))
-    (message "Creating msgdb...done")
-    new-msgdb))
-
-(luna-define-method elmo-folder-append-buffer ((folder elmo-mark-folder)
-                                              &optional flag number)
-  (let* ((msgid (elmo-field-body "message-id"))
-        (path (elmo-file-cache-get-path msgid))
-        dir)
-    (when path
-      (setq dir (directory-file-name (file-name-directory path)))
-      (unless (file-exists-p dir)
-       (elmo-make-directory dir))
-      (when (file-writable-p path)
-       (write-region-as-binary (point-min) (point-max)
-                               path nil 'no-msg)))
-    (elmo-msgdb-global-mark-set msgid
-                               (elmo-mark-folder-mark-internal folder))))
-
-(luna-define-method elmo-map-folder-delete-messages ((folder elmo-mark-folder)
-                                                    locations)
-  (dolist (location locations)
-    (elmo-msgdb-global-mark-delete location)))
-
-(luna-define-method elmo-message-fetch-with-cache-process
-  ((folder elmo-mark-folder) number strategy &optional section unseen)
-  ;; disbable cache process
-  (elmo-message-fetch-internal folder number strategy section unseen))
-
-(luna-define-method elmo-map-message-fetch ((folder elmo-mark-folder)
-                                           location strategy
-                                           &optional section unseen)
-  (let ((file (elmo-file-cache-get-path location)))
-    (when (file-exists-p file)
-      (insert-file-contents-as-binary file))))
-
-(luna-define-method elmo-folder-exists-p ((folder elmo-mark-folder))
-  t)
-
-(luna-define-method elmo-folder-writable-p ((folder elmo-mark-folder))
-  t)
-
-(require 'product)
-(product-provide (provide 'elmo-mark) (require 'elmo-version))
-
-;;; elmo-mark.el ends here
index 939f418..d9dbdbf 100644 (file)
 (require 'modb)
 (require 'modb-entity)
 
-(defconst elmo-msgdb-new-mark "N"
-  "Mark for new message.")
-
-(defconst elmo-msgdb-unread-uncached-mark "U"
-  "Mark for unread and uncached message.")
-
-(defconst elmo-msgdb-unread-cached-mark "!"
-  "Mark for unread but already cached message.")
-
-(defconst elmo-msgdb-read-uncached-mark "u"
-  "Mark for read but uncached message.")
-
-(defconst elmo-msgdb-answered-cached-mark "&"
-  "Mark for answered and cached message.")
-
-(defconst elmo-msgdb-answered-uncached-mark "A"
-  "Mark for answered but cached message.")
-
-(defconst elmo-msgdb-important-mark "$"
-  "Mark for important message.")
-
 ;;; MSGDB interface.
 ;;
 ;; MSGDB elmo-load-msgdb PATH
   (let ((flags (elmo-get-hash-val msg-id flag-table)))
     (if flags
        (append
-        (and (elmo-msgdb-global-mark-get msg-id)
-             '(important))
         (and (elmo-file-cache-exists-p msg-id)
              '(cached))
-        (elmo-list-delete '(important cached read)
+        (elmo-list-delete '(cached read)
                           (copy-sequence flags)
                           #'delq))
       '(new unread))))
index 7d5d86d..a006b84 100644 (file)
                               (elmo-multi-folder-divide-number-internal
                                folder))))
                     (elmo-folder-list-importants child)))))
-    (elmo-uniq-list
-     (nconc importants
-           (elmo-folder-list-messages-with-global-mark
-            folder elmo-msgdb-important-mark)))))
+    importants))
 
 (luna-define-method elmo-folder-list-messages
   ((folder elmo-multi-folder) &optional visible-only in-msgdb)
       (setq msg-list (cdr msg-list)))
     ret-val))
 
-(luna-define-method elmo-folder-mark-as-important ((folder
+(luna-define-method elmo-folder-flag-as-important ((folder
                                                    elmo-multi-folder)
                                                   numbers
                                                   &optional
-                                                  ignore-flags)
+                                                  is-local)
   (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers))
-    (elmo-folder-mark-as-important (car folder-numbers)
+    (elmo-folder-flag-as-important (car folder-numbers)
                                   (cdr folder-numbers)
-                                  ignore-flags)))
+                                  is-local)))
 
-(luna-define-method elmo-folder-unmark-important ((folder
+(luna-define-method elmo-folder-unflag-important ((folder
                                                   elmo-multi-folder)
                                                  numbers
                                                  &optional
-                                                 ignore-flags)
+                                                 is-local)
   (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers))
-    (elmo-folder-unmark-important (car folder-numbers)
+    (elmo-folder-unflag-important (car folder-numbers)
                                  (cdr folder-numbers)
-                                 ignore-flags)))
+                                 is-local)))
 
-(luna-define-method elmo-folder-mark-as-read ((folder
+(luna-define-method elmo-folder-flag-as-read ((folder
                                               elmo-multi-folder)
                                              numbers
-                                             &optional ignore-flag)
+                                             &optional is-local)
   (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers))
-    (elmo-folder-mark-as-read (car folder-numbers)
+    (elmo-folder-flag-as-read (car folder-numbers)
                              (cdr folder-numbers)
-                             ignore-flag)))
+                             is-local)))
 
-(luna-define-method elmo-folder-unmark-read ((folder
+(luna-define-method elmo-folder-unflag-read ((folder
                                              elmo-multi-folder)
                                             numbers
-                                            &optional ignore-flag)
+                                            &optional is-local)
   (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers))
-    (elmo-folder-unmark-read (car folder-numbers)
+    (elmo-folder-unflag-read (car folder-numbers)
                             (cdr folder-numbers)
-                            ignore-flag)))
+                            is-local)))
 
-(luna-define-method elmo-folder-mark-as-answered ((folder
+(luna-define-method elmo-folder-flag-as-answered ((folder
                                                   elmo-multi-folder)
-                                                 numbers)
+                                                 numbers
+                                                 &optional is-local)
   (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers))
-    (elmo-folder-mark-as-answered (car folder-numbers)
-                                 (cdr folder-numbers))))
+    (elmo-folder-flag-as-answered (car folder-numbers)
+                                 (cdr folder-numbers)
+                                 is-local)))
 
-(luna-define-method elmo-folder-unmark-answered ((folder
+(luna-define-method elmo-folder-unflag-answered ((folder
                                                  elmo-multi-folder)
-                                                numbers)
+                                                numbers
+                                                &optional is-local)
   (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers))
-    (elmo-folder-unmark-answered (car folder-numbers)
-                                (cdr folder-numbers))))
+    (elmo-folder-unflag-answered (car folder-numbers)
+                                (cdr folder-numbers)
+                                is-local)))
 
 (luna-define-method elmo-folder-list-flagged ((folder elmo-multi-folder)
                                              flag
index b8c8577..9ec6022 100644 (file)
@@ -453,98 +453,102 @@ Returned value is searched from `elmo-network-stream-type-alist'."
                             (mapcar 'abs numbers)
                             flag-table)))
 
-(luna-define-method elmo-folder-unmark-important :before ((folder
+(luna-define-method elmo-folder-unflag-important :before ((folder
                                                           elmo-net-folder)
                                                          numbers
                                                          &optional
-                                                         ignore-flag)
+                                                         is-local)
   (when (and (elmo-folder-use-flag-p folder)
-            (not ignore-flag))
+            (not is-local))
     (if (elmo-folder-plugged-p folder)
-       (elmo-folder-send folder 'elmo-folder-unmark-important-plugged
+       (elmo-folder-send folder 'elmo-folder-unflag-important-plugged
                          numbers)
       (elmo-folder-send folder
-                       'elmo-folder-unmark-important-unplugged numbers))))
+                       'elmo-folder-unflag-important-unplugged numbers))))
 
-(luna-define-method elmo-folder-mark-as-important :before ((folder
+(luna-define-method elmo-folder-flag-as-important :before ((folder
                                                            elmo-net-folder)
                                                           numbers
                                                           &optional
-                                                          ignore-flag)
+                                                          is-local)
   (when (and (elmo-folder-use-flag-p folder)
-            (not ignore-flag))
+            (not is-local))
     (if (elmo-folder-plugged-p folder)
-       (elmo-folder-send folder 'elmo-folder-mark-as-important-plugged
+       (elmo-folder-send folder 'elmo-folder-flag-as-important-plugged
                          numbers)
-      (elmo-folder-send folder 'elmo-folder-mark-as-important-unplugged
+      (elmo-folder-send folder 'elmo-folder-flag-as-important-unplugged
                        numbers))))
 
-(luna-define-method elmo-folder-unmark-read :before ((folder elmo-net-folder)
+(luna-define-method elmo-folder-unflag-read :before ((folder elmo-net-folder)
                                                     numbers
-                                                    &optional ignore-flag)
+                                                    &optional is-local)
   (when (and (elmo-folder-use-flag-p folder)
-            (not ignore-flag))
+            (not is-local))
     (if (elmo-folder-plugged-p folder)
-       (elmo-folder-send folder 'elmo-folder-unmark-read-plugged numbers)
-      (elmo-folder-send folder 'elmo-folder-unmark-read-unplugged numbers))))
+       (elmo-folder-send folder 'elmo-folder-unflag-read-plugged numbers)
+      (elmo-folder-send folder 'elmo-folder-unflag-read-unplugged numbers))))
 
-(luna-define-method elmo-folder-mark-as-read :before ((folder elmo-net-folder)
+(luna-define-method elmo-folder-flag-as-read :before ((folder elmo-net-folder)
                                                      numbers
-                                                     &optional ignore-flag)
+                                                     &optional is-local)
   (when (and (elmo-folder-use-flag-p folder)
-            (not ignore-flag))
+            (not is-local))
     (if (elmo-folder-plugged-p folder)
-       (elmo-folder-send folder 'elmo-folder-mark-as-read-plugged numbers)
+       (elmo-folder-send folder 'elmo-folder-flag-as-read-plugged numbers)
       (elmo-folder-send
-       folder 'elmo-folder-mark-as-read-unplugged numbers))))
+       folder 'elmo-folder-flag-as-read-unplugged numbers))))
 
-(luna-define-method elmo-folder-unmark-answered :before ((folder
+(luna-define-method elmo-folder-unflag-answered :before ((folder
                                                          elmo-net-folder)
-                                                        numbers)
-  (when (elmo-folder-use-flag-p folder)
+                                                        numbers
+                                                        &optional is-local)
+  (when (and (elmo-folder-use-flag-p folder)
+            (not is-local))
     (if (elmo-folder-plugged-p folder)
-       (elmo-folder-send folder 'elmo-folder-unmark-answered-plugged
+       (elmo-folder-send folder 'elmo-folder-unflag-answered-plugged
                          numbers)
       (elmo-folder-send folder
-                       'elmo-folder-unmark-answered-unplugged numbers))))
+                       'elmo-folder-unflag-answered-unplugged numbers))))
 
-(luna-define-method elmo-folder-mark-as-answered :before ((folder
+(luna-define-method elmo-folder-flag-as-answered :before ((folder
                                                           elmo-net-folder)
-                                                         numbers)
-  (when (elmo-folder-use-flag-p folder)
+                                                         numbers
+                                                         &optional is-local)
+  (when (and (elmo-folder-use-flag-p folder)
+            (not is-local))
     (if (elmo-folder-plugged-p folder)
-       (elmo-folder-send folder 'elmo-folder-mark-as-answered-plugged
+       (elmo-folder-send folder 'elmo-folder-flag-as-answered-plugged
                          numbers)
-      (elmo-folder-send folder 'elmo-folder-mark-as-answered-unplugged
+      (elmo-folder-send folder 'elmo-folder-flag-as-answered-unplugged
                        numbers))))
 
-(luna-define-method elmo-folder-mark-as-read-unplugged ((folder
+(luna-define-method elmo-folder-flag-as-read-unplugged ((folder
                                                         elmo-net-folder)
                                                        numbers)
-  (elmo-folder-mark-as-read-dop folder numbers))
+  (elmo-folder-flag-as-read-dop folder numbers))
 
-(luna-define-method elmo-folder-unmark-read-unplugged ((folder elmo-net-folder)
+(luna-define-method elmo-folder-unflag-read-unplugged ((folder elmo-net-folder)
                                                     numbers)
-  (elmo-folder-unmark-read-dop folder numbers))
+  (elmo-folder-unflag-read-dop folder numbers))
 
-(luna-define-method elmo-folder-mark-as-important-unplugged ((folder
+(luna-define-method elmo-folder-flag-as-important-unplugged ((folder
                                                              elmo-net-folder)
                                                             numbers)
-  (elmo-folder-mark-as-important-dop folder numbers))
+  (elmo-folder-flag-as-important-dop folder numbers))
 
-(luna-define-method elmo-folder-unmark-important-unplugged ((folder
+(luna-define-method elmo-folder-unflag-important-unplugged ((folder
                                                             elmo-net-folder)
                                                            numbers)
-  (elmo-folder-unmark-important-dop folder numbers))
+  (elmo-folder-unflag-important-dop folder numbers))
 
-(luna-define-method elmo-folder-mark-as-answered-unplugged ((folder
+(luna-define-method elmo-folder-flag-as-answered-unplugged ((folder
                                                             elmo-net-folder)
                                                            numbers)
-  (elmo-folder-mark-as-answered-dop folder numbers))
+  (elmo-folder-flag-as-answered-dop folder numbers))
 
-(luna-define-method elmo-folder-unmark-answered-unplugged
+(luna-define-method elmo-folder-unflag-answered-unplugged
   ((folder elmo-net-folder) numbers)
-  (elmo-folder-unmark-answered-dop folder numbers))
+  (elmo-folder-unflag-answered-dop folder numbers))
 
 (luna-define-method elmo-message-encache :around ((folder elmo-net-folder)
                                                  number &optional read)
index be5b936..9c80224 100644 (file)
@@ -128,11 +128,7 @@ If the value is a list, all elements are used as index paths for namazu."
            (elmo-nmz-msgdb-create-entity
             folder (car numlist)))
       (when entity
-       (setq mark (or (elmo-msgdb-global-mark-get
-                       (elmo-msgdb-overview-entity-get-id
-                        entity))
-                      elmo-msgdb-new-mark))
-       (elmo-msgdb-append-entity new-msgdb entity mark))
+       (elmo-msgdb-append-entity new-msgdb entity '(new)))
       (when (> num elmo-display-progress-threshold)
        (setq i (1+ i))
        (setq percent (/ (* i 100) num))
index 93cd0d9..9494d76 100644 (file)
@@ -737,13 +737,14 @@ Don't cache if nil.")
     ("lines" . 7)
     ("xref" . 8)))
 
-(defun elmo-nntp-create-msgdb-from-overview-string (str
+(defun elmo-nntp-create-msgdb-from-overview-string (folder
+                                                   str
                                                    flag-table
                                                    &optional numlist)
   (let ((new-msgdb (elmo-make-msgdb))
        ov-list message-id entity
        ov-entity num
-       extras extra ext field field-index)
+       extras extra ext field field-index flags)
     (setq ov-list (elmo-nntp-parse-overview-string str))
     (while ov-list
       (setq ov-entity (car ov-list))
@@ -782,9 +783,10 @@ Don't cache if nil.")
                      :date       (aref ov-entity 3)
                      :size       (string-to-int (aref ov-entity 6))
                      :extra      extra))
-       (setq message-id (elmo-message-entity-field entity 'message-id))
-       (elmo-msgdb-append-entity new-msgdb entity
-                                 (elmo-flag-table-get flag-table message-id)))
+       (setq message-id (elmo-message-entity-field entity 'message-id)
+             flags (elmo-flag-table-get flag-table message-id))
+       (elmo-global-flags-set flags folder num message-id)
+       (elmo-msgdb-append-entity new-msgdb entity flags))
       (setq ov-list (cdr ov-list)))
     new-msgdb))
 
@@ -820,6 +822,7 @@ Don't cache if nil.")
              (elmo-msgdb-append
               new-msgdb
               (elmo-nntp-create-msgdb-from-overview-string
+               folder
                ov-str
                flag-table
                filter))))
@@ -847,6 +850,7 @@ Don't cache if nil.")
            (elmo-msgdb-append
             new-msgdb
             (elmo-nntp-create-msgdb-from-overview-string
+             folder
              ov-str
              flag-table
              filter)))))
@@ -1453,7 +1457,7 @@ Returns a list of cons cells like (NUMBER . VALUE)"
 ;;         temp-crosses slot is a list of cons cell:
 ;;         (NUMBER . (MESSAGE-ID (LIST-OF-NEWSGROUPS) 'ng))
 ;;    1.2. In elmo-folder-close, `temp-crosses' slot is cleared,
-;;    1.3. In elmo-folder-mark-as-read, move crosspost entry
+;;    1.3. In elmo-folder-flag-as-read, move crosspost entry
 ;;         from `temp-crosses' slot to `elmo-crosspost-message-alist'.
 
 ;; 2. process crosspost alist.
@@ -1498,7 +1502,7 @@ Returns a list of cons cells like (NUMBER . VALUE)"
   )
 
 (defun elmo-nntp-folder-update-crosspost-message-alist (folder numbers)
-;;    1.3. In elmo-folder-mark-as-read, move crosspost entry
+;;    1.3. In elmo-folder-flag-as-read, move crosspost entry
 ;;         from `temp-crosses' slot to `elmo-crosspost-message-alist'.
   (let (elem)
     (dolist (number numbers)
@@ -1511,10 +1515,10 @@ Returns a list of cons cells like (NUMBER . VALUE)"
         folder
         (delq elem (elmo-nntp-folder-temp-crosses-internal folder)))))))
 
-(luna-define-method elmo-folder-mark-as-read :before ((folder
+(luna-define-method elmo-folder-flag-as-read :before ((folder
                                                       elmo-nntp-folder)
                                                      numbers
-                                                     &optional ignore-flags)
+                                                     &optional is-local)
   (elmo-nntp-folder-update-crosspost-message-alist folder numbers))
 
 (defsubst elmo-nntp-folder-process-crosspost (folder)
index 13791b0..4e84663 100644 (file)
   (elmo-folder-message-make-temp-files
    (elmo-pipe-folder-dst-internal folder) numbers start-number))
 
-(luna-define-method elmo-folder-mark-as-read ((folder elmo-pipe-folder)
-                                             numbers &optional ignore-flag)
-  (elmo-folder-mark-as-read (elmo-pipe-folder-dst-internal folder)
-                           numbers ignore-flag))
+(luna-define-method elmo-folder-flag-as-read ((folder elmo-pipe-folder)
+                                             numbers &optional is-local)
+  (elmo-folder-flag-as-read (elmo-pipe-folder-dst-internal folder)
+                           numbers is-local))
 
-(luna-define-method elmo-folder-unmark-read ((folder elmo-pipe-folder)
+(luna-define-method elmo-folder-unflag-read ((folder elmo-pipe-folder)
                                             numbers
-                                            &optional ignore-flag)
-  (elmo-folder-unmark-read (elmo-pipe-folder-dst-internal folder)
-                          numbers ignore-flag))
+                                            &optional is-local)
+  (elmo-folder-unflag-read (elmo-pipe-folder-dst-internal folder)
+                          numbers is-local))
 
-(luna-define-method elmo-folder-unmark-important ((folder elmo-pipe-folder)
+(luna-define-method elmo-folder-unflag-important ((folder elmo-pipe-folder)
                                                  numbers
-                                                 &optional ignore-flag)
-  (elmo-folder-unmark-important (elmo-pipe-folder-dst-internal folder)
-                               numbers ignore-flag))
+                                                 &optional is-local)
+  (elmo-folder-unflag-important (elmo-pipe-folder-dst-internal folder)
+                               numbers is-local))
 
-(luna-define-method elmo-folder-mark-as-important ((folder elmo-pipe-folder)
+(luna-define-method elmo-folder-flag-as-important ((folder elmo-pipe-folder)
                                                   numbers
-                                                  &optional ignore-flag)
-  (elmo-folder-mark-as-important (elmo-pipe-folder-dst-internal folder)
-                                numbers ignore-flag))
+                                                  &optional is-local)
+  (elmo-folder-flag-as-important (elmo-pipe-folder-dst-internal folder)
+                                numbers is-local))
 
-(luna-define-method elmo-folder-unmark-answered ((folder elmo-pipe-folder)
-                                                numbers)
-  (elmo-folder-unmark-answered (elmo-pipe-folder-dst-internal folder)
-                              numbers))
+(luna-define-method elmo-folder-unflag-answered ((folder elmo-pipe-folder)
+                                                numbers
+                                                &optional is-local)
+  (elmo-folder-unflag-answered (elmo-pipe-folder-dst-internal folder)
+                              numbers is-local))
 
-(luna-define-method elmo-folder-mark-as-answered ((folder elmo-pipe-folder)
-                                                 numbers)
-  (elmo-folder-mark-as-answered (elmo-pipe-folder-dst-internal folder)
-                               numbers))
+(luna-define-method elmo-folder-flag-as-answered ((folder elmo-pipe-folder)
+                                                 numbers
+                                                 &optional is-local)
+  (elmo-folder-flag-as-answered (elmo-pipe-folder-dst-internal folder)
+                               numbers is-local))
 
 (luna-define-method elmo-folder-pack-numbers ((folder elmo-pipe-folder))
   (elmo-folder-pack-numbers (elmo-pipe-folder-dst-internal folder)))
index 4ea54bc..bf00c65 100644 (file)
@@ -696,6 +696,7 @@ If IF-EXISTS is `any-exists', get BIFF session or normal session if exists."
       (elmo-pop3-sort-msgdb-by-original-number
        folder
        (elmo-pop3-msgdb-create-by-header
+       folder
        process
        numlist
        flag-table
@@ -729,9 +730,9 @@ If IF-EXISTS is `any-exists', get BIFF session or normal session if exists."
   (elmo-get-hash-val (format "#%d" number)
                     elmo-pop3-size-hash))
 
-(defun elmo-pop3-msgdb-create-by-header (process numlist
-                                                flag-table
-                                                loc-alist)
+(defun elmo-pop3-msgdb-create-by-header (folder process numlist
+                                               flag-table
+                                               loc-alist)
   (let ((tmp-buffer (get-buffer-create " *ELMO Overview TMP*")))
     (with-current-buffer (process-buffer process)
       (if loc-alist ; use uidl.
@@ -746,6 +747,7 @@ If IF-EXISTS is `any-exists', get BIFF session or normal session if exists."
                                  tmp-buffer process numlist)
       (prog1
          (elmo-pop3-msgdb-create-message
+          folder
           tmp-buffer
           process
           (length numlist)
@@ -753,7 +755,8 @@ If IF-EXISTS is `any-exists', get BIFF session or normal session if exists."
           flag-table loc-alist)
        (kill-buffer tmp-buffer)))))
 
-(defun elmo-pop3-msgdb-create-message (buffer
+(defun elmo-pop3-msgdb-create-message (folder
+                                      buffer
                                       process
                                       num
                                       numlist
@@ -761,7 +764,7 @@ If IF-EXISTS is `any-exists', get BIFF session or normal session if exists."
                                       loc-alist)
   (save-excursion
     (let ((new-msgdb (elmo-make-msgdb))
-         beg entity i number message-id)
+         beg entity i number message-id flags)
       (set-buffer buffer)
       (elmo-set-buffer-multibyte default-enable-multibyte-characters)
       (goto-char (point-min))
@@ -792,11 +795,10 @@ If IF-EXISTS is `any-exists', get BIFF session or normal session if exists."
                             (elmo-msgdb-overview-entity-get-number entity))
                            loc-alist)))
                    (elmo-msgdb-overview-entity-set-number entity number)))
-             (setq message-id (elmo-message-entity-field entity 'message-id))
-             (elmo-msgdb-append-entity
-              new-msgdb
-              entity
-              (elmo-flag-table-get flag-table message-id)))))
+             (setq message-id (elmo-message-entity-field entity 'message-id)
+                   flags (elmo-flag-table-get flag-table message-id))
+             (elmo-global-flags-set flags folder number message-id)
+             (elmo-msgdb-append-entity new-msgdb entity flags))))
        (when (> num elmo-display-progress-threshold)
          (setq i (1+ i))
          (if (or (zerop (% i 5)) (= i num))
index 02c05eb..7a5c811 100644 (file)
@@ -85,7 +85,7 @@
   (let ((i 0)
        (len (length numbers))
        (new-msgdb (elmo-make-msgdb))
-       entity message-id)
+       entity message-id flags)
     (message "Creating msgdb...")
     (while numbers
       (setq entity
           (nconc
            (elmo-folder-killed-list-internal folder)
            (list (car numbers))))
-       (setq message-id (elmo-msgdb-overview-entity-get-id entity))
-       (elmo-msgdb-append-entity new-msgdb entity
-                                 (elmo-flag-table-get flag-table message-id)))
+       (setq message-id (elmo-msgdb-overview-entity-get-id entity)
+             flags (elmo-flag-table-get flag-table message-id))
+       (elmo-global-flags-set flags folder (car numbers) message-id)
+       (elmo-msgdb-append-entity new-msgdb entity flags))
       (when (> len elmo-display-progress-threshold)
        (setq i (1+ i))
        (elmo-display-progress
index 08415f7..f15b37e 100644 (file)
@@ -351,7 +351,7 @@ update overview when message is fetched."
 (luna-define-method elmo-folder-msgdb-create ((folder elmo-shimbun-folder)
                                              numlist flag-table)
   (let ((new-msgdb (elmo-make-msgdb))
-       entity i percent length msgid)
+       entity i percent length msgid flags)
     (setq length (length numlist))
     (setq i 0)
     (message "Creating msgdb...")
@@ -360,9 +360,10 @@ update overview when message is fetched."
            (elmo-shimbun-msgdb-create-entity
             folder (car numlist)))
       (when entity
-       (setq msgid (elmo-msgdb-overview-entity-get-id entity))
-       (elmo-msgdb-append-entity new-msgdb entity
-                                 (elmo-flag-table-get flag-table msgid)))
+       (setq msgid (elmo-msgdb-overview-entity-get-id entity)
+             flags (elmo-flag-table-get flag-table msgid))
+       (elmo-global-flags-set flags folder (car numlist) msgid)
+       (elmo-msgdb-append-entity new-msgdb entity flags))
       (when (> length elmo-display-progress-threshold)
        (setq i (1+ i))
        (setq percent (/ (* i 100) length))
index 0e3ab3e..56ac49f 100644 (file)
@@ -1602,49 +1602,6 @@ NUMBER-SET is altered."
                                  (match-end matchn)) list)))
     (nreverse list)))
 
-;;;
-;; parsistent mark handling
-;; (for global!)
-;; (FIXME: this should be treated in the msgdb.)
-
-(defvar elmo-msgdb-global-mark-alist nil)
-
-(defun elmo-msgdb-global-mark-delete (msgid)
-  (let* ((path (expand-file-name
-               elmo-msgdb-global-mark-filename
-               elmo-msgdb-directory))
-        (malist (or elmo-msgdb-global-mark-alist
-                    (setq elmo-msgdb-global-mark-alist
-                          (elmo-object-load path))))
-        match)
-    (when (setq match (assoc msgid malist))
-      (setq elmo-msgdb-global-mark-alist
-           (delete match elmo-msgdb-global-mark-alist))
-      (elmo-object-save path elmo-msgdb-global-mark-alist))))
-
-(defun elmo-msgdb-global-mark-set (msgid mark)
-  (let* ((path (expand-file-name
-               elmo-msgdb-global-mark-filename
-               elmo-msgdb-directory))
-        (malist (or elmo-msgdb-global-mark-alist
-                    (setq elmo-msgdb-global-mark-alist
-                          (elmo-object-load path))))
-        match)
-    (if (setq match (assoc msgid malist))
-       (setcdr match mark)
-      (setq elmo-msgdb-global-mark-alist
-           (nconc elmo-msgdb-global-mark-alist
-                  (list (cons msgid mark)))))
-    (elmo-object-save path elmo-msgdb-global-mark-alist)))
-
-(defun elmo-msgdb-global-mark-get (msgid)
-  (cdr (assoc msgid (or elmo-msgdb-global-mark-alist
-                       (setq elmo-msgdb-global-mark-alist
-                             (elmo-object-load
-                              (expand-file-name
-                               elmo-msgdb-global-mark-filename
-                               elmo-msgdb-directory)))))))
-
 ;;; File cache.
 (defmacro elmo-make-file-cache (path status)
   "PATH is the cache file name.
@@ -1702,16 +1659,14 @@ SECTION is the section string."
 
 (defun elmo-file-cache-delete (path)
   "Delete a cache on PATH."
-  (unless (elmo-msgdb-global-mark-get
-          (elmo-cache-to-msgid (file-name-nondirectory path)))
-    (when (file-exists-p path)
-      (if (file-directory-p path)
-         (progn
-           (dolist (file (directory-files path t "^[^\\.]"))
-             (delete-file file))
-           (delete-directory path))
-       (delete-file path))
-      t)))
+  (when (file-exists-p path)
+    (if (file-directory-p path)
+       (progn
+         (dolist (file (directory-files path t "^[^\\.]"))
+           (delete-file file))
+         (delete-directory path))
+      (delete-file path))
+    t))
 
 (defun elmo-file-cache-exists-p (msgid)
   "Returns 'section or 'entire if a cache which corresponds to MSGID exists."
index 5f072bc..e2de650 100644 (file)
@@ -240,8 +240,6 @@ This is taken precedence over `elmo-network-stream-type-alist'.")
 (defvar elmo-msgdb-lock-list-filename "lock"
   "Locked messages...list of message-id.
 For disconnected operations.")
-(defvar elmo-msgdb-global-mark-filename "global-mark"
-  "Alist of global mark.")
 (defvar elmo-lost+found-folder "+lost+found"
   "Lost and found.")
 (defvar elmo-crosspost-alist-filename "crosspost-alist"
index c9769f6..27751ef 100644 (file)
@@ -107,7 +107,7 @@ If a folder name begins with PREFIX, use BACKEND."
                                     killed-list  ; killed list.
                                     persistent   ; non-nil if persistent.
                                     message-modified ; message is modified.
-                                    mark-modified    ; mark is modified.
+                                    flag-modified    ; flag is modified.
                                     process-duplicates  ; read or hide
                                     biff   ; folder for biff
                                     ))
@@ -238,23 +238,6 @@ If second optional IN-MSGDB is non-nil, only messages in the msgdb are listed.")
 (luna-define-generic elmo-folder-list-answereds (folder)
   "Return a list of answered message numbers contained in FOLDER.")
 
-;; TODO: Should reconsider the structure of global mark.
-(defun elmo-folder-list-messages-with-global-mark (folder mark)
-  (let (entity msgs)
-    (dolist (mark-pair (or elmo-msgdb-global-mark-alist
-                          (setq elmo-msgdb-global-mark-alist
-                                (elmo-object-load
-                                 (expand-file-name
-                                  elmo-msgdb-global-mark-filename
-                                  elmo-msgdb-directory)))))
-      (if (and (string= mark (cdr mark-pair))
-              (setq entity
-                    (elmo-msgdb-message-entity (elmo-folder-msgdb folder)
-                                               (car mark-pair))))
-         (setq msgs (cons (elmo-msgdb-overview-entity-get-number entity)
-                          msgs))))
-    msgs))
-
 (luna-define-generic elmo-folder-list-flagged (folder flag &optional in-msgdb)
   "List messages in the FOLDER with FLAG.
 FLAG is a symbol which is one of the following:
@@ -348,45 +331,47 @@ FOLDER is the ELMO folder structure.
 NUMBERS is a list of message numbers to create msgdb.
 FLAG-TABLE is a hashtable of message-id and flag.")
 
-(luna-define-generic elmo-folder-unmark-important (folder
+(luna-define-generic elmo-folder-unflag-important (folder
                                                   numbers
-                                                  &optional ignore-flags)
-  "Un-mark messages as important.
+                                                  &optional is-local)
+  "Un-flag messages as important.
 FOLDER is the ELMO folder structure.
 NUMBERS is a list of message numbers to be processed.
-If IGNORE-FLAGS is non-nil, folder flags are not updated.")
+If IS-LOCAL is non-nil, only the local flag is updated.")
 
-(luna-define-generic elmo-folder-mark-as-important (folder
+(luna-define-generic elmo-folder-flag-as-important (folder
                                                    numbers
-                                                   &optional ignore-flags)
-  "Mark messages as important.
+                                                   &optional is-local)
+  "Flag messages as important.
 FOLDER is the ELMO folder structure.
 NUMBERS is a list of message numbers to be processed.
-If IGNORE-FLAGS is non-nil, folder flags are not updated.")
+If IS-LOCAL is non-nil, only the local flag is updated.")
 
-(luna-define-generic elmo-folder-unmark-read (folder numbers
-                                                    &optional ignore-flags)
-  "Un-mark messages as read.
+(luna-define-generic elmo-folder-unflag-read (folder numbers
+                                                    &optional is-local)
+  "Un-flag messages as read.
 FOLDER is the ELMO folder structure.
 NUMBERS is a list of message numbers to be processed.
-If IGNORE-FLAGS is non-nil, folder flags are not updated.")
+If IS-LOCAL is non-nil, only the local flag is updated.")
 
-(luna-define-generic elmo-folder-mark-as-read (folder numbers
-                                                     &optional ignore-flags)
-  "Mark messages as read.
+(luna-define-generic elmo-folder-flag-as-read (folder numbers
+                                                     &optional is-local)
+  "Flag messages as read.
 FOLDER is the ELMO folder structure.
 NUMBERS is a list of message numbers to be processed.
-If IGNORE-FLAGS is non-nil, folder flags are not updated.")
+If IS-LOCAL is non-nil, only the local flag is updated.")
 
-(luna-define-generic elmo-folder-unmark-answered (folder numbers)
-  "Un-mark messages as answered.
+(luna-define-generic elmo-folder-unflag-answered (folder numbers
+                                                        &optional is-local)
+  "Un-flag messages as answered.
 FOLDER is the ELMO folder structure.
-NUMBERS is a list of message numbers to be processed.")
+If IS-LOCAL is non-nil, only the local flag is updated.")
 
-(luna-define-generic elmo-folder-mark-as-answered (folder numbers)
-  "Mark messages as answered.
+(luna-define-generic elmo-folder-flag-as-answered (folder numbers
+                                                         &optional is-local)
+  "Flag messages as answered.
 FOLDER is the ELMO folder structure.
-NUMBERS is a list of message numbers to be processed.")
+If IS-LOCAL is non-nil, only the local flag is updated.")
 
 (luna-define-generic elmo-folder-append-buffer (folder &optional flag
                                                       number)
@@ -404,7 +389,7 @@ If optional argument NUMBER is specified, the new message number is set
   "Append messages from folder.
 FOLDER is the ELMO folder structure.
 Caller should make sure FOLDER is `writable'.
-(Can be checked with `elmo-folder-writable-p').
+\(Can be checked with `elmo-folder-writable-p'\).
 SRC-FOLDER is the source ELMO folder structure.
 NUMBERS is the message numbers to be appended in the SRC-FOLDER.
 If second optional argument SAME-NUMBER is specified,
@@ -553,25 +538,27 @@ Return newly created temporary directory name which contains temporary files.")
 
 (defun elmo-folder-encache (folder numbers &optional unread)
   "Encache messages in the FOLDER with NUMBERS.
-If UNREAD is non-nil, messages are not marked as read."
+If UNREAD is non-nil, messages are not flaged as read."
   (dolist (number numbers)
     (elmo-message-encache folder number unread)))
 
 (luna-define-generic elmo-message-encache (folder number &optional read)
   "Encache message in the FOLDER with NUMBER.
-If READ is non-nil, message is marked as read.")
+If READ is non-nil, message is flaged as read.")
 
 (luna-define-method elmo-message-encache ((folder elmo-folder) number
                                          &optional read)
-  (elmo-message-fetch
-   folder number
-   (elmo-make-fetch-strategy 'entire
-                            nil ;use-cache
-                            t   ;save-cache
-                            (elmo-file-cache-get-path
-                             (elmo-message-field
-                              folder number 'message-id)))
-   nil nil (not read)))
+  (let (path)
+    (elmo-message-fetch
+     folder number
+     (elmo-make-fetch-strategy 'entire
+                              nil ;use-cache
+                              t   ;save-cache
+                              (setq path (elmo-file-cache-get-path
+                                          (elmo-message-field
+                                           folder number 'message-id))))
+     nil nil (not read))
+    path))
 
 (luna-define-generic elmo-message-fetch (folder number strategy
                                                &optional
@@ -586,7 +573,7 @@ If optional argument SECTION is specified, only the SECTION of the message
 is fetched (if possible).
 If second optional argument OUTBUF is specified, fetched message is
 inserted to the buffer and returns t if fetch was ended successfully.
-If third optional argument UNREAD is non-nil, message is not marked as read.
+If third optional argument UNREAD is non-nil, message is not flaged as read.
 Returns non-nil if fetching was succeed.")
 
 (luna-define-generic elmo-message-fetch-with-cache-process (folder
@@ -600,7 +587,7 @@ NUMBER is the number of the message in the FOLDER.
 STRATEGY is the message fetching strategy.
 If optional argument SECTION is specified, only the SECTION of the message
 is fetched (if possible).
-If second optional argument UNREAD is non-nil, message is not marked as read.
+If second optional argument UNREAD is non-nil, message is not flaged as read.
 Returns non-nil if fetching was succeed.")
 
 (luna-define-generic elmo-message-fetch-internal (folder number strategy
@@ -613,7 +600,7 @@ NUMBER is the number of the message in the FOLDER.
 STRATEGY is the message fetching strategy.
 If optional argument SECTION is specified, only the SECTION of the message
 is fetched (if possible).
-If second optional argument UNREAD is non-nil, message is not marked as read.
+If second optional argument UNREAD is non-nil, message is not flaged as read.
 Returns non-nil if fetching was succeed.")
 
 (luna-define-generic elmo-message-fetch-field (folder number field)
@@ -627,7 +614,7 @@ FIELD is a symbol of the field name.")
 
 (luna-define-generic elmo-folder-process-crosspost (folder)
   "Process crosspost for FOLDER.
-Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).")
+Return a cons cell of (NUMBER-CROSSPOSTS . NEW-FLAG-ALIST).")
 
 (luna-define-generic elmo-folder-newsgroups (folder)
   "Return list of newsgroup name of FOLDER.")
@@ -684,7 +671,7 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).")
         (elmo-folder-msgdb-path folder)
         (elmo-folder-killed-list-internal folder)))
       (elmo-folder-set-message-modified folder nil)
-      (elmo-folder-set-mark-modified-internal folder nil)
+      (elmo-folder-set-flag-modified-internal folder nil)
       (elmo-msgdb-save msgdb))))
 
 (luna-define-method elmo-folder-close-internal ((folder elmo-folder))
@@ -1081,7 +1068,9 @@ NUMBERS is a list of message numbers, messages are searched from the list."
          (progn
            (if (and (elmo-folder-delete-messages src-folder succeeds)
                     (elmo-folder-detach-messages src-folder succeeds))
-               (setq result t)
+               (progn
+                 (elmo-global-flag-detach-messages src-folder succeeds)
+                 (setq result t))
              (message "move: delete messages from %s failed."
                       (elmo-folder-name-internal src-folder))
              (setq result nil))
@@ -1225,7 +1214,7 @@ NUMBER is a message number to test."
       (t
        (memq flag cur-flags)))))
 
-(defun elmo-message-set-flag (folder number flag)
+(defun elmo-message-set-flag (folder number flag &optional is-local)
   "Set message flag.
 FOLDER is a ELMO folder structure.
 NUMBER is a message number to set flag.
@@ -1235,9 +1224,20 @@ FLAG is a symbol which is one of the following:
   `answered'  (set the message as answered)
   `important' (set the message as important)
 'sugar' flag:
-  `read'      (remove new and unread flags)")
-
-(defun elmo-message-unset-flag (folder number flag)
+  `read'      (remove new and unread flags)
+If optional IS-LOCAL is non-nil, update only local (not server) status."
+  ;; XXX Transitional implementation.
+  (case flag
+    (unread
+     (elmo-folder-unflag-read folder (list number) is-local))
+    (read
+     (elmo-folder-flag-as-read folder (list number) is-local))
+    (answered
+     (elmo-folder-flag-as-answered folder (list number) is-local))
+    (important
+     (elmo-folder-flag-as-important folder (list number) is-local))))
+
+(defun elmo-message-unset-flag (folder number flag &optional is-local)
   "Unset message flag.
 FOLDER is a ELMO folder structure.
 NUMBER is a message number to set flag.
@@ -1247,7 +1247,18 @@ FLAG is a symbol which is one of the following:
   `answered'  (remove answered flag)
   `important' (remove important flag)
 'sugar' flag:
-  `read'      (set unread flag)")
+  `read'      (set unread flag)
+If optional IS-LOCAL is non-nil, update only local (not server) status."
+  ;; XXX Transitional implementation.
+  (case flag
+    (unread
+     (elmo-folder-flag-as-read folder (list number) is-local))
+    (read
+     (elmo-folder-unflag-read folder (list number) is-local))
+    (answered
+     (elmo-folder-unflag-answered folder (list number) is-local))
+    (important
+     (elmo-folder-unflag-important folder (list number) is-local))))
 
 (luna-define-generic elmo-message-field (folder number field)
   "Get message field value in the msgdb.
@@ -1266,50 +1277,65 @@ FIELD is a symbol of the field.")
 (luna-define-method elmo-message-folder ((folder elmo-folder) number)
   folder) ; default is folder
 
-(luna-define-method elmo-folder-unmark-important ((folder elmo-folder)
+(luna-define-method elmo-folder-unflag-important ((folder elmo-folder)
                                                  numbers
-                                                 &optional ignore-flags)
+                                                 &optional is-local)
   (when (elmo-folder-msgdb-internal folder)
     (dolist (number numbers)
+      (when (elmo-global-flag-p 'important)
+       (elmo-global-flag-detach 'important folder number 'remove-if-none))
       (elmo-msgdb-unset-flag (elmo-folder-msgdb folder)
                             number
                             'important))))
 
-(luna-define-method elmo-folder-mark-as-important ((folder elmo-folder)
+(luna-define-method elmo-folder-flag-as-important ((folder elmo-folder)
                                                   numbers
-                                                  &optional ignore-flags)
-  (when (elmo-folder-msgdb-internal folder)
-    (dolist (number numbers)
-      (elmo-msgdb-set-flag (elmo-folder-msgdb folder)
-                          number
-                          'important))))
+                                                  &optional is-local)
+  (let (path message-id)
+    (when (elmo-folder-msgdb-internal folder)
+      (dolist (number numbers)
+       ;; important message should always be a read message.
+       (if (eq (elmo-file-cache-exists-p
+                (setq message-id
+                      (elmo-message-field folder number 'message-id)))
+               'entire)
+           (elmo-folder-flag-as-read folder (list number)))
+       (when (elmo-global-flag-p 'important)
+         (elmo-global-flag-set 'important folder number message-id))
+       (elmo-msgdb-set-flag (elmo-folder-msgdb folder)
+                            number
+                            'important)))))
 
-(luna-define-method elmo-folder-unmark-read ((folder elmo-folder)
+(luna-define-method elmo-folder-unflag-read ((folder elmo-folder)
                                             numbers
-                                            &optional ignore-flags)
+                                            &optional is-local)
   (when (elmo-folder-msgdb-internal folder)
     (dolist (number numbers)
       (elmo-msgdb-unset-flag (elmo-folder-msgdb folder)
                             number
                             'read))))
 
-(luna-define-method elmo-folder-mark-as-read ((folder elmo-folder)
+(luna-define-method elmo-folder-flag-as-read ((folder elmo-folder)
                                              numbers
-                                             &optional ignore-flag)
+                                             &optional is-local)
   (when (elmo-folder-msgdb-internal folder)
     (dolist (number numbers)
       (elmo-msgdb-set-flag (elmo-folder-msgdb folder)
                           number
                           'read))))
 
-(luna-define-method elmo-folder-unmark-answered ((folder elmo-folder) numbers)
+(luna-define-method elmo-folder-unflag-answered ((folder elmo-folder)
+                                                numbers
+                                                &optional is-local)
   (when (elmo-folder-msgdb-internal folder)
     (dolist (number numbers)
       (elmo-msgdb-unset-flag (elmo-folder-msgdb folder)
                             number
                             'answered))))
 
-(luna-define-method elmo-folder-mark-as-answered ((folder elmo-folder) numbers)
+(luna-define-method elmo-folder-flag-as-answered ((folder elmo-folder)
+                                                 numbers
+                                                 &optional is-local)
   (when (elmo-folder-msgdb-internal folder)
     (dolist (number numbers)
       (elmo-msgdb-set-flag (elmo-folder-msgdb folder)
@@ -1341,12 +1367,12 @@ FIELD is a symbol of the field.")
                   'hide)
               ;; Let duplicates be a temporary killed message.
               (elmo-folder-kill-messages folder duplicates)
-              ;; Should be mark as read.
-              (elmo-folder-mark-as-read folder duplicates))
+              ;; Should be flag as read.
+              (elmo-folder-flag-as-read folder duplicates))
              ((eq (elmo-folder-process-duplicates-internal folder)
                   'read)
-              ;; Mark as read duplicates.
-              (elmo-folder-mark-as-read folder duplicates))
+              ;; Flag as read duplicates.
+              (elmo-folder-flag-as-read folder duplicates))
              (t
               ;; Do nothing.
               (setq duplicates nil)))
@@ -1473,7 +1499,7 @@ If update process is interrupted, return nil.")
                                             no-check)
   (let ((killed-list (elmo-folder-killed-list-internal folder))
        (before-append t)
-       old-msgdb diff diff-2 delete-list new-list new-msgdb mark
+       old-msgdb diff diff-2 delete-list new-list new-msgdb flag
        flag-table crossed after-append)
     (setq old-msgdb (elmo-folder-msgdb folder))
     (setq flag-table (elmo-flag-table-load (elmo-folder-msgdb-path folder)))
@@ -1523,10 +1549,10 @@ If update process is interrupted, return nil.")
              (setq before-append nil)
              (setq crossed (elmo-folder-append-msgdb folder new-msgdb))
              ;; process crosspost.
-             ;; Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).
+             ;; Return a cons cell of (NUMBER-CROSSPOSTS . NEW-FLAG-ALIST).
              (elmo-folder-process-crosspost folder)
              (elmo-folder-set-message-modified folder t)
-             (elmo-folder-set-mark-modified-internal folder t))
+             (elmo-folder-set-flag-modified-internal folder t))
            ;; return value.
            (or crossed 0)))
       (quit
@@ -1629,6 +1655,7 @@ Return a hashtable for newsgroups."
   "Initialize ELMO module."
   (elmo-crosspost-message-alist-load)
   (elmo-resque-obsolete-variables)
+  (elmo-global-flag-initialize)
   (elmo-dop-queue-load))
 
 (defun elmo-quit ()
@@ -1641,7 +1668,8 @@ Return a hashtable for newsgroups."
     (while types
       (setq class
            (luna-find-class
-            (intern (format "elmo-%s-folder" (symbol-name (cdr (car types)))))))
+            (intern (format "elmo-%s-folder"
+                            (symbol-name (cdr (car types)))))))
       ;; Call all folder's `elmo-quit' method.
       (if class
          (dolist (func (luna-class-find-functions class 'elmo-quit))
@@ -1714,6 +1742,11 @@ Return a hashtable for newsgroups."
 ;; autoloads
 (autoload 'elmo-dop-queue-flush "elmo-dop")
 (autoload 'elmo-nntp-post "elmo-nntp")
+(autoload 'elmo-global-flag-initialize "elmo-flag")
+(autoload 'elmo-global-flag-p "elmo-flag")
+(autoload 'elmo-global-flag-detach "elmo-flag")
+(autoload 'elmo-global-flag-detach-messages "elmo-flag")
+(autoload 'elmo-global-flag-set "elmo-flag")
 
 (require 'product)
 (product-provide (provide 'elmo) (require 'elmo-version))
index 572d475..1e61701 100644 (file)
 
 ;;; legacy implement
 ;;
+
+(defconst modb-legacy-new-mark "N"
+  "Mark for new message.")
+
+(defconst modb-legacy-unread-uncached-mark "U"
+  "Mark for unread and uncached message.")
+
+(defconst modb-legacy-unread-cached-mark "!"
+  "Mark for unread but already cached message.")
+
+(defconst modb-legacy-read-uncached-mark "u"
+  "Mark for read but uncached message.")
+
+(defconst modb-legacy-answered-cached-mark "&"
+  "Mark for answered and cached message.")
+
+(defconst modb-legacy-answered-uncached-mark "A"
+  "Mark for answered but cached message.")
+
+(defconst modb-legacy-important-mark "$"
+  "Mark for important message.")
+
 (eval-and-compile
   (luna-define-class modb-legacy (modb-generic)
                     (overview number-alist mark-alist index))
 (defsubst elmo-msgdb-set-path (msgdb path)
   (modb-generic-set-location-internal msgdb path))
 
-(defvar elmo-msgdb-unread-marks-internal nil)
-(defsubst elmo-msgdb-unread-marks ()
+(defvar modb-legacy-unread-marks-internal nil)
+(defsubst modb-legacy-unread-marks ()
   "Return an unread mark list"
-  (or elmo-msgdb-unread-marks-internal
-      (setq elmo-msgdb-unread-marks-internal
-           (list elmo-msgdb-new-mark
-                 elmo-msgdb-unread-uncached-mark
-                 elmo-msgdb-unread-cached-mark))))
-
-(defvar elmo-msgdb-answered-marks-internal nil)
-(defsubst elmo-msgdb-answered-marks ()
+  (or modb-legacy-unread-marks-internal
+      (setq modb-legacy-unread-marks-internal
+           (list modb-legacy-new-mark
+                 modb-legacy-unread-uncached-mark
+                 modb-legacy-unread-cached-mark))))
+
+(defvar modb-legacy-answered-marks-internal nil)
+(defsubst modb-legacy-answered-marks ()
   "Return an answered mark list"
-  (or elmo-msgdb-answered-marks-internal
-      (setq elmo-msgdb-answered-marks-internal
-           (list elmo-msgdb-answered-cached-mark
-                 elmo-msgdb-answered-uncached-mark))))
-
-(defvar elmo-msgdb-uncached-marks-internal nil)
-(defsubst elmo-msgdb-uncached-marks ()
-  (or elmo-msgdb-uncached-marks-internal
-      (setq elmo-msgdb-uncached-marks-internal
-           (list elmo-msgdb-new-mark
-                 elmo-msgdb-answered-uncached-mark
-                 elmo-msgdb-unread-uncached-mark
-                 elmo-msgdb-read-uncached-mark))))
-
-(defsubst elmo-msgdb-mark-to-flags (mark)
+  (or modb-legacy-answered-marks-internal
+      (setq modb-legacy-answered-marks-internal
+           (list modb-legacy-answered-cached-mark
+                 modb-legacy-answered-uncached-mark))))
+
+(defvar modb-legacy-uncached-marks-internal nil)
+(defsubst modb-legacy-uncached-marks ()
+  (or modb-legacy-uncached-marks-internal
+      (setq modb-legacy-uncached-marks-internal
+           (list modb-legacy-new-mark
+                 modb-legacy-answered-uncached-mark
+                 modb-legacy-unread-uncached-mark
+                 modb-legacy-read-uncached-mark))))
+
+(defsubst modb-legacy-mark-to-flags (mark)
   (append
-   (and (string= mark elmo-msgdb-new-mark)
+   (and (string= mark modb-legacy-new-mark)
        '(new))
-   (and (string= mark elmo-msgdb-important-mark)
+   (and (string= mark modb-legacy-important-mark)
        '(important))
-   (and (member mark (elmo-msgdb-unread-marks))
+   (and (member mark (modb-legacy-unread-marks))
        '(unread))
-   (and (member mark (elmo-msgdb-answered-marks))
+   (and (member mark (modb-legacy-answered-marks))
        '(answered))
-   (and (not (member mark (elmo-msgdb-uncached-marks)))
+   (and (not (member mark (modb-legacy-uncached-marks)))
        '(cached))))
 
-(defsubst elmo-msgdb-flags-to-mark (flags)
+(defsubst modb-legacy-flags-to-mark (flags)
   (cond ((memq 'new flags)
-        elmo-msgdb-new-mark)
+        modb-legacy-new-mark)
        ((memq 'important flags)
-        elmo-msgdb-important-mark)
+        modb-legacy-important-mark)
        ((memq 'answered flags)
         (if (memq 'cached flags)
-            elmo-msgdb-answered-cached-mark
-          elmo-msgdb-answered-uncached-mark))
+            modb-legacy-answered-cached-mark
+          modb-legacy-answered-uncached-mark))
        ((memq 'unread flags)
         (if (memq 'cached flags)
-            elmo-msgdb-unread-cached-mark
-          elmo-msgdb-unread-uncached-mark))
+            modb-legacy-unread-cached-mark
+          modb-legacy-unread-uncached-mark))
        (t
         (if (memq 'cached flags)
             nil
-          elmo-msgdb-read-uncached-mark))))
+          modb-legacy-read-uncached-mark))))
 
 (defsubst elmo-msgdb-get-mark (msgdb number)
   "Get mark string from MSGDB which corresponds to the message with NUMBER."
@@ -295,7 +317,7 @@ Return a list of message numbers which have duplicated message-ids."
   (length (modb-legacy-overview-internal msgdb)))
 
 (luna-define-method elmo-msgdb-flags ((msgdb modb-legacy) number)
-  (elmo-msgdb-mark-to-flags (elmo-msgdb-get-mark msgdb number)))
+  (modb-legacy-mark-to-flags (elmo-msgdb-get-mark msgdb number)))
 
 (luna-define-method elmo-msgdb-set-flag ((msgdb modb-legacy)
                                         number flag)
@@ -306,7 +328,7 @@ Return a list of message numbers which have duplicated message-ids."
      (elmo-msgdb-unset-flag msgdb number 'cached))
     (t
      (let* ((cur-mark (elmo-msgdb-get-mark msgdb number))
-           (flags (elmo-msgdb-mark-to-flags cur-mark))
+           (flags (modb-legacy-mark-to-flags cur-mark))
            new-mark)
        (and (memq 'new flags)
            (setq flags (delq 'new flags)))
@@ -315,7 +337,7 @@ Return a list of message numbers which have duplicated message-ids."
        (when (and (eq flag 'unread)
                  (memq 'answered flags))
         (setq flags (delq 'answered flags)))
-       (setq new-mark (elmo-msgdb-flags-to-mark flags))
+       (setq new-mark (modb-legacy-flags-to-mark flags))
        (unless (string= new-mark cur-mark)
         (elmo-msgdb-set-mark msgdb number new-mark))))))
 
@@ -328,7 +350,7 @@ Return a list of message numbers which have duplicated message-ids."
      (elmo-msgdb-set-flag msgdb number 'cached))
     (t
      (let* ((cur-mark (elmo-msgdb-get-mark msgdb number))
-           (flags (elmo-msgdb-mark-to-flags cur-mark))
+           (flags (modb-legacy-mark-to-flags cur-mark))
            new-mark)
        (and (memq 'new flags)
            (setq flags (delq 'new flags)))
@@ -337,7 +359,7 @@ Return a list of message numbers which have duplicated message-ids."
        (when (and (eq flag 'unread)
                  (memq 'answered flags))
         (setq flags (delq 'answered flags)))
-       (setq new-mark (elmo-msgdb-flags-to-mark flags))
+       (setq new-mark (modb-legacy-flags-to-mark flags))
        (unless (string= new-mark cur-mark)
         (elmo-msgdb-set-mark msgdb number new-mark))))))
 
@@ -350,25 +372,25 @@ Return a list of message numbers which have duplicated message-ids."
        mark-regexp matched)
     (case flag
       (new
-       (setq mark-regexp (regexp-quote elmo-msgdb-new-mark)))
+       (setq mark-regexp (regexp-quote modb-legacy-new-mark)))
       (unread
-       (setq mark-regexp (elmo-regexp-opt (elmo-msgdb-unread-marks))))
+       (setq mark-regexp (elmo-regexp-opt (modb-legacy-unread-marks))))
       (answered
-       (setq mark-regexp (elmo-regexp-opt (elmo-msgdb-answered-marks))))
+       (setq mark-regexp (elmo-regexp-opt (modb-legacy-answered-marks))))
       (important
-       (setq mark-regexp (regexp-quote elmo-msgdb-important-mark)))
+       (setq mark-regexp (regexp-quote modb-legacy-important-mark)))
       (read
-       (setq mark-regexp (elmo-regexp-opt (elmo-msgdb-unread-marks))))
+       (setq mark-regexp (elmo-regexp-opt (modb-legacy-unread-marks))))
       (digest
        (setq mark-regexp (elmo-regexp-opt
-                         (append (elmo-msgdb-unread-marks)
-                                 (list elmo-msgdb-important-mark)))))
+                         (append (modb-legacy-unread-marks)
+                                 (list modb-legacy-important-mark)))))
       (any
        (setq mark-regexp (elmo-regexp-opt
                          (append
-                          (elmo-msgdb-unread-marks)
-                          (elmo-msgdb-answered-marks)
-                          (list elmo-msgdb-important-mark))))))
+                          (modb-legacy-unread-marks)
+                          (modb-legacy-answered-marks)
+                          (list modb-legacy-important-mark))))))
     (when mark-regexp
       (if (eq flag 'read)
          (dolist (number (elmo-msgdb-list-messages msgdb))
@@ -395,7 +417,7 @@ Return a list of message numbers which have duplicated message-ids."
        (nconc (elmo-msgdb-get-number-alist msgdb)
              (list (cons number message-id))))
       (modb-generic-set-message-modified-internal msgdb t)
-      (when (setq mark (elmo-msgdb-flags-to-mark flags))
+      (when (setq mark (modb-legacy-flags-to-mark flags))
        (elmo-msgdb-set-mark-alist
         msgdb
         (nconc (elmo-msgdb-get-mark-alist msgdb)
index c093895..7dd2782 100644 (file)
@@ -76,8 +76,8 @@ NUMBER is a message number to set flag.
 FLAG is a symbol which is one of the following:
 `new'       ... Message which is new.
 `read'      ... Message which is already read.
-`important' ... Message which is marked as important.
-`answered'  ... Message which is marked as answered.
+`important' ... Message which is important.
+`answered'  ... Message which is answered.
 `cached'    ... Message which is cached.")
 
 (luna-define-generic elmo-msgdb-unset-flag (msgdb number flag)
@@ -87,8 +87,8 @@ NUMBER is a message number to set flag.
 FLAG is a symbol which is one of the following:
 `new'       ... Message which is new.
 `read'      ... Message which is already read.
-`important' ... Message which is marked as important.
-`answered'  ... Message which is marked as answered.
+`important' ... Message which is important.
+`answered'  ... Message which is answered.
 `cached'    ... Message which is cached.")
 
 (luna-define-generic elmo-msgdb-list-messages (msgdb)
index 48729ff..76a5166 100644 (file)
@@ -1,5 +1,32 @@
 2003-09-18  Yuuichi Teranishi  <teranisi@gohome.org>
 
+       * wl-vars.el (wl-folder-sync-range-alist): Set default range for
+       'flag as all.
+       (wl-use-flag-folder-help-echo): New user option.
+
+       * wl-summary.el (wl-summary-detect-mark-position): Bind 
+       wl-summary-highlight as nil.
+       (wl-summary-set-mark-modified): Follow the API change.
+       (wl-summary-mark-modified-p): Ditto.
+       (wl-summary-mark-as-read-all): Ditto.
+       (wl-summary-sync-marks): Don't call
+       elmo-folder-list-messages-with-global-mark.
+       (wl-summary-mark-as-read-internal): Follow the API change.
+       (wl-summary-mark-as-answered-internal): Ditto.
+       (wl-summary-mark-as-important): Cause an error when 'flag folder;
+       Follow the API change.
+       (wl-summary-create-line): Call with number argument.
+       (wl-summary-reply): Follow the API change.
+
+       * wl-highlight.el (wl-highlight-summary-line-flag-folder): New
+       function.
+       (wl-highlight-summary-line-string): Call it when
+       wl-use-flag-folder-help-echo is non-nil.
+       (wl-highlight-summary-current-line): Ditto.
+       (elmo-flag-folder-referrer): Added autoload setting.
+
+       * wl-draft.el (wl-draft-kill): Follow the API change.
+
        * Version number is increased to 2.11.14.
        
 2003-09-17  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
index 16d0a3a..1a2bf75 100644 (file)
@@ -772,11 +772,11 @@ Reply to author if WITH-ARG is non-nil."
                       (string= (wl-summary-buffer-folder-name)
                                folder-name)))
                (with-current-buffer buffer
-                 (elmo-folder-unmark-answered folder (list number))
+                 (elmo-folder-unflag-answered folder (list number))
                  (when (wl-summary-jump-to-msg number)
                    (wl-summary-update-persistent-mark)))
              (elmo-folder-open folder 'load-msgdb)
-             (elmo-folder-unmark-answered folder (list number))
+             (elmo-folder-unflag-answered folder (list number))
              (elmo-folder-close folder))))
        (wl-draft-hide cur-buf)
        (wl-draft-delete cur-buf)))
index ff027e0..b432a6a 100644 (file)
              '(wl-highlight-summary-normal-face)
            '(wl-highlight-summary-thread-top-face)))))))
 
-(defun wl-highlight-summary-line-string (line flags temp-mark indent)
+(defun wl-highlight-summary-line-flag-folder (number beg end &optional string)
+  ;; help-echo for flag folder.
+  (let (flag-info)
+    (current-buffer)
+    (when (eq (elmo-folder-type-internal wl-summary-buffer-elmo-folder)
+             'flag)
+      (setq flag-info
+           (elmo-flag-folder-referrer wl-summary-buffer-elmo-folder
+                                      number))
+      (if flag-info
+         (put-text-property beg end 'help-echo
+                            (concat "The message exists in "
+                                    (mapconcat
+                                     (lambda (pair)
+                                       (concat (car pair) "/"
+                                               (number-to-string
+                                                (cdr pair))))
+                                     flag-info ","))
+                            string)))))
+
+(defun wl-highlight-summary-line-string (number line flags temp-mark indent)
   (let ((fsymbol (car (wl-highlight-summary-line-face-spec
                       flags
                       temp-mark
                       (> (length indent) 0)))))
     (put-text-property 0 (length line) 'face fsymbol line))
-  (if wl-use-highlight-mouse-line
-      (put-text-property 0 (length line) 'mouse-face 'highlight line)))
+  (when wl-use-highlight-mouse-line
+    (put-text-property 0 (length line) 'mouse-face 'highlight line))
+  (when wl-use-flag-folder-help-echo
+    (wl-highlight-summary-line-flag-folder number 0 (length line) line)))
 
 (defun wl-highlight-summary-current-line ()
   (interactive)
                           'wl-highlight-action-argument-face))
       (when wl-use-highlight-mouse-line
        (put-text-property bol eol 'mouse-face 'highlight))
+      (when wl-use-flag-folder-help-echo
+       (wl-highlight-summary-line-flag-folder number bol eol))
       (when wl-use-dnd
        (wl-dnd-set-drag-starter bol eol)))))
 
@@ -1217,6 +1241,9 @@ interpreted as cited text.)"
         (inhibit-read-only t))
     (put-text-property beg end 'mouse-face 'highlight)))
 
+
+(autoload 'elmo-flag-folder-referrer "elmo-flag")
+
 (require 'product)
 (product-provide (provide 'wl-highlight) (require 'wl-version))
 
index dbdd091..f38da63 100644 (file)
@@ -665,6 +665,7 @@ you."
        (dummy-temp (char-to-string 200))
        (wl-summary-new-mark (char-to-string 201)) ; bind only for the check.
        (wl-summary-flag-priority-list '(new))     ; ditto.
+       wl-summary-highlight
        temp persistent)
     (with-temp-buffer
       (setq wl-summary-buffer-number-column column
@@ -1011,10 +1012,10 @@ Entering Folder mode calls the value of `wl-summary-mode-hook'."
 (defun wl-summary-message-modified-p ()
   wl-summary-buffer-message-modified)
 (defun wl-summary-set-mark-modified ()
-  (elmo-folder-set-mark-modified-internal
+  (elmo-folder-set-flag-modified-internal
    wl-summary-buffer-elmo-folder t))
 (defun wl-summary-mark-modified-p ()
-  (elmo-folder-mark-modified-internal
+  (elmo-folder-flag-modified-internal
    wl-summary-buffer-elmo-folder))
 (defun wl-summary-set-thread-modified ()
   (setq wl-summary-buffer-thread-modified t))
@@ -1537,7 +1538,7 @@ If ARG is non-nil, checking is omitted."
       (let ((folder wl-summary-buffer-elmo-folder)
            (cur-buf (current-buffer)))
        (message "Setting all msgs as read...")
-       (elmo-folder-mark-as-read folder
+       (elmo-folder-flag-as-read folder
                                  (elmo-folder-list-unreads
                                   folder))
        (save-excursion
@@ -1667,13 +1668,8 @@ If ARG is non-nil, checking is omitted."
                    wl-summary-buffer-elmo-folder)
                   'internal))
       (message "Updating marks...")
-      (setq importants (elmo-uniq-list
-                       (nconc
-                        (elmo-folder-list-importants
-                         wl-summary-buffer-elmo-folder)
-                        (elmo-folder-list-messages-with-global-mark
-                         wl-summary-buffer-elmo-folder
-                         elmo-msgdb-important-mark)))
+      (setq importants (elmo-folder-list-importants
+                       wl-summary-buffer-elmo-folder)
            unreads (elmo-folder-list-unreads
                     wl-summary-buffer-elmo-folder)
            answereds (elmo-folder-list-answereds
@@ -2857,8 +2853,8 @@ Return non-nil if the mark is updated"
       (if (null number-list)
          (message "No message.")
        (if inverse
-           (elmo-folder-unmark-read folder number-list no-folder-mark)
-         (elmo-folder-mark-as-read folder number-list no-folder-mark))
+           (elmo-folder-unflag-read folder number-list no-folder-mark)
+         (elmo-folder-flag-as-read folder number-list no-folder-mark))
        (dolist (number number-list)
          (setq visible (wl-summary-jump-to-msg number))
          (unless inverse
@@ -2869,7 +2865,7 @@ Return non-nil if the mark is updated"
            (wl-summary-update-persistent-mark)))
        (unless no-modeline-update
          ;; Update unread numbers.
-         ;; should elmo-folder-mark-as-read return unread numbers?
+         ;; should elmo-folder-flag-as-read return unread numbers?
          (wl-summary-count-unread)
          (wl-summary-update-modeline)
          (wl-folder-update-unread
@@ -2912,8 +2908,8 @@ Return non-nil if the mark is updated"
       (if (null number-list)
          (message "No message.")
        (if inverse
-           (elmo-folder-unmark-answered folder number-list)
-         (elmo-folder-mark-as-answered folder number-list))
+           (elmo-folder-unflag-answered folder number-list)
+         (elmo-folder-flag-as-answered folder number-list))
        (dolist (number number-list)
          (setq visible (wl-summary-jump-to-msg number))
          ;; set mark on buffer
@@ -2921,7 +2917,7 @@ Return non-nil if the mark is updated"
            (wl-summary-update-persistent-mark)))
        (unless no-modeline-update
          ;; Update unread numbers.
-         ;; should elmo-folder-mark-as-read return unread numbers?
+         ;; should elmo-flag-mark-as-read return unread numbers?
          (wl-summary-count-unread)
          (wl-summary-update-modeline)
          (wl-folder-update-unread
@@ -2951,7 +2947,7 @@ Return non-nil if the mark is updated"
                                               no-server-update)
   (interactive)
   (if (eq (elmo-folder-type-internal wl-summary-buffer-elmo-folder)
-         'internal)
+         'flag)
       (error "Cannot process mark in this folder"))
   (save-excursion
     (let* ((folder wl-summary-buffer-elmo-folder)
@@ -2979,10 +2975,8 @@ Return non-nil if the mark is updated"
            (progn
              ;; server side mark
              (save-match-data
-               (elmo-folder-unmark-important folder (list number)
+               (elmo-folder-unflag-important folder (list number)
                                              no-server-update)
-               (unless no-server-update
-                 (elmo-msgdb-global-mark-delete message-id))
                ;; Remove cache if local folder.
                (if (and (elmo-folder-local-p folder)
                         (not (eq 'mark
@@ -2990,15 +2984,8 @@ Return non-nil if the mark is updated"
                    (elmo-file-cache-delete
                     (elmo-file-cache-get-path message-id)))))
          ;; server side mark
-         (elmo-folder-mark-as-important folder (list number)
-                                        no-server-update)
-         (if (eq (elmo-file-cache-exists-p message-id) 'entire)
-             (elmo-folder-mark-as-read folder (list number))
-           ;; Force cache message.
-           (elmo-message-encache folder number 'read))
-         (unless no-server-update
-           (elmo-msgdb-global-mark-set message-id
-                                       elmo-msgdb-important-mark))))
+         (elmo-folder-flag-as-important folder (list number)
+                                        no-server-update)))
       (when visible
        (wl-summary-update-persistent-mark))))
   number)
@@ -3116,6 +3103,13 @@ Return non-nil if the mark is updated"
        "@"
       "")))
 
+;;; For future use.
+;;(defun wl-summary-line-cached ()
+;;  (if (elmo-message-cached-p wl-summary-buffer-elmo-folder
+;;                          (elmo-message-entity-number wl-message-entity))
+;;      " "
+;;    "u"))
+
 (defun wl-summary-create-line (wl-message-entity
                               wl-parent-message-entity
                               wl-temp-mark
@@ -3159,10 +3153,12 @@ Return non-nil if the mark is updated"
                        (elmo-msgdb-overview-entity-get-number
                         wl-message-entity))))
     (if wl-summary-highlight
-       (wl-highlight-summary-line-string line
-                                         wl-flags
-                                         wl-temp-mark
-                                         wl-thr-indent-string))
+       (wl-highlight-summary-line-string
+        (elmo-msgdb-overview-entity-get-number wl-message-entity)
+        line
+        wl-flags
+        wl-temp-mark
+        wl-thr-indent-string))
     line))
 
 (defsubst wl-summary-proc-wday (wday-str year month mday)
@@ -3801,7 +3797,7 @@ Reply to author if invoked with ARG."
        (error (set-window-configuration winconf)
               (signal (car err)(cdr err))))
       (with-current-buffer summary-buf
-       (elmo-folder-mark-as-answered folder (list number))
+       (elmo-folder-flag-as-answered folder (list number))
        (wl-summary-update-persistent-mark))
       t)))
 
index fe8b8a5..2ec2e0c 100644 (file)
@@ -2181,7 +2181,8 @@ e.x.
 (defcustom wl-folder-sync-range-alist
   (list (cons (concat "^" (regexp-quote wl-draft-folder) "$\\|^"
                      (regexp-quote wl-queue-folder) "$")
-             "all"))
+             "all")
+       (cons "^'flag" "all"))
   "*Default sync range alist.  If no matches, `wl-default-sync-range' is used."
   :type '(repeat (cons (regexp :tag "Folder Regexp")
                       (choice (const "update")
@@ -2642,7 +2643,12 @@ This variable can also be a regex."
 ;; highilght about mouse
 (defcustom wl-use-highlight-mouse-line (and window-system
                                            (>= emacs-major-version 19))
-  "*Highlight mouse line, if non nil."
+  "*Highlight mouse line, if non-nil."
+  :type 'boolean
+  :group 'wl-highlight)
+
+(defcustom wl-use-flag-folder-help-echo nil
+  "*Display help-echo in the flag folder if non-nil."
   :type 'boolean
   :group 'wl-highlight)