| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This chapter deals with decoding and viewing MIME messages on a higher level.
The main idea is to first analyze a MIME article, and then allow other programs to do things based on the list of handles that are returned as a result of this analysis.
3.1 Dissection Analyzing a MIME message. 3.2 Handles Handle manipulations. 3.3 Display Displaying handles. 3.4 Customization Variables that affect display. 3.5 New Viewers How to write your own viewers.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The mm-dissect-buffer is the function responsible for dissecting
a MIME article. If given a multipart message, it will recursively
descend the message, following the structure, and return a tree of
MIME handles that describes the structure of the message.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A MIME handle is a list that fully describes a MIME component.
The following macros can be used to access elements in a handle:
mm-handle-buffer
mm-handle-type
Content-Type of the part.
mm-handle-encoding
Content-Transfer-Encoding of the part.
mm-handle-undisplayer
mm-handle-set-undisplayer
mm-handle-disposition
Content-Disposition of the part.
mm-handle-disposition
mm-get-content-id
Content-ID.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Functions for displaying, removing and saving.
mm-display-part
mm-remove-part
mm-inlinable-p
mm-automatic-display-p
mm-destroy-part
mm-save-part
mm-pipe-part
mm-interactively-view-part
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
mm-inline-media-tests
evaled to say whether the part
can be displayed inline.
This variable specifies whether a part can be displayed inline, and, if so, how to do it. It does not say whether parts are actually displayed inline.
mm-inlined-types
mm-automatic-display
mm-attachment-override-types
mm-discouraged-alternatives
("text/html" "text/richtext")
|
mm-inline-large-images-p
t disables this check and
makes the library display all inline images as inline, regardless of
their size.
mm-inline-override-p
mm-inlined-types may include regular expressions, for example to
specify that all `text/.*' parts be displayed inline. If a user
prefers to have a type that matches such a regular expression be treated
as an attachment, that can be accomplished by setting this variable to a
list containing that type. For example assuming mm-inlined-types
includes `text/.*', then including `text/html' in this
variable will cause `text/html' parts to be treated as attachments.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Here's an example viewer for displaying text/enriched inline:
(defun mm-display-enriched-inline (handle)
(let (text)
(with-temp-buffer
(mm-insert-part handle)
(save-window-excursion
(enriched-decode (point-min) (point-max))
(setq text (buffer-string))))
(mm-insert-inline handle text)))
|
We see that the function takes a MIME handle as its parameter. It then goes to a temporary buffer, inserts the text of the part, does some work on the text, stores the result, goes back to the buffer it was called from and inserts the result.
The two important helper functions here are mm-insert-part and
mm-insert-inline. The first function inserts the text of the
handle in the current buffer. It handles charset and/or content
transfer decoding. The second function just inserts whatever text you
tell it to insert, but it also sets things up so that the text can be
"undisplayed' in a convenient manner.
| [ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |