cvs: php4 /ext/imap php_imap.c
| From: | Jani Taskinen | Date: | Tue, 01 Aug 2000 09:11:47 +0000 |
| Subject: | cvs: php4 /ext/imap php_imap.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-1003@lists.php.net to get a copy of this message | ||
sniper Tue Aug 1 02:11:47 2000 EDT
Modified files:
/php4/ext/imap php_imap.c
Log:
@- Fixed bug in imap_fetchheader() where using FT_PREFETCHTEXT didn't return
@ the body. Bug #4447. (Jani)
Index: php4/ext/imap/php_imap.c
diff -u php4/ext/imap/php_imap.c:1.37 php4/ext/imap/php_imap.c:1.38
--- php4/ext/imap/php_imap.c:1.37 Sat Jul 29 11:45:06 2000
+++ php4/ext/imap/php_imap.c Tue Aug 1 02:11:46 2000
@@ -25,7 +25,7 @@
| PHP 4.0 updates: Zeev Suraski <zeev@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_imap.c,v 1.37 2000/07/29 18:45:06 sniper Exp $ */
+/* $Id: php_imap.c,v 1.38 2000/08/01 09:11:46 sniper Exp $ */
#define IMAP41
@@ -2621,8 +2621,10 @@
zval **streamind, **msgno, **flags;
int ind, ind_type, msgindex;
pils *imap_le_struct;
+ char *body, *header, *tempstring;
+ unsigned long blen, hlen;
int myargc = ZEND_NUM_ARGS();
-
+
if (myargc < 2 || myargc > 3 || zend_get_parameters_ex(myargc, &streamind, &msgno,
&flags) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
@@ -2652,8 +2654,18 @@
php_error(E_WARNING, "Bad message number");
RETURN_FALSE;
}
-
- RETVAL_STRING(mail_fetchheader_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), NIL, NIL,
myargc==3 ? Z_LVAL_PP(flags) : NIL), 1);
+
+ if ((myargc == 3) && (Z_LVAL_PP(flags) & FT_PREFETCHTEXT)) {
+ header = mail_fetchheader_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), NIL, &hlen,
Z_LVAL_PP(flags));
+ body = mail_fetchtext_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), &blen,
Z_LVAL_PP(flags));
+ tempstring = emalloc(hlen+blen+1);
+ strcpy(tempstring,header);
+ strcat(tempstring,body);
+ RETVAL_STRINGL(tempstring,(hlen+blen+1),1);
+ efree(tempstring);
+ } else {
+ RETVAL_STRING(mail_fetchheader_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), NIL, NIL,
NIL), 1);
+ }
}
/* }}} */