* wl-summary.el (wl-summary-get-original-buffer): New function.
authorteranisi <teranisi>
Thu, 8 Feb 2001 22:17:17 +0000 (22:17 +0000)
committerteranisi <teranisi>
Thu, 8 Feb 2001 22:17:17 +0000 (22:17 +0000)
(wl-summary-set-crosspost): Use it.
(wl-summary-target-mark-uudecode): Ditto.
(wl-summary-reedit): Ditto.
(wl-summary-resend-bounced-mail): Ditto.
(wl-summary-update-crosspost): Eliminated (It may be incorporated
into `elmo-folder-append-msgdb' method of elmo-nntp-folder class).

* wl-message.el (wl-message-buffer-display): Added argumnet `unread'.
(wl-message-display-internal): Ditto.

* elmo-mime.el (elmo-mime-message-display): Added argument `unread'.
 (elmo-mime-message-display-as-is): Ditto.

elmo/ChangeLog
elmo/elmo-mime.el
wl/ChangeLog
wl/wl-message.el
wl/wl-summary.el

index cd41e67..423011e 100644 (file)
@@ -1,3 +1,8 @@
+2001-02-09  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-mime.el (elmo-mime-message-display): Added argument `unread'.
+       (elmo-mime-message-display-as-is): Ditto.
+
 2001-02-07  Yuuichi Teranishi  <teranisi@gohome.org>
 
        * elmo-pipe.el (elmo-pipe-drain): Eliminated needless bindings;
index 74cd30f..13397cd 100644 (file)
@@ -204,12 +204,14 @@ value is used."
     rawbuf))
 
 (defun elmo-mime-message-display (folder number viewbuf rawbuf original-mode
-                                        &optional ignore-cache)
+                                        &optional ignore-cache unread)
   "Display MIME message. 
 A message in the FOLDER with NUMBER is displayed on the VIEWBUF using RAWBUF.
 VIEWBUF is a view buffer and RAWBUF is a raw buffer.
 ORIGINAL is the major mode of RAWBUF.
 If optional argument IGNORE-CACHE is specified, existing cache is ignored.
+If second optional argument UNREAD is specified, message is displayed but
+keep it as unread.
 Return non-nil if not entire message was fetched."
   (let (mime-display-header-hook ; Do nothing.
        entity strategy)
@@ -225,7 +227,7 @@ Return non-nil if not entire message was fetched."
          'elmo-imap
        'elmo-buffer)
       (elmo-make-mime-message-location
-       folder number strategy rawbuf nil))
+       folder number strategy rawbuf unread))
      viewbuf nil nil original-mode)
     (if strategy
        (or (elmo-fetch-strategy-use-cache strategy)
@@ -233,12 +235,14 @@ Return non-nil if not entire message was fetched."
                'section)))))
 
 (defun elmo-mime-display-as-is (folder number viewbuf rawbuf original-mode
-                                        &optional ignore-cache)
+                                      &optional ignore-cache unread)
   "Display MIME message. 
 A message in the FOLDER with NUMBER is displayed on the VIEWBUF using RAWBUF.
 VIEWBUF is a view buffer and RAWBUF is a raw buffer.
 ORIGINAL is the major mode of RAWBUF.
 If optional argument IGNORE-CACHE is specified, existing cache is ignored.
+If second optional argument UNREAD is specified, message is displayed but
+keep it as unread.
 Return non-nil if cache is used."
   (let ((entity (elmo-msgdb-overview-get-entity number
                                                (elmo-folder-msgdb-internal
@@ -256,7 +260,7 @@ Return non-nil if cache is used."
      (mime-open-entity
       'elmo-buffer
       (elmo-make-mime-message-location
-       folder number strategy rawbuf nil))
+       folder number strategy rawbuf unread))
      viewbuf nil nil original-mode)
     (elmo-fetch-strategy-use-cache strategy)))
 
index ef3532a..7f9f441 100644 (file)
@@ -1,3 +1,16 @@
+2001-02-09  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-summary.el (wl-summary-get-original-buffer): New function.
+       (wl-summary-set-crosspost): Use it.
+       (wl-summary-target-mark-uudecode): Ditto.
+       (wl-summary-reedit): Ditto.
+       (wl-summary-resend-bounced-mail): Ditto.
+       (wl-summary-update-crosspost): Eliminated (It may be incorporated
+       into `elmo-folder-append-msgdb' method of elmo-nntp-folder class).
+
+       * wl-message.el (wl-message-buffer-display): Added argumnet `unread'.
+       (wl-message-display-internal): Ditto.
+
 2001-02-07  Yuuichi Teranishi  <teranisi@gohome.org>
 
        * wl-draft.el (wl-draft-parse-msg-id-list-string): Fix.
index ff05986..8a09ea8 100644 (file)
@@ -355,7 +355,6 @@ Returns non-nil if bottom of message."
 
 (defun wl-message-get-original-buffer ()
   "Get original buffer for current message buffer."
-  (current-buffer)
   wl-message-buffer-original-buffer)
 
 (defun wl-message-redisplay (folder number flag &optional force-reload)
@@ -406,7 +405,8 @@ Returns non-nil if bottom of message."
     cache-used))
 
 ;; Use message buffer cache.
-(defun wl-message-buffer-display (folder number flag &optional force-reload)
+(defun wl-message-buffer-display (folder number flag
+                                        &optional force-reload unread)
   (let* ((msg-id (elmo-message-field folder number 'message-id))
         (fname (elmo-folder-name-internal folder))
         (hit (wl-message-buffer-cache-hit (list fname number msg-id)))
@@ -429,24 +429,25 @@ Returns non-nil if bottom of message."
       (setq hit (wl-message-buffer-cache-add (list fname number msg-id)))
       (setq read t))
     (if (or force-reload read)
-       ;(condition-case err
+       (condition-case err
            (save-excursion
              (set-buffer hit)
              (setq
               cache-used
-              (wl-message-display-internal folder number flag force-reload))
+              (wl-message-display-internal folder number flag
+                                           force-reload unread))
              (setq wl-message-buffer-cur-flag flag))
-;        (quit
-;         (wl-message-buffer-cache-delete)
-;         (error "Display message %s/%s is quitted" fname number))
-;        (error
-;         (wl-message-buffer-cache-delete)
-;         (signal (car err) (cdr err))
-;         nil))) ;; will not be used
-      )
+         (quit
+          (wl-message-buffer-cache-delete)
+          (error "Display message %s/%s is quitted" fname number))
+         (error
+          (wl-message-buffer-cache-delete)
+          (signal (car err) (cdr err))
+          nil))) ;; will not be used
     (cons hit cache-used)))
 
-(defun wl-message-display-internal (folder number flag &optional force-reload)
+(defun wl-message-display-internal (folder number flag
+                                          &optional force-reload unread)
   (let ((elmo-message-ignored-field-list
         (if (eq flag 'all-header)
             nil
@@ -461,12 +462,14 @@ Returns non-nil if bottom of message."
                                       (current-buffer)
                                       (wl-message-get-original-buffer)
                                       'wl-original-message-mode
-                                      force-reload))
+                                      force-reload
+                                      unread))
          (elmo-mime-message-display folder number
                                     (current-buffer)
                                     (wl-message-get-original-buffer)
                                     'wl-original-message-mode
-                                    force-reload))
+                                    force-reload
+                                    unread))
       (setq buffer-read-only t))))
 
 (defsubst wl-message-buffer-prefetch-p (folder &optional number)
@@ -528,7 +531,8 @@ Returns non-nil if bottom of message."
                  (when wl-message-buffer-prefetch-debug
                    (setq time1 (current-time))
                    (message "Prefetching %d..." number))
-                 (setq result (wl-message-buffer-display folder number 'mime))
+                 (setq result (wl-message-buffer-display folder number
+                                                         'mime nil 'unread))
                  (when wl-message-buffer-prefetch-debug
                    (setq time2 (current-time))
                    (setq sec  (- (nth 1 time2)(nth 1 time1)))
index 5104764..f2e971e 100644 (file)
@@ -591,8 +591,7 @@ If ARG is non-nil, Supersedes message"
        (let ((mmelmo-force-fetch-entire-message t))
          (if (null (wl-summary-message-number))
              (message "No message.")
-           (wl-summary-set-message-buffer-or-redisplay)
-           (set-buffer (wl-message-get-original-buffer))
+           (set-buffer (wl-summary-get-original-buffer))
            (wl-draft-edit-string (buffer-substring (point-min)
                                                    (point-max)))))))))
 
@@ -4062,9 +4061,9 @@ If ARG, exit virtual folder."
                  (if (and visible wl-summary-highlight)
                      (wl-highlight-summary-current-line nil nil t))
                  (if (not notcrosses)
-                     (wl-summary-set-crosspost nil
-                                               (and wl-summary-buffer-disp-msg
-                                                    (interactive-p)))))
+                     (wl-summary-set-crosspost
+                      wl-summary-buffer-elmo-folder
+                      number)))
              (if mark (message "Warning: Changing mark failed.")))))
       (set-buffer-modified-p nil)
       (if stat
@@ -5508,6 +5507,14 @@ Use function list is `wl-summary-write-current-folder-functions'."
                                           wl-summary-buffer-new-count)
                                        (length num-db)))))
 
+(defun wl-summary-get-original-buffer ()
+  "Get original buffer for the current summary."
+  (save-excursion
+    (wl-summary-set-message-buffer-or-redisplay)
+    (wl-message-get-original-buffer)))
+
+;; This function will be needless in the future.
+;; (After when Newsgroups: field is saved in msgdb)
 (defun wl-summary-get-newsgroups ()
   (let ((folder-list (elmo-folder-get-primitive-list
                      wl-summary-buffer-elmo-folder))
@@ -5519,28 +5526,22 @@ Use function list is `wl-summary-write-current-folder-functions'."
       (setq folder-list (cdr folder-list)))
     ng-list))
 
-(defun wl-summary-set-crosspost (&optional type redisplay)
-  (let* ((number (wl-summary-message-number))
-        message-buf newsgroups)
-    (when (eq (elmo-folder-type-internal wl-summary-buffer-elmo-folder)
-             'nntp)
-      (if redisplay
-         (wl-summary-redisplay))
-      (save-excursion
-       (if (setq message-buf (wl-message-get-original-buffer))
-           (set-buffer message-buf))
+;; This function will be moved to elmo in the future.
+;; (After when Newsgroups: field is saved in msgdb)
+(defun wl-summary-set-crosspost (folder number)
+  (let (newsgroups)
+    (when (eq (elmo-folder-type-internal folder) 'nntp)
+      (with-current-buffer (wl-summary-get-original-buffer)
        (setq newsgroups (std11-field-body "newsgroups")))
       (when newsgroups
-       (let* ((msgdb (wl-summary-buffer-msgdb))
-              (num-db (elmo-msgdb-get-number-alist msgdb))
-              (ng-list (wl-summary-get-newsgroups)) ;; for multi folder
-              crosspost-folders)
-         (when (setq crosspost-folders
+       (let* ((ng-list (wl-summary-get-newsgroups)) ;; for multi folder
+              crosspost-newsgroups)
+         (when (setq crosspost-newsgroups
                      (elmo-list-delete ng-list
                                        (wl-parse-newsgroups newsgroups t)))
-           (elmo-crosspost-message-set (cdr (assq number num-db)) ;;message-id
-                                       crosspost-folders
-                                       type) ;;not used
+           (elmo-crosspost-message-set
+            (elmo-message-field folder number 'message-id)
+            crosspost-newsgroups)
            (setq wl-crosspost-alist-modified t)))))))
 
 (defun wl-summary-is-crosspost-folder (folder-list groups)
@@ -5554,37 +5555,6 @@ Use function list is `wl-summary-write-current-folder-functions'."
       (setq folder-list (cdr folder-list)))
     crosses))
 
-(defun wl-summary-update-crosspost ()
-  (let* ((msgdb (wl-summary-buffer-msgdb))
-        (number-alist (elmo-msgdb-get-number-alist msgdb))
-        (mark-alist (elmo-msgdb-get-mark-alist msgdb))
-        (folder-list
-         (elmo-folder-get-primitive-list wl-summary-buffer-elmo-folder))
-        (alist elmo-crosspost-message-alist)
-        (crossed 0)
-        mark ngs num)
-    (when (elmo-folder-contains-type wl-summary-buffer-elmo-folder 'nntp)
-      (while alist
-       (when (setq ngs
-                   (wl-summary-is-crosspost-folder
-                    folder-list
-                    (nth 1 (car alist))))
-         (when (setq num (car (rassoc (caar alist) number-alist)))
-           (if (and (setq mark (cadr (assq num mark-alist)))
-                    (member mark (list wl-summary-new-mark
-                                       wl-summary-unread-uncached-mark
-                                       wl-summary-unread-cached-mark)))
-               (setq crossed (1+ crossed)))
-           (if (wl-summary-jump-to-msg num)
-               (wl-summary-mark-as-read t);; opened
-             (wl-summary-mark-as-read t nil nil num)));; closed
-         ;; delete if message does't exists.
-         (elmo-crosspost-message-delete (caar alist) ngs)
-         (setq wl-crosspost-alist-modified t))
-       (setq alist (cdr alist))))
-    (if (> crossed 0)
-       crossed)))
-
 (defun wl-crosspost-alist-load ()
   (setq elmo-crosspost-message-alist (elmo-crosspost-alist-load))
   (setq wl-crosspost-alist-modified nil))
@@ -5629,7 +5599,7 @@ Use function list is `wl-summary-write-current-folder-functions'."
        (set-buffer summary-buf)
        (wl-summary-jump-to-msg (car mlist))
        (wl-summary-redisplay)
-       (set-buffer (setq orig-buf (wl-message-get-original-buffer)))
+       (set-buffer (setq orig-buf (wl-summary-get-original-buffer)))
        (goto-char (point-min))
        (cond ((= i 1) ; first
               (if (setq filename (wl-message-uu-substring