I'm hoping this letter will reach Robert (newsspam5REMOVETHIS@xxxxxxx)
because this question is a follow up to something he helped me on. But if
anyone else can answer my questions, I would appreciate it!
My project is to clip unwanted attachments out of emails. I am able to do
so using the function vm-mime-action-on-all-attachments from
vm-rfaddons.el. At this time, I run my function interactively rather than
by a hook. Here is the code:
(setq jjf-vm-mime-cut-list '("IMSTP.gif"))
(defun jjf-vm-cut-unwanted-mime-objects ()
nil 'jjf-vm-cut-unwanted-mime-objects-internal '("image")))
(defun jjf-vm-cut-unwanted-mime-objects-internal (layout type file)
(when (member file jjf-vm-mime-cut-list)
(message "%s is a member of jjf-vm-mime-cut-list" file)
(let ((buf (marker-buffer (vm-mm-layout-body-start layout)))
(header-start (vm-mm-layout-header-start layout))
(header-end (vm-mm-layout-header-end layout))
(body-start (vm-mm-layout-body-start layout))
(body-end (vm-mm-layout-body-end layout)))
(delete-region header-start header-end)
(delete-region body-start body-end)
(message "header: %s %s body: %s %s" header-start header-end
(message "%s" (buffer-substring header-start header-end))
This code works, and I am able to cut a named mime object out of an email.
What it does not do, is refresh the presentation buffer. The presentation
buffer is left with a non-functioning mime-button.
Next question: I want to be able to use other criteria in the cut-list, for
instance, the Sender, or maybe an md5 sum of the unwanted object. That
would eliminate false positives. Can I access the Sender field from the
scope of my function? Does emacs have an md5sum or similar hash-key
generator that would be apt for matching content?
This message is getting long so I will leave it there. Any suggestions for
improvement in the code are welcome--I am an elisp novice.
Last question: is it just my news client or do the messages in this
newsgroup expire fast?