]> code.citadel.org Git - citadel.git/commitdiff
* Bugfix for MSG0 command to properly handle multipart/alternative
authorArt Cancro <ajc@citadel.org>
Wed, 10 Oct 2001 17:12:54 +0000 (17:12 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 10 Oct 2001 17:12:54 +0000 (17:12 +0000)
citadel/ChangeLog
citadel/mime_parser.c
citadel/msgbase.c

index 025964627c6567e358d5f166f4fae0d794e3f7d5..92a17bbc8e91377440f5b3984b55f66d70fb749e 100644 (file)
@@ -1,4 +1,7 @@
  $Log$
+ Revision 580.54  2001/10/10 17:12:54  ajc
+ * Bugfix for MSG0 command to properly handle multipart/alternative
+
  Revision 580.53  2001/10/06 21:32:29  ajc
  * Finished the concurrency check for network polling.  (Now works both for
    polling and being polled.  Severe UUCP deja vu.)
@@ -2782,3 +2785,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import 
+
index 1d35ce7a7fd731f6c84bd757f2b792a993e265f3..94a508cb3d2b051d21f17313cb19fe3b33b87d5c 100644 (file)
@@ -308,6 +308,8 @@ void the_mime_parser(char *partnum,
                        if (!strncasecmp(header, "Content-type: ", 14)) {
                                strcpy(content_type, &header[14]);
                                extract_key(name, content_type, "name");
+                               lprintf(9, "Extracted content-type <%s>\n",
+                                       content_type);
                        }
                        if (!strncasecmp(header, "Content-Disposition: ", 21)) {
                                strcpy(disposition, &header[21]);
index 6c92b64c13befba32d3afeda123f7fdf01960d8b..f1b8c0530bffe54c5fb3f46f346f715b9faa5c66 100644 (file)
@@ -821,7 +821,39 @@ void CtdlFreeMessage(struct CtdlMessage *msg)
 
 
 /*
- * Callback function for mime parser that wants to display text
+ * Pre callback function for mime parser that wants to display text
+ */
+void fixed_output_pre(char *name, char *filename, char *partnum, char *disp,
+               void *content, char *cbtype, size_t length, char *encoding,
+               void *cbuserdata)
+{
+               lprintf(9, "fixed_output_pre() type=<%s>\n", cbtype);   
+               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
+ */
+void fixed_output_post(char *name, char *filename, char *partnum, char *disp,
+               void *content, char *cbtype, size_t length, char *encoding,
+               void *cbuserdata)
+{
+               lprintf(9, "fixed_output_post() type=<%s>\n", cbtype);  
+               if (!strcasecmp(cbtype, "multipart/alternative")) {
+                       ma->is_ma = 0;
+                       ma->did_print = 0;
+                       lprintf(9, "multipart/alternative: <%s>\n", ma->prefix);
+                       return;
+               }
+}
+
+/*
+ * Inline callback function for mime parser that wants to display text
  */
 void fixed_output(char *name, char *filename, char *partnum, char *disp,
                void *content, char *cbtype, size_t length, char *encoding,
@@ -831,18 +863,10 @@ void fixed_output(char *name, char *filename, char *partnum, char *disp,
                char *wptr;
                size_t wlen;
                CIT_UBYTE ch = 0;
+
+               lprintf(9, "fixed_output() type=<%s>\n", cbtype);       
        
-               if (!strcasecmp(cbtype, "multipart/alternative")) {
-                       strcpy(ma->prefix, partnum);
-                       strcat(ma->prefix, ".");
-                       ma->is_ma = 1;
-                       ma->did_print = 0;
-                       return;
-               }
-       
-               if ( (!strncasecmp(partnum, ma->prefix, strlen(ma->prefix)))
-               && (ma->is_ma == 1) 
-               && (ma->did_print == 1) ) {
+               if ( (ma->is_ma == 1) && (ma->did_print == 1) ) {
                        lprintf(9, "Skipping part %s (%s)\n", partnum, cbtype);
                        return;
                }
@@ -1235,7 +1259,7 @@ int CtdlOutputPreLoadedMsg(struct CtdlMessage *TheMessage,
                CtdlAllocUserData(SYM_MA_INFO, sizeof(struct ma_info));
                memset(ma, 0, sizeof(struct ma_info));
                mime_parser(mptr, NULL,
-                       *fixed_output, NULL, NULL,
+                       *fixed_output, *fixed_output_pre, *fixed_output_post,
                        NULL, 0);
        }