1 --- php-imap-4.3.9/php_imap.c.fix 2004-08-06 15:04:17 +0400
2 +++ php-imap-4.3.9/php_imap.c 2004-08-06 15:11:43 +0400
3 @@ -138,6 +138,7 @@ function_entry imap_functions[] = {
4 PHP_FE(imap_get_quotaroot, NULL)
5 PHP_FE(imap_set_quota, NULL)
6 PHP_FE(imap_setacl, NULL)
7 + PHP_FE(imap_getacl, NULL)
8 #endif
10 PHP_FE(imap_mail, NULL)
11 @@ -377,6 +378,22 @@ void mail_getquota(MAILSTREAM *stream, c
12 /* }}} */
13 #endif
15 +/* {{{ mail_getquota
16 + *
17 + * Mail GET_ACL callback
18 + * Called via the mail_parameter function in c-client:src/c-client/mail.c
19 + */
20 +void mail_getacl(MAILSTREAM *stream, char *mailbox, ACLLIST *alist)
21 +{
22 + TSRMLS_FETCH();
23 +
24 + /* walk through the ACLLIST */
25 + for (; alist; alist = alist->next)
26 + {
27 + add_assoc_stringl(IMAPG(imap_acl_list), alist->identifier, alist->rights, strlen(alist->rights), 1);
28 + }
29 +}
30 +/* }}} */
32 /* {{{ php_imap_init_globals
33 */
34 @@ -402,6 +419,7 @@ static void php_imap_init_globals(zend_i
35 imap_globals->folderlist_style = FLIST_ARRAY;
36 #if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
37 imap_globals->quota_return = NULL;
38 + imap_globals->imap_acl_list = NIL;
39 #endif
40 }
41 /* }}} */
42 @@ -985,6 +1003,37 @@ PHP_FUNCTION(imap_setacl)
43 }
44 /* }}} */
46 +/* {{{ proto array imap_get_quota(int stream_id, string mailbox)
47 + Gets the ACL for a given mailbox */
48 +PHP_FUNCTION(imap_getacl)
49 +{
50 + zval **streamind, **mailbox;
51 + pils *imap_le_struct;
52 +
53 + if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &mailbox) == FAILURE) {
54 + ZEND_WRONG_PARAM_COUNT();
55 + }
56 +
57 + ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
58 +
59 + convert_to_string_ex(mailbox);
60 +
61 + /* initializing the special array for the return values */
62 + array_init(return_value);
63 +
64 + IMAPG(imap_acl_list) = return_value;
65 +
66 + /* set the callback for the GET_ACL function */
67 + mail_parameters(NIL, SET_ACL, (void *) mail_getacl);
68 + if(!imap_getacl(imap_le_struct->imap_stream, Z_STRVAL_PP(mailbox))) {
69 + php_error(E_WARNING, "c-client imap_getacl failed");
70 + RETURN_FALSE;
71 + }
72 +
73 + IMAPG(imap_acl_list) = NIL;
74 +}
75 +/* }}} */
76 +
77 #endif /* HAVE_IMAP2000 || HAVE_IMAP2001 */
80 --- php-imap-4.3.9/php_imap.h.fix 2004-08-06 15:09:33 +0400
81 +++ php-imap-4.3.9/php_imap.h 2004-08-06 15:10:42 +0400
82 @@ -172,6 +172,7 @@ PHP_FUNCTION(imap_get_quota);
83 PHP_FUNCTION(imap_get_quotaroot);
84 PHP_FUNCTION(imap_set_quota);
85 PHP_FUNCTION(imap_setacl);
86 +PHP_FUNCTION(imap_getacl);
87 #endif
90 @@ -202,6 +203,7 @@ ZEND_BEGIN_MODULE_GLOBALS(imap)
91 unsigned long status_uidvalidity;
92 #if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
93 zval **quota_return;
94 + pval *imap_acl_list;
95 #endif
96 ZEND_END_MODULE_GLOBALS(imap)