]> git.pld-linux.org Git - packages/php.git/blame - php-imap-myrights.patch
cleanups
[packages/php.git] / php-imap-myrights.patch
CommitLineData
da461f9c
ER
1diff -r 5daa8cce8706 ext/imap/php_imap.c
2--- a/ext/imap/php_imap.c Wed Dec 23 22:46:34 2009 +0100
3+++ b/ext/imap/php_imap.c Wed Dec 23 22:49:02 2009 +0100
4@@ -157,6 +157,11 @@
5 ZEND_END_ARG_INFO()
6
7 ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_getacl, 0, 0, 2)
8+ ZEND_ARG_INFO(0, stream_id)
9+ ZEND_ARG_INFO(0, mailbox)
10+ZEND_END_ARG_INFO()
11+
12+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_myrights, 0, 0, 2)
13 ZEND_ARG_INFO(0, stream_id)
14 ZEND_ARG_INFO(0, mailbox)
15 ZEND_END_ARG_INFO()
16@@ -555,6 +560,7 @@
17 PHP_FE(imap_set_quota, arginfo_imap_set_quota)
18 PHP_FE(imap_setacl, arginfo_imap_setacl)
19 PHP_FE(imap_getacl, arginfo_imap_getacl)
20+ PHP_FE(imap_myrights, arginfo_imap_myrights)
21 #endif
22 #if defined(HAVE_IMAP2005)
23 PHP_FE(imap_setannotation, arginfo_imap_setannotation)
24@@ -817,6 +823,20 @@
25 for(; alist; alist = alist->next) {
26 add_assoc_stringl(IMAPG(imap_acl_list), alist->identifier, alist->rights, strlen(alist->rights), 1);
27 }
28+}
29+/* }}} */
30+
31+/* {{{ mail_myrights
32+ *
33+ * Mail MYRIGHTS callback
34+ * Called via the mail_parameter function in c-client:src/c-client/mail.c
35+ */
36+void mail_myrights(MAILSTREAM *stream, char *mailbox, char *rights)
37+{
38+ TSRMLS_FETCH();
39+
40+ ZVAL_STRING(IMAPG(imap_acl_list), rights, 1)
41+
42 }
43 /* }}} */
44 #endif
45@@ -1525,6 +1545,36 @@
46 IMAPG(imap_acl_list) = NIL;
47 }
48 /* }}} */
49+
50+/* {{{ proto string imap_myrights(resource stream_id, string mailbox)
51+ Gets my rights (ACL) for a given mailbox */
52+PHP_FUNCTION(imap_myrights)
53+{
54+ zval **streamind, **mailbox;
55+ pils *imap_le_struct;
56+
57+ if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &mailbox) == FAILURE) {
58+ ZEND_WRONG_PARAM_COUNT();
59+ }
60+
61+ ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
62+
63+ convert_to_string_ex(mailbox);
64+
65+ IMAPG(imap_acl_list) = return_value;
66+
67+ /* set the callback for the GET_ACL function */
68+ mail_parameters(NIL, SET_MYRIGHTS, (void *) mail_myrights);
69+ if(!imap_myrights(imap_le_struct->imap_stream, Z_STRVAL_PP(mailbox))) {
70+ php_error(E_WARNING, "c-client imap_myrights failed");
71+ zval_dtor(return_value);
72+ RETURN_FALSE;
73+ }
74+
75+ IMAPG(imap_acl_list) = NIL;
76+}
77+/* }}} */
78+
79 #endif /* HAVE_IMAP2000 || HAVE_IMAP2001 */
80
81 #if defined(HAVE_IMAP2005)
82diff -r 5daa8cce8706 ext/imap/php_imap.h
83--- a/ext/imap/php_imap.h Wed Dec 23 22:46:34 2009 +0100
84+++ b/ext/imap/php_imap.h Wed Dec 23 22:49:02 2009 +0100
85@@ -183,6 +183,7 @@
86 PHP_FUNCTION(imap_set_quota);
87 PHP_FUNCTION(imap_setacl);
88 PHP_FUNCTION(imap_getacl);
89+PHP_FUNCTION(imap_myrights);
90 #endif
91 #if defined(HAVE_IMAP2005)
92 PHP_FUNCTION(imap_setannotation);
This page took 0.033496 seconds and 4 git commands to generate.