From 408b11dc68554ec1a6f98c3984978adaee7419c8 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 10 Oct 2001 18:35:12 +0000 Subject: [PATCH] * Comments & cosmetics for previous update --- citadel/ChangeLog | 4 +++- citadel/msgbase.c | 20 ++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 92a17bbc8..acdf36b04 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,7 @@ $Log$ + Revision 580.55 2001/10/10 18:35:12 ajc + * Comments & cosmetics for previous update + Revision 580.54 2001/10/10 17:12:54 ajc * Bugfix for MSG0 command to properly handle multipart/alternative @@ -2785,4 +2788,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import - diff --git a/citadel/msgbase.c b/citadel/msgbase.c index f1b8c0530..981fc2583 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -821,7 +821,14 @@ void CtdlFreeMessage(struct CtdlMessage *msg) /* - * Pre callback function for mime parser that wants to display text + * Pre callback function for multipart/alternative + * + * NOTE: this differs from the standard behavior for a reason. Normally when + * displaying multipart/alternative you want to show the _last_ usable + * format in the message. Here we show the _first_ one, because it's + * usually text/plain. Since this set of functions is designed for text + * output to non-MIME-aware clients, this is the desired behavior. + * */ void fixed_output_pre(char *name, char *filename, char *partnum, char *disp, void *content, char *cbtype, size_t length, char *encoding, @@ -831,13 +838,12 @@ void fixed_output_pre(char *name, char *filename, char *partnum, char *disp, if (!strcasecmp(cbtype, "multipart/alternative")) { ma->is_ma = 1; ma->did_print = 0; - lprintf(9, "multipart/alternative: <%s>\n", ma->prefix); return; } } /* - * Pre callback function for mime parser that wants to display text + * Post callback function for multipart/alternative */ void fixed_output_post(char *name, char *filename, char *partnum, char *disp, void *content, char *cbtype, size_t length, char *encoding, @@ -847,7 +853,6 @@ void fixed_output_post(char *name, char *filename, char *partnum, char *disp, if (!strcasecmp(cbtype, "multipart/alternative")) { ma->is_ma = 0; ma->did_print = 0; - lprintf(9, "multipart/alternative: <%s>\n", ma->prefix); return; } } @@ -865,12 +870,15 @@ void fixed_output(char *name, char *filename, char *partnum, char *disp, CIT_UBYTE ch = 0; lprintf(9, "fixed_output() type=<%s>\n", cbtype); - + + /* + * If we're in the middle of a multipart/alternative scope and + * we've already printed another section, skip this one. + */ if ( (ma->is_ma == 1) && (ma->did_print == 1) ) { lprintf(9, "Skipping part %s (%s)\n", partnum, cbtype); return; } - ma->did_print = 1; if ( (!strcasecmp(cbtype, "text/plain")) -- 2.39.2