pajoye Sat Apr 25 16:36:02 2009 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/imap php_imap.c
Log:
- ws
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.46&r2=1.208.2.7.2.47&diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.46
php-src/ext/imap/php_imap.c:1.208.2.7.2.47
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.46 Fri Apr 24 14:53:59 2009
+++ php-src/ext/imap/php_imap.c Sat Apr 25 16:36:02 2009
@@ -26,7 +26,7 @@
| PHP 4.0 updates: Zeev Suraski <[email protected]> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_imap.c,v 1.208.2.7.2.46 2009/04/24 14:53:59 pajoye Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.47 2009/04/25 16:36:02 pajoye Exp $ */
#define IMAP41
@@ -241,7 +241,7 @@
static int add_assoc_object(zval *arg, char *key, zval *tmp TSRMLS_DC)
{
HashTable *symtable;
-
+
if (Z_TYPE_P(arg) == IS_OBJECT) {
symtable = Z_OBJPROP_P(arg);
} else {
@@ -256,14 +256,14 @@
static inline int add_next_index_object(zval *arg, zval *tmp TSRMLS_DC)
{
HashTable *symtable;
-
+
if (Z_TYPE_P(arg) == IS_OBJECT) {
symtable = Z_OBJPROP_P(arg);
} else {
symtable = Z_ARRVAL_P(arg);
}
- return zend_hash_next_index_insert(symtable, (void *) &tmp, sizeof(zval
*), NULL);
+ return zend_hash_next_index_insert(symtable, (void *) &tmp, sizeof(zval
*), NULL);
}
/* }}} */
@@ -334,7 +334,7 @@
/* }}} */
/* {{{ mail_newmessagelist
- *
+ *
* Mail instantiate MESSAGELIST
* Returns: new MESSAGELIST list
* Author: CJH
@@ -365,8 +365,8 @@
}
/* }}} */
-#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
-/* {{{ mail_getquota
+#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
+/* {{{ mail_getquota
*
* Mail GET_QUOTA callback
* Called via the mail_parameter function in c-client:src/c-client/mail.c
@@ -377,7 +377,7 @@
{
zval *t_map, *return_value;
TSRMLS_FETCH();
-
+
return_value = *IMAPG(quota_return);
/* put parsing code here */
@@ -472,7 +472,7 @@
#ifndef PHP_WIN32
auth_link(&auth_log); /* link in the log authenticator */
- auth_link(&auth_md5); /* link in the cram-md5 authenticator */
+ auth_link(&auth_md5); /* link in the cram-md5 authenticator */
#if HAVE_IMAP_KRB && defined(HAVE_IMAP_AUTH_GSS)
auth_link(&auth_gss); /* link in the gss authenticator */
#endif
@@ -522,13 +522,13 @@
REGISTER_LONG_CONSTANT("OP_SECURE", OP_SECURE, CONST_PERSISTENT |
CONST_CS);
/* don't do non-secure authentication */
- /*
+ /*
PHP re-assigns CL_EXPUNGE a custom value that can be used as part of
the imap_open() bitfield
- because it seems like a good idea to be able to indicate that the
mailbox should be
+ because it seems like a good idea to be able to indicate that the
mailbox should be
automatically expunged during imap_open in case the script get
interrupted and it doesn't get
to the imap_close() where this option is normally placed. If the
c-client library adds other
- options and the value for this one conflicts, simply make PHP_EXPUNGE
higher at the top of
- this file
+ options and the value for this one conflicts, simply make PHP_EXPUNGE
higher at the top of
+ this file
*/
REGISTER_LONG_CONSTANT("CL_EXPUNGE", PHP_EXPUNGE, CONST_PERSISTENT |
CONST_CS);
/* expunge silently */
@@ -759,7 +759,7 @@
long flags=NIL;
long cl_flags=NIL;
int myargc = ZEND_NUM_ARGS();
-
+
if (myargc < 3 || myargc > 5 || zend_get_parameters_ex(myargc,
&mailbox, &user, &passwd, &options, &retries) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
@@ -776,17 +776,17 @@
}
}
- if (IMAPG(imap_user)) {
+ if (IMAPG(imap_user)) {
efree(IMAPG(imap_user));
}
- if (IMAPG(imap_password)) {
+ if (IMAPG(imap_password)) {
efree(IMAPG(imap_password));
}
/* local filename, need to perform open_basedir and safe_mode checks */
- if (Z_STRVAL_PP(mailbox)[0] != '{' &&
- (php_check_open_basedir(Z_STRVAL_PP(mailbox) TSRMLS_CC)
||
+ if (Z_STRVAL_PP(mailbox)[0] != '{' &&
+ (php_check_open_basedir(Z_STRVAL_PP(mailbox) TSRMLS_CC)
||
(PG(safe_mode) && !php_checkuid(Z_STRVAL_PP(mailbox),
NULL, CHECKUID_CHECK_FILE_AND_DIR)))) {
RETURN_FALSE;
}
@@ -816,7 +816,7 @@
imap_le_struct = emalloc(sizeof(pils));
imap_le_struct->imap_stream = imap_stream;
- imap_le_struct->flags = cl_flags;
+ imap_le_struct->flags = cl_flags;
ZEND_REGISTER_RESOURCE(return_value, imap_le_struct, le_imap);
}
@@ -835,7 +835,7 @@
PHP_FUNCTION(imap_reopen)
{
zval **streamind, **mailbox, **options, **retries;
- pils *imap_le_struct;
+ pils *imap_le_struct;
MAILSTREAM *imap_stream;
long flags=NIL;
long cl_flags=NIL;
@@ -856,7 +856,7 @@
cl_flags = CL_EXPUNGE;
flags ^= PHP_EXPUNGE;
}
- imap_le_struct->flags = cl_flags;
+ imap_le_struct->flags = cl_flags;
}
#ifdef SET_MAXLOGINTRIALS
if (myargc == 4) {
@@ -865,8 +865,8 @@
}
#endif
/* local filename, need to perform open_basedir and safe_mode checks */
- if (Z_STRVAL_PP(mailbox)[0] != '{' &&
- (php_check_open_basedir(Z_STRVAL_PP(mailbox) TSRMLS_CC)
||
+ if (Z_STRVAL_PP(mailbox)[0] != '{' &&
+ (php_check_open_basedir(Z_STRVAL_PP(mailbox) TSRMLS_CC)
||
(PG(safe_mode) && !php_checkuid(Z_STRVAL_PP(mailbox),
NULL, CHECKUID_CHECK_FILE_AND_DIR)))) {
RETURN_FALSE;
}
@@ -886,14 +886,14 @@
PHP_FUNCTION(imap_append)
{
zval **streamind, **folder, **message, **flags;
- pils *imap_le_struct;
+ pils *imap_le_struct;
STRING st;
int myargc=ZEND_NUM_ARGS();
-
+
if (myargc < 3 || myargc > 4 || zend_get_parameters_ex(myargc,
&streamind, &folder, &message, &flags) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap",
le_imap);
convert_to_string_ex(folder);
@@ -918,7 +918,7 @@
PHP_FUNCTION(imap_num_msg)
{
zval **streamind;
- pils *imap_le_struct;
+ pils *imap_le_struct;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &streamind) ==
FAILURE) {
ZEND_WRONG_PARAM_COUNT();
@@ -935,7 +935,7 @@
PHP_FUNCTION(imap_ping)
{
zval **streamind;
- pils *imap_le_struct;
+ pils *imap_le_struct;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &streamind) ==
FAILURE) {
ZEND_WRONG_PARAM_COUNT();
@@ -1042,7 +1042,7 @@
limits.text.size = Z_LVAL_PP(mailbox_size);
limits.next = NIL;
- RETURN_BOOL(imap_setquota(imap_le_struct->imap_stream,
Z_STRVAL_PP(qroot), &limits));
+ RETURN_BOOL(imap_setquota(imap_le_struct->imap_stream,
Z_STRVAL_PP(qroot), &limits));
}
/* }}} */
@@ -1052,7 +1052,7 @@
{
zval **streamind, **mailbox, **id, **rights;
pils *imap_le_struct;
-
+
if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &streamind,
&mailbox, &id, &rights) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
@@ -1108,7 +1108,7 @@
PHP_FUNCTION(imap_expunge)
{
zval **streamind;
- pils *imap_le_struct;
+ pils *imap_le_struct;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &streamind) ==
FAILURE) {
ZEND_WRONG_PARAM_COUNT();
@@ -1127,7 +1127,7 @@
PHP_FUNCTION(imap_close)
{
zval **options, **streamind=NULL;
- pils *imap_le_struct=NULL;
+ pils *imap_le_struct=NULL;
long flags = NIL;
int myargcount=ZEND_NUM_ARGS();
@@ -1151,7 +1151,7 @@
if (flags & PHP_EXPUNGE) {
flags ^= PHP_EXPUNGE;
flags |= CL_EXPUNGE;
- }
+ }
imap_le_struct->flags = flags;
}
@@ -1166,21 +1166,21 @@
PHP_FUNCTION(imap_headers)
{
zval **streamind;
- pils *imap_le_struct;
+ pils *imap_le_struct;
unsigned long i;
char *t;
unsigned int msgno;
char tmp[MAILTMPLEN];
-
+
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &streamind) ==
FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap",
le_imap);
/* Initialize return array */
array_init(return_value);
-
+
for (msgno = 1; msgno <= imap_le_struct->imap_stream->nmsgs; msgno++) {
MESSAGECACHE * cache = mail_elt (imap_le_struct->imap_stream,
msgno);
mail_fetchstructure(imap_le_struct->imap_stream, msgno, NIL);
@@ -1216,7 +1216,7 @@
PHP_FUNCTION(imap_body)
{
zval **streamind, **msgno, **pflags;
- pils *imap_le_struct;
+ pils *imap_le_struct;
int msgindex, myargc=ZEND_NUM_ARGS();
long flags=0L;
char *body;
@@ -1228,7 +1228,7 @@
ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap",
le_imap);
-
+
convert_to_long_ex(msgno);
if (myargc == 3) {
convert_to_long_ex(pflags);
@@ -1266,7 +1266,7 @@
PHP_FUNCTION(imap_mail_copy)
{
zval **streamind, **seq, **folder, **options;
- pils *imap_le_struct;
+ pils *imap_le_struct;
int myargcount = ZEND_NUM_ARGS();
if (myargcount > 4 || myargcount < 3 ||
zend_get_parameters_ex(myargcount, &streamind, &seq, &folder, &options) ==
FAILURE) {
@@ -1294,7 +1294,7 @@
PHP_FUNCTION(imap_mail_move)
{
zval **streamind, **seq, **folder, **options;
- pils *imap_le_struct;
+ pils *imap_le_struct;
int myargcount = ZEND_NUM_ARGS();
if (myargcount > 4 || myargcount < 3 ||
zend_get_parameters_ex(myargcount, &streamind, &seq, &folder, &options) ==
FAILURE) {
@@ -1322,7 +1322,7 @@
PHP_FUNCTION(imap_createmailbox)
{
zval **streamind, **folder;
- pils *imap_le_struct;
+ pils *imap_le_struct;
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind,
&folder) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
@@ -1345,7 +1345,7 @@
PHP_FUNCTION(imap_renamemailbox)
{
zval **streamind, **old_mailbox, **new_mailbox;
- pils *imap_le_struct;
+ pils *imap_le_struct;
if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &streamind,
&old_mailbox, &new_mailbox) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
@@ -1369,7 +1369,7 @@
PHP_FUNCTION(imap_deletemailbox)
{
zval **streamind, **folder;
- pils *imap_le_struct;
+ pils *imap_le_struct;
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind,
&folder) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
@@ -1392,7 +1392,7 @@
PHP_FUNCTION(imap_list)
{
zval **streamind, **ref, **pat;
- pils *imap_le_struct;
+ pils *imap_le_struct;
STRINGLIST *cur=NIL;
if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &streamind, &ref,
&pat) == FAILURE) {
@@ -1406,7 +1406,7 @@
/* set flag for normal, old mailbox list */
IMAPG(folderlist_style) = FLIST_ARRAY;
-
+
IMAPG(imap_folders) = IMAPG(imap_folders_tail) = NIL;
mail_list(imap_le_struct->imap_stream, Z_STRVAL_PP(ref),
Z_STRVAL_PP(pat));
if (IMAPG(imap_folders) == NIL) {
@@ -1431,14 +1431,14 @@
PHP_FUNCTION(imap_list_full)
{
zval **streamind, **ref, **pat, *mboxob;
- pils *imap_le_struct;
+ pils *imap_le_struct;
FOBJECTLIST *cur=NIL;
char *delim=NIL;
-
+
if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &streamind, &ref,
&pat) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap",
le_imap);
convert_to_string_ex(ref);
@@ -1446,13 +1446,13 @@
/* set flag for new, improved array of objects mailbox list */
IMAPG(folderlist_style) = FLIST_OBJECT;
-
+
IMAPG(imap_folder_objects) = IMAPG(imap_folder_objects_tail) = NIL;
mail_list(imap_le_struct->imap_stream, Z_STRVAL_PP(ref),
Z_STRVAL_PP(pat));
if (IMAPG(imap_folder_objects) == NIL) {
RETURN_FALSE;
}
-
+
array_init(return_value);
delim = safe_emalloc(2, sizeof(char), 0);
cur=IMAPG(imap_folder_objects);
@@ -1552,18 +1552,18 @@
zval **streamind, **sequence, **flags;
pils *imap_le_struct;
int myargc=ZEND_NUM_ARGS();
-
+
if (myargc < 2 || myargc > 3 || zend_get_parameters_ex(myargc,
&streamind, &sequence, &flags) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap",
le_imap);
convert_to_string_ex(sequence);
if (myargc == 3) {
convert_to_long_ex(flags);
}
-
+
mail_setflag_full(imap_le_struct->imap_stream, Z_STRVAL_PP(sequence),
"\\DELETED", myargc==3 ? Z_LVAL_PP(flags) : NIL);
RETVAL_TRUE;
}
@@ -1580,9 +1580,9 @@
if (myargc < 2 || myargc > 3 || zend_get_parameters_ex(myargc,
&streamind, &sequence, &flags) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap",
le_imap);
-
+
convert_to_string_ex(sequence);
if (myargc == 3) {
convert_to_long_ex(flags);
@@ -1603,11 +1603,11 @@
ENVELOPE *en;
char dummy[2000], fulladdress[MAILTMPLEN + 1];
int myargc = ZEND_NUM_ARGS();
-
+
if (myargc < 2 || myargc > 5 || zend_get_parameters_ex(myargc,
&streamind, &msgno, &fromlength, &subjectlength, &defaulthost) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap",
le_imap);
convert_to_long_ex(msgno);
@@ -1632,7 +1632,7 @@
if (myargc == 5) {
convert_to_string_ex(defaulthost);
}
-
+
PHP_IMAP_CHECK_MSGNO(Z_LVAL_PP(msgno));
if (mail_fetchstructure(imap_le_struct->imap_stream, Z_LVAL_PP(msgno),
NIL)) {
@@ -1640,13 +1640,13 @@
} else {
RETURN_FALSE;
}
-
+
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);
-
+
/* now run through properties that are only going to be returned
from a server, not text headers */
add_property_string(return_value, "Recent", cache->recent ?
(cache->seen ? "R": "N") : " ", 1);
@@ -1655,18 +1655,18 @@
add_property_string(return_value, "Answered", cache->answered ? "A" : "
", 1);
add_property_string(return_value, "Deleted", cache->deleted ? "D" : "
", 1);
add_property_string(return_value, "Draft", cache->draft ? "X" : " ", 1);
-
+
snprintf(dummy, sizeof(dummy), "%4ld", cache->msgno);
add_property_string(return_value, "Msgno", dummy, 1);
-
+
mail_date(dummy, cache);
add_property_string(return_value, "MailDate", dummy, 1);
-
- snprintf(dummy, sizeof(dummy), "%ld", cache->rfc822_size);
+
+ snprintf(dummy, sizeof(dummy), "%ld", cache->rfc822_size);
add_property_string(return_value, "Size", dummy, 1);
-
+
add_property_long(return_value, "udate", mail_longdate(cache));
-
+
if (en->from && fromlength) {
fulladdress[0] = 0x00;
mail_fetchfrom(fulladdress, imap_le_struct->imap_stream,
Z_LVAL_PP(msgno), Z_LVAL_PP(fromlength));
@@ -1691,18 +1691,18 @@
if (myargc < 1 || myargc > 2 || zend_get_parameters_ex(myargc,
&headers, &defaulthost) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
convert_to_string_ex(headers);
if (myargc == 2) {
convert_to_string_ex(defaulthost);
}
-
+
if (myargc == 2) {
rfc822_parse_msg(&en, NULL, Z_STRVAL_PP(headers),
Z_STRLEN_PP(headers), NULL, Z_STRVAL_PP(defaulthost), NIL);
} else {
rfc822_parse_msg(&en, NULL, Z_STRVAL_PP(headers),
Z_STRLEN_PP(headers), NULL, "UNKNOWN", NIL);
}
-
+
/* call a function to parse all the text, so that we can use the
same function no matter where the headers are from */
_php_make_header_object(return_value, en TSRMLS_CC);
@@ -1719,19 +1719,19 @@
zval **streamind, **ref, **pat;
pils *imap_le_struct;
STRINGLIST *cur=NIL;
-
+
if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &streamind, &ref,
&pat) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap",
le_imap);
-
+
convert_to_string_ex(ref);
convert_to_string_ex(pat);
/* set flag for normal, old mailbox list */
IMAPG(folderlist_style) = FLIST_ARRAY;
-
+
IMAPG(imap_sfolders) = NIL;
mail_lsub(imap_le_struct->imap_stream, Z_STRVAL_PP(ref),
Z_STRVAL_PP(pat));
if (IMAPG(imap_sfolders) == NIL) {
@@ -1758,11 +1758,11 @@
pils *imap_le_struct;
FOBJECTLIST *cur=NIL;
char *delim=NIL;
-
+
if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &streamind, &ref,
&pat) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap",
le_imap);
convert_to_string_ex(ref);
@@ -1770,13 +1770,13 @@
/* set flag for new, improved array of objects list */
IMAPG(folderlist_style) = FLIST_OBJECT;
-
+
IMAPG(imap_sfolder_objects) = IMAPG(imap_sfolder_objects_tail) = NIL;
mail_lsub(imap_le_struct->imap_stream, Z_STRVAL_PP(ref),
Z_STRVAL_PP(pat));
if (IMAPG(imap_sfolder_objects) == NIL) {
RETURN_FALSE;
}
-
+
array_init(return_value);
delim = safe_emalloc(2, sizeof(char), 0);
cur=IMAPG(imap_sfolder_objects);
@@ -1811,7 +1811,7 @@
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind,
&folder) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap",
le_imap);
convert_to_string_ex(folder);
@@ -1861,7 +1861,7 @@
ZEND_WRONG_PARAM_COUNT();
}
-
+
ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap",
le_imap);
convert_to_long_ex(msgno);
@@ -1891,12 +1891,12 @@
PHP_IMAP_CHECK_MSGNO(msgindex);
mail_fetchstructure_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno),
&body , myargc == 3 ? Z_LVAL_PP(pflags) : NIL);
-
+
if (!body) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "No body
information available");
RETURN_FALSE;
}
-
+
_php_imap_add_body(return_value, body TSRMLS_CC);
}
/* }}} */
@@ -1956,17 +1956,17 @@
char *section = "";
int section_len = 0, close_stream = 1;
long msgno, flags = 0;
-
+
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
"rZl|sl", &stream, &out, &msgno, §ion, §ion_len, &flags)) {
RETURN_FALSE;
}
-
+
ZEND_FETCH_RESOURCE(imap_ptr, pils *, &stream, -1, "imap", le_imap);
-
+
if (!imap_ptr) {
RETURN_FALSE;
}
-
+
switch (Z_TYPE_PP(out))
{
case IS_LONG:
@@ -1980,19 +1980,19 @@
writer = php_stream_open_wrapper(Z_STRVAL_PP(out),
"wb", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL);
break;
}
-
+
if (!writer) {
RETURN_FALSE;
}
-
+
IMAPG(gets_stream) = writer;
mail_fetchbody_full(imap_ptr->imap_stream, msgno, section, NULL, flags);
IMAPG(gets_stream) = NULL;
-
+
if (close_stream) {
php_stream_close(writer);
}
-
+
RETURN_TRUE;
}
/* }}} */
@@ -2232,7 +2232,7 @@
}
add_next_index_object(return_value, tovals TSRMLS_CC);
} while ((addresstmp = addresstmp->next));
-
+
mail_free_envelope(&env);
}
/* }}} */
@@ -2243,13 +2243,13 @@
{
zval **str;
SIZEDTEXT src, dest;
-
+
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE)
{
ZEND_WRONG_PARAM_COUNT();
}
convert_to_string_ex(str);
-
+
src.data = NULL;
src.size = 0;
dest.data = NULL;
@@ -2273,9 +2273,9 @@
/* }}} */
-/* {{{ macros for the modified utf7 conversion functions
+/* {{{ macros for the modified utf7 conversion functions
*
- * author: Andrew Skalski <[email protected]>
+ * author: Andrew Skalski <[email protected]>
*/
/* tests `c' and returns true if it is a special character */
@@ -2314,14 +2314,14 @@
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
{
ZEND_WRONG_PARAM_COUNT();
}
-
+
convert_to_string_ex(arg); /* Is this string really
modified?
If it is use and you don't want it to be seen outside of the function
then use zend_get_parameters() */
in = (const unsigned char *) Z_STRVAL_PP(arg);
inlen = Z_STRLEN_PP(arg);
-
+
/* validate and compute length of output string */
outlen = 0;
state = ST_NORMAL;
@@ -2621,7 +2621,7 @@
SORTPGM *mypgm=NIL;
SEARCHPGM *spg=NIL;
int myargc = ZEND_NUM_ARGS();
-
+
if (myargc < 3 || myargc > 6 || zend_get_parameters_ex(myargc,
&streamind, &pgm, &rev, &flags, &criteria, &charset) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
@@ -2652,12 +2652,12 @@
} else {
spg = mail_newsearchpgm();
}
-
+
mypgm = mail_newsortpgm();
mypgm->reverse = Z_LVAL_PP(rev);
mypgm->function = (short) Z_LVAL_PP(pgm);
mypgm->next = NIL;
-
+
slst = mail_sort(imap_le_struct->imap_stream, (myargc == 6 ?
Z_STRVAL_PP(charset) : NIL), spg, mypgm, (myargc >= 4 ? Z_LVAL_PP(flags) :
NIL));
if (spg) {
@@ -2666,7 +2666,7 @@
array_init(return_value);
if (slst != NIL && slst != 0) {
- for (sl = slst; *sl; sl++) {
+ for (sl = slst; *sl; sl++) {
add_next_index_long(return_value, *sl);
}
fs_give ((void **) &slst);
@@ -2682,7 +2682,7 @@
pils *imap_le_struct;
int msgindex, myargc = ZEND_NUM_ARGS();
long flags=0L;
-
+
if (myargc < 2 || myargc > 3 || zend_get_parameters_ex(myargc,
&streamind, &msgno, &pflags) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
@@ -2699,7 +2699,7 @@
}
}
-
+
if ((myargc == 3) && (flags & FT_UID)) {
/* This should be cached; if it causes an extra RTT to the
IMAP server, then that's the price we pay for making sure
@@ -2722,15 +2722,15 @@
zval **streamind, **msgno;
pils *imap_le_struct;
int msgindex;
-
+
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind,
&msgno) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap",
le_imap);
-
+
convert_to_long_ex(msgno);
-
+
msgindex = Z_LVAL_PP(msgno);
if ((msgindex < 1) || ((unsigned) msgindex >
imap_le_struct->imap_stream->nmsgs)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad message
number");
@@ -2747,15 +2747,15 @@
{
zval **streamind, **msgno;
pils *imap_le_struct;
-
+
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind,
&msgno) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap",
le_imap);
-
+
convert_to_long_ex(msgno);
-
+
RETURN_LONG(mail_msgno(imap_le_struct->imap_stream, Z_LVAL_PP(msgno)));
}
/* }}} */
@@ -2814,9 +2814,9 @@
if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &streamind, &msg,
§ion) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap",
le_imap);
-
+
convert_to_long_ex(msg);
convert_to_string_ex(section);
@@ -2826,7 +2826,7 @@
}
object_init(return_value);
-
+
body=mail_body(imap_le_struct->imap_stream, Z_LVAL_PP(msg),
Z_STRVAL_PP(section));
if (body == NULL) {
zval_dtor(return_value);
@@ -2838,14 +2838,14 @@
if (body->encoding <= ENCMAX) {
add_property_long(return_value, "encoding", body->encoding);
}
-
+
if (body->subtype) {
add_property_long(return_value, "ifsubtype", 1);
add_property_string(return_value, "subtype", body->subtype, 1);
} else {
add_property_long(return_value, "ifsubtype", 0);
}
-
+
if (body->description) {
add_property_long(return_value, "ifdescription", 1);
add_property_string(return_value, "description",
body->description, 1);
@@ -2859,7 +2859,7 @@
add_property_long(return_value, "ifid", 0);
}
-
+
if (body->size.lines) {
add_property_long(return_value, "lines", body->size.lines);
}
@@ -2873,7 +2873,7 @@
} else {
add_property_long(return_value, "ifdisposition", 0);
}
-
+
if (body->disposition.parameter) {
dpar = body->disposition.parameter;
add_property_long(return_value, "ifdparameters", 1);
@@ -2891,10 +2891,10 @@
add_property_long(return_value, "ifdparameters", 0);
}
#endif
-
+
if ((par = body->parameter)) {
add_property_long(return_value, "ifparameters", 1);
-
+
MAKE_STD_ZVAL(parametres);
array_init(parametres);
do {
@@ -2906,7 +2906,7 @@
if (par->value) {
add_property_string(param, "value", par->value,
1);
}
-
+
add_next_index_object(parametres, param TSRMLS_CC);
} while ((par = par->next));
} else {
@@ -2920,7 +2920,7 @@
/* }}} */
/* {{{ proto array imap_fetch_overview(resource stream_id, int msg_no [, int
options])
- Read an overview of the information in the headers of the given message
sequence */
+ Read an overview of the information in the headers of the given message
sequence */
PHP_FUNCTION(imap_fetch_overview)
{
zval **streamind, **sequence, **pflags;
@@ -2929,7 +2929,7 @@
char *address;
long status, flags=0L;
int myargc = ZEND_NUM_ARGS();
-
+
if (myargc < 2 || myargc > 3 || zend_get_parameters_ex(myargc,
&streamind, &sequence, &pflags) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
@@ -2944,20 +2944,20 @@
if (flags && ((flags & ~FT_UID) != 0)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid
value for the options parameter");
RETURN_FALSE;
- }
+ }
}
array_init(return_value);
-
- status = (flags & FT_UID)
+
+ status = (flags & FT_UID)
? mail_uid_sequence (imap_le_struct->imap_stream,
Z_STRVAL_PP(sequence))
: mail_sequence (imap_le_struct->imap_stream,
Z_STRVAL_PP(sequence));
-
- if (status) {
+
+ if (status) {
MESSAGECACHE *elt;
ENVELOPE *env;
unsigned long i;
-
+
for (i = 1; i <= imap_le_struct->imap_stream->nmsgs; i++) {
if (((elt = mail_elt (imap_le_struct->imap_stream,
i))->sequence) &&
(env = mail_fetch_structure
(imap_le_struct->imap_stream, i, NIL, NIL))) {
@@ -3229,7 +3229,7 @@
if (type != TYPEMULTIPART) {
bod->type = type;
- }
+ }
if (zend_hash_find(Z_ARRVAL_PP(data), "encoding",
sizeof("encoding"), (void **) &pvalue)== SUCCESS) {
convert_to_long_ex(pvalue);
@@ -3263,7 +3263,7 @@
}
if (zend_hash_find(Z_ARRVAL_PP(data), "subtype",
sizeof("subtype"), (void **) &pvalue)== SUCCESS) {
convert_to_string_ex(pvalue);
- bod->subtype = cpystr(Z_STRVAL_PP(pvalue));
+ bod->subtype = cpystr(Z_STRVAL_PP(pvalue));
}
if (zend_hash_find(Z_ARRVAL_PP(data), "id",
sizeof("id"), (void **) &pvalue)== SUCCESS) {
convert_to_string_ex(pvalue);
@@ -3342,7 +3342,7 @@
tmp[l] = '\0';
tempstring = emalloc(l);
memcpy(tempstring, tmp, l);
-
+
do {
l2 = strlen(custom_headers_param->value);
tempstring = erealloc(tempstring, l + l2 + CRLF_LEN +
1);
@@ -3351,7 +3351,7 @@
l += l2 + CRLF_LEN;
} while ((custom_headers_param = custom_headers_param->next));
- mail_free_body_parameter(&tp);
+ mail_free_body_parameter(&tp);
mystring = emalloc(l + CRLF_LEN + 1);
memcpy(mystring, tempstring, l);
@@ -3365,10 +3365,10 @@
bod = topbod;
- if (bod && bod->type == TYPEMULTIPART) {
+ if (bod && bod->type == TYPEMULTIPART) {
/* first body part */
- part = bod->nested.part;
+ part = bod->nested.part;
/* find cookie */
for (param = bod->parameter; param && !cookie; param =
param->next) {
@@ -3379,17 +3379,17 @@
/* yucky default */
if (!cookie) {
- cookie = "-";
+ cookie = "-";
} else if (strlen(cookie) > (SENDBUFLEN - 2 - 2 - 2)) {
/* validate cookie length -- + CRLF * 2 */
php_error_docref(NULL TSRMLS_CC, E_WARNING,
"The boudary should be no longer then 4kb");
RETVAL_FALSE;
- goto done;
+ goto done;
}
/* for each part */
do {
t = tmp;
-
+
/* append mini-header */
*t = '\0';
rfc822_write_body_header(&t, &part->body);
@@ -3639,7 +3639,7 @@
convert_to_string_ex(argv[3]);
headers = Z_STRVAL_PP(argv[3]);
}
-
+
/* cc */
if (argc > 4) {
convert_to_string_ex(argv[4]);
@@ -3685,7 +3685,7 @@
convert_to_string_ex(criteria);
search_criteria = estrndup(Z_STRVAL_PP(criteria),
Z_STRLEN_PP(criteria));
-
+
if (argc == 2) {
flags = SE_FREE;
} else {
@@ -3695,14 +3695,14 @@
convert_to_string_ex(charset);
}
}
-
+
IMAPG(imap_messages) = IMAPG(imap_messages_tail) = NIL;
mail_search_full(imap_le_struct->imap_stream, (argc == 4 ?
Z_STRVAL_PP(charset) : NIL), mail_criteria(search_criteria), flags);
if (IMAPG(imap_messages) == NIL) {
efree(search_criteria);
RETURN_FALSE;
}
-
+
array_init(return_value);
cur = IMAPG(imap_messages);
@@ -3724,12 +3724,12 @@
if (ZEND_NUM_ARGS() > 0) {
ZEND_WRONG_PARAM_COUNT();
- }
-
+ }
+
if (IMAPG(imap_alertstack) == NIL) {
RETURN_FALSE;
}
-
+
array_init(return_value);
cur = IMAPG(imap_alertstack);
@@ -3751,12 +3751,12 @@
if (ZEND_NUM_ARGS() > 0) {
ZEND_WRONG_PARAM_COUNT();
- }
-
+ }
+
if (IMAPG(imap_errorstack) == NIL) {
RETURN_FALSE;
}
-
+
array_init(return_value);
cur = IMAPG(imap_errorstack);
@@ -3769,7 +3769,7 @@
}
/* }}} */
-/* {{{ proto string imap_last_error(void)
+/* {{{ proto string imap_last_error(void)
Returns the last error that was generated by an IMAP function. The error
stack is NOT cleared after this call. */
/* Author: CJH */
PHP_FUNCTION(imap_last_error)
@@ -3778,12 +3778,12 @@
if (ZEND_NUM_ARGS() > 0) {
ZEND_WRONG_PARAM_COUNT();
- }
-
+ }
+
if (IMAPG(imap_errorstack) == NIL) {
RETURN_FALSE;
}
-
+
cur = IMAPG(imap_errorstack);
while (cur != NIL) {
if (cur->next == NIL) {
@@ -3814,7 +3814,7 @@
string = Z_STRVAL_PP(str);
end = Z_STRLEN_PP(str);
-
+
charset = (char *) safe_emalloc((end + 1), 2, 0);
text = &charset[end + 1];
while (offset < end) { /* Reached end of the string? */
@@ -3886,7 +3886,7 @@
add_property_string(myobject, "charset", "default", 1);
add_property_string(myobject, "text", text, 1);
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), (void
*)&myobject, sizeof(zval *), NULL);
-
+
offset = end; /* We have reached the end of the string. */
}
efree(charset);
@@ -3905,7 +3905,7 @@
smart_str *ret = (smart_str*)stream;
int len = strlen(string);
- smart_str_appendl(ret, string, len);
+ smart_str_appendl(ret, string, len);
return LONGT;
}
@@ -3935,7 +3935,7 @@
/* {{{ _php_rfc822_len
* Calculate string length based on imap's rfc822_cat function.
- */
+ */
static int _php_rfc822_len(char *str)
{
int len;
@@ -3980,8 +3980,8 @@
num_ent++;
} while ((tmp = tmp->next));
- /*
- * rfc822_write_address_full() needs some extra space for '<>,', etc.
+ /*
+ * rfc822_write_address_full() needs some extra space for '<>,', etc.
* for this perpouse we allocate additional PHP_IMAP_ADDRESS_SIZE_BUF
bytes
* by default this buffer is 10 bytes long
*/
@@ -4015,11 +4015,11 @@
char *fulladdress;
ADDRESS *addresstmp;
zval *tmpvals;
-
+
addresstmp = addresslist;
fulladdress = _php_rfc822_write_address(addresstmp TSRMLS_CC);
-
+
addresstmp = addresslist;
do {
MAKE_STD_ZVAL(tmpvals);
@@ -4040,9 +4040,9 @@
{
zval *paddress;
char *fulladdress=NULL;
-
+
object_init(myzvalue);
-
+
if (en->remail) add_property_string(myzvalue, "remail", en->remail, 1);
if (en->date) add_property_string(myzvalue, "date", en->date, 1);
if (en->date) add_property_string(myzvalue, "Date", en->date, 1);
@@ -4053,7 +4053,7 @@
if (en->newsgroups) add_property_string(myzvalue, "newsgroups",
en->newsgroups, 1);
if (en->followup_to) add_property_string(myzvalue, "followup_to",
en->followup_to, 1);
if (en->references) add_property_string(myzvalue, "references",
en->references, 1);
-
+
if (en->to) {
MAKE_STD_ZVAL(paddress);
array_init(paddress);
@@ -4063,7 +4063,7 @@
}
add_assoc_object(myzvalue, "to", paddress TSRMLS_CC);
}
-
+
if (en->from) {
MAKE_STD_ZVAL(paddress);
array_init(paddress);
@@ -4073,7 +4073,7 @@
}
add_assoc_object(myzvalue, "from", paddress TSRMLS_CC);
}
-
+
if (en->cc) {
MAKE_STD_ZVAL(paddress);
array_init(paddress);
@@ -4083,7 +4083,7 @@
}
add_assoc_object(myzvalue, "cc", paddress TSRMLS_CC);
}
-
+
if (en->bcc) {
MAKE_STD_ZVAL(paddress);
array_init(paddress);
@@ -4093,7 +4093,7 @@
}
add_assoc_object(myzvalue, "bcc", paddress TSRMLS_CC);
}
-
+
if (en->reply_to) {
MAKE_STD_ZVAL(paddress);
array_init(paddress);
@@ -4133,7 +4133,7 @@
zval *parametres, *param, *dparametres, *dparam;
PARAMETER *par, *dpar;
PART *part;
-
+
if (body->type <= TYPEMAX) {
add_property_long(arg, "type", body->type);
}
@@ -4162,7 +4162,7 @@
} else {
add_property_long(arg, "ifid", 0);
}
-
+
if (body->size.lines) {
add_property_long(arg, "lines", body->size.lines);
}
@@ -4196,7 +4196,7 @@
add_property_long(arg, "ifdparameters", 0);
}
#endif
-
+
if ((par = body->parameter)) {
add_property_long(arg, "ifparameters", 1);
@@ -4233,7 +4233,7 @@
}
add_assoc_object(arg, "parts", parametres TSRMLS_CC);
}
-
+
/* encapsulated message ? */
if ((body->type == TYPEMESSAGE) && (!strcasecmp(body->subtype,
"rfc822"))) {
body = body->CONTENT_MSG_BODY;
@@ -4274,14 +4274,14 @@
if(cur->branch) {
(*numNodes)++;
add_assoc_long(tree, buf, *numNodes);
- build_thread_tree_helper(cur->branch, tree, numNodes, buf);
+ build_thread_tree_helper(cur->branch, tree, numNodes, buf);
} else { /* "null pointer" */
add_assoc_long(tree, buf, 0);
}
}
/* }}} */
-/* {{{ build_thread_tree
+/* {{{ build_thread_tree
*/
static int build_thread_tree(THREADNODE *top, zval **tree)
{
@@ -4289,7 +4289,7 @@
char buf[25];
array_init(*tree);
-
+
build_thread_tree_helper(top, *tree, &numNodes, buf);
return SUCCESS;
@@ -4310,16 +4310,16 @@
if ( argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &streamind,
&search_flags) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
-
+
ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap",
le_imap);
-
+
if (argc == 1) {
flags = SE_FREE;
} else {
convert_to_long_ex(search_flags);
flags = Z_LVAL_PP(search_flags);
}
-
+
top = mail_thread(imap_le_struct->imap_stream, "REFERENCES", NIL,
mail_criteria(criteria), flags);
if(top == NIL) {
@@ -4400,15 +4400,15 @@
static char *php_mail_gets(readfn_t f, void *stream, unsigned long size,
GETS_DATA *md)
{
TSRMLS_FETCH();
-
- /* write to the gets stream if it is set,
+
+ /* write to the gets stream if it is set,
otherwise forward to c-clients gets */
if (IMAPG(gets_stream)) {
char buf[GETS_FETCH_SIZE];
-
+
while (size) {
unsigned long read;
-
+
if (size > GETS_FETCH_SIZE) {
read = GETS_FETCH_SIZE;
size -=GETS_FETCH_SIZE;
@@ -4416,7 +4416,7 @@
read = size;
size = 0;
}
-
+
if (!f(stream, read, buf)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,
"Failed to read from socket");
break;
@@ -4428,7 +4428,7 @@
return NULL;
} else {
char *buf = pemalloc(size + 1, 1);
-
+
if (f(stream, size, buf)) {
buf[size] = '\0';
} else {
@@ -4441,7 +4441,7 @@
}
/* }}} */
-/* {{{ Interfaces to C-client
+/* {{{ Interfaces to C-client
*/
void mm_searched(MAILSTREAM *stream, unsigned long number)
{
@@ -4480,12 +4480,12 @@
{
STRINGLIST *cur = NIL;
TSRMLS_FETCH();
-
+
if (strncmp(str, "[ALERT] ", 8) == 0) {
if (IMAPG(imap_alertstack) == NIL) {
IMAPG(imap_alertstack) = mail_newstringlist();
IMAPG(imap_alertstack)->LSIZE =
strlen(IMAPG(imap_alertstack)->LTEXT = cpystr(str));
- IMAPG(imap_alertstack)->next = NIL;
+ IMAPG(imap_alertstack)->next = NIL;
} else {
cur = IMAPG(imap_alertstack);
while (cur->next != NIL) {
@@ -4504,7 +4504,7 @@
STRINGLIST *cur=NIL;
FOBJECTLIST *ocur=NIL;
TSRMLS_FETCH();
-
+
if (IMAPG(folderlist_style) == FLIST_OBJECT) {
/* build up a the new array of objects */
/* Author: CJH */
@@ -4525,14 +4525,14 @@
ocur->next = NIL;
IMAPG(imap_folder_objects_tail) = ocur;
}
-
+
} else {
/* build the old IMAPG(imap_folders) variable to allow old
imap_listmailbox() to work */
if (!(attributes & LATT_NOSELECT)) {
if (IMAPG(imap_folders) == NIL) {
IMAPG(imap_folders)=mail_newstringlist();
IMAPG(imap_folders)->LSIZE=strlen(IMAPG(imap_folders)->LTEXT=cpystr(mailbox));
- IMAPG(imap_folders)->next=NIL;
+ IMAPG(imap_folders)->next=NIL;
IMAPG(imap_folders_tail) = IMAPG(imap_folders);
} else {
cur=IMAPG(imap_folders_tail);
@@ -4551,7 +4551,7 @@
STRINGLIST *cur=NIL;
FOBJECTLIST *ocur=NIL;
TSRMLS_FETCH();
-
+
if (IMAPG(folderlist_style) == FLIST_OBJECT) {
/* build the array of objects */
/* Author: CJH */
@@ -4577,7 +4577,7 @@
if (IMAPG(imap_sfolders) == NIL) {
IMAPG(imap_sfolders)=mail_newstringlist();
IMAPG(imap_sfolders)->LSIZE=strlen(IMAPG(imap_sfolders)->LTEXT=cpystr(mailbox));
- IMAPG(imap_sfolders)->next=NIL;
+ IMAPG(imap_sfolders)->next=NIL;
IMAPG(imap_sfolders_tail) = IMAPG(imap_sfolders);
} else {
cur=IMAPG(imap_sfolders_tail);
@@ -4616,14 +4616,14 @@
{
ERRORLIST *cur = NIL;
TSRMLS_FETCH();
-
+
/* Author: CJH */
if (errflg != NIL) { /* CJH: maybe put these into a more comprehensive
log for debugging purposes? */
if (IMAPG(imap_errorstack) == NIL) {
IMAPG(imap_errorstack) = mail_newerrorlist();
IMAPG(imap_errorstack)->LSIZE =
strlen(IMAPG(imap_errorstack)->LTEXT = cpystr(str));
IMAPG(imap_errorstack)->errflg = errflg;
- IMAPG(imap_errorstack)->next = NIL;
+ IMAPG(imap_errorstack)->next = NIL;
} else {
cur = IMAPG(imap_errorstack);
while (cur->next != NIL) {
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php