* wl.el (wl-exit): Call `wl-acap-exit'.
authorteranisi <teranisi>
Wed, 28 Nov 2001 10:54:20 +0000 (10:54 +0000)
committerteranisi <teranisi>
Wed, 28 Nov 2001 10:54:20 +0000 (10:54 +0000)
* wl-summary.el (wl-summary-message-string): New function.
(wl-summary-reedit): Use it.
(wl-summary-resend-bounced-mail): Remove needless let.
(wl-summary-supersedes-message): Ditto.
(wl-summary-save): Ditto.

* wl-acap.el (wl-acap-original-msgdb-dir): New variable.
(wl-acap-init): Set it.
(wl-acap-exit): New function.

* acap.el (acap-response-bye-p): New function.
(acap-response-bye-message): Ditto.
(acap-wait-for-response): If bye response is received, cause an error.
(acap-parse-response): Make bye response when 'Bye' is received.

elmo/ChangeLog
elmo/acap.el
wl/ChangeLog
wl/wl-acap.el
wl/wl-summary.el
wl/wl.el

index 453de16..d26a83d 100644 (file)
@@ -1,3 +1,10 @@
+2001-11-28  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * acap.el (acap-response-bye-p): New function.
+       (acap-response-bye-message): Ditto.
+       (acap-wait-for-response): If bye response is received, cause an error.
+       (acap-parse-response): Make bye response when 'Bye' is received.
+
 2001-11-23  Kenichi OKADA  <okada@opaopa.org>
 
        * elmo-pipe.el (elmo-pipe-drain): Load killed-list.
index b2f4173..780ea6c 100644 (file)
@@ -445,6 +445,12 @@ ENTRIES is a store-entry list."
 (defun acap-response-ok-p (response)
   (assq 'done-ok response))
 
+(defun acap-response-bye-p (response)
+  (assq 'bye response))
+
+(defun acap-response-bye-message (response)
+  (nth 1 (cdr (assq 'bye response))))
+
 (defun acap-response-cont-p (response)
   (assq 'cont response))
 
@@ -536,6 +542,9 @@ ENTRIES is a store-entry list."
   (with-current-buffer (process-buffer process)
     (while (and (not (acap-response-cont-p acap-response))
                (< acap-reached-tag tag))
+      (when (acap-response-bye-p acap-response)
+       (error (prog1 (acap-response-bye-message acap-response)
+                (setq acap-response nil))))
       (or (and (not (memq (process-status process) '(open run)))
               (sit-for 1))
          (let ((len (/ (point-max) 1024))
@@ -799,10 +808,8 @@ ENTRIES is a store-entry list."
                               (acap-parse-return-data-list)))))
          (ALERT ;(cons 'alert (acap-parse-resp-body))
           (message (nth 1 (acap-parse-resp-body))))
-         (BYE   ;(cons 'bye (acap-parse-resp-body)))
-          ;;(message (nth 1  (acap-parse-resp-body)))
-          ;;(ding)
-          )
+         ((BYE Bye bye)  
+          (cons 'bye (acap-parse-resp-body)))
          (CHANGE (cons 'change
                        (list (acap-parse-quoted)
                              (progn
index 9e85dca..b570a55 100644 (file)
@@ -1,3 +1,17 @@
+2001-11-28  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl.el (wl-exit): Call `wl-acap-exit'.
+
+       * wl-summary.el (wl-summary-message-string): New function.
+       (wl-summary-reedit): Use it.
+       (wl-summary-resend-bounced-mail): Remove needless let.
+       (wl-summary-supersedes-message): Ditto.
+       (wl-summary-save): Ditto.
+
+       * wl-acap.el (wl-acap-original-msgdb-dir): New variable.
+       (wl-acap-init): Set it.
+       (wl-acap-exit): New function.
+
 2001-11-26  TAKAHASHI Kaoru  <kaoru@kaisei.org>
 
        * wl.el (wl-init): Revert (require 'mime-setup). move from
index e44ed29..a514094 100644 (file)
@@ -96,6 +96,12 @@ If nil, default acap port is used."
   :type 'symbol
   :group 'wl)
 
+(defvar wl-acap-original-msgdb-dir nil)
+
+(defun wl-acap-exit ()
+  "End ACAP session."
+  (setq elmo-msgdb-dir wl-acap-original-msgdb-dir))
+  
 (defun wl-acap-init ()
   "A candidate for `wl-folder-init-function'."
   (let ((service (wl-acap-find-acap-service))
@@ -161,6 +167,7 @@ If nil, default acap port is used."
     (dolist (setting settings)
       (set (car setting) (cdr setting)))
     ;; Database directory becomes specific to the ACAP server.
+    (setq wl-acap-original-msgdb-dir elmo-msgdb-dir)
     (setq elmo-msgdb-dir (expand-file-name
                          (concat "acap/" (car service) "/" wl-acap-user)
                          elmo-msgdb-dir))
index 91f3ff9..f362a36 100644 (file)
              wl-summary-buffer-unread-count unread))
     (+ new unread)))
 
+(defun wl-summary-message-string (&optional use-cache)
+  "Return full body string of current message.
+If optional USE-CACHE is non-nil, use cache if exists."
+  (let ((number (wl-summary-message-number))
+       (folder wl-summary-buffer-elmo-folder))
+    (if (null number)
+       (message "No message.")
+      (elmo-set-work-buf
+       (elmo-message-fetch folder
+                          number
+                          (elmo-make-fetch-strategy
+                           'entire
+                           use-cache ; use cache
+                           nil ; save cache (should `t'?)
+                           (and
+                            use-cache
+                            (elmo-file-cache-get-path
+                             (elmo-message-field folder number 'message-id))))
+                          nil
+                          (current-buffer)
+                          'unread)
+       (buffer-string)))))
+
 (defun wl-summary-reedit (&optional arg)
   "Re-edit current message.
 If ARG is non-nil, Supersedes message"
@@ -578,13 +601,7 @@ If ARG is non-nil, Supersedes message"
                  (mail-position-on-field "Newsgroups")
                (mail-position-on-field "To"))
              (delete-other-windows)))
-      (save-excursion
-       (let ((mmelmo-force-fetch-entire-message t))
-         (if (null (wl-summary-message-number))
-             (message "No message.")
-           (set-buffer (wl-summary-get-original-buffer))
-           (wl-draft-edit-string (buffer-substring (point-min)
-                                                   (point-max)))))))))
+      (wl-draft-edit-string (wl-summary-message-string)))))
 
 (defun wl-summary-resend-bounced-mail ()
   "Re-mail the current message.
@@ -593,37 +610,36 @@ contains some mail you have written but has been bounced back to
 you."
   (interactive)
   (save-excursion
-    (let ((mmelmo-force-fetch-entire-message t))
-      (wl-summary-set-message-buffer-or-redisplay)
-      (set-buffer (wl-message-get-original-buffer))
-      (goto-char (point-min))
-      (let ((case-fold-search nil))
-       (cond
-        ((and
-          (re-search-forward
-           (concat "^\\($\\|[Cc]ontent-[Tt]ype:[ \t]+multipart/\\(report\\|mixed\\)\\)") nil t)
-          (not (bolp))
-          (re-search-forward "boundary=\"\\([^\"]+\\)\"" nil t))
-         (let ((boundary (buffer-substring (match-beginning 1) (match-end 1)))
-               start)
-           (cond
-            ((and (setq start (re-search-forward
-                          (concat "^--" boundary "\n"
-                                  "\\([Cc]ontent-[Dd]escription:.*\n\\)?"
-                                  "[Cc]ontent-[Tt]ype:[ \t]+"
-                                  "\\(message/rfc822\\|text/rfc822-headers\\)\n"
-                                  "\\(.+\n\\)*\n") nil t))
-                  (re-search-forward
-                        (concat "\n\\(--" boundary "\\)--\n") nil t))
-             (wl-draft-edit-string (buffer-substring start (match-beginning 1))))
-            (t
-             (message "Seems no message/rfc822 part.")))))
-        ((let ((case-fold-search t))
-           (re-search-forward wl-rejected-letter-start nil t))
-         (skip-chars-forward " \t\n")
-         (wl-draft-edit-string (buffer-substring (point) (point-max))))
-        (t
-         (message "Does not appear to be a rejected letter.")))))))
+    (wl-summary-set-message-buffer-or-redisplay)
+    (set-buffer (wl-message-get-original-buffer))
+    (goto-char (point-min))
+    (let ((case-fold-search nil))
+      (cond
+       ((and
+        (re-search-forward
+         (concat "^\\($\\|[Cc]ontent-[Tt]ype:[ \t]+multipart/\\(report\\|mixed\\)\\)") nil t)
+        (not (bolp))
+        (re-search-forward "boundary=\"\\([^\"]+\\)\"" nil t))
+       (let ((boundary (buffer-substring (match-beginning 1) (match-end 1)))
+             start)
+         (cond
+          ((and (setq start (re-search-forward
+                             (concat "^--" boundary "\n"
+                                     "\\([Cc]ontent-[Dd]escription:.*\n\\)?"
+                                     "[Cc]ontent-[Tt]ype:[ \t]+"
+                                     "\\(message/rfc822\\|text/rfc822-headers\\)\n"
+                                     "\\(.+\n\\)*\n") nil t))
+                (re-search-forward
+                 (concat "\n\\(--" boundary "\\)--\n") nil t))
+           (wl-draft-edit-string (buffer-substring start (match-beginning 1))))
+          (t
+           (message "Seems no message/rfc822 part.")))))
+       ((let ((case-fold-search t))
+         (re-search-forward wl-rejected-letter-start nil t))
+       (skip-chars-forward " \t\n")
+       (wl-draft-edit-string (buffer-substring (point) (point-max))))
+       (t
+       (message "Does not appear to be a rejected letter."))))))
 
 (defun wl-summary-resend-message (address)
   "Resend the current message to ADDRESS."
@@ -5340,7 +5356,6 @@ Use function list is `wl-summary-write-current-folder-functions'."
   "Supersede current message."
   (interactive)
   (let ((summary-buf (current-buffer))
-       (mmelmo-force-fetch-entire-message t)
        message-buf from)
     (wl-summary-set-message-buffer-or-redisplay)
     (if (setq message-buf (wl-message-get-original-buffer))
@@ -5374,8 +5389,7 @@ Use function list is `wl-summary-write-current-folder-functions'."
 (defun wl-summary-save (&optional arg wl-save-dir)
   (interactive)
   (let ((filename)
-       (num (wl-summary-message-number))
-       (mmelmo-force-fetch-entire-message t))
+       (num (wl-summary-message-number)))
     (if (null wl-save-dir)
        (setq wl-save-dir wl-tmp-dir))
     (if num
index ca87a98..ea347ed 100644 (file)
--- a/wl/wl.el
+++ b/wl/wl.el
@@ -643,6 +643,8 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'."
   (when (or (not wl-interactive-exit)
            (y-or-n-p "Do you really want to quit Wanderlust? "))
     (elmo-quit)
+    (when wl-use-acap
+      (wl-acap-exit))
     (wl-biff-stop)
     (run-hooks 'wl-exit-hook)
     (wl-save-status)