Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46934 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3194 invoked from network); 2 Feb 2010 21:14:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Feb 2010 21:14:22 -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 209.85.221.185 cause and error) X-PHP-List-Original-Sender: dominik@dokdok.com X-Host-Fingerprint: 209.85.221.185 mail-qy0-f185.google.com Received: from [209.85.221.185] ([209.85.221.185:50919] helo=mail-qy0-f185.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5E/09-56668-DA5986B4 for ; Tue, 02 Feb 2010 16:14:21 -0500 Received: by qyk15 with SMTP id 15so453837qyk.20 for ; Tue, 02 Feb 2010 13:14:19 -0800 (PST) Received: by 10.224.87.20 with SMTP id u20mr3112989qal.192.1265145256243; Tue, 02 Feb 2010 13:14:16 -0800 (PST) Received: from ?192.168.1.103? (modemcable144.86-58-74.mc.videotron.ca [74.58.86.144]) by mx.google.com with ESMTPS id 20sm4883900qyk.5.2010.02.02.13.14.14 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 02 Feb 2010 13:14:15 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1077) In-Reply-To: <75DD619F-181F-4299-B812-ADC963C78CE8@dokdok.com> Date: Tue, 2 Feb 2010 16:14:12 -0500 Content-Transfer-Encoding: quoted-printable Message-ID: 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) 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. The functions could then be defined along the following lines (untested = code ...): PHP_FUNCTION(imap_searchprogram_new) { int myargc =3D ZEND_NUM_ARGS(); if (myargc !=3D 0) { ZEND_WRONG_PARAM_COUNT(); } pgm =3D mail_newsearchpgm(); searchpgm =3D emalloc(sizeof(php_imap_searchpgm)); searchpgm->searchpgm =3D pgm; ZEND_REGISTER_RESOURCE(return_value, searchpgm, = le_imap_searchpgm); } PHP_FUNCTION(imap_searchprogram_sentsince) { zval *zpgm; php_imap_searchpgm *pgm; char *criterion =3D ""; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", = &zpgm, &criterion) =3D=3D FAILURE) { RETURN_FALSE; } ZEND_FETCH_RESOURCE(pgm, php_imap_search_pgm*, &zpgm, -1, = "imapsearch", le_imap_searchpgm); mail_criteria_date(&pgm->searchpgm->sentsince, &criterion); RETURN_TRUE; } etc. etc. And finally, the imap_search function could then accept either the = criteria string OR an imap_searchpgm resource. Ideas, comments ? Thanks, Dominik On 2010-02-01, at 10:06 AM, Dominik Gehl wrote: > 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