From f52da547b4d13e3380280f60ede663c860fc2ae7 Mon Sep 17 00:00:00 2001 From: yoichi Date: Wed, 16 Oct 2002 10:16:16 +0000 Subject: [PATCH] * wl-mime.el (wl-message-delete-current-part): New function. (wl-mime-node-id-to-string): Ditto. --- wl/ChangeLog | 5 +++++ wl/wl-mime.el | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/wl/ChangeLog b/wl/ChangeLog index d907337..63c42f3 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,3 +1,8 @@ +2002-10-16 Yoichi NAKAYAMA + + * wl-mime.el (wl-message-delete-current-part): New function. + (wl-mime-node-id-to-string): Ditto. + 2002-10-12 Yuuichi Teranishi * wl-summary.el (wl-summary-insert-headers): Put alike hash in reverse diff --git a/wl/wl-mime.el b/wl/wl-mime.el index 7f09b26..3dfa7bb 100644 --- a/wl/wl-mime.el +++ b/wl/wl-mime.el @@ -166,6 +166,52 @@ By setting following-method as yank-content." (defalias 'wl-message-button-dispatcher-internal 'mime-button-dispatcher) +(defsubst wl-mime-node-id-to-string (node-id) + (if (consp node-id) + (mapconcat (function (lambda (num) (format "%s" (1+ num)))) + (reverse node-id) + ".") + "0")) + +(defun wl-message-delete-current-part () + "Delete a part under the cursor from the multipart message." + (interactive) + (let* ((entity (get-text-property (point) 'mime-view-entity)) + (node-id (mime-entity-node-id entity)) + (header-start (mime-buffer-entity-header-start-internal entity)) + (body-end (mime-buffer-entity-body-end-internal entity)) + (folder (wl-folder-get-elmo-folder wl-message-buffer-cur-folder)) + (number wl-message-buffer-cur-number) + (msgid (elmo-message-field folder number 'message-id))) + (when (and node-id + (yes-or-no-p + (format "Do you really want to delete part %s? " + (wl-mime-node-id-to-string node-id)))) + (with-temp-buffer + (elmo-message-fetch folder + number + (elmo-make-fetch-strategy 'entire) + nil + (current-buffer) + 'unread) + (kill-region header-start body-end) + (goto-char header-start) + (insert "Content-Type: text/plain; charset=US-ASCII\n\n") + (insert "** This part has been removed by Wanderlust **\n\n") + (elmo-folder-append-buffer folder t)) + + (elmo-folder-append-messages + (wl-folder-get-elmo-folder wl-trash-folder) + folder (list number) nil) + (elmo-folder-delete-messages folder (list number)) + + (when (file-exists-p (elmo-cache-get-path msgid)) + (delete-file (elmo-cache-get-path msgid))) + + (mime-preview-quit) + (wl-summary-toggle-disp-msg 'off) + (wl-summary-sync nil "update")))) + ;;; Summary (defun wl-summary-burst-subr (message-entity target number) ;; returns new number. -- 1.7.10.4