Only in php-4.2.3.patched/ext/imap/: Makefile Only in php-4.2.3.patched/ext/imap/: config.cache Only in php-4.2.3.patched/ext/imap/: config.h Only in php-4.2.3.patched/ext/imap/: config.log Only in php-4.2.3.patched/ext/imap/: config.status Only in php-4.2.3.patched/ext/imap/: config_vars.mk Only in php4-4.2.3/ext/imap/: conftest Only in php4-4.2.3/ext/imap/: conftest.c Only in php-4.2.3.patched/ext/imap/: libtool diff -b -r -U5 php4-4.2.3/ext/imap/php_imap.c php-4.2.3.patched/ext/imap/php_imap.c --- php4-4.2.3/ext/imap/php_imap.c Mon Aug 26 03:58:31 2002 +++ php-4.2.3.patched/ext/imap/php_imap.c Fri May 16 16:23:12 2003 @@ -133,10 +133,11 @@ #if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001) PHP_FE(imap_get_quota, NULL) PHP_FE(imap_set_quota, NULL) PHP_FE(imap_setacl, NULL) + PHP_FE(imap_getacl, NULL) #endif PHP_FE(imap_mail, NULL) PHP_FALIAS(imap_header, imap_headerinfo, NULL) @@ -384,10 +385,29 @@ IMAPG(quota_usage) = qlist->usage; IMAPG(quota_limit) = qlist->limit; } } /* }}} */ + + +/* {{{ mail_getquota + * + * Mail GET_ACL callback + * Called via the mail_parameter function in c-client:src/c-client/mail.c + */ +void mail_getacl(MAILSTREAM *stream, char *mailbox, ACLLIST *alist) +{ + TSRMLS_FETCH(); + + /* walk through the ACLLIST */ + for (; alist; alist = alist->next) + { + add_assoc_stringl(IMAPG(imap_acl_list), alist->identifier, alist->rights, strlen(alist->rights), 1); + } + +} +/* }}} */ #endif /* {{{ php_imap_init_globals */ static void php_imap_init_globals(zend_imap_globals *imap_globals) @@ -406,10 +426,11 @@ imap_globals->imap_messages_tail = NIL; imap_globals->imap_folder_objects = NIL; imap_globals->imap_folder_objects_tail = NIL; imap_globals->imap_sfolder_objects = NIL; imap_globals->imap_sfolder_objects_tail = NIL; + imap_globals->imap_acl_list = NIL; imap_globals->folderlist_style = FLIST_ARRAY; } /* }}} */ @@ -1105,10 +1126,41 @@ RETURN_LONG(imap_setacl(imap_le_struct->imap_stream, Z_STRVAL_PP(mailbox), Z_STRVAL_PP(id), Z_STRVAL_PP(rights))); } /* }}} */ + +/* {{{ proto array imap_get_quota(int stream_id, string mailbox) + Gets the ACL for a given mailbox */ +PHP_FUNCTION(imap_getacl) +{ + zval **streamind, **mailbox; + pils *imap_le_struct; + + if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &mailbox) == FAILURE) { + ZEND_WRONG_PARAM_COUNT(); + } + + ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap); + + convert_to_string_ex(mailbox); + + /* initializing the special array for the return values */ + array_init(return_value); + + IMAPG(imap_acl_list) = return_value; + + /* set the callback for the GET_ACL function */ + mail_parameters(NIL, SET_ACL, (void *) mail_getacl); + if(!imap_getacl(imap_le_struct->imap_stream, Z_STRVAL_PP(mailbox))) { + php_error(E_WARNING, "c-client imap_getacl failed"); + RETURN_FALSE; + } + + IMAPG(imap_acl_list) = NIL; +} +/* }}} */ #endif /* HAVE_IMAP2000 || HAVE_IMAP2001 */ /* {{{ proto int imap_expunge(int stream_id) Permanently delete all messages marked for deletion */ diff -b -r -U5 php4-4.2.3/ext/imap/php_imap.h php-4.2.3.patched/ext/imap/php_imap.h --- php4-4.2.3/ext/imap/php_imap.h Mon Aug 26 03:58:32 2002 +++ php-4.2.3.patched/ext/imap/php_imap.h Thu Apr 24 16:28:42 2003 @@ -177,10 +177,11 @@ #if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001) PHP_FUNCTION(imap_get_quota); PHP_FUNCTION(imap_set_quota); PHP_FUNCTION(imap_setacl); +PHP_FUNCTION(imap_getacl); #endif ZEND_BEGIN_MODULE_GLOBALS(imap) char *imap_user; @@ -208,10 +209,11 @@ unsigned long status_uidnext; unsigned long status_uidvalidity; #if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001) unsigned long quota_usage; unsigned long quota_limit; + pval *imap_acl_list; #endif ZEND_END_MODULE_GLOBALS(imap) #ifdef ZTS # define IMAPG(v) TSRMG(imap_globals_id, zend_imap_globals *, v)