* elmo-imap4.el (elmo-folder-delete-messages-plugged): Call
authorteranisi <teranisi>
Wed, 16 Jul 2003 13:00:45 +0000 (13:00 +0000)
committerteranisi <teranisi>
Wed, 16 Jul 2003 13:00:45 +0000 (13:00 +0000)
elmo-imap4-session-select-mailbox.

* wl-vars.el (wl-summary-mark-action-list): Define resend action.

* wl-summary.el (wl-summary-mode-map): Bind resend action.

* wl-highlight.el (wl-highlight-summary-disposed-face): New face
(Renamed from wl-highlight-summary-deleted-face).
(wl-highlight-summary-resend-face): New face.

* wl-address.el (wl-complete-field-to): Added optional argument prompt.

* wl-action.el (wl-summary-get-resend-address): New function.
(wl-summary-exec-action-resend): Ditto.
(wl-summary-exec-action-resend-subr): Ditto.

elmo/ChangeLog
elmo/elmo-imap4.el
wl/ChangeLog
wl/wl-action.el
wl/wl-address.el
wl/wl-highlight.el
wl/wl-summary.el
wl/wl-vars.el

index 3795bc1..e7c5fa5 100644 (file)
@@ -1,5 +1,8 @@
 2003-07-16  Yuuichi Teranishi  <teranisi@gohome.org>
 
+       * elmo-imap4.el (elmo-folder-delete-messages-plugged): Call
+       elmo-imap4-session-select-mailbox.
+
        * elmo.el (elmo-folder-move-messages): Don't display any message.
 
        * elmo-imap4.el (elmo-imap4-send-command): Accept process output when
index bf8865d..2827172 100644 (file)
@@ -2087,7 +2087,11 @@ If optional argument REMOVE is non-nil, remove FLAG."
 (luna-define-method elmo-folder-delete-messages-plugged
   ((folder elmo-imap4-folder) numbers)
   (let ((session (elmo-imap4-get-session folder)))
-    (elmo-imap4-set-flag folder numbers "\\Deleted")
+    (elmo-imap4-session-select-mailbox
+     session
+     (elmo-imap4-folder-mailbox-internal folder))
+    (unless (elmo-imap4-set-flag folder numbers "\\Deleted")
+      (error "Failed to set deleted flag"))
     (elmo-imap4-send-command session "expunge")))
 
 (defmacro elmo-imap4-detect-search-charset (string)
index 01f0d91..b108a83 100644 (file)
@@ -1,5 +1,22 @@
 2003-07-16  Yuuichi Teranishi  <teranisi@gohome.org>
 
+       * wl-vars.el (wl-summary-mark-action-list): Define resend action.
+
+       * wl-summary.el (wl-summary-mode-map): Bind resend action.
+
+       * wl-highlight.el (wl-highlight-summary-disposed-face): New face
+       (Renamed from wl-highlight-summary-deleted-face).
+       (wl-highlight-summary-resend-face): New face.
+
+       (wl-highlight-summary-deleted-face): Renamed from
+       wl-highlight-summary-erased-face.
+
+       * wl-address.el (wl-complete-field-to): Added optional argument prompt.
+
+       * wl-action.el (wl-summary-get-resend-address): New function.
+       (wl-summary-exec-action-resend): Ditto.
+       (wl-summary-exec-action-resend-subr): Ditto.
+
        * w-thread.el (wl-thread-copy): Removed definition.
        (wl-thread-refile): Ditto.
        (wl-thread-delete): Ditto.
index 87613e8..aa6ac45 100644 (file)
@@ -555,6 +555,75 @@ Return number if put mark succeed"
       (message "Prefetching...done")
       0)))
 
+;; Resend.
+(defun wl-summary-get-resend-address (action number)
+  "Decide resend address."
+  (wl-complete-field-to "Resend message to: "))
+
+(defun wl-summary-exec-action-resend (mark-list)
+  (let ((failure 0))
+    (dolist (mark-info mark-list)
+      (if (condition-case nil
+             (progn
+               (wl-summary-exec-action-resend-subr (car mark-info)
+                                                   (nth 2 mark-info))
+               t)
+           (error))
+         (wl-summary-unmark (car mark-info))
+       (incf failure)))
+    failure))
+
+(defun wl-summary-exec-action-resend-subr (number address)
+  "Resend the message with NUMBER to ADDRESS."
+  (message "Resending message to %s..." address)
+  (let ((folder wl-summary-buffer-elmo-folder))
+    (save-excursion
+      ;; We first set up a normal mail buffer.
+      (set-buffer (get-buffer-create " *wl-draft-resend*"))
+      (buffer-disable-undo (current-buffer))
+      (erase-buffer)
+      (setq wl-sent-message-via nil)
+      ;; Insert our usual headers.
+      (wl-draft-insert-from-field)
+      (wl-draft-insert-date-field)
+      (insert "To: " address "\n")
+      (goto-char (point-min))
+      ;; Rename them all to "Resent-*".
+      (while (re-search-forward "^[A-Za-z]" nil t)
+       (forward-char -1)
+       (insert "Resent-"))
+      (widen)
+      (forward-line)
+      (delete-region (point) (point-max))
+      (let ((beg (point)))
+       ;; Insert the message to be resent.
+       (insert
+        (with-temp-buffer
+          (elmo-message-fetch folder number
+                              (elmo-make-fetch-strategy 'entire)
+                              nil (current-buffer) 'unread)
+          (buffer-string)))
+       (goto-char (point-min))
+       (search-forward "\n\n")
+       (forward-char -1)
+       (save-restriction
+         (narrow-to-region beg (point))
+         (wl-draft-delete-fields wl-ignored-resent-headers)
+         (goto-char (point-max)))
+       (insert mail-header-separator)
+       ;; Rename all old ("Previous-")Resent headers.
+       (while (re-search-backward "^\\(Previous-\\)*Resent-" beg t)
+         (beginning-of-line)
+         (insert "Previous-"))
+       ;; Quote any "From " lines at the beginning.
+       (goto-char beg)
+       (when (looking-at "From ")
+         (replace-match "X-From-Line: ")))
+      ;; Send it.
+      (wl-draft-dispatch-message)
+      (kill-buffer (current-buffer)))
+    (message "Resending message to %s...done" address)))
+
 ;;;
 (defun wl-summary-remove-destination ()
   (save-excursion
index d168f52..a7d0125 100644 (file)
@@ -274,12 +274,12 @@ Matched address lists are append to CL."
       (setq entries (cdr entries)))
     (append result cl)))
 
-(defun wl-complete-field-to ()
+(defun wl-complete-field-to (prompt)
   (interactive)
   (let ((cl wl-address-completion-list))
     (if cl
-       (completing-read "To: " cl)
-      (read-string "To: "))))
+       (completing-read (or prompt "To: ") cl)
+      (read-string (or prompt "To: ")))))
 
 (defalias 'wl-address-quote-specials 'elmo-address-quote-specials)
 
index 9c95808..fa0cdbb 100644 (file)
   :group 'wl-summary-faces
   :group 'wl-faces)
 
-(wl-defface wl-highlight-summary-deleted-face
+(wl-defface wl-highlight-summary-disposed-face
   '(
     (((type tty)
       (background dark))
     (((class color)
       (background light))
      (:foreground "DarkKhaki")))
-  "Face used for displaying messages mark as deleted."
+  "Face used for displaying messages mark as disposed."
   :group 'wl-summary-faces
   :group 'wl-faces)
 
-(wl-defface wl-highlight-summary-erased-face
+(wl-defface wl-highlight-summary-deleted-face
   '(
     (((type tty)
       (background dark))
     (((class color)
       (background light))
      (:foreground "SteelBlue")))
-  "Face used for displaying messages mark as erased."
+  "Face used for displaying messages mark as deleted."
   :group 'wl-summary-faces
   :group 'wl-faces)
 
   :group 'wl-summary-faces
   :group 'wl-faces)
 
+(wl-defface wl-highlight-summary-resend-face
+  '(
+    (((type tty)
+      (background dark))
+     (:foreground "Yellow"))
+    (((class color)
+      (background dark))
+     (:foreground "orange3"))
+    (((class color)
+      (background light))
+     (:foreground "orange3")))
+  "Face used for displaying messages mark as resend."
+  :group 'wl-summary-faces
+  :group 'wl-faces)
+
 (wl-defface wl-highlight-summary-refiled-face
   '(
     (((type tty)
index 1e89bd0..5b54d4f 100644 (file)
@@ -466,6 +466,7 @@ See also variable `wl-use-petname'."
   (define-key wl-summary-mode-map "u"    'wl-summary-unmark)
   (define-key wl-summary-mode-map "U"    'wl-summary-unmark-all)
   (define-key wl-summary-mode-map "D"    'wl-summary-delete)
+  (define-key wl-summary-mode-map "~"    'wl-summary-resend)
 
   ;; thread commands
   (define-key wl-summary-mode-map "t"  (make-sparse-keymap))
@@ -477,6 +478,7 @@ See also variable `wl-use-petname'."
   (define-key wl-summary-mode-map "tO" 'wl-thread-copy)
   (define-key wl-summary-mode-map "td" 'wl-thread-dispose)
   (define-key wl-summary-mode-map "tD" 'wl-thread-delete)
+  (define-key wl-summary-mode-map "t~" 'wl-thread-resend)
   (define-key wl-summary-mode-map "tu" 'wl-thread-unmark)
   (define-key wl-summary-mode-map "t!" 'wl-thread-mark-as-unread)
   (define-key wl-summary-mode-map "t$" 'wl-thread-mark-as-important)
@@ -486,14 +488,18 @@ See also variable `wl-use-petname'."
   ;; target-mark commands
   (define-key wl-summary-mode-map "m"    (make-sparse-keymap))
   (define-key wl-summary-mode-map "mi"   'wl-summary-target-mark-prefetch)
-  (define-key wl-summary-mode-map "mR"   'wl-summary-target-mark-mark-as-read)
   (define-key wl-summary-mode-map "mo"   'wl-summary-target-mark-refile)
   (define-key wl-summary-mode-map "mO"   'wl-summary-target-mark-copy)
-  (define-key wl-summary-mode-map "md"   'wl-summary-target-mark-delete)
+  (define-key wl-summary-mode-map "md"   'wl-summary-target-mark-dispose)
+  (define-key wl-summary-mode-map "mD"   'wl-summary-target-mark-delete)
+  (define-key wl-summary-mode-map "m~"   'wl-summary-target-mark-resend)
+
+  (define-key wl-summary-mode-map "mu"   'wl-summary-delete-all-temp-marks)
+
   (define-key wl-summary-mode-map "my"   'wl-summary-target-mark-save)
+  (define-key wl-summary-mode-map "mR"   'wl-summary-target-mark-mark-as-read)
   (define-key wl-summary-mode-map "m!"   'wl-summary-target-mark-mark-as-unread)
   (define-key wl-summary-mode-map "m$"   'wl-summary-target-mark-mark-as-important)
-  (define-key wl-summary-mode-map "mu"   'wl-summary-delete-all-temp-marks)
   (define-key wl-summary-mode-map "mU"   'wl-summary-target-mark-uudecode)
   (define-key wl-summary-mode-map "ma"   'wl-summary-target-mark-all)
   (define-key wl-summary-mode-map "mt"   'wl-summary-target-mark-thread)
@@ -502,7 +508,6 @@ See also variable `wl-use-petname'."
   (define-key wl-summary-mode-map "m?"   'wl-summary-target-mark-pick)
   (define-key wl-summary-mode-map "m#"   'wl-summary-target-mark-print)
   (define-key wl-summary-mode-map "m|"   'wl-summary-target-mark-pipe)
-  (define-key wl-summary-mode-map "mD"   'wl-summary-target-mark-delete)
 
   ;; region commands
   (define-key wl-summary-mode-map "r"    (make-sparse-keymap))
@@ -515,6 +520,7 @@ See also variable `wl-use-petname'."
   (define-key wl-summary-mode-map "rO"   'wl-summary-copy-region)
   (define-key wl-summary-mode-map "rd"   'wl-summary-dispose-region)
   (define-key wl-summary-mode-map "rD"   'wl-summary-delete-region)
+  (define-key wl-summary-mode-map "r~"   'wl-summary-resend-region)
   (define-key wl-summary-mode-map "ru"   'wl-summary-unmark-region)
   (define-key wl-summary-mode-map "r!"   'wl-summary-mark-as-unread-region)
   (define-key wl-summary-mode-map "r$"   'wl-summary-mark-as-important-region)
index 857ea73..bbd4bf6 100644 (file)
@@ -346,14 +346,14 @@ If nil, never search search parent by subject."
      nil
      wl-summary-register-temp-mark
      wl-summary-exec-action-dispose
-     wl-highlight-summary-deleted-face
+     wl-highlight-summary-disposed-face
      "dispose messages according to `wl-dispose-folder-alist'.")
     ("D"
      delete
      nil
      wl-summary-register-temp-mark
      wl-summary-exec-action-delete
-     wl-highlight-summary-erased-face
+     wl-highlight-summary-deleted-face
      "delete messages immediately.")
     ("o"
      refile
@@ -375,7 +375,14 @@ If nil, never search search parent by subject."
      wl-summary-register-temp-mark
      wl-summary-exec-action-prefetch
      wl-highlight-summary-prefetch-face
-     "prefetch messages."))
+     "prefetch messages.")
+    ("~"
+     resend
+     wl-summary-get-resend-address
+     wl-summary-register-temp-mark
+     wl-summary-exec-action-resend
+     wl-highlight-summary-resend-face
+     ))
   "A variable to define Mark & Action.
 Each element of the list should be a list of
 \(MARK