cvs: php4 /ext/imap php_imap.c

From: Date: Mon, 13 May 2002 00:29:22 +0000
Subject: cvs: php4 /ext/imap php_imap.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-11893@lists.php.net to get a copy of this message
jon Sun May 12 20:29:22 2002 EDT Modified files: /php4/ext/imap php_imap.c Log: Instead of calling mail_fetchheader_full() to retrieve the complete header information just to extract the message envelope, call mail_fetchenvelope(), which returns just what we need. This is simpler, faster, and saves the IMAP server some work. Submitted by: Adam Kauffman <adam.kauffman@mindspring.com> Index: php4/ext/imap/php_imap.c diff -u php4/ext/imap/php_imap.c:1.114 php4/ext/imap/php_imap.c:1.115 --- php4/ext/imap/php_imap.c:1.114 Sun May 12 16:53:25 2002 +++ php4/ext/imap/php_imap.c Sun May 12 20:29:22 2002 @@ -25,7 +25,7 @@ | PHP 4.0 updates: Zeev Suraski <zeev@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: php_imap.c,v 1.114 2002/05/12 20:53:25 jon Exp $ */ +/* $Id: php_imap.c,v 1.115 2002/05/13 00:29:22 jon Exp $ */ #define IMAP41 @@ -1583,10 +1583,9 @@ { zval **streamind, **msgno, **fromlength, **subjectlength, **defaulthost; pils *imap_le_struct; - unsigned long length; MESSAGECACHE *cache; ENVELOPE *en; - char *mystring, dummy[2000], fulladdress[MAILTMPLEN]; + char dummy[2000], fulladdress[MAILTMPLEN]; int myargc = ZEND_NUM_ARGS(); if (myargc < 2 || myargc > 5 || zend_get_parameters_ex(myargc, &streamind, &msgno, &fromlength, &subjectlength, &defaulthost) == FAILURE) { @@ -1621,13 +1620,8 @@ RETURN_FALSE; } - mystring = mail_fetchheader_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), NIL, &length, NIL); - if (myargc == 5) { - rfc822_parse_msg(&en, NULL, mystring, length, NULL, Z_STRVAL_PP(defaulthost), NIL); - } else { - rfc822_parse_msg(&en, NULL, mystring, length, NULL, "UNKNOWN", NIL); - } - + en = mail_fetchenvelope(imap_le_struct->imap_stream, Z_LVAL_PP(msgno)); + /* call a function to parse all the text, so that we can use the same function to parse text from other sources */ _php_make_header_object(return_value, en TSRMLS_CC); @@ -1662,7 +1656,6 @@ mail_fetchsubject(fulladdress, imap_le_struct->imap_stream, Z_LVAL_PP(msgno), Z_LVAL_PP(subjectlength)); add_property_string(return_value, "fetchsubject", fulladdress, 1); } - mail_free_envelope(&en); } /* }}} */

« previous php.cvs (#11893) next »