summaryrefslogtreecommitdiff
path: root/ext/imap/php_imap.c
diff options
context:
space:
mode:
authorChuck Hagenbuch <chagenbu@php.net>2001-05-04 20:03:47 +0000
committerChuck Hagenbuch <chagenbu@php.net>2001-05-04 20:03:47 +0000
commit2f8eef81f5d063a8e51324649076ba46559a46ef (patch)
tree4db3c622b141ea89d5d898524478b5c41fdc7320 /ext/imap/php_imap.c
parentbb131011a72274230468a6a5aa4e3afab8db357b (diff)
downloadphp-git-2f8eef81f5d063a8e51324649076ba46559a46ef.tar.gz
Add support for in_reply_to header, and fix erealloc usage ("Johan Ekenberg"
<johan@ekenberg.se>).
Diffstat (limited to 'ext/imap/php_imap.c')
-rw-r--r--ext/imap/php_imap.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c
index 3e6a1092d5..7d96319889 100644
--- a/ext/imap/php_imap.c
+++ b/ext/imap/php_imap.c
@@ -3166,7 +3166,7 @@ PHP_FUNCTION(imap_mail_compose)
BODY *bod=NULL, *topbod=NULL;
PART *mypart=NULL, *toppart=NULL, *part;
PARAMETER *param, *disp_param = NULL, *custom_headers_param = NULL, *tmp_param = NULL;
- char tmp[8 * MAILTMPLEN], *mystring=NULL, *t=NULL, *tempstring=NULL, *tempstring_2=NULL;
+ char tmp[8 * MAILTMPLEN], *mystring=NULL, *t=NULL, *tempstring=NULL;
int myargc = ZEND_NUM_ARGS();
if (myargc != 2 || zend_get_parameters_ex(myargc, &envelope, &body) == FAILURE) {
@@ -3204,6 +3204,10 @@ PHP_FUNCTION(imap_mail_compose)
convert_to_string_ex(pvalue);
rfc822_parse_adrlist (&env->reply_to, Z_STRVAL_PP(pvalue), "NO HOST");
}
+ if (zend_hash_find(Z_ARRVAL_PP(envelope), "in_reply_to", sizeof("in_reply_to"), (void **) &pvalue)== SUCCESS) {
+ convert_to_string_ex(pvalue);
+ env->in_reply_to=cpystr(Z_STRVAL_PP(pvalue));
+ }
if (zend_hash_find(Z_ARRVAL_PP(envelope), "subject", sizeof("subject"), (void **) &pvalue)== SUCCESS) {
convert_to_string_ex(pvalue);
env->subject=cpystr(Z_STRVAL_PP(pvalue));
@@ -3401,17 +3405,12 @@ PHP_FUNCTION(imap_mail_compose)
tempstring = emalloc(strlen(tmp) + 1);
strcpy(tempstring, tmp);
do {
- tempstring_2 = emalloc(strlen(tempstring) + strlen(custom_headers_param->value) + strlen(CRLF) + 1);
- sprintf(tempstring_2, "%s%s%s", tempstring, custom_headers_param->value, CRLF);
- efree(tempstring);
- tempstring = emalloc(strlen(tempstring_2) + 1);
- strcpy(tempstring, tempstring_2);
- efree(tempstring_2);
+ tempstring = erealloc(tempstring, strlen(tempstring) + strlen(custom_headers_param->value) + strlen(CRLF) + 1);
+ sprintf(tempstring, "%s%s%s", tempstring, custom_headers_param->value, CRLF);
} while ((custom_headers_param = custom_headers_param->next));
mystring = emalloc(strlen(tempstring) + strlen(CRLF) + 1);
- strcpy(mystring, tempstring);
- strcat(mystring, CRLF);
+ sprintf(mystring, "%s%s", tempstring, CRLF);
efree(tempstring);
} else {
mystring = emalloc(strlen(tmp) + 1);