Skip to content

Commit a2b297b

Browse files
author
Chuck Hagenbuch
committed
Add imap_setacl() function (Brian Masney <masneyb@seul.org>).
1 parent 831f05b commit a2b297b

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

ext/imap/php_imap.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ function_entry imap_functions[] = {
132132
#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
133133
PHP_FE(imap_get_quota, NULL)
134134
PHP_FE(imap_set_quota, NULL)
135+
PHP_FE(imap_setacl, NULL)
135136
#endif
136137

137138
#ifndef PHP_WIN32
@@ -1058,6 +1059,36 @@ PHP_FUNCTION(imap_set_quota)
10581059
RETURN_LONG(imap_setquota(imap_le_struct->imap_stream, Z_STRVAL_PP(qroot), &limits));
10591060
}
10601061
/* }}} */
1062+
1063+
1064+
/* {{{ proto int imap_setacl(int stream_id, string mailbox, string id, string rights)
1065+
Sets the ACL for a giving mailbox */
1066+
PHP_FUNCTION(imap_setacl)
1067+
{
1068+
zval **streamind, **mailbox, **id, **rights;
1069+
int ind, ind_type;
1070+
pils *imap_le_struct;
1071+
1072+
if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &streamind, &mailbox, &id, &rights) == FAILURE) {
1073+
ZEND_WRONG_PARAM_COUNT();
1074+
}
1075+
1076+
convert_to_long_ex(streamind);
1077+
convert_to_string_ex(mailbox);
1078+
convert_to_string_ex(id);
1079+
convert_to_string_ex(rights);
1080+
1081+
ind = Z_LVAL_PP(streamind);
1082+
imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
1083+
if (!imap_le_struct || !IS_STREAM(ind_type)) {
1084+
php_error(E_WARNING, "Unable to find stream pointer");
1085+
RETURN_FALSE;
1086+
}
1087+
1088+
RETURN_LONG(imap_setacl(imap_le_struct->imap_stream, Z_STRVAL_PP(mailbox), Z_STRVAL_PP(id), Z_STRVAL_PP(rights)));
1089+
}
1090+
/* }}} */
1091+
10611092
#endif
10621093

10631094

ext/imap/php_imap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ PHP_FUNCTION(imap_thread);
178178
#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
179179
PHP_FUNCTION(imap_get_quota);
180180
PHP_FUNCTION(imap_set_quota);
181+
PHP_FUNCTION(imap_setacl);
181182
#endif
182183

183184

0 commit comments

Comments
 (0)