From: teranisi Date: Fri, 13 Sep 2002 04:15:20 +0000 (+0000) Subject: * elmo-pop3.el (elmo-folder-msgdb-create): Follow the API change. X-Git-Tag: elmo-mark-restart~154 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=6a04c1030e0afd6d3705aed1d1d56bf41a01abe6;p=elisp%2Fwanderlust.git * elmo-pop3.el (elmo-folder-msgdb-create): Follow the API change. (elmo-pop3-msgdb-create-by-header): Ditto. (elmo-pop3-msgdb-create-message): Ditto. * elmo-shimbun.el (elmo-folder-msgdb-create): Ditto. * elmo-sendlog.el (elmo-folder-msgdb-create): Ditto. * elmo-nmz.el (elmo-folder-msgdb-create): Ditto. * elmo-nntp.el (elmo-nntp-create-msgdb-from-overview-string): Ditto. (elmo-folder-msgdb-create): Ditto. (elmo-nntp-folder-msgdb-create): Ditto. (elmo-nntp-msgdb-create-by-header): Ditto. (elmo-nntp-msgdb-create-message): Ditto. (elmo-folder-list-unreads): Define. * elmo-pipe.el (elmo-folder-msgdb-create): Ditto. (elmo-folder-append-messages): Ditto. (elmo-folder-list-unreads): Define. (elmo-folder-list-importants): Ditto. (elmo-folder-list-answereds): Ditto. * elmo-net.el (elmo-folder-list-unreads): Define. (elmo-folder-list-importants): Ditto. (elmo-folder-list-answereds): Ditto. (elmo-folder-list-answereds-plugged): Ditto. (elmo-folder-msgdb-create): Follow the API change. (elmo-folder-msgdb-create-unplugged): Ditto. (elmo-folder-unmark-answered): Define. (elmo-folder-mark-as-answered-unplugged): Ditto. (elmo-folder-unmark-answered-unplugged): Ditto. * elmo-msgdb.el (elmo-msgdb-new-mark): New user option. (elmo-msgdb-unread-uncached-mark): Ditto. (elmo-msgdb-unread-cached-mark): Ditto. (elmo-msgdb-read-uncached-mark): Ditto. (elmo-msgdb-answered-cached-mark): Ditto. (elmo-msgdb-answered-uncached-mark): Ditto. (elmo-msgdb-important-mark): Ditto. (elmo-msgdb-set-mark): Rewrite. (elmo-msgdb-count-marks): Rewrite. (elmo-msgdb-mark-alist-set): Abolish. (elmo-msgdb-seen-list): Removed argument `seen-marks'. (elmo-msgdb-add-msgs-to-seen-list): Likewise. * elmo-multi.el (elmo-folder-check): Call elmo-folder-synchronize. (elmo-folder-close): Define. (elmo-folder-msgdb-create): Follow the API change. (elmo-folder-list-unreads): Rewrite. (elmo-folder-mark-as-important): Ditto. (elmo-folder-unmark-important): Ditto. (elmo-folder-mark-as-read): Ditto. (elmo-folder-unmark-read): Ditto. (elmo-folder-mark-as-answered): Define. (elmo-folder-unmark-answered): Ditto. * elmo-localdir.el (elmo-folder-msgdb-create): Follow the API change. (elmo-folder-append-messages): Ditto. * elmo-mark.el (elmo-folder-msgdb-create): Ditto. * elmo-map.el (elmo-folder-list-unreads): Ditto. (elmo-folder-list-importants): Ditto. * elmo-maildir.el (elmo-folder-msgdb-create): Ditto. (elmo-folder-append-messages): Ditto. --- diff --git a/elmo/elmo-localdir.el b/elmo/elmo-localdir.el index 2fa24e5..4907de0 100644 --- a/elmo/elmo-localdir.el +++ b/elmo/elmo-localdir.el @@ -140,10 +140,6 @@ (luna-define-method elmo-folder-msgdb-create ((folder elmo-localdir-folder) numbers - new-mark - already-mark - seen-mark - important-mark seen-list) (when numbers (let ((dir (elmo-localdir-folder-directory-internal folder)) @@ -172,10 +168,10 @@ (if (elmo-file-cache-exists-p message-id) ; XXX (if seen nil - already-mark) + elmo-msgdb-unread-cached-mark) (if seen nil ;;seen-mark - new-mark)))) + elmo-msgdb-new-mark)))) (setq mark-alist (elmo-msgdb-mark-append mark-alist @@ -227,7 +223,7 @@ (luna-define-method elmo-folder-append-messages :around ((folder elmo-localdir-folder) - src-folder numbers unread-marks &optional same-number) + src-folder numbers &optional same-number) (if (elmo-folder-message-file-p src-folder) (let ((dir (elmo-localdir-folder-directory-internal folder)) (succeeds numbers) diff --git a/elmo/elmo-maildir.el b/elmo/elmo-maildir.el index 8ff700d..eb07a04 100644 --- a/elmo/elmo-maildir.el +++ b/elmo/elmo-maildir.el @@ -132,8 +132,7 @@ LOCATION." (elmo-maildir-folder-flagged-locations-internal folder)) (luna-define-method elmo-folder-msgdb-create - ((folder elmo-maildir-folder) - numbers new-mark already-mark seen-mark important-mark seen-list) + ((folder elmo-maildir-folder) numbers seen-list) (let* ((unread-list (elmo-maildir-folder-unread-locations-internal folder)) (flagged-list (elmo-maildir-folder-flagged-locations-internal folder)) (len (length numbers)) @@ -159,9 +158,9 @@ LOCATION." entity))) (cond ((member location unread-list) - (setq mark new-mark)) ; unread! + (setq mark elmo-msgdb-new-mark)) ; unread! ((member location flagged-list) - (setq mark important-mark))) + (setq mark elmo-msgdb-important-mark))) (if (setq mark (or (elmo-msgdb-global-mark-get (elmo-msgdb-overview-entity-get-id entity)) @@ -394,7 +393,7 @@ file name for maildir directories." (luna-define-method elmo-folder-append-messages :around ((folder elmo-maildir-folder) - src-folder numbers unread-marks &optional same-number) + src-folder numbers &optional same-number) (if (elmo-folder-message-file-p src-folder) (let ((dir (elmo-maildir-folder-directory-internal folder)) (succeeds numbers) diff --git a/elmo/elmo-map.el b/elmo/elmo-map.el index cb13519..69ab1c9 100644 --- a/elmo/elmo-map.el +++ b/elmo/elmo-map.el @@ -291,18 +291,21 @@ (elmo-map-message-location folder number) strategy section unread)) -(luna-define-method elmo-folder-list-unreads-internal - ((folder elmo-map-folder) unread-marks &optional mark-alist) - (elmo-map-folder-locations-to-numbers - folder - (elmo-map-folder-list-unreads folder))) +(luna-define-method elmo-folder-list-unreads ((folder elmo-map-folder)) + (let ((locations (elmo-map-folder-list-unreads folder))) + (if (listp locations) + (elmo-map-folder-locations-to-numbers + folder + (elmo-map-folder-list-unreads folder))))) -(luna-define-method elmo-folder-list-importants-internal - ((folder elmo-map-folder) important-mark) +(luna-define-method elmo-folder-list-importants ((folder elmo-map-folder)) (let ((locations (elmo-map-folder-list-importants folder))) (if (listp locations) - (elmo-map-folder-locations-to-numbers folder locations) - t))) + (elmo-uniq-list + (nconc (elmo-map-folder-locations-to-numbers folder locations) + (elmo-folder-list-messages-with-global-mark + folder elmo-msgdb-important-mark))) + (luna-call-next-method)))) (luna-define-method elmo-folder-delete-messages ((folder elmo-map-folder) numbers) @@ -318,7 +321,6 @@ folder)) (elmo-map-folder-location-alist-internal folder)))) t) ; success - (require 'product) (product-provide (provide 'elmo-map) (require 'elmo-version)) diff --git a/elmo/elmo-mark.el b/elmo/elmo-mark.el index 02cdde2..cc2cc44 100644 --- a/elmo/elmo-mark.el +++ b/elmo/elmo-mark.el @@ -84,15 +84,10 @@ (elmo-map-message-location folder number))) (luna-define-method elmo-folder-msgdb-create ((folder elmo-mark-folder) - numbers new-mark - already-mark seen-mark - important-mark - seen-list) - (elmo-mark-folder-msgdb-create folder numbers new-mark already-mark - seen-mark important-mark)) - -(defun elmo-mark-folder-msgdb-create (folder numbers new-mark already-mark - seen-mark important-mark) + numbers seen-list) + (elmo-mark-folder-msgdb-create folder numbers)) + +(defun elmo-mark-folder-msgdb-create (folder numbers) (let ((i 0) (len (length numbers)) overview number-alist mark-alist entity message-id @@ -165,10 +160,6 @@ t) ;;; To override elmo-map-folder methods. -(luna-define-method elmo-folder-list-unreads-internal - ((folder elmo-mark-folder) unread-marks &optional mark-alist) - t) - (luna-define-method elmo-folder-unmark-important ((folder elmo-mark-folder) numbers) t) diff --git a/elmo/elmo-msgdb.el b/elmo/elmo-msgdb.el index 6eda5f8..32203ea 100644 --- a/elmo/elmo-msgdb.el +++ b/elmo/elmo-msgdb.el @@ -38,6 +38,42 @@ (require 'std11) (require 'mime) +(defcustom elmo-msgdb-new-mark "N" + "Mark for new message." + :type '(string :tag "Mark") + :group 'elmo) + +(defcustom elmo-msgdb-unread-uncached-mark "U" + "Mark for unread and uncached message." + :type '(string :tag "Mark") + :group 'elmo) + +(defcustom elmo-msgdb-unread-cached-mark "!" + "Mark for unread but already cached message." + :type '(string :tag "Mark") + :group 'elmo) + +(defcustom elmo-msgdb-read-uncached-mark "u" + "Mark for read but uncached message." + :type '(string :tag "Mark") + :group 'elmo) + +;; Not implemented yet. +(defcustom elmo-msgdb-answered-cached-mark "&" + "Mark for answered and cached message." + :type '(string :tag "Mark") + :group 'elmo) + +(defcustom elmo-msgdb-answered-uncached-mark "A" + "Mark for answered but cached message." + :type '(string :tag "Mark") + :group 'elmo) + +(defcustom elmo-msgdb-important-mark"$" + "Mark for important message." + :type '(string :tag "Mark") + :group 'elmo) + ;;; MSGDB interface. (defun elmo-load-msgdb (path) "Load the MSGDB from PATH." @@ -60,25 +96,175 @@ (defsubst elmo-msgdb-set-mark (msgdb number mark) "Set MARK of the message with NUMBER in the MSGDB. if MARK is nil, mark is removed." - (elmo-msgdb-set-mark-alist - msgdb - (elmo-msgdb-mark-alist-set (elmo-msgdb-get-mark-alist msgdb) - number - mark msgdb)) - (unless mark - (elmo-clear-hash-val (format "#%d" number) - (elmo-msgdb-get-mark-hashtb msgdb)))) - -(defsubst elmo-msgdb-count-marks (msgdb new-mark unread-marks) + (let ((elem (elmo-get-hash-val (format "#%d" number) + (elmo-msgdb-get-mark-hashtb msgdb)))) + (if elem + (if mark + ;; Set mark of the elem + (setcar (cdr elem) mark) + ;; Delete elem from mark-alist + (elmo-msgdb-set-mark-alist + msgdb + (delq elem (elmo-msgdb-get-mark-alist msgdb))) + (elmo-clear-hash-val (format "#%d" number) + (elmo-msgdb-get-mark-hashtb msgdb))) + (when mark + ;; Append new element. + (elmo-msgdb-set-mark-alist + msgdb + (nconc + (elmo-msgdb-get-mark-alist msgdb) + (list (setq elem (list number mark))))) + (elmo-set-hash-val (format "#%d" number) elem + (elmo-msgdb-get-mark-hashtb msgdb)))))) + +(defun elmo-msgdb-set-cached (msgdb number cached) + "Set message cache status." + (let* ((cur-mark (elmo-msgdb-get-mark msgdb number)) + (cur-status (cond + ((string= cur-mark elmo-msgdb-important-mark) + 'important) + ((member cur-mark (elmo-msgdb-answered-marks)) + 'answered) + ((not (member cur-mark (elmo-msgdb-unread-marks))) + 'read))) + (cur-cached (not (member cur-mark (elmo-msgdb-uncached-marks))))) + (unless (eq (not cached) (not cur-cached)) + (case cur-status + (read + (elmo-msgdb-set-mark msgdb number + (unless cached + elmo-msgdb-read-uncached-mark))) + (important nil) + (answered + (elmo-msgdb-set-mark msgdb number + (if cached + elmo-msgdb-answered-cached-mark + elmo-msgdb-answered-uncached-mark))) + (t + (elmo-msgdb-set-mark msgdb number + (if cached + elmo-msgdb-unread-cached-mark + elmo-msgdb-unread-uncached-mark))))))) + +(defun elmo-msgdb-set-status (msgdb folder number status) + "Set message status. +MSGDB is the ELMO msgdb. +FOLDER is a ELMO folder structure. +NUMBER is a message number to be set status. +STATUS is a symbol which is one of the following: +`read' ... Messages which are already read. +`important' ... Messages which are marked as important. +`answered' ... Messages which are marked as answered." + (let* ((cur-mark (elmo-msgdb-get-mark msgdb number)) + (use-cache (elmo-message-use-cache-p folder number)) + (cur-status (cond + ((string= cur-mark elmo-msgdb-important-mark) + 'important) + ((member cur-mark (elmo-msgdb-answered-marks)) + 'answered) + ((not (member cur-mark (elmo-msgdb-unread-marks))) + 'read))) + (cur-cached (not (member cur-mark (elmo-msgdb-uncached-marks)))) + mark-modified) + (case status + (read + (case cur-status + ((read important answered)) + (t (elmo-msgdb-set-mark msgdb number + (if (and use-cache cur-cached) + (elmo-msgdb-set-mark + msgdb number + elmo-msgdb-read-uncached-mark))) + (setq mark-modified t)))) + (important + (unless (eq cur-status 'important) + (elmo-msgdb-set-mark msgdb number elmo-msgdb-important-mark) + (setq mark-modified t))) + (answered + (unless (or (eq cur-status 'answered) (eq cur-status 'important)) + (elmo-msgdb-set-mark msgdb number + (if cur-cached + (if use-cache + elmo-msgdb-answered-cached-mark + elmo-msgdb-answered-uncached-mark) + elmo-msgdb-answered-uncached-mark))) + (setq mark-modified t))) + (if mark-modified (elmo-folder-set-mark-modified-internal folder t)))) + +(defun elmo-msgdb-unset-status (msgdb folder number status) + "Unset message status. +MSGDB is the ELMO msgdb. +FOLDER is a ELMO folder structure. +NUMBER is a message number to be set status. +STATUS is a symbol which is one of the following: +`read' ... Messages which are already read. +`important' ... Messages which are marked as important. +`answered' ... Messages which are marked as answered." + (let* ((cur-mark (elmo-msgdb-get-mark msgdb number)) + (use-cache (elmo-message-use-cache-p folder number)) + (cur-status (cond + ((string= cur-mark elmo-msgdb-important-mark) + 'important) + ((member cur-mark (elmo-msgdb-answered-marks)) + 'answered) + ((not (member cur-mark (elmo-msgdb-unread-marks))) + 'read))) + (cur-cached (not (member cur-mark (elmo-msgdb-uncached-marks))))) + (case status + (read + (if (eq cur-status 'read) + (elmo-msgdb-set-mark msgdb number + (if (and cur-cached use-cache) + elmo-msgdb-unread-cached-mark + elmo-msgdb-unread-uncached-mark)))) + (important + (if (eq cur-status 'important) + (elmo-msgdb-set-mark msgdb number nil))) + (answered + (if (eq cur-status 'answered) + (elmo-msgdb-set-mark msgdb number + (if (and cur-cached (not use-cache)) + elmo-msgdb-read-uncached-mark))))))) + +(defvar elmo-msgdb-unread-marks-internal nil) +(defsubst elmo-msgdb-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 () + "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-answered-uncached-mark + elmo-msgdb-unread-uncached-mark + elmo-msgdb-read-uncached-mark)))) + +(defsubst elmo-msgdb-count-marks (msgdb) (let ((new 0) - (unreads 0)) + (unreads 0) + (answered 0)) (dolist (elem (elmo-msgdb-get-mark-alist msgdb)) (cond - ((string= (cadr elem) new-mark) + ((string= (cadr elem) elmo-msgdb-new-mark) (incf new)) - ((member (cadr elem) unread-marks) - (incf unreads)))) - (cons new unreads))) + ((member (cadr elem) (elmo-msgdb-unread-marks)) + (incf unreads)) + ((member (cadr elem) (elmo-msgdb-answered-marks)) + (incf answered)))) + (list new unreads answered))) (defsubst elmo-msgdb-get-number (msgdb message-id) "Get number of the message which corrensponds to MESSAGE-ID from MSGDB." @@ -253,30 +439,13 @@ content of MSGDB is changed." ;;; ;; persistent mark handling ;; (for each folder) -(defun elmo-msgdb-mark-alist-set (alist id mark msgdb) - (let ((ret-val alist) - entity) - (setq entity (assq id alist)) - (if entity - (if (eq mark nil) - ;; delete this entity - (setq ret-val (delq entity alist)) - ;; set mark - (setcar (cdr entity) mark)) - (when mark - (setq ret-val (elmo-msgdb-append-element ret-val - (setq entity - (list id mark)))) - (elmo-set-hash-val (format "#%d" id) entity - (elmo-msgdb-get-mark-hashtb msgdb)))) - ret-val)) (defun elmo-msgdb-mark-append (alist id mark) "Append mark." (setq alist (elmo-msgdb-append-element alist (list id mark)))) -(defun elmo-msgdb-seen-list (msgdb seen-marks) +(defun elmo-msgdb-seen-list (msgdb) "Get SEEN-MSGID-LIST from MSGDB." (let ((ov (elmo-msgdb-get-overview msgdb)) mark seen-list) @@ -284,7 +453,8 @@ content of MSGDB is changed." (if (setq mark (elmo-msgdb-get-mark msgdb (elmo-msgdb-overview-entity-get-number (car ov)))) - (if (and mark (member mark seen-marks)) + (if (and mark (member mark (list elmo-msgdb-important-mark + elmo-msgdb-read-uncached-mark))) (setq seen-list (cons (elmo-msgdb-overview-entity-get-id (car ov)) seen-list))) @@ -749,12 +919,12 @@ header separator." elmo-msgdb-directory) alist)) -(defun elmo-msgdb-add-msgs-to-seen-list (msgs msgdb unread-marks seen-list) +(defun elmo-msgdb-add-msgs-to-seen-list (msgs msgdb seen-list) ;; Add to seen list. (let (mark) (while msgs (if (setq mark (elmo-msgdb-get-mark msgdb (car msgs))) - (unless (member mark unread-marks) ;; not unread mark + (unless (member mark (elmo-msgdb-unread-marks)) ;; not unread mark (setq seen-list (cons (elmo-msgdb-get-field msgdb (car msgs) 'message-id) diff --git a/elmo/elmo-multi.el b/elmo/elmo-multi.el index bf636c0..26149cd 100644 --- a/elmo/elmo-multi.el +++ b/elmo/elmo-multi.el @@ -65,12 +65,16 @@ (luna-define-method elmo-folder-check ((folder elmo-multi-folder)) (dolist (fld (elmo-multi-folder-children-internal folder)) - (elmo-folder-check fld))) + (elmo-folder-synchronize fld))) (luna-define-method elmo-folder-close-internal ((folder elmo-multi-folder)) (dolist (fld (elmo-multi-folder-children-internal folder)) (elmo-folder-close-internal fld))) +(luna-define-method elmo-folder-close :around ((folder elmo-multi-folder)) + (dolist (fld (elmo-multi-folder-children-internal folder)) + (elmo-folder-close fld))) + (luna-define-method elmo-folder-expand-msgdb-path ((folder elmo-multi-folder)) (expand-file-name (elmo-replace-string-as-filename @@ -152,9 +156,7 @@ numbers-list)) (luna-define-method elmo-folder-msgdb-create ((folder elmo-multi-folder) - numbers new-mark already-mark - seen-mark important-mark - seen-list) + numbers seen-list) (let* ((folders (elmo-multi-folder-children-internal folder)) overview number-alist mark-alist entity numbers-list @@ -171,8 +173,6 @@ (elmo-multi-msgdb (elmo-folder-msgdb-create (nth cur-number folders) (nth cur-number numbers-list) - new-mark already-mark - seen-mark important-mark seen-list) (* (elmo-multi-folder-divide-number-internal folder) (1+ cur-number)))))) @@ -385,70 +385,53 @@ (setq result (nconc result (list one-alist)))) result)) -(luna-define-method elmo-folder-list-unreads-internal - ((folder elmo-multi-folder) unread-marks &optional mark-alist) - (elmo-multi-folder-list-unreads-internal folder unread-marks)) - -(defun elmo-multi-folder-list-unreads-internal (folder unread-marks) - (let ((folders (elmo-multi-folder-children-internal folder)) - (mark-alists (elmo-multi-split-mark-alist - folder - (elmo-msgdb-get-mark-alist - (elmo-folder-msgdb folder)))) - (cur-number 0) - unreads - all-unreads) - (while folders +(luna-define-method elmo-folder-list-unreads ((folder elmo-multi-folder)) + (let ((cur-number 0) + unreads) + (dolist (child (elmo-multi-folder-children-internal folder)) (setq cur-number (+ cur-number 1)) - (unless (listp (setq unreads - (elmo-folder-list-unreads-internal - (car folders) unread-marks (car mark-alists)))) - (setq unreads (delq nil - (mapcar - (lambda (x) - (if (member (cadr x) unread-marks) - (car x))) - (car mark-alists))))) - (setq all-unreads - (nconc all-unreads - (mapcar - (lambda (x) - (+ x - (* cur-number - (elmo-multi-folder-divide-number-internal - folder)))) - unreads))) - (setq mark-alists (cdr mark-alists) - folders (cdr folders))) - all-unreads)) - -(luna-define-method elmo-folder-list-importants-internal - ((folder elmo-multi-folder) important-mark) - (let ((folders (elmo-multi-folder-children-internal folder)) - (mark-alists (elmo-multi-split-mark-alist - folder - (elmo-msgdb-get-mark-alist - (elmo-folder-msgdb folder)))) - (cur-number 0) - importants - all-importants) - (while folders + (setq unreads + (nconc + unreads + (mapcar (lambda (x) + (+ x (* cur-number + (elmo-multi-folder-divide-number-internal + folder)))) + (elmo-folder-list-unreads child))))) + unreads)) + +(luna-define-method elmo-folder-list-answereds ((folder elmo-multi-folder)) + (let ((cur-number 0) + answereds) + (dolist (child (elmo-multi-folder-children-internal folder)) (setq cur-number (+ cur-number 1)) - (when (listp (setq importants - (elmo-folder-list-importants-internal - (car folders) important-mark))) - (setq all-importants - (nconc all-importants - (mapcar - (lambda (x) - (+ x - (* cur-number - (elmo-multi-folder-divide-number-internal - folder)))) - importants)))) - (setq mark-alists (cdr mark-alists) - folders (cdr folders))) - all-importants)) + (setq answereds + (nconc + answereds + (mapcar (lambda (x) + (+ x (* cur-number + (elmo-multi-folder-divide-number-internal + folder)))) + (elmo-folder-list-answereds child))))) + answereds)) + +(luna-define-method elmo-folder-list-importants ((folder elmo-multi-folder)) + (let ((cur-number 0) + importants) + (dolist (child (elmo-multi-folder-children-internal folder)) + (setq cur-number (+ cur-number 1)) + (setq importants + (nconc + importants + (mapcar (lambda (x) + (+ x (* cur-number + (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))))) (luna-define-method elmo-folder-list-messages-internal ((folder elmo-multi-folder) &optional nohide) @@ -601,33 +584,53 @@ (setq msg-list (cdr msg-list))) ret-val)) -(luna-define-method elmo-folder-mark-as-important ((folder elmo-multi-folder) - numbers) +(luna-define-method elmo-folder-mark-as-important :around ((folder + elmo-multi-folder) + numbers) (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) (elmo-folder-mark-as-important (car folder-numbers) (cdr folder-numbers))) - t) + (luna-call-next-method)) -(luna-define-method elmo-folder-unmark-important ((folder elmo-multi-folder) - numbers) +(luna-define-method elmo-folder-unmark-important :around ((folder + elmo-multi-folder) + numbers) (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) (elmo-folder-unmark-important (car folder-numbers) (cdr folder-numbers))) - t) + (luna-call-next-method)) -(luna-define-method elmo-folder-mark-as-read ((folder elmo-multi-folder) - numbers) +(luna-define-method elmo-folder-mark-as-read :around ((folder + elmo-multi-folder) + numbers) (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) (elmo-folder-mark-as-read (car folder-numbers) (cdr folder-numbers))) - t) + (luna-call-next-method)) -(luna-define-method elmo-folder-unmark-read ((folder elmo-multi-folder) - numbers) +(luna-define-method elmo-folder-unmark-read :around ((folder + elmo-multi-folder) + numbers) (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers)) (elmo-folder-unmark-read (car folder-numbers) (cdr folder-numbers))) - t) + (luna-call-next-method)) + +(luna-define-method elmo-folder-mark-as-answered :around ((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-call-next-method)) + +(luna-define-method elmo-folder-unmark-answered :around ((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-call-next-method)) (require 'product) (product-provide (provide 'elmo-multi) (require 'elmo-version)) diff --git a/elmo/elmo-net.el b/elmo/elmo-net.el index 009dcae..1b824fe 100644 --- a/elmo/elmo-net.el +++ b/elmo/elmo-net.el @@ -393,19 +393,30 @@ Returned value is searched from `elmo-network-stream-type-alist'." (elmo-dop-spool-folder-list-messages folder)))) t)) -(luna-define-method elmo-folder-list-unreads-internal - ((folder elmo-net-folder) unread-marks &optional mark-alist) +(luna-define-method elmo-folder-list-unreads :around ((folder + elmo-net-folder)) (if (and (elmo-folder-plugged-p folder) (elmo-folder-use-flag-p folder)) (elmo-folder-send folder 'elmo-folder-list-unreads-plugged) - t)) + (luna-call-next-method))) -(luna-define-method elmo-folder-list-importants-internal - ((folder elmo-net-folder) important-mark) +(luna-define-method elmo-folder-list-importants :around ((folder + elmo-net-folder)) (if (and (elmo-folder-plugged-p folder) (elmo-folder-use-flag-p folder)) - (elmo-folder-send folder 'elmo-folder-list-importants-plugged) - t)) + (elmo-uniq-list + (nconc + (elmo-folder-send folder 'elmo-folder-list-importants-plugged) + (elmo-folder-list-messages-with-global-mark + folder elmo-msgdb-important-mark))) + (luna-call-next-method))) + +(luna-define-method elmo-folder-list-answereds :around ((folder + elmo-net-folder)) + (if (and (elmo-folder-plugged-p folder) + (elmo-folder-use-flag-p folder)) + (elmo-folder-send folder 'elmo-folder-list-answereds-plugged) + (luna-call-next-method))) (luna-define-method elmo-folder-list-unreads-plugged ((folder elmo-net-folder)) @@ -415,6 +426,10 @@ Returned value is searched from `elmo-network-stream-type-alist'." ((folder elmo-net-folder)) t) +(luna-define-method elmo-folder-list-answereds-plugged + ((folder elmo-net-folder)) + t) + (luna-define-method elmo-folder-delete-messages ((folder elmo-net-folder) numbers) (if (elmo-folder-plugged-p folder) @@ -427,34 +442,21 @@ Returned value is searched from `elmo-network-stream-type-alist'." (elmo-folder-delete-messages-dop folder numbers)) (luna-define-method elmo-folder-msgdb-create ((folder elmo-net-folder) - numbers new-mark - already-mark seen-mark - important-mark seen-list) + numbers seen-list) (if (elmo-folder-plugged-p folder) (elmo-folder-send folder 'elmo-folder-msgdb-create-plugged - numbers - new-mark - already-mark seen-mark - important-mark seen-list) + numbers seen-list) (elmo-folder-send folder 'elmo-folder-msgdb-create-unplugged - numbers - new-mark already-mark seen-mark - important-mark seen-list))) + numbers seen-list))) (luna-define-method elmo-folder-msgdb-create-unplugged ((folder elmo-net-folder) numbers - new-mark already-mark - seen-mark - important-mark seen-list) ;; XXXX should be appended to already existing msgdb. (elmo-dop-msgdb (elmo-folder-msgdb-create (elmo-dop-spool-folder folder) (mapcar 'abs numbers) - new-mark already-mark - seen-mark - important-mark seen-list))) (luna-define-method elmo-folder-unmark-important ((folder elmo-net-folder) @@ -494,6 +496,26 @@ Returned value is searched from `elmo-network-stream-type-alist'." folder 'elmo-folder-mark-as-read-unplugged numbers)) t)) +(luna-define-method elmo-folder-unmark-answered ((folder elmo-net-folder) + numbers) + (if (elmo-folder-use-flag-p folder) + (if (elmo-folder-plugged-p folder) + (elmo-folder-send folder 'elmo-folder-unmark-answered-plugged + numbers) + (elmo-folder-send folder + 'elmo-folder-unmark-answered-unplugged numbers)) + (luna-call-next-method))) + +(luna-define-method elmo-folder-mark-as-answered ((folder elmo-net-folder) + numbers) + (if (elmo-folder-use-flag-p folder) + (if (elmo-folder-plugged-p folder) + (elmo-folder-send folder 'elmo-folder-mark-as-answered-plugged + numbers) + (elmo-folder-send folder 'elmo-folder-mark-as-answered-unplugged + numbers)) + (luna-call-next-method))) + (luna-define-method elmo-folder-mark-as-read-unplugged ((folder elmo-net-folder) numbers) @@ -513,6 +535,15 @@ Returned value is searched from `elmo-network-stream-type-alist'." numbers) (elmo-folder-unmark-important-dop folder numbers)) +(luna-define-method elmo-folder-mark-as-answered-unplugged ((folder + elmo-net-folder) + numbers) + (elmo-folder-mark-as-answered-dop folder numbers)) + +(luna-define-method elmo-folder-unmark-answered-unplugged + ((folder elmo-net-folder) numbers) + (elmo-folder-unmark-answered-dop folder numbers)) + (luna-define-method elmo-message-encache :around ((folder elmo-net-folder) number &optional read) (if (elmo-folder-plugged-p folder) diff --git a/elmo/elmo-nmz.el b/elmo/elmo-nmz.el index 269e2a8..59e9a22 100644 --- a/elmo/elmo-nmz.el +++ b/elmo/elmo-nmz.el @@ -117,10 +117,7 @@ If the value is a list, all elements are used as index paths for namazu." entity)) (luna-define-method elmo-folder-msgdb-create ((folder elmo-nmz-folder) - numlist new-mark - already-mark seen-mark - important-mark - seen-list) + numlist seen-list) (let* (overview number-alist mark-alist entity i percent num pair) (setq num (length numlist)) @@ -148,7 +145,7 @@ If the value is a list, all elements are used as index paths for namazu." (or (elmo-msgdb-global-mark-get (elmo-msgdb-overview-entity-get-id entity)) - new-mark)))) + elmo-msgdb-new-mark)))) (when (> num elmo-display-progress-threshold) (setq i (1+ i)) (setq percent (/ (* i 100) num)) @@ -254,25 +251,6 @@ If the value is a list, all elements are used as index paths for namazu." (luna-define-method elmo-folder-exists-p ((folder elmo-nmz-folder)) t) -;;; To override elmo-map-folder methods. -(luna-define-method elmo-folder-list-unreads-internal - ((folder elmo-nmz-folder) unread-marks &optional mark-alist) - t) - -(luna-define-method elmo-folder-unmark-important ((folder elmo-nmz-folder) - numbers) - t) - -(luna-define-method elmo-folder-mark-as-important ((folder elmo-nmz-folder) - numbers) - t) - -(luna-define-method elmo-folder-unmark-read ((folder elmo-nmz-folder) numbers) - t) - -(luna-define-method elmo-folder-mark-as-read ((folder elmo-nmz-folder) numbers) - t) - (require 'product) (product-provide (provide 'elmo-nmz) (require 'elmo-version)) diff --git a/elmo/elmo-nntp.el b/elmo/elmo-nntp.el index 9e64227..5e02c1a 100644 --- a/elmo/elmo-nntp.el +++ b/elmo/elmo-nntp.el @@ -703,10 +703,6 @@ Don't cache if nil.") ("xref" . 8))) (defun elmo-nntp-create-msgdb-from-overview-string (str - new-mark - already-mark - seen-mark - important-mark seen-list &optional numlist) (let (ov-list gmark message-id seen @@ -768,11 +764,11 @@ Don't cache if nil.") (elmo-file-cache-get message-id)) (if seen nil - already-mark) + elmo-msgdb-unread-cached-mark) (if seen (if elmo-nntp-use-cache - seen-mark) - new-mark)))) + elmo-msgdb-read-uncached-mark) + elmo-msgdb-new-mark)))) (setq mark-alist (elmo-msgdb-mark-append mark-alist num gmark)))) @@ -780,16 +776,10 @@ Don't cache if nil.") (list overview number-alist mark-alist))) (luna-define-method elmo-folder-msgdb-create ((folder elmo-nntp-folder) - numbers new-mark already-mark - seen-mark important-mark - seen-list) - (elmo-nntp-folder-msgdb-create folder numbers new-mark already-mark - seen-mark important-mark - seen-list)) - -(defun elmo-nntp-folder-msgdb-create (folder numbers new-mark already-mark - seen-mark important-mark - seen-list) + numbers seen-list) + (elmo-nntp-folder-msgdb-create folder numbers seen-list)) + +(defun elmo-nntp-folder-msgdb-create (folder numbers seen-list) (let ((filter numbers) (session (elmo-nntp-get-session folder)) beg-num end-num cur length @@ -818,10 +808,6 @@ Don't cache if nil.") ret-val (elmo-nntp-create-msgdb-from-overview-string ov-str - new-mark - already-mark - seen-mark - important-mark seen-list filter ))))) @@ -843,8 +829,7 @@ Don't cache if nil.") 'elmo-nntp-msgdb-create "Getting overview..." 100))) (if (not use-xover) (setq ret-val (elmo-nntp-msgdb-create-by-header - session numbers - new-mark already-mark seen-mark seen-list)) + session numbers seen-list)) (with-current-buffer (elmo-network-session-buffer session) (if ov-str (setq ret-val @@ -852,10 +837,6 @@ Don't cache if nil.") ret-val (elmo-nntp-create-msgdb-from-overview-string ov-str - new-mark - already-mark - seen-mark - important-mark seen-list filter)))))) (elmo-folder-set-killed-list-internal @@ -916,13 +897,11 @@ Don't cache if nil.") (nconc number-alist (list (cons max-number nil)))))))))) -(defun elmo-nntp-msgdb-create-by-header (session numbers - new-mark already-mark - seen-mark seen-list) +(defun elmo-nntp-msgdb-create-by-header (session numbers seen-list) (with-temp-buffer (elmo-nntp-retrieve-headers session (current-buffer) numbers) (elmo-nntp-msgdb-create-message - (length numbers) new-mark already-mark seen-mark seen-list))) + (length numbers) seen-list))) (defun elmo-nntp-parse-xhdr-response (string) (let (response) @@ -1398,8 +1377,7 @@ Returns a list of cons cells like (NUMBER . VALUE)" ;; end of from Gnus -(defun elmo-nntp-msgdb-create-message (len new-mark - already-mark seen-mark seen-list) +(defun elmo-nntp-msgdb-create-message (len seen-list) (save-excursion (let (beg overview number-alist mark-alist entity i num gmark seen message-id) @@ -1438,11 +1416,11 @@ Returns a list of cons cells like (NUMBER . VALUE)" (elmo-file-cache-get message-id)) (if seen nil - already-mark) + elmo-msgdb-unread-cached-mark) (if seen (if elmo-nntp-use-cache - seen-mark) - new-mark)))) + elmo-msgdb-read-uncached-mark) + elmo-msgdb-new-mark)))) (setq mark-alist (elmo-msgdb-mark-append mark-alist @@ -1575,19 +1553,12 @@ Returns a list of cons cells like (NUMBER . VALUE)" elmo-crosspost-message-alist))) (elmo-nntp-folder-set-reads-internal folder reads))) -(luna-define-method elmo-folder-list-unreads-internal - ((folder elmo-nntp-folder) unread-marks mark-alist) +(luna-define-method elmo-folder-list-unreads :around ((folder + elmo-nntp-folder)) ;; 2.3. elmo-folder-list-unreads return unread message list according to ;; `reads' slot. - (let ((mark-alist (or mark-alist (elmo-msgdb-get-mark-alist - (elmo-folder-msgdb folder))))) - (elmo-living-messages (delq nil - (mapcar - (lambda (x) - (if (member (nth 1 x) unread-marks) - (car x))) - mark-alist)) - (elmo-nntp-folder-reads-internal folder)))) + (elmo-living-messages (luna-call-next-method) + (elmo-nntp-folder-reads-internal folder))) (require 'product) (product-provide (provide 'elmo-nntp) (require 'elmo-version)) diff --git a/elmo/elmo-pipe.el b/elmo/elmo-pipe.el index f2cfdcf..05f64c0 100644 --- a/elmo/elmo-pipe.el +++ b/elmo/elmo-pipe.el @@ -66,20 +66,15 @@ (elmo-folder-contains-type (elmo-pipe-folder-dst-internal folder) type))) (luna-define-method elmo-folder-msgdb-create ((folder elmo-pipe-folder) - numlist new-mark already-mark - seen-mark important-mark - seen-list) + numlist seen-list) (elmo-folder-msgdb-create (elmo-pipe-folder-dst-internal folder) - numlist new-mark already-mark - seen-mark important-mark seen-list)) + numlist seen-list)) (luna-define-method elmo-folder-append-messages ((folder elmo-pipe-folder) src-folder numbers - unread-marks &optional same-number) (elmo-folder-append-messages (elmo-pipe-folder-dst-internal folder) src-folder numbers - unread-marks same-number)) (luna-define-method elmo-folder-append-buffer ((folder elmo-pipe-folder) @@ -177,15 +172,14 @@ (elmo-folder-list-messages-internal (elmo-pipe-folder-dst-internal folder) nohide)) -(luna-define-method elmo-folder-list-unreads-internal - ((folder elmo-pipe-folder) unread-marks &optional mark-alist) - (elmo-folder-list-unreads-internal (elmo-pipe-folder-dst-internal folder) - unread-marks mark-alist)) +(luna-define-method elmo-folder-list-unreads ((folder elmo-pipe-folder)) + (elmo-folder-list-unreads (elmo-pipe-folder-dst-internal folder))) -(luna-define-method elmo-folder-list-importants-internal - ((folder elmo-pipe-folder) important-mark) - (elmo-folder-list-importants-internal (elmo-pipe-folder-dst-internal folder) - important-mark)) +(luna-define-method elmo-folder-list-importants ((folder elmo-pipe-folder)) + (elmo-folder-list-importants (elmo-pipe-folder-dst-internal folder))) + +(luna-define-method elmo-folder-list-answereds ((folder elmo-pipe-folder)) + (elmo-folder-list-answereds (elmo-pipe-folder-dst-internal folder))) (luna-define-method elmo-folder-status ((folder elmo-pipe-folder)) (elmo-folder-open-internal (elmo-pipe-folder-src-internal folder)) diff --git a/elmo/elmo-pop3.el b/elmo/elmo-pop3.el index 730c1a3..cb59583 100644 --- a/elmo/elmo-pop3.el +++ b/elmo/elmo-pop3.el @@ -666,9 +666,7 @@ Debug information is inserted in the buffer \"*POP3 DEBUG*\"") (copy-to-buffer tobuffer (point-min) (point-max))))) (luna-define-method elmo-folder-msgdb-create ((folder elmo-pop3-folder) - numlist new-mark - already-mark seen-mark - important-mark seen-list) + numlist seen-list) (let ((process (elmo-network-session-process-internal (elmo-pop3-get-session folder)))) (with-current-buffer (process-buffer process) @@ -677,8 +675,7 @@ Debug information is inserted in the buffer \"*POP3 DEBUG*\"") (elmo-pop3-msgdb-create-by-header process numlist - new-mark already-mark - seen-mark seen-list + seen-list (if (elmo-pop3-folder-use-uidl-internal folder) (elmo-pop3-folder-location-alist-internal folder))))))) @@ -716,8 +713,6 @@ Debug information is inserted in the buffer \"*POP3 DEBUG*\"") elmo-pop3-size-hash)) (defun elmo-pop3-msgdb-create-by-header (process numlist - new-mark already-mark - seen-mark seen-list loc-alist) (let ((tmp-buffer (get-buffer-create " *ELMO Overview TMP*"))) @@ -738,14 +733,13 @@ Debug information is inserted in the buffer \"*POP3 DEBUG*\"") process (length numlist) numlist - new-mark already-mark seen-mark seen-list loc-alist) + seen-list loc-alist) (kill-buffer tmp-buffer))))) (defun elmo-pop3-msgdb-create-message (buffer process num - numlist new-mark already-mark - seen-mark + numlist seen-list loc-alist) (save-excursion @@ -796,11 +790,11 @@ Debug information is inserted in the buffer \"*POP3 DEBUG*\"") (elmo-file-cache-get message-id)) (if seen nil - already-mark) + elmo-msgdb-unread-cached-mark) (if seen (if elmo-pop3-use-cache - seen-mark) - new-mark)))) + elmo-msgdb-read-uncached-mark) + elmo-msgdb-new-mark)))) (setq mark-alist (elmo-msgdb-mark-append mark-alist diff --git a/elmo/elmo-sendlog.el b/elmo/elmo-sendlog.el index 3cf0bc5..de753f8 100644 --- a/elmo/elmo-sendlog.el +++ b/elmo/elmo-sendlog.el @@ -81,10 +81,7 @@ (elmo-map-message-location folder number))) (luna-define-method elmo-folder-msgdb-create ((folder elmo-sendlog-folder) - numbers new-mark - already-mark seen-mark - important-mark - seen-list) + numbers seen-list) (let ((i 0) (len (length numbers)) overview number-alist mark-alist entity message-id @@ -110,7 +107,8 @@ num message-id)) (if (setq mark (or (elmo-msgdb-global-mark-get message-id) - (if (member message-id seen-list) nil new-mark))) + (if (member message-id seen-list) nil + elmo-msgdb-new-mark))) (setq mark-alist (elmo-msgdb-mark-append mark-alist @@ -152,27 +150,6 @@ (luna-define-method elmo-message-file-p ((folder elmo-sendlog-folder) number) t) -;;; To override elmo-map-folder methods. -(luna-define-method elmo-folder-list-unreads-internal - ((folder elmo-sendlog-folder) unread-marks &optional mark-alist) - t) - -(luna-define-method elmo-folder-unmark-important ((folder elmo-sendlog-folder) - numbers) - t) - -(luna-define-method elmo-folder-mark-as-important ((folder elmo-sendlog-folder) - numbers) - t) - -(luna-define-method elmo-folder-unmark-read ((folder elmo-sendlog-folder) - numbers) - t) - -(luna-define-method elmo-folder-mark-as-read ((folder elmo-sendlog-folder) - numbers) - t) - (require 'product) (product-provide (provide 'elmo-sendlog) (require 'elmo-version)) diff --git a/elmo/elmo-shimbun.el b/elmo/elmo-shimbun.el index 0668c11..0a55ec1 100644 --- a/elmo/elmo-shimbun.el +++ b/elmo/elmo-shimbun.el @@ -341,10 +341,7 @@ update overview when message is fetched." (list (cons "xref" (shimbun-header-xref header))))))))) (luna-define-method elmo-folder-msgdb-create ((folder elmo-shimbun-folder) - numlist new-mark - already-mark seen-mark - important-mark - seen-list) + numlist seen-list) (let* (overview number-alist mark-alist entity i percent number length pair msgid gmark seen) (setq length (length numlist)) @@ -367,11 +364,11 @@ update overview when message is fetched." (if (setq gmark (or (elmo-msgdb-global-mark-get msgid) (if (elmo-file-cache-status (elmo-file-cache-get msgid)) - (if seen nil already-mark) + (if seen nil elmo-msgdb-unread-cached-mark) (if seen (if elmo-shimbun-use-cache - seen-mark) - new-mark)))) + elmo-msgdb-read-uncached-mark) + elmo-msgdb-new-mark)))) (setq mark-alist (elmo-msgdb-mark-append mark-alist number gmark)))) @@ -509,27 +506,6 @@ update overview when message is fetched." folder)))) t)) -;;; To override elmo-map-folder methods. -(luna-define-method elmo-folder-list-unreads-internal - ((folder elmo-shimbun-folder) unread-marks &optional mark-alist) - t) - -(luna-define-method elmo-folder-unmark-important ((folder elmo-shimbun-folder) - numbers) - t) - -(luna-define-method elmo-folder-mark-as-important ((folder elmo-shimbun-folder) - numbers) - t) - -(luna-define-method elmo-folder-unmark-read ((folder elmo-shimbun-folder) - numbers) - t) - -(luna-define-method elmo-folder-mark-as-read ((folder elmo-shimbun-folder) - numbers) - t) - (require 'product) (product-provide (provide 'elmo-shimbun) (require 'elmo-version)) diff --git a/elmo/elmo-util.el b/elmo/elmo-util.el index 49326f0..8e505ee 100644 --- a/elmo/elmo-util.el +++ b/elmo/elmo-util.el @@ -234,7 +234,7 @@ Return value is a cons cell of (STRUCTURE . REST)" (goto-char (match-end 0)))) ;; search-key ::= [A-Za-z-]+ ;; ;; "since" / "before" / "last" / "first" / -;; ;; "body" / field-name +;; ;; "body" / "mark" / field-name ((looking-at "\\(!\\)? *\\([A-Za-z-]+\\) *: *") (goto-char (match-end 0)) (let ((search-key (vector