Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:40035 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 20489 invoked from network); 21 Aug 2008 01:55:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Aug 2008 01:55:37 -0000 Authentication-Results: pb1.pair.com header.from=jani.taskinen@sci.fi; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=jani.taskinen@sci.fi; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain sci.fi from 63.208.196.178 cause and error) X-PHP-List-Original-Sender: jani.taskinen@sci.fi X-Host-Fingerprint: 63.208.196.178 mho-01-bos.mailhop.org Received: from [63.208.196.178] ([63.208.196.178:62996] helo=mho-01-bos.mailhop.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 03/B5-06543-71BCCA84 for ; Wed, 20 Aug 2008 21:55:36 -0400 Received: from domina.ee ([62.65.250.226] helo=[127.0.0.1]) by mho-01-bos.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1KVzOe-0002x9-Ra; Thu, 21 Aug 2008 01:55:33 +0000 X-Mail-Handler: MailHop Outbound by DynDNS X-Originating-IP: 62.65.250.226 X-Report-Abuse-To: abuse@dyndns.com (see http://www.mailhop.org/outbound/abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1/zzCqNrdKi0JhedX7yxu+7+jTb9BMrU24= Message-ID: <48ACCB1E.8030607@sci.fi> Date: Thu, 21 Aug 2008 04:55:42 +0300 Reply-To: jani.taskinen@iki.fi User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: Diego Woitasen CC: internals@lists.php.net References: <20080821005220.GA23091@motherbox.xtech.com.ar> In-Reply-To: <20080821005220.GA23091@motherbox.xtech.com.ar> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [PATCH] add imap_myrights From: jani.taskinen@sci.fi (Jani Taskinen) Diego Woitasen kirjoitti: > Hi, > I attach the patch that adds imap_myrights function to IMAP module. > MYRIGHTS is a standard IMAP command defined in RFC 2086. > > diff -u -r php-5.2.6/ext/imap/php_imap.c php-myrights/ext/imap/php_imap.c > --- php-5.2.6/ext/imap/php_imap.c Thu Apr 17 13:04:49 2008 > +++ php-myrights/ext/imap/php_imap.c Tue Jun 3 18:06:37 2008 > @@ -154,6 +154,7 @@ > PHP_FE(imap_set_quota, NULL) > PHP_FE(imap_setacl, NULL) > PHP_FE(imap_getacl, NULL) > + PHP_FE(imap_myrights, NULL) > #endif > > PHP_FE(imap_mail, NULL) > @@ -413,6 +414,20 @@ > } > /* }}} */ > > +/* {{{ mail_myrights > + * > + * Mail MYRIGHTS callback > + * Called via the mail_parameter function in c-client:src/c-client/mail.c > + */ > +void mail_myrights(MAILSTREAM *stream, char *mailbox, char *rights) > +{ > + TSRMLS_FETCH(); > + > + ZVAL_STRING(IMAPG(imap_acl_list), rights, 1) > + > +} > +/* }}} */ > + > #endif Does this really work? You're blindly overwriting the acl global, AFAICT..? Or is that intentional? > > > @@ -1087,6 +1102,35 @@ > 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"); > + zval_dtor(return_value); > + RETURN_FALSE; > + } > + > + IMAPG(imap_acl_list) = NIL; > +} > +/* }}} */ ..and again.. > + > +/* {{{ proto string imap_myrights(resource stream_id, string mailbox) > + Gets my rights (ACL) for a given mailbox */ > +PHP_FUNCTION(imap_myrights) > +{ > + 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); > + > + IMAPG(imap_acl_list) = return_value; > + > + /* set the callback for the GET_ACL function */ > + mail_parameters(NIL, SET_MYRIGHTS, (void *) mail_myrights); SET? Not GET? In what c-client version was this added anyway..? --Jani > + if(!imap_myrights(imap_le_struct->imap_stream, Z_STRVAL_PP(mailbox))) { > + php_error(E_WARNING, "c-client imap_myrights failed"); > zval_dtor(return_value); > RETURN_FALSE; > } > diff -u -r php-5.2.6/ext/imap/php_imap.h php-myrights/ext/imap/php_imap.h > --- php-5.2.6/ext/imap/php_imap.h Mon Dec 31 08:20:07 2007 > +++ php-myrights/ext/imap/php_imap.h Tue Jun 3 18:05:14 2008 > @@ -174,6 +174,7 @@ > PHP_FUNCTION(imap_set_quota); > PHP_FUNCTION(imap_setacl); > PHP_FUNCTION(imap_getacl); > +PHP_FUNCTION(imap_myrights); > #endif > > > >