* elmo.el (elmo-message-fetch-with-cache-process): Abolish.
authorhmurata <hmurata>
Thu, 13 Jan 2005 10:31:27 +0000 (10:31 +0000)
committerhmurata <hmurata>
Thu, 13 Jan 2005 10:31:27 +0000 (10:31 +0000)
(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
elmo/elmo-cache.el
elmo/elmo-nntp.el
elmo/elmo-sendlog.el
elmo/elmo.el

index d776bfc..34c065a 100644 (file)
@@ -1,5 +1,18 @@
 2005-01-13  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
 
+       * 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.
 
index ce178a5..7a81949 100644 (file)
                       (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
index e472fdc..38bec12 100644 (file)
@@ -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
index f0ce85b..4187f7f 100644 (file)
     (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
index 8ea8651..5b975bc 100644 (file)
@@ -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