Commit graph

2 commits

Author SHA1 Message Date
Austin Clements
5d1ac7d1d3 Utility function to seek in MIME trees in depth-first order.
This function matches how we number parts for the --part argument to
show.  It will allow us to jump directly to the desired part, rather
than traversing the entire tree and carefully tracking whether or not
we're "in the zone".
2011-12-25 22:21:04 -04:00
Austin Clements
bb189220a3 Introduce a generic tree-like abstraction for MIME traversal.
This wraps all of the complex MIME part handling in a single, simple
function that gets part N from *any* MIME object, so traversing a MIME
part tree becomes a two-line for loop.  Furthermore, the MIME node
structure provides easy access to envelopes for message parts as well
as cryptographic information.

This code is directly derived from the current show_message_body code
(much of it is identical), but the control relation is inverted:
instead of show_message_body controlling the traversal of the MIME
structure and invoking callbacks, the caller controls the traversal of
the MIME structure.
2011-12-25 22:19:12 -04:00