(Sorry for the multiple posting. I'm not sure if the mailing lists
are working.)
Hello,
Yesterday I sent a patch. However, I noticed today that one of my changes in parse.c broke some of the MIME handling. Here's a new version of my parse.c patch, which fixes the problem.
Apply this patch against your CVS parse.c.
Cheers,
-Jose
! int preferedcontent(int *current_weight, char *type) {
- int weight; - int status; - - status = 0; -
/* We let plain text remain PREFERED at all times */
! if(!strcasecmp("text/plain", type)) { ! if (*current_weight != 0) { ! /* to avoid having two text/plain alternatives */ ! *current_weight = 0; ! status = 1; ! } ! } ! /* find the weight of the type arg. If the weight is ! inferior to the current_weight, we make it the ! prefered content */ ! else if (set_prefered_types) { ! weight = inlist_pos (set_prefered_types, type); ! if (weight != -1) { ! /* +1 so that weight 0 is reserved for text/plain */ ! weight++; ! if (*current_weight == -1) { ! *current_weight = weight; ! status = 1; ! } ! else if (*current_weight > weight) { ! *current_weight = weight; ! status = 1; ! } ! }
}
! return status;
}
int textcontent(char *type)
--- 85,105 ----
return (inlist(set_inline_types, type)); }
! int preferedcontent(char *type)
{
/* We let plain text remain PREFERED at all times */
! if(!strcasecmp("text/plain", type)) ! return 1; ! ! /* ! ** Parsing for embedded html needs more work before we ! ** can actually do this... ! */ ! if(set_prefered_types) { ! return (inlist(set_prefered_types, type));
}
! return 0;
}
int textcontent(char *type)
struct body *bp;
--- 897,906 ----
char attachname[129]; /* for attachment file names */
char attachname[129]; /* for attachment file names */
/*
--- 1014,1020 ----
/*
! if (alternativeparser) { ! struct body *next, *temp_bp; ! ! /* We are parsing alternatives... */ ! if(preferedcontent(&alternative_weight, type) ) { ! /* ... this is a prefered type, we want to store this [instead of the earlier one]. */ #if 0 ! printf("%s is more fun than the previous one\n", ! type); #endif ! /* erase the previous alternative info */ ! temp_bp = alternative_bp; /* remember the value of bp for GC */ ! alternative_bp = alternative_lp = NULL; ! alternative_lastfile_created = NO_FILE; ! content = CONTENT_UNKNOWN; ! if (alternative_lastfile[0] != '\0') { ! /* remove the previous attachment */ ! unlink (alternative_lastfile); ! alternative_lastfile[0] = '\0'; ! } } else { /* ...and this type is not a prefered one. Thus, we * shall ignore it completely! */ content = CONTENT_IGNORE; - /* erase the current alternative info */ - temp_bp = bp; /* remember the value of bp for GC */ - lp = alternative_lp; - bp = alternative_bp; - strcpy (alternative_file, alternative_lastfile); - file_created = alternative_lastfile_created; - alternative_bp = alternative_lp = NULL; - alternative_lastfile_created = NO_FILE; - alternative_lastfile[0] = '\0'; - /* we haven't yet created any attachment file, so there's no need - to erase it yet */ } ! /* free any previous alternative */ ! while (temp_bp) { ! next = temp_bp->next; ! if (temp_bp->line) free (temp_bp->line); ! free (temp_bp); ! temp_bp = next; ! } ! /* _at_@ not sure if I should add a diff flag to do this break */ ! if (content == CONTENT_IGNORE) ! /* end the header parsing... we already know what we want */ ! break; ! } ! ! if (content == CONTENT_IGNORE) ! continue; ! else if (ignorecontent(type)) ! /* don't save this */ ! content = CONTENT_IGNORE; else if (textcontent(type) || (inlinehtml && !strcasecmp(type, "text/html"))) { /* text content or text/html follows. --- 1135,1178 ---- charset = strsav(charbuffer); } ! if(alternativeparser) { ! /* We are parsing alternatives... */ ! if(preferedcontent(type) ) { ! /* ... this is a prefered type, we want to store this [instead of the earlier one]. */ #if 0 ! struct body *next; ! printf("%s is more fun than the previous one\n", ! type); ! #endif ! #if 0 ! /* ! ** Not sure why this free section is here. ! ** It is causing purify to barf with massive numbers of ! ** "FMR: Free memory reads". When I commented it out it ! ** cleared up the problem with no associated memory leaked ! ** or difference in output. It's history for now. ! */ ! while(bp) { ! next=bp->next; ! if (bp->line) free(bp->line); ! if (bp) free(bp); ! bp=next; ! } #endif ! headp = NULL; } else { /* ...and this type is not a prefered one. Thus, we * shall ignore it completely! */ content = CONTENT_IGNORE; } ! } ! if(ignorecontent(type)) { ! /* don't save this */ ! content = CONTENT_IGNORE; ! } else if (textcontent(type) || (inlinehtml && !strcasecmp(type, "text/html"))) { /* text content or text/html follows.
alternativeparser = TRUE; /* restart on a new list: */ lp=bp=NULL; - /* clean the alternative status variables */ - alternative_weight = -1; - alternative_lp = alternative_bp = NULL; - alternative_lastfile_created = NO_FILE; - alternative_file[0] = alternative_lastfile[0] = '\0'; } headp = lp; /* start at this point next time */ } else { ! bp = addbody(bp, &lp, line, BODY_HEADER|bodyflags); } } else { --- 1368,1381 ---- origlp=lp; alternativeparser = TRUE; + /* restart on a new list: */ lp=bp=NULL; } headp = lp; /* start at this point next time */ } else { ! bp = addbody(bp, &lp, line, BODY_HEADER|bodyflags); } } else {
file=strrchr(binname, PATH_SEPARATOR); if (file) file++; /* pass the separator */
! if (!nameisuniq && binname) { free(binname); - } } }
else content = CONTENT_UNKNOWN; ! if (!nameisuniq && binname) free(binname); } }
This archive was generated by hypermail 2.2.0 : Thu 22 Feb 2007 07:33:51 PM GMT GMT