wl-summary-update-status-marks.
* modb.el (elmo-msgdb-flag-count): New API.
* modb-standard.el (modb-standard): Added slot flag-count.
(modb-standard-countup-flags): New function.
(modb-standard-load-flag): Call it.
(elmo-msgdb-append): Ditto.
(elmo-msgdb-clear): Clear slot flag-count.
(elmo-msgdb-set-flag): Call modb-standard-countup-flags.
(elmo-msgdb-unset-flag): Treat `all' flag and call
modb-standard-countup-flags.
(elmo-msgdb-flag-count): Define.
(elmo-msgdb-append-entity): Call modb-standard-countup-flags.
(elmo-msgdb-delete-messages): Ditto.
* modb-legacy.el (elmo-msgdb-unset-flag): Treat `all' flag.
(elmo-msgdb-flag-count): Define.
* elmo.el (elmo-folder-list-messages): Undo last change.
(elmo-folder-count-flags): Use elmo-msgdb-flag-count.
(elmo-folder-kill-messages): Unset all flags to numbers.
* elmo-sendlog.el (elmo-folder-delete-messages): Rewrite; use
elmo-folder-kill-messages.
* elmo-nntp.el (elmo-folder-delete-messages): Ditto.
(elmo-nntp-folder-delete-messages): Abolish.
2003-09-27 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
+ * modb.el (elmo-msgdb-flag-count): New API.
+
+ * modb-standard.el (modb-standard): Added slot flag-count.
+ (modb-standard-countup-flags): New function.
+ (modb-standard-load-flag): Call it.
+ (elmo-msgdb-append): Ditto.
+ (elmo-msgdb-clear): Clear slot flag-count.
+ (elmo-msgdb-set-flag): Call modb-standard-countup-flags.
+ (elmo-msgdb-unset-flag): Treat `all' flag and call
+ modb-standard-countup-flags.
+ (elmo-msgdb-flag-count): Define.
+ (elmo-msgdb-append-entity): Call modb-standard-countup-flags.
+ (elmo-msgdb-delete-messages): Ditto.
+
+ * modb-legacy.el (elmo-msgdb-unset-flag): Treat `all' flag.
+ (elmo-msgdb-flag-count): Define.
+
+ * elmo.el (elmo-folder-list-messages): Undo last change.
+ (elmo-folder-count-flags): Use elmo-msgdb-flag-count.
+ (elmo-folder-kill-messages): Unset all flags to numbers.
+
+ * elmo-sendlog.el (elmo-folder-delete-messages): Rewrite; use
+ elmo-folder-kill-messages.
+
+ * elmo-nntp.el (elmo-folder-delete-messages): Ditto.
+ (elmo-nntp-folder-delete-messages): Abolish.
+
* elmo-version.el (elmo-version): Up to 2.11.18.
2003-09-26 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
(luna-define-method elmo-folder-delete-messages ((folder elmo-nntp-folder)
numbers)
- (elmo-nntp-folder-delete-messages folder numbers))
-
-(defun elmo-nntp-folder-delete-messages (folder numbers)
- (let ((killed-list (elmo-folder-killed-list-internal folder)))
- (dolist (number numbers)
- (setq killed-list
- (elmo-msgdb-set-as-killed killed-list number)))
- (elmo-folder-set-killed-list-internal folder killed-list))
+ (elmo-folder-kill-messages folder numbers)
t)
(luna-define-method elmo-folder-exists-p-plugged ((folder elmo-nntp-folder))
(luna-define-method elmo-folder-delete-messages ((folder elmo-sendlog-folder)
numbers)
- (let ((killed-list (elmo-folder-killed-list-internal folder)))
- (dolist (number numbers)
- (setq killed-list
- (elmo-msgdb-set-as-killed killed-list number)))
- (elmo-folder-set-killed-list-internal folder killed-list))
+ (elmo-folder-kill-messages folder numbers)
t)
(luna-define-method elmo-message-file-p ((folder elmo-sendlog-folder) number)
(setq list (elmo-msgdb-list-messages (elmo-folder-msgdb folder))))
(if visible-only
(elmo-living-messages list killed-list)
- (elmo-uniq-list
- (nconc (elmo-number-set-to-number-list killed-list) list)))))
+ list)))
(luna-define-generic elmo-folder-list-unreads (folder)
"Return a list of unread message numbers contained in FOLDER.")
Return a list of numbers (`new' `unread' `answered')")
(luna-define-method elmo-folder-count-flags ((folder elmo-folder))
- (let ((new 0)
- (unreads 0)
- (answered 0)
- flags)
- (dolist (number (elmo-folder-list-messages folder 'visible 'in-msgdb))
- (setq flags (elmo-message-flags folder number))
- (cond
- ((memq 'new flags)
- (incf new))
- ((memq 'unread flags)
- (incf unreads))
- ((memq 'answered flags)
- (incf answered))))
- (list new unreads answered)))
+ (let* ((flag-count (elmo-msgdb-flag-count (elmo-folder-msgdb folder)))
+ (new (or (cdr (assq 'new flag-count)) 0))
+ (unread (or (cdr (assq 'unread flag-count)) 0))
+ (answered(or (cdr (assq 'answered flag-count)) 0)))
+ (list new (- unread new) answered)))
(defun elmo-message-set-flag (folder number flag &optional is-local)
"Set message flag.
(defun elmo-folder-kill-messages (folder numbers)
"Kill(hide) messages in the FOLDER with NUMBERS."
- (elmo-folder-set-killed-list-internal
- folder
- (elmo-number-set-append-list (elmo-folder-killed-list-internal
- folder) numbers)))
+ (let ((msgdb (elmo-folder-msgdb folder))
+ (killed (elmo-folder-killed-list-internal folder)))
+ (dolist (number numbers)
+ (elmo-number-set-append killed number)
+ (elmo-msgdb-unset-flag msgdb number 'all))
+ (elmo-folder-set-killed-list-internal folder killed)))
(luna-define-method elmo-folder-clear ((folder elmo-folder)
(elmo-msgdb-set-flag msgdb number 'unread))
(uncached
(elmo-msgdb-set-flag msgdb number 'cached))
+ (all
+ (elmo-msgdb-set-mark msgdb number nil))
(t
(let* ((cur-mark (elmo-msgdb-get-mark msgdb number))
(flags (modb-legacy-mark-to-flags cur-mark))
(unless (string= new-mark cur-mark)
(elmo-msgdb-set-mark msgdb number new-mark))))))
+(luna-define-method elmo-msgdb-flag-count ((msgdb modb-legacy))
+ (let ((new 0)
+ (unread 0)
+ (answered 0))
+ (dolist (elem (elmo-msgdb-get-mark-alist msgdb))
+ (cond
+ ((string= (cadr elem) modb-legacy-new-mark)
+ (incf new)
+ (incf unread))
+ ((member (cadr elem) (modb-legacy-unread-marks))
+ (incf unread))
+ ((member (cadr elem) (modb-legacy-answered-marks))
+ (incf answered))))
+ (list (cons 'new new)
+ (cons 'unread unread)
+ (cons 'answered answered))))
+
(luna-define-method elmo-msgdb-list-messages ((msgdb modb-legacy))
(mapcar 'elmo-msgdb-overview-entity-get-number-internal
(elmo-msgdb-get-overview msgdb)))
(number-list ; sorted list of message numbers.
entity-map ; number, msg-id -> entity mapping.
flag-map ; number -> flag-list mapping
+ flag-count ; list of (FLAG . COUNT)
))
(luna-define-internal-accessors 'modb-standard))
(throw 'done t))
(setq check-flags (cdr check-flags)))))
+(defsubst modb-standard-countup-flags (modb flags &optional delta)
+ (let ((flag-count (modb-standard-flag-count-internal modb))
+ (delta (or delta 1))
+ elem)
+ (dolist (flag flags)
+ (if (setq elem (assq flag flag-count))
+ (setcdr elem (+ (cdr elem) delta))
+ (setq flag-count (cons (cons flag delta) flag-count))))
+ (modb-standard-set-flag-count-internal modb flag-count)))
;; save and load functions
(defun modb-standard-load-msgid (modb path)
(elmo-make-hash (elmo-msgdb-length modb)))))
(dolist (info (elmo-object-load
(expand-file-name modb-standard-flag-filename path)))
+ (modb-standard-countup-flags modb (cdr info))
(elmo-set-hash-val (modb-standard-key (car info)) info table))
(modb-standard-set-flag-map-internal modb table)))
(symbol-value atom)
table))
(modb-standard-flag-map msgdb-append)))
+ ;; flag-count
+ (dolist (pair (modb-standard-flag-count-internal msgdb-append))
+ (modb-standard-countup-flags msgdb (list (car pair)) (cdr pair)))
;; modification flags
(dolist (number (modb-standard-number-list-internal msgdb-append))
(modb-standard-set-message-modified msgdb number)
(luna-define-method elmo-msgdb-clear :after ((msgdb modb-standard))
(modb-standard-set-number-list-internal msgdb nil)
(modb-standard-set-entity-map-internal msgdb nil)
- (modb-standard-set-flag-map-internal msgdb nil))
+ (modb-standard-set-flag-map-internal msgdb nil)
+ (modb-standard-set-flag-count-internal msgdb nil))
(luna-define-method elmo-msgdb-length ((msgdb modb-standard))
(length (modb-standard-number-list-internal msgdb)))
(elmo-msgdb-unset-flag msgdb number 'cached))
(t
(let* ((cur-flags (modb-standard-message-flags msgdb number))
- (new-flags (copy-sequence cur-flags)))
+ (new-flags (copy-sequence cur-flags))
+ diff)
(and (memq 'new new-flags)
(setq new-flags (delq 'new new-flags)))
(or (memq flag new-flags)
(memq 'answered new-flags))
(setq new-flags (delq 'answered new-flags)))
(unless (equal new-flags cur-flags)
+ (setq diff (elmo-list-diff new-flags cur-flags))
+ (modb-standard-countup-flags msgdb (car diff))
+ (modb-standard-countup-flags msgdb (cadr diff) -1)
(elmo-set-hash-val (modb-standard-key number)
(cons number new-flags)
(modb-standard-flag-map msgdb))
(elmo-msgdb-set-flag msgdb number 'unread))
(uncached
(elmo-msgdb-set-flag msgdb number 'cached))
+ (all
+ (modb-standard-countup-flags msgdb
+ (modb-standard-message-flags msgdb number)
+ -1)
+ (elmo-clear-hash-val (modb-standard-key number)
+ (modb-standard-flag-map msgdb)))
(t
(let* ((cur-flags (modb-standard-message-flags msgdb number))
- (new-flags (copy-sequence cur-flags)))
+ (new-flags (copy-sequence cur-flags))
+ diff)
(and (memq 'new new-flags)
(setq new-flags (delq 'new new-flags)))
(and (memq flag new-flags)
(memq 'answered new-flags))
(setq new-flags (delq 'answered new-flags)))
(unless (equal new-flags cur-flags)
+ (setq diff (elmo-list-diff new-flags cur-flags))
+ (modb-standard-countup-flags msgdb (car diff))
+ (modb-standard-countup-flags msgdb (cadr diff) -1)
(elmo-set-hash-val (modb-standard-key number)
(cons number new-flags)
(modb-standard-flag-map msgdb))
(modb-standard-set-flag-modified msgdb number))))))
+(luna-define-method elmo-msgdb-flag-count ((msgdb modb-standard))
+ (modb-standard-flag-count-internal msgdb))
+
(luna-define-method elmo-msgdb-list-messages ((msgdb modb-standard))
(copy-sequence
(modb-standard-number-list-internal msgdb)))
(modb-standard-key number)
(cons number flags)
(modb-standard-flag-map msgdb))
+ (modb-standard-countup-flags msgdb flags)
(modb-standard-set-flag-modified msgdb number))
duplicate))
;; entity-map
(elmo-clear-hash-val key entity-map)
(elmo-clear-hash-val (modb-standard-entity-id entity) entity-map)
+ ;; flag-count (must be BEFORE flag-map)
+ (modb-standard-countup-flags
+ msgdb
+ (modb-standard-message-flags msgdb number)
+ -1)
;; flag-map
(elmo-clear-hash-val key flag-map)
(modb-standard-set-message-modified msgdb number)
`answered' ... Message which is answered.
`cached' ... Message which is cached.")
+(luna-define-generic elmo-msgdb-flag-count (msgdb)
+ "Return a list of cons cell as (flag . count).
+The count is number of message which is set flag in the MSGDB.")
+
(luna-define-generic elmo-msgdb-list-messages (msgdb)
"Return a list of message numbers in the MSGDB.")
2003-09-27 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
+ * wl-summary.el (wl-summary-sync-update): Don't call
+ wl-summary-update-status-marks.
+
* Version number is increased to 2.11.18.
2003-09-26 Yuuichi Teranishi <teranisi@gohome.org>
(when delete-list
(wl-summary-delete-messages-on-buffer delete-list))
- (wl-summary-update-status-marks)
(setq num (length append-list))
(setq i 0)
(setq wl-summary-delayed-update nil)