jani Tue May 5 01:44:22 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/imap php_imap.c Log: MFH: ws fix
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.26.2.47&r2=1.208.2.7.2.26.2.48&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.26.2.47 php-src/ext/imap/php_imap.c:1.208.2.7.2.26.2.48 --- php-src/ext/imap/php_imap.c:1.208.2.7.2.26.2.47 Tue May 5 01:22:44 2009 +++ php-src/ext/imap/php_imap.c Tue May 5 01:44:22 2009 @@ -21,12 +21,12 @@ | Chuck Hagenbuch <ch...@horde.org> | | Andrew Skalski <askal...@chekinc.com> | | Hartmut Holzgraefe <hholz...@php.net> | - | Jani Taskinen <sni...@iki.fi> | + | Jani Taskinen <jani.taski...@iki.fi> | | Daniel R. Kalowsky <kalow...@php.net> | | PHP 4.0 updates: Zeev Suraski <z...@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: php_imap.c,v 1.208.2.7.2.26.2.47 2009/05/05 01:22:44 jani Exp $ */ +/* $Id: php_imap.c,v 1.208.2.7.2.26.2.48 2009/05/05 01:44:22 jani Exp $ */ #define IMAP41 @@ -59,7 +59,7 @@ MAILSTREAM DEFAULTPROTO; #endif -#define CRLF "\015\012" +#define CRLF "\015\012" #define CRLF_LEN sizeof("\015\012") - 1 #define PHP_EXPUNGE 32768 #define PHP_IMAP_ADDRESS_SIZE_BUF 10 @@ -73,7 +73,6 @@ # define PHP_IMAP_EXPORT #endif - static void _php_make_header_object(zval *myzvalue, ENVELOPE *en TSRMLS_DC); static void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC); static char* _php_imap_parse_address(ADDRESS *addresslist, zval *paddress TSRMLS_DC); @@ -652,7 +651,7 @@ */ FOBJECTLIST *mail_newfolderobjectlist(void) { - return (FOBJECTLIST *) memset(fs_get(sizeof(FOBJECTLIST)), 0, sizeof(FOBJECTLIST)); + return (FOBJECTLIST *) memset(fs_get(sizeof(FOBJECTLIST)), 0, sizeof(FOBJECTLIST)); } /* }}} */ @@ -775,7 +774,6 @@ } /* }}} */ - /* {{{ mail_getquota * * Mail GET_ACL callback @@ -791,10 +789,8 @@ } } /* }}} */ - #endif - /* {{{ PHP_GINIT_FUNCTION */ static PHP_GINIT_FUNCTION(imap) @@ -849,7 +845,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 @@ -910,7 +906,6 @@ REGISTER_LONG_CONSTANT("CL_EXPUNGE", PHP_EXPUNGE, CONST_PERSISTENT | CONST_CS); /* expunge silently */ - /* Fetch options */ REGISTER_LONG_CONSTANT("FT_UID", FT_UID, CONST_PERSISTENT | CONST_CS); @@ -924,7 +919,6 @@ REGISTER_LONG_CONSTANT("FT_PREFETCHTEXT", FT_PREFETCHTEXT, CONST_PERSISTENT | CONST_CS); /* IMAP prefetch text when fetching header */ - /* Flagging options */ REGISTER_LONG_CONSTANT("ST_UID", ST_UID, CONST_PERSISTENT | CONST_CS); @@ -934,7 +928,6 @@ REGISTER_LONG_CONSTANT("ST_SET", ST_SET, CONST_PERSISTENT | CONST_CS); /* set vs. clear */ - /* Copy options */ REGISTER_LONG_CONSTANT("CP_UID", CP_UID, CONST_PERSISTENT | CONST_CS); @@ -942,7 +935,6 @@ REGISTER_LONG_CONSTANT("CP_MOVE", CP_MOVE, CONST_PERSISTENT | CONST_CS); /* delete from source after copying */ - /* Search/sort options */ REGISTER_LONG_CONSTANT("SE_UID", SE_UID, CONST_PERSISTENT | CONST_CS); @@ -956,7 +948,6 @@ REGISTER_LONG_CONSTANT("SO_NOSERVER", SO_NOSERVER, CONST_PERSISTENT | CONST_CS); /* don't do server-based sort */ - /* Status options */ REGISTER_LONG_CONSTANT("SA_MESSAGES", SA_MESSAGES , CONST_PERSISTENT | CONST_CS); @@ -972,7 +963,6 @@ REGISTER_LONG_CONSTANT("SA_ALL", sa_all, CONST_PERSISTENT | CONST_CS); /* get all status information */ - /* Bits for mm_list() and mm_lsub() */ REGISTER_LONG_CONSTANT("LATT_NOINFERIORS", LATT_NOINFERIORS , CONST_PERSISTENT | CONST_CS); @@ -1446,7 +1436,6 @@ } /* }}} */ - /* {{{ proto array imap_getacl(resource stream_id, string mailbox) Gets the ACL for a given mailbox */ PHP_FUNCTION(imap_getacl) @@ -1478,10 +1467,8 @@ IMAPG(imap_acl_list) = NIL; } /* }}} */ - #endif /* HAVE_IMAP2000 || HAVE_IMAP2001 */ - /* {{{ proto bool imap_expunge(resource stream_id) Permanently delete all messages marked for deletion */ PHP_FUNCTION(imap_expunge) @@ -1608,7 +1595,7 @@ strlcat(tmp, "} ", sizeof(tmp)); } mail_fetchsubject(t = tmp + strlen(tmp), imap_le_struct->imap_stream, msgno, (long)25); - snprintf(t += strlen(t), sizeof(tmp) - strlen(tmp), " (%ld chars)", cache->rfc822_size); + snprintf(t += strlen(t), sizeof(tmp) - strlen(tmp), " (%ld chars)", cache->rfc822_size); add_next_index_string(return_value, tmp, 1); } } @@ -2082,7 +2069,6 @@ } /* }}} */ - /* KMLANG */ /* {{{ proto array imap_lsub(resource stream_id, string ref, string pattern) Return a list of subscribed mailboxes */ @@ -2617,7 +2603,6 @@ } /* }}} */ - /* {{{ macros for the modified utf7 conversion functions * * author: Andrew Skalski <askal...@chek.com> @@ -2630,12 +2615,12 @@ #define B64CHAR(c) (isalnum(c) || (c) == '+' || (c) == ',') /* map the low 64 bits of `n' to the modified-base64 characters */ -#define B64(n) ("ABCDEFGHIJKLMNOPQRSTUVWXYZ" \ - "abcdefghijklmnopqrstuvwxyz0123456789+,"[(n) & 0x3f]) +#define B64(n) ("ABCDEFGHIJKLMNOPQRSTUVWXYZ" \ + "abcdefghijklmnopqrstuvwxyz0123456789+,"[(n) & 0x3f]) /* map the modified-base64 character `c' to its 64 bit value */ -#define UNB64(c) ((c) == '+' ? 62 : (c) == ',' ? 63 : (c) >= 'a' ? \ - (c) - 71 : (c) >= 'A' ? (c) - 65 : (c) + 4) +#define UNB64(c) ((c) == '+' ? 62 : (c) == ',' ? 63 : (c) >= 'a' ? \ + (c) - 71 : (c) >= 'A' ? (c) - 65 : (c) + 4) /* }}} */ /* {{{ proto string imap_utf7_decode(string buf) @@ -2900,12 +2885,12 @@ #undef UNB64 #ifdef HAVE_IMAP_MUTF7 -static void php_imap_mutf7(INTERNAL_FUNCTION_PARAMETERS, int mode) +static void php_imap_mutf7(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */ { char *in; int in_len; unsigned char *out; - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &in, &in_len) == FAILURE) { return; } @@ -2926,6 +2911,7 @@ RETURN_STRING((char *)out, 1); } } +/* }}} */ /* {{{ proto string imap_utf8_to_mutf7(string in) Encode a UTF-8 string to modified UTF-7 */ @@ -2933,6 +2919,7 @@ { php_imap_mutf7(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } +/* }}} */ /* {{{ proto string imap_mutf7_to_utf8(string in) Decode a modified UTF-7 string to UTF-8 */ @@ -2940,6 +2927,7 @@ { php_imap_mutf7(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); } +/* }}} */ #endif /* {{{ proto bool imap_setflag_full(resource stream_id, string sequence, string flag [, int options]) @@ -3084,14 +3072,14 @@ Get the unique message id associated with a standard sequential message number */ PHP_FUNCTION(imap_uid) { - zval *streamind; - long msgno; + zval *streamind; + long msgno; pils *imap_le_struct; - int msgindex; + int msgindex; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &streamind, &msgno) == FAILURE) { - return; - } + return; + } ZEND_FETCH_RESOURCE(imap_le_struct, pils *, &streamind, -1, "imap", le_imap); @@ -3109,17 +3097,17 @@ Get the sequence number associated with a UID */ PHP_FUNCTION(imap_msgno) { - zval *streamind; - long msgno; + zval *streamind; + long msgno; pils *imap_le_struct; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &streamind, &msgno) == FAILURE) { - return; - } + return; + } ZEND_FETCH_RESOURCE(imap_le_struct, pils *, &streamind, -1, "imap", le_imap); - RETURN_LONG(mail_msgno(imap_le_struct->imap_stream, msgno)); + RETURN_LONG(mail_msgno(imap_le_struct->imap_stream, msgno)); } /* }}} */ @@ -3127,21 +3115,21 @@ Get status info from a mailbox */ PHP_FUNCTION(imap_status) { - zval *streamind; - char *mbx; - int mbx_len; - long flags; + zval *streamind; + char *mbx; + int mbx_len; + long flags; pils *imap_le_struct; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsl", &streamind, &mbx, &mbx_len, &flags) == FAILURE) { - return; - } + return; + } ZEND_FETCH_RESOURCE(imap_le_struct, pils *, &streamind, -1, "imap", le_imap); object_init(return_value); - if (mail_status(imap_le_struct->imap_stream, mbx, flags)) { + if (mail_status(imap_le_struct->imap_stream, mbx, flags)) { add_property_long(return_value, "flags", IMAPG(status_flags)); if (IMAPG(status_flags) & SA_MESSAGES) { add_property_long(return_value, "messages", IMAPG(status_messages)); @@ -3178,8 +3166,8 @@ BODY *body; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rls", &streamind, &msg, §ion, §ion_len) == FAILURE) { - return; - } + return; + } ZEND_FETCH_RESOURCE(imap_le_struct, pils *, &streamind, -1, "imap", le_imap); @@ -3204,25 +3192,24 @@ if (body->subtype) { add_property_long(return_value, "ifsubtype", 1); - add_property_string(return_value, "subtype", body->subtype, 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); + add_property_string(return_value, "description", body->description, 1); } else { add_property_long(return_value, "ifdescription", 0); } if (body->id) { add_property_long(return_value, "ifid", 1); - add_property_string(return_value, "id", body->id, 1); + add_property_string(return_value, "id", body->id, 1); } else { add_property_long(return_value, "ifid", 0); } - if (body->size.lines) { add_property_long(return_value, "lines", body->size.lines); } @@ -3286,9 +3273,9 @@ Read an overview of the information in the headers of the given message sequence */ PHP_FUNCTION(imap_fetch_overview) { - zval *streamind; - char *sequence; - int sequence_len; + zval *streamind; + char *sequence; + int sequence_len; pils *imap_le_struct; zval *myoverview; char *address; @@ -3299,7 +3286,7 @@ return; } - if (flags && ((flags & ~FT_UID) !=0)) { + if (flags && ((flags & ~FT_UID) != 0)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid value for the options parameter"); RETURN_FALSE; } @@ -3555,7 +3542,7 @@ } } - zend_hash_move_forward(Z_ARRVAL_P(body)); + zend_hash_move_forward(Z_ARRVAL_P(body)); while (zend_hash_get_current_data(Z_ARRVAL_P(body), (void **) &data) == SUCCESS) { if (Z_TYPE_PP(data) == IS_ARRAY) { @@ -3729,7 +3716,7 @@ /* yucky default */ if (!cookie) { cookie = "-"; - } else if (strlen(cookie) > (SENDBUFLEN - 2 - 2 - 2)) { /* validate cookie length -- + CRLF * 2 */ + } 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; @@ -3779,7 +3766,6 @@ } /* }}} */ - /* {{{ _php_imap_mail */ int _php_imap_mail(char *to, char *subject, char *message, char *headers, char *cc, char *bcc, char* rpath TSRMLS_DC) @@ -4207,7 +4193,6 @@ } /* }}} */ - /* Support Functions */ #ifdef HAVE_RFC822_OUTPUT_ADDRESS_LIST @@ -4221,7 +4206,6 @@ smart_str_appendl(ret, string, len); return LONGT; } - /* }}} */ /* {{{ _php_rfc822_write_address @@ -4456,21 +4440,21 @@ if (body->subtype) { add_property_long(arg, "ifsubtype", 1); - add_property_string(arg, "subtype", body->subtype, 1); + add_property_string(arg, "subtype", body->subtype, 1); } else { add_property_long(arg, "ifsubtype", 0); } if (body->description) { add_property_long(arg, "ifdescription", 1); - add_property_string(arg, "description", body->description, 1); + add_property_string(arg, "description", body->description, 1); } else { add_property_long(arg, "ifdescription", 0); } if (body->id) { add_property_long(arg, "ifid", 1); - add_property_string(arg, "id", body->id, 1); + add_property_string(arg, "id", body->id, 1); } else { add_property_long(arg, "ifid", 0); } @@ -4560,7 +4544,6 @@ } /* }}} */ - /* imap_thread, stealing this from header cclient -rjs3 */ /* {{{ build_thread_tree_helper */ @@ -4706,8 +4689,7 @@ /* }}} */ #define GETS_FETCH_SIZE 8196LU -/* {{{ php_mail_gets */ -static char *php_mail_gets(readfn_t f, void *stream, unsigned long size, GETS_DATA *md) +static char *php_mail_gets(readfn_t f, void *stream, unsigned long size, GETS_DATA *md) /* {{{ */ { TSRMLS_FETCH();
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php