Re: PATCH - improvements for imap_headerinfo()
| From: | adam dot kauffman at mindspring dot com | Date: | Tue, 23 Apr 2002 20:13:44 +0000 |
| Subject: | Re: PATCH - improvements for imap_headerinfo() | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-83229@lists.php.net to get a copy of this message | ||
Hmmm... does the list filter attachments? Anyways, sorry for sending twice.
Hi all,
After getting done with a pretty large PHP4 project, I have a patch I would like to submit for
php_imap.c in the IMAP extension. Here is what this patch does:
imap_headerinfo() really only needs envelope info whereas the current version fetches all headers
and requires a BODY.PEEK. This patch also reduces the overhead of having to convert the structure
returned from the call to mail_fetchheader_full() into an ENVELOPE structure, when
mail_fetch_envelope() actually returns an ENVELOPE struct (saves some mallocs and frees).
This patch also deprecates the 'defaulthost' parameter (it is no longer needed). I
don't get rid of it in the patch but we may want to create imap_headerinfo() as an alias (to
maintain old backward compatibility) and get rid of that parameter in a new function.
Thanks,
Adam
1573c1573
< char dummy[2000], fulladdress[MAILTMPLEN];
---
> char *mystring, dummy[2000], fulladdress[MAILTMPLEN];
1608c1608,1617
< en = mail_fetch_envelope(&en);
---
> 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);
> }
>
> /* 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);
1639a1649
> mail_free_envelope(&en);