From: David Levine Date: Tue, 26 Aug 2014 01:49:39 +0000 (-0500) Subject: Moved reverse_alternative_parts() from mhfixmsg.c to mhparse.c X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/68036228524d8e62588ace46d71aeb05ff04ffa4?ds=inline;hp=-c Moved reverse_alternative_parts() from mhfixmsg.c to mhparse.c and added declaration to mhparse.h. --- 68036228524d8e62588ace46d71aeb05ff04ffa4 diff --git a/h/mhparse.h b/h/mhparse.h index 0b0afb0f..b9e7b90e 100644 --- a/h/mhparse.h +++ b/h/mhparse.h @@ -342,6 +342,7 @@ const char *ce_str (int); const struct str2init *get_ce_method (const char *); char *content_charset (CT); int convert_charset (CT, char *, int *); +void reverse_alternative_parts (CT); /* * Given a content structure, return true if the content has a disposition diff --git a/uip/mhfixmsg.c b/uip/mhfixmsg.c index f5488532..56253803 100644 --- a/uip/mhfixmsg.c +++ b/uip/mhfixmsg.c @@ -53,7 +53,6 @@ int debugsw; /* Needed by mhparse.c. */ extern int skip_mp_cte_check; /* flag to InitMultiPart */ extern int suppress_bogus_mp_content_warning; /* flag to InitMultiPart */ extern int bogus_mp_content; /* flag from InitMultiPart */ -void reverse_parts (CT); /* mhoutsbr.c */ int output_message (CT, char *); @@ -78,7 +77,6 @@ typedef struct fix_transformations { } fix_transformations; int mhfixmsgsbr (CT *, const fix_transformations *, char *); -static void reverse_alternative_parts (CT); static int fix_boundary (CT *, int *); static int get_multipart_boundary (CT, char **); static int replace_boundary (CT, char *, char *); @@ -459,27 +457,6 @@ mhfixmsgsbr (CT *ctp, const fix_transformations *fx, char *outfile) { } -/* parse_mime() arranges alternates in reverse (priority) order, so - reverse them back. This will put a text/plain part at the front of - a multipart/alternative part, for example, where it belongs. */ -static void -reverse_alternative_parts (CT ct) { - if (ct->c_type == CT_MULTIPART) { - struct multipart *m = (struct multipart *) ct->c_ctparams; - struct part *part; - - if (ct->c_subtype == MULTI_ALTERNATE) { - reverse_parts (ct); - } - - /* And call recursively on each part of a multipart. */ - for (part = m->mp_parts; part; part = part->mp_next) { - reverse_alternative_parts (part->mp_part); - } - } -} - - static int fix_boundary (CT *ct, int *message_mods) { struct multipart *mp; diff --git a/uip/mhparse.c b/uip/mhparse.c index 75414667..14701398 100644 --- a/uip/mhparse.c +++ b/uip/mhparse.c @@ -115,7 +115,7 @@ static int get_comment (const char *, const char *, char **, char **); static int InitGeneric (CT); static int InitText (CT); static int InitMultiPart (CT); -void reverse_parts (CT); +static void reverse_parts (CT); static int InitMessage (CT); static int InitApplication (CT); static int init_encoding (CT, OpenCEFunc); @@ -1277,7 +1277,7 @@ last_part: * reverse the order of the parts of a multipart/alternative */ -void +static void reverse_parts (CT ct) { struct multipart *m = (struct multipart *) ct->c_ctparams; @@ -1294,6 +1294,30 @@ reverse_parts (CT ct) } + + +/* parse_mime() arranges alternates in reverse (priority) order. This + function can be used to reverse them back. This will put, for + example, a text/plain part before a text/html part in a + multipart/alternative part, for example, where it belongs. */ +void +reverse_alternative_parts (CT ct) { + if (ct->c_type == CT_MULTIPART) { + struct multipart *m = (struct multipart *) ct->c_ctparams; + struct part *part; + + if (ct->c_subtype == MULTI_ALTERNATE) { + reverse_parts (ct); + } + + /* And call recursively on each part of a multipart. */ + for (part = m->mp_parts; part; part = part->mp_next) { + reverse_alternative_parts (part->mp_part); + } + } +} + + /* * MESSAGE */