Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46939 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37404 invoked from network); 3 Feb 2010 19:37:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Feb 2010 19:37:19 -0000 Authentication-Results: pb1.pair.com smtp.mail=dominik@dokdok.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=dominik@dokdok.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain dokdok.com from 74.125.92.25 cause and error) X-PHP-List-Original-Sender: dominik@dokdok.com X-Host-Fingerprint: 74.125.92.25 qw-out-2122.google.com Received: from [74.125.92.25] ([74.125.92.25:6608] helo=qw-out-2122.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D7/8A-22982-E60D96B4 for ; Wed, 03 Feb 2010 14:37:19 -0500 Received: by qw-out-2122.google.com with SMTP id 5so39348qwd.59 for ; Wed, 03 Feb 2010 11:37:16 -0800 (PST) Received: by 10.229.231.138 with SMTP id jq10mr22124qcb.85.1265225835959; Wed, 03 Feb 2010 11:37:15 -0800 (PST) Received: from ?172.16.10.128? ([38.108.74.28]) by mx.google.com with ESMTPS id 4sm27705680qwe.53.2010.02.03.11.37.12 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 03 Feb 2010 11:37:13 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v1077) Content-Type: multipart/mixed; boundary=Apple-Mail-3--844177296 In-Reply-To: Date: Wed, 3 Feb 2010 14:37:11 -0500 Message-ID: <9862FA74-6B36-4C0E-AA15-6A5E17273C24@dokdok.com> References: <20100130232224.GA18033@joeysmith.com> <75DD619F-181F-4299-B812-ADC963C78CE8@dokdok.com> To: internals@lists.php.net X-Mailer: Apple Mail (2.1077) Subject: Re: [PHP-DEV] imap4 search criteria From: dominik@dokdok.com (Dominik Gehl) --Apple-Mail-3--844177296 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Attached is a patch which would allow the usage of most of the IMAP4 = search criteria. Please let me know if I should contact someone else (IMAP extension = maintainer(s) ?) regarding this ... Dominik --Apple-Mail-3--844177296 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 2010-02-02, at 4:14 PM, Dominik Gehl wrote: > I continued thinking about this and came up with the idea of adding a = new resource 'imap_searchpgm' to the imap extension, which would then = have quite a good number of new functions: imap_searchprogram_new, = imap_searchprogram_sentsince, imap_searchprogram_since, = imap_searchprogram_before, imap_searchprogram_on etc. etc. >=20 > The functions could then be defined along the following lines = (untested code ...): >=20 > PHP_FUNCTION(imap_searchprogram_new) > { > int myargc =3D ZEND_NUM_ARGS(); >=20 > if (myargc !=3D 0) { > ZEND_WRONG_PARAM_COUNT(); > } >=20 > pgm =3D mail_newsearchpgm(); > searchpgm =3D emalloc(sizeof(php_imap_searchpgm)); > searchpgm->searchpgm =3D pgm; > ZEND_REGISTER_RESOURCE(return_value, searchpgm, = le_imap_searchpgm); > } >=20 > PHP_FUNCTION(imap_searchprogram_sentsince) > { > zval *zpgm; > php_imap_searchpgm *pgm; > char *criterion =3D ""; >=20 > if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", = &zpgm, &criterion) =3D=3D FAILURE) { > RETURN_FALSE; > } >=20 > ZEND_FETCH_RESOURCE(pgm, php_imap_search_pgm*, &zpgm, -1, = "imapsearch", le_imap_searchpgm); >=20 > mail_criteria_date(&pgm->searchpgm->sentsince, &criterion); >=20 > RETURN_TRUE; > } >=20 > etc. etc. >=20 >=20 > And finally, the imap_search function could then accept either the = criteria string OR an imap_searchpgm resource. >=20 > Ideas, comments ? >=20 > Thanks, > Dominik >=20 >=20 > On 2010-02-01, at 10:06 AM, Dominik Gehl wrote: >=20 >> Thanks a lot for your reply. I also found a second bug report related = to this: http://bugs.php.net/bug.php?id=3D21168 >>=20 >> Now, how about adding an imap_newsearchpgm function to the PHP imap = extension which would do a call to mail_nsewsearchpgm inside c-client = and return a structure allowing to contruct IMAP4 search programs = (SEARCHPGM inside c-client) ? >>=20 >> Anyone interested in this ? >>=20 >> Dominik >>=20 >> On 2010-01-30, at 6:22 PM, Joey Smith wrote: >>=20 >>> There's an open bug on this, #15238 = (http://bugs.php.net/bug.php?id=3D15238&). I'm >>> sure patches would be welcomed. >>>=20 >>> On Fri, Jan 29, 2010 at 03:49:18PM -0500, Dominik Gehl wrote: >>>> Hi, >>>>=20 >>>> I noticed that the imap extension seems to support only IMAP2 = search criteria. >>>>=20 >>>> This is caused by the fact that in ext/imap/php_imap.c, the = imap_search function uses a call to mail_criteria. And >>>> the University of Washington IMAP toolkit mentions in = docs/internal.txt: >>>>=20 >>>> SEARCHPGM *mail_criteria (char *criteria); >>>> criteria IMAP2-format search criteria string >>>>=20 >>>> This function accepts an IMAP2-format search criteria string and >>>> parses it. If the parse is successful, it returns a search program >>>> suitable for use in mail_search_full(). >>>> WARNING: This function does not accept IMAP4 search criteria. >>>>=20 >>>>=20 >>>> Is there any specific reason why PHP uses this mail_criteria call ? = It really would be nice to be able to use IMAP4 search criteria ! >>>>=20 >>>> Thanks, >>>> Dominik >>>>=20 >>>> -- >>>> PHP Internals - PHP Runtime Development Mailing List >>>> To unsubscribe, visit: http://www.php.net/unsub.php >>>>=20 >>=20 >=20 --Apple-Mail-3--844177296--