Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46941 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57372 invoked from network); 3 Feb 2010 20:19:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Feb 2010 20:19:52 -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.24 cause and error) X-PHP-List-Original-Sender: dominik@dokdok.com X-Host-Fingerprint: 74.125.92.24 qw-out-2122.google.com Received: from [74.125.92.24] ([74.125.92.24:21308] helo=qw-out-2122.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A8/1F-22982-76AD96B4 for ; Wed, 03 Feb 2010 15:19:52 -0500 Received: by qw-out-2122.google.com with SMTP id 5so51003qwd.59 for ; Wed, 03 Feb 2010 12:19:49 -0800 (PST) Received: by 10.229.119.7 with SMTP id x7mr139477qcq.22.1265228389026; Wed, 03 Feb 2010 12:19:49 -0800 (PST) Received: from ?172.16.10.128? ([38.108.74.28]) by mx.google.com with ESMTPS id 8sm4070695qwj.41.2010.02.03.12.19.46 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 03 Feb 2010 12:19:47 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1077) In-Reply-To: Date: Wed, 3 Feb 2010 15:19:43 -0500 Content-Transfer-Encoding: quoted-printable Message-ID: References: <20100130232224.GA18033@joeysmith.com> <75DD619F-181F-4299-B812-ADC963C78CE8@dokdok.com> <9862FA74-6B36-4C0E-AA15-6A5E17273C24@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) Hi, I just checked the mailinglist archive = (http://news.php.net/php.internals/46939) and you're right, the = attachment was missing, even though it's in my sent items ... is there = some list policy which rejects attachments ? Dominik On 2010-02-03, at 3:08 PM, Pierre Joye wrote: > hi, >=20 > Can you send patches as attachment please? >=20 > Also I like to think again about a nicer approach. As your proposal > works, it sounds like multiple calls could be avoided. >=20 > Cheers, >=20 > On Wed, Feb 3, 2010 at 8:37 PM, Dominik Gehl = wrote: >> Attached is a patch which would allow the usage of most of the IMAP4 = search criteria. >>=20 >> Please let me know if I should contact someone else (IMAP extension = maintainer(s) ?) regarding this ... >>=20 >> Dominik >>=20 >>=20 >> On 2010-02-02, at 4:14 PM, Dominik Gehl wrote: >>=20 >>> 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 >>=20 >>=20 >>=20 >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >>=20 >=20 >=20 >=20 > --=20 > Pierre >=20 > @pierrejoye | http://blog.thepimp.net | http://www.libgd.org