cvs: php4 /ext/imap php_imap.c php_imap.h

From: Date: Fri, 26 Jul 2002 16:22:44 +0000
Subject: cvs: php4 /ext/imap php_imap.c php_imap.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-12991@lists.php.net to get a copy of this message
kalowsky Fri Jul 26 12:22:44 2002 EDT Modified files: /php4/ext/imap php_imap.c php_imap.h Log: (PHP imap_get_quota) updated to properly reflect the RFC 2087 as per bug #14673 @- imap_get_quota now allows multiple resource values to be returned, as per RFC 2087, closes bug #14673 (kalowsky, Sander Steffann) Index: php4/ext/imap/php_imap.c diff -u php4/ext/imap/php_imap.c:1.125 php4/ext/imap/php_imap.c:1.126 --- php4/ext/imap/php_imap.c:1.125 Tue Jul 2 19:45:32 2002 +++ php4/ext/imap/php_imap.c Fri Jul 26 12:22:43 2002 @@ -22,10 +22,11 @@ | Andrew Skalski <askalski@chekinc.com> | | Hartmut Holzgraefe <hartmut@six.de> | | Jani Taskinen <sniper@iki.fi> | + | Daniel R. Kalowsky <kalowsky@php.net> | | PHP 4.0 updates: Zeev Suraski <zeev@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: php_imap.c,v 1.125 2002/07/02 23:45:32 fmk Exp $ */ +/* $Id: php_imap.c,v 1.126 2002/07/26 16:22:43 kalowsky Exp $ */ #define IMAP41 @@ -377,18 +378,27 @@ */ void mail_getquota(MAILSTREAM *stream, char *qroot, QUOTALIST *qlist) { + zval *t_map; TSRMLS_FETCH(); +/* put parsing code here */ + for(; qlist; qlist = qlist->next) { + MAKE_STD_ZVAL(t_map); + if (array_init(t_map) == FAILURE) { + php_error(E_WARNING, "Unable to allocate t_map memory"); + FREE_ZVAL(t_map); + FREE_ZVAL(IMAPG(quota_return)); + } - /* this should only be run through once */ - for (; qlist; qlist = qlist->next) - { - IMAPG(quota_usage) = qlist->usage; - IMAPG(quota_limit) = qlist->limit; + add_assoc_long_ex(t_map, "usage", sizeof("usage"), qlist->usage); + add_assoc_long_ex(t_map, "limit", sizeof("usage"), qlist->limit); + add_assoc_zval_ex(IMAPG(quota_return), qlist->name, strlen(qlist->name), t_map); } } /* }}} */ + #endif + /* {{{ php_imap_init_globals */ static void php_imap_init_globals(zend_imap_globals *imap_globals) @@ -411,6 +421,9 @@ imap_globals->imap_sfolder_objects_tail = NIL; imap_globals->folderlist_style = FLIST_ARRAY; +#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001) + imap_globals->quota_return = NULL; +#endif } /* }}} */ @@ -1045,6 +1058,13 @@ convert_to_string_ex(qroot); + MAKE_STD_ZVAL(IMAPG(quota_return)); + if (array_init(IMAPG(quota_return)) == FAILURE) { + php_error(E_WARNING, "Unable to allocate array memory"); + FREE_ZVAL(IMAPG(quota_return)); + RETURN_FALSE; + } + /* set the callback for the GET_QUOTA function */ mail_parameters(NIL, SET_QUOTA, (void *) mail_getquota); if(!imap_getquota(imap_le_struct->imap_stream, Z_STRVAL_PP(qroot))) { @@ -1053,12 +1073,12 @@ } if (array_init(return_value) == FAILURE) { - php_error(E_WARNING, "%s(): Unable to allocate array memory", get_active_function_name(TSRMLS_C)); + php_error(E_WARNING, "Unable to allocate array memory"); RETURN_FALSE; } - - add_assoc_long(return_value, "usage", IMAPG(quota_usage)); - add_assoc_long(return_value, "limit", IMAPG(quota_limit)); + + add_next_index_zval(return_value, IMAPG(quota_return)); + } /* }}} */ @@ -1087,9 +1107,8 @@ } /* }}} */ - /* {{{ proto int imap_setacl(int stream_id, string mailbox, string id, string rights) - Sets the ACL for a giving mailbox */ + Sets the ACL for a given mailbox */ PHP_FUNCTION(imap_setacl) { zval **streamind, **mailbox, **id, **rights; Index: php4/ext/imap/php_imap.h diff -u php4/ext/imap/php_imap.h:1.19 php4/ext/imap/php_imap.h:1.20 --- php4/ext/imap/php_imap.h:1.19 Sun May 12 16:53:25 2002 +++ php4/ext/imap/php_imap.h Fri Jul 26 12:22:43 2002 @@ -22,11 +22,12 @@ | Andrew Skalski <askalski@chekinc.com> | | Hartmut Holzgraefe <hartmut@six.de> | | Jani Taskinen <sniper@iki.fi> | + | Daniel R. Kalowsky <kalowsky@php.net> | | PHP 4.0 updates: Zeev Suraski <zeev@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: php_imap.h,v 1.19 2002/05/12 20:53:25 jon Exp $ */ +/* $Id: php_imap.h,v 1.20 2002/07/26 16:22:43 kalowsky Exp $ */ #ifndef PHP_IMAP_H #define PHP_IMAP_H @@ -208,8 +209,7 @@ unsigned long status_uidnext; unsigned long status_uidvalidity; #if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001) - unsigned long quota_usage; - unsigned long quota_limit; + zval *quota_return; #endif ZEND_END_MODULE_GLOBALS(imap)

« previous php.cvs (#12991) next »