From fb40159a1fc3d4fb1400f8fe3befb1056bc75b8c Mon Sep 17 00:00:00 2001 From: teranisi Date: Fri, 18 Jul 2003 03:59:00 +0000 Subject: [PATCH] * elmo.el (elmo-folder-list-unreads): Don't use msgdb API. (elmo-folder-list-importants): Ditto. (elmo-folder-list-answereds): Ditto. * elmo-multi.el (elmo-folder-mark-as-important): Remove :before qualifier. (elmo-folder-mark-as-read): Ditto. (elmo-folder-unmark-read): Ditto. (elmo-folder-mark-as-answered): Ditto. (elmo-folder-unmark-answered): Ditto. (elmo-folder-list-flagged): Define. (elmo-folder-commit): Ditto. (elmo-folder-length): Ditto. (elmo-folder-count-flags): Ditto. --- elmo/ChangeLog | 17 ++++++++++ elmo/elmo-multi.el | 89 ++++++++++++++++++++++++++++++++++++++-------------- elmo/elmo.el | 6 ++-- 3 files changed, 85 insertions(+), 27 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index ad00910..aa31f36 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,20 @@ +2003-07-18 Yuuichi Teranishi + + * elmo.el (elmo-folder-list-unreads): Don't use msgdb API. + (elmo-folder-list-importants): Ditto. + (elmo-folder-list-answereds): Ditto. + + * elmo-multi.el (elmo-folder-mark-as-important): Remove :before + qualifier. + (elmo-folder-mark-as-read): Ditto. + (elmo-folder-unmark-read): Ditto. + (elmo-folder-mark-as-answered): Ditto. + (elmo-folder-unmark-answered): Ditto. + (elmo-folder-list-flagged): Define. + (elmo-folder-commit): Ditto. + (elmo-folder-length): Ditto. + (elmo-folder-count-flags): Ditto. + 2003-07-17 Yuuichi Teranishi * elmo.el (elmo-folder-detach-messages): New method. diff --git a/elmo/elmo-multi.el b/elmo/elmo-multi.el index e7a7aa6..b854255 100644 --- a/elmo/elmo-multi.el +++ b/elmo/elmo-multi.el @@ -441,58 +441,99 @@ (setq msg-list (cdr msg-list))) ret-val)) -(luna-define-method elmo-folder-mark-as-important :before ((folder - elmo-multi-folder) - numbers - &optional - ignore-flags) +(luna-define-method elmo-folder-mark-as-important ((folder + elmo-multi-folder) + numbers + &optional + ignore-flags) (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) (elmo-folder-mark-as-important (car folder-numbers) (cdr folder-numbers) ignore-flags))) -(luna-define-method elmo-folder-unmark-important :before ((folder - elmo-multi-folder) - numbers - &optional - ignore-flags) +(luna-define-method elmo-folder-unmark-important ((folder + elmo-multi-folder) + numbers + &optional + ignore-flags) (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) (elmo-folder-unmark-important (car folder-numbers) (cdr folder-numbers) ignore-flags))) -(luna-define-method elmo-folder-mark-as-read :before ((folder - elmo-multi-folder) - numbers - &optional ignore-flag) +(luna-define-method elmo-folder-mark-as-read ((folder + elmo-multi-folder) + numbers + &optional ignore-flag) (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) (elmo-folder-mark-as-read (car folder-numbers) (cdr folder-numbers) ignore-flag))) -(luna-define-method elmo-folder-unmark-read :before ((folder - elmo-multi-folder) - numbers - &optional ignore-flag) +(luna-define-method elmo-folder-unmark-read ((folder + elmo-multi-folder) + numbers + &optional ignore-flag) (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) (elmo-folder-unmark-read (car folder-numbers) (cdr folder-numbers) ignore-flag))) -(luna-define-method elmo-folder-mark-as-answered :before ((folder - elmo-multi-folder) - numbers) +(luna-define-method elmo-folder-mark-as-answered ((folder + elmo-multi-folder) + numbers) (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) (elmo-folder-mark-as-answered (car folder-numbers) (cdr folder-numbers)))) -(luna-define-method elmo-folder-unmark-answered :before ((folder - elmo-multi-folder) - numbers) +(luna-define-method elmo-folder-unmark-answered ((folder + elmo-multi-folder) + numbers) (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) (elmo-folder-unmark-answered (car folder-numbers) (cdr folder-numbers)))) +(luna-define-method elmo-folder-list-flagged ((folder elmo-multi-folder) + flag + &optional in-msgdb) + (let ((cur-number 0) + numbers) + (dolist (child (elmo-multi-folder-children-internal folder)) + (setq cur-number (+ cur-number 1) + numbers + (nconc + numbers + (mapcar + (function + (lambda (x) + (+ + (* (elmo-multi-folder-divide-number-internal folder) + cur-number) x))) + (elmo-folder-list-flagged child flag in-msgdb))))) + numbers)) + +(luna-define-method elmo-folder-commit ((folder elmo-multi-folder)) + (dolist (child (elmo-multi-folder-children-internal folder)) + (elmo-folder-commit child))) + +(luna-define-method elmo-folder-length ((folder elmo-multi-folder)) + (let ((sum 0)) + (dolist (child (elmo-multi-folder-children-internal folder)) + (setq sum (+ sum (elmo-folder-length child)))) + sum)) + +(luna-define-method elmo-folder-count-flags ((folder elmo-multi-folder)) + (let ((new 0) + (unreads 0) + (answered 0) + flags) + (dolist (child (elmo-multi-folder-children-internal folder)) + (setq flags (elmo-folder-count-flags child)) + (setq new (+ new (nth 0 flags))) + (setq unreads (+ unreads (nth 1 flags))) + (setq answered (+ answered (nth 2 flags)))) + (list new unreads answered))) + (require 'product) (product-provide (provide 'elmo-multi) (require 'elmo-version)) diff --git a/elmo/elmo.el b/elmo/elmo.el index bb0ea4f..a4e4793 100644 --- a/elmo/elmo.el +++ b/elmo/elmo.el @@ -268,13 +268,13 @@ If optional IN-MSGDB is non-nil, retrieve flag information from msgdb.") (elmo-msgdb-list-flagged (elmo-folder-msgdb folder) flag)) (luna-define-method elmo-folder-list-unreads ((folder elmo-folder)) - (elmo-msgdb-list-flagged (elmo-folder-msgdb folder) 'unread)) + (elmo-folder-list-flagged folder 'unread)) (luna-define-method elmo-folder-list-importants ((folder elmo-folder)) - (elmo-msgdb-list-flagged (elmo-folder-msgdb folder) 'important)) + (elmo-folder-list-flagged folder 'important)) (luna-define-method elmo-folder-list-answereds ((folder elmo-folder)) - (elmo-msgdb-list-flagged (elmo-folder-msgdb folder) 'answered)) + (elmo-folder-list-flagged folder 'answered)) (luna-define-generic elmo-folder-list-messages-internal (folder &optional visible-only) -- 1.7.10.4