Re: cvs: php4 /ext/mailparse rfc2045.c

From: Date: Wed, 27 Mar 2002 17:55:51 +0000
Subject: Re: cvs: php4 /ext/mailparse rfc2045.c
References: 1  Groups: php.qa 
Request: Send a blank email to php-qa+get-4776@lists.php.net to get a copy of this message
Hello Wez, does it seem useful to ou to merge this into 4.2.0 ? Derick On Wed, 27 Mar 2002, Wez Furlong wrote: > wez Wed Mar 27 09:05:55 2002 EDT > > Modified files: > /php4/ext/mailparse rfc2045.c > Log: > allow headers hash to handle multiple To: lines > > Index: php4/ext/mailparse/rfc2045.c > diff -u php4/ext/mailparse/rfc2045.c:1.4 php4/ext/mailparse/rfc2045.c:1.5 > --- php4/ext/mailparse/rfc2045.c:1.4 Sun Sep 9 09:28:55 2001 > +++ php4/ext/mailparse/rfc2045.c Wed Mar 27 09:05:55 2002 > @@ -1,4 +1,4 @@ > -/* $Id: rfc2045.c,v 1.4 2001/09/09 13:28:55 derick Exp $ */ > +/* $Id: rfc2045.c,v 1.5 2002/03/27 14:05:55 wez Exp $ */ > /* > ** Copyright 1998 - 1999 Double Precision, Inc. See COPYING for > ** distribution information. > @@ -758,7 +758,32 @@ > val++; > while(isspace(*val)) > val++; > - add_assoc_string(p->headerhash, t, val, 1); > + > + if (strcmp(t, "to") == 0 || strcmp(t, "cc") == 0) { > + /* join multiple To: or Cc: lines together, so that > + * those addresses are not silently ignored by scripts > + * that do not parse headers manually */ > + zval **existing = NULL; > + > + if (SUCCESS == zend_hash_find(Z_ARRVAL_P(p->headerhash), t, strlen(t)+1, > (void**)&existing)) { > + int newlen; > + char *newstr; > + > + newlen = strlen(val) + Z_STRLEN_PP(existing) + 3; > + newstr = emalloc(newlen); > + > + strcpy(newstr, Z_STRVAL_PP(existing)); > + strcat(newstr, ", "); > + strcat(newstr, val); > + > + add_assoc_string(p->headerhash, t, newstr, 0); > + > + } else { > + add_assoc_string(p->headerhash, t, val, 1); > + } > + } else { > + add_assoc_string(p->headerhash, t, val, 1); > + } > } > if (strcmp(t, "mime-version") == 0) > { > > > > -- > PHP CVS Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > ----------------------------------------------------------------------- PHP: Scripting the Web - derick@php.net All your branches are belong to me! SRM: Script Running Machine - www.vl-srm.net -----------------------------------------------------------------------

« previous php.qa (#4776) next »