From 0aae3b9e4f92a7339511a9770eba3606f0dd6b12 Mon Sep 17 00:00:00 2001 From: hmurata Date: Thu, 13 Jan 2005 10:31:27 +0000 Subject: [PATCH] * elmo.el (elmo-message-fetch-with-cache-process): Abolish. (elmo-message-fetch): Merge from `elmo-message-fetch-with-cache-process'. * elmo-sendlog.el (elmo-message-fetch-with-cache-process): Abolish. (elmo-message-fetch): Define. * elmo-nntp.el (elmo-message-fetch): Renamed from `elmo-message-fetch-with-cache-process'. * elmo-cache.el (elmo-message-fetch-with-cache-process): Abolish. (elmo-message-fetch): Define. --- elmo/ChangeLog | 13 +++++++++++++ elmo/elmo-cache.el | 11 ++++++++--- elmo/elmo-nntp.el | 4 ++-- elmo/elmo-sendlog.el | 11 ++++++++--- elmo/elmo.el | 45 ++++++++++----------------------------------- 5 files changed, 41 insertions(+), 43 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index d776bfc..34c065a 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,5 +1,18 @@ 2005-01-13 Hiroya Murata + * elmo.el (elmo-message-fetch-with-cache-process): Abolish. + (elmo-message-fetch): Merge from + `elmo-message-fetch-with-cache-process'. + + * elmo-sendlog.el (elmo-message-fetch-with-cache-process): Abolish. + (elmo-message-fetch): Define. + + * elmo-nntp.el (elmo-message-fetch): Renamed from + `elmo-message-fetch-with-cache-process'. + + * elmo-cache.el (elmo-message-fetch-with-cache-process): Abolish. + (elmo-message-fetch): Define. + * elmo-util.el (elmo-condition-parse-primitive): Downcase search-key. diff --git a/elmo/elmo-cache.el b/elmo/elmo-cache.el index ce178a5..7a81949 100644 --- a/elmo/elmo-cache.el +++ b/elmo/elmo-cache.el @@ -138,10 +138,15 @@ (elmo-cache-folder-directory-internal folder)))) t) -(luna-define-method elmo-message-fetch-with-cache-process - ((folder elmo-cache-folder) number strategy &optional section unseen) +(luna-define-method elmo-message-fetch + ((folder elmo-cache-folder) number strategy &optional unseen section) ;; disbable cache process - (elmo-message-fetch-internal folder number strategy section unseen)) + (erase-buffer) + (when (elmo-message-fetch-internal folder number strategy section unseen) + (when (and (not unseen) + (elmo-message-flagged-p folder number 'unread)) + (elmo-message-unset-flag folder number 'unread)) + t)) (luna-define-method elmo-map-message-fetch ((folder elmo-cache-folder) location strategy diff --git a/elmo/elmo-nntp.el b/elmo/elmo-nntp.el index e472fdc..38bec12 100644 --- a/elmo/elmo-nntp.el +++ b/elmo/elmo-nntp.el @@ -959,8 +959,8 @@ Don't cache if nil.") (with-current-buffer (elmo-network-session-buffer session) (std11-field-body "Newsgroups"))))) -(luna-define-method elmo-message-fetch-with-cache-process :around - ((folder elmo-nntp-folder) number strategy &optional section unread) +(luna-define-method elmo-message-fetch :around + ((folder elmo-nntp-folder) number strategy &optional unread section) (when (luna-call-next-method) (elmo-nntp-setup-crosspost-buffer folder number) (unless unread diff --git a/elmo/elmo-sendlog.el b/elmo/elmo-sendlog.el index f0ce85b..4187f7f 100644 --- a/elmo/elmo-sendlog.el +++ b/elmo/elmo-sendlog.el @@ -111,10 +111,15 @@ (message "Creating msgdb...done") new-msgdb)) -(luna-define-method elmo-message-fetch-with-cache-process - ((folder elmo-sendlog-folder) number strategy &optional section unseen) +(luna-define-method elmo-message-fetch + ((folder elmo-sendlog-folder) number strategy &optional unseen section) ;; disbable cache process - (elmo-message-fetch-internal folder number strategy section unseen)) + (erase-buffer) + (when (elmo-message-fetch-internal folder number strategy section unseen) + (when (and (not unseen) + (elmo-message-flagged-p folder number 'unread)) + (elmo-message-unset-flag folder number 'unread)) + t)) (luna-define-method elmo-map-message-fetch ((folder elmo-sendlog-folder) location strategy diff --git a/elmo/elmo.el b/elmo/elmo.el index 8ea8651..5b975bc 100644 --- a/elmo/elmo.el +++ b/elmo/elmo.el @@ -633,20 +633,6 @@ If second optional argument SECTION is specified, only the SECTION of the message is fetched (if possible). Returns non-nil if fetching was succeed.") -(luna-define-generic elmo-message-fetch-with-cache-process (folder - number strategy - &optional - section - unread) - "Fetch a message into current buffer with cache process. -FOLDER is the ELMO folder structure. -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 flaged as read. -Returns non-nil if fetching was succeed.") - (luna-define-generic elmo-message-fetch-internal (folder number strategy &optional section @@ -1417,23 +1403,6 @@ If Optional LOCAL is non-nil, don't update server flag." unread section) (erase-buffer) - (when (elmo-message-fetch-with-cache-process folder number - strategy section unread) - (when (and (not unread) - (elmo-message-flagged-p folder number 'unread)) - (elmo-message-unset-flag folder number 'unread - ;; If cache does not exists, update only msgdb. - ;; otherwise, flag status on server should be - ;; changed since it is never touched at this - ;; point. - (not (elmo-message-flagged-p - folder number 'cached)))) - t)) - -(luna-define-method elmo-message-fetch-with-cache-process ((folder elmo-folder) - number strategy - &optional - section unread) (let ((cache-path (elmo-fetch-strategy-cache-path strategy)) (method-priorities (cond ((eq (elmo-fetch-strategy-use-cache strategy) 'maybe) @@ -1442,9 +1411,9 @@ If Optional LOCAL is non-nil, don't update server flag." '(cache entity)) (t '(entity)))) - result err) + result err updated-server-flag) (while (and method-priorities - (null result)) + (not result)) (setq result (case (car method-priorities) (cache @@ -1457,13 +1426,19 @@ If Optional LOCAL is non-nil, don't update server flag." unread) (error (setq err error) nil)) (> (buffer-size) 0)) + (setq updated-server-flag t) (when (and (elmo-fetch-strategy-save-cache strategy) cache-path) (elmo-file-cache-save cache-path section)) t))) method-priorities (cdr method-priorities))) - (or result - (and err (signal (car err) (cdr err)))))) + (if result + (when (and (not unread) + (elmo-message-flagged-p folder number 'unread)) + (elmo-message-unset-flag folder number 'unread updated-server-flag)) + (when err + (signal (car err) (cdr err)))) + result)) (defun elmo-folder-kill-messages-range (folder beg end) (elmo-folder-set-killed-list-internal -- 1.7.10.4