Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46940 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49560 invoked from network); 3 Feb 2010 20:08:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Feb 2010 20:08:06 -0000 Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 72.14.220.158 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 72.14.220.158 fg-out-1718.google.com Received: from [72.14.220.158] ([72.14.220.158:32868] helo=fg-out-1718.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D4/5D-22982-4A7D96B4 for ; Wed, 03 Feb 2010 15:08:05 -0500 Received: by fg-out-1718.google.com with SMTP id 16so40849fgg.11 for ; Wed, 03 Feb 2010 12:08:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=tuLtPLHtq6uyirv+E6tMmviCi5kpuxovvSo+WV4hTek=; b=K0om/AL1W6Y59tE9HSih+8pq1RDyIWOug9E86LVTi9weA/WLHe4fa/vH7wCvNXEPwM 8Ds3R3yhI2+Q0tyiQU0h6JfcqsTIXZDzcUPt2e+OWfBeCVaI5L1yas8khIoeZ0EbPqkB U6E5gckMZM3G0v9KEN8cKVkjEr1FB9xbnBWGw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=lr6aT3eBRZefYTYRQFTijt5yOJLip7hiEGoBxrnQ4oQUn+JV7y7bVooJLe2i0vmtqR VLvJu4ec3eCl+iCuKPwlc6F27C6rrM3hoXxEc2bc+lUjavGimS/CV3jV4P70QUExf1qS 5jXC1oHEasq3orJzCcrNdk1PYYiSJBip+Rsc4= MIME-Version: 1.0 Received: by 10.216.87.3 with SMTP id x3mr30596wee.132.1265227680516; Wed, 03 Feb 2010 12:08:00 -0800 (PST) In-Reply-To: <9862FA74-6B36-4C0E-AA15-6A5E17273C24@dokdok.com> References: <20100130232224.GA18033@joeysmith.com> <75DD619F-181F-4299-B812-ADC963C78CE8@dokdok.com> <9862FA74-6B36-4C0E-AA15-6A5E17273C24@dokdok.com> Date: Wed, 3 Feb 2010 21:08:00 +0100 Message-ID: To: Dominik Gehl Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] imap4 search criteria From: pierre.php@gmail.com (Pierre Joye) hi, Can you send patches as attachment please? Also I like to think again about a nicer approach. As your proposal works, it sounds like multiple calls could be avoided. Cheers, 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 sear= ch criteria. > > Please let me know if I should contact someone else (IMAP extension maint= ainer(s) ?) regarding this ... > > Dominik > > > 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 ne= w resource 'imap_searchpgm' to the imap extension, which would then have qu= ite a good number of new functions: imap_searchprogram_new, imap_searchprog= ram_sentsince, imap_searchprogram_since, imap_searchprogram_before, imap_se= archprogram_on etc. etc. >> >> The functions could then be defined along the following lines (untested = code ...): >> >> PHP_FUNCTION(imap_searchprogram_new) >> { >> =A0 =A0 =A0 int myargc =3D ZEND_NUM_ARGS(); >> >> =A0 =A0 =A0 if (myargc !=3D 0) { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 ZEND_WRONG_PARAM_COUNT(); >> =A0 =A0 =A0 } >> >> =A0 =A0 =A0 pgm =3D mail_newsearchpgm(); >> =A0 =A0 =A0 searchpgm =3D emalloc(sizeof(php_imap_searchpgm)); >> =A0 =A0 =A0 searchpgm->searchpgm =3D pgm; >> =A0 =A0 =A0 ZEND_REGISTER_RESOURCE(return_value, searchpgm, le_imap_sear= chpgm); >> } >> >> PHP_FUNCTION(imap_searchprogram_sentsince) >> { >> =A0 =A0 =A0 zval *zpgm; >> =A0 =A0 =A0 php_imap_searchpgm *pgm; >> =A0 =A0 =A0 char *criterion =3D ""; >> >> =A0 =A0 =A0 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &= zpgm, &criterion) =3D=3D FAILURE) { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 RETURN_FALSE; >> =A0 =A0 =A0 } >> >> =A0 =A0 =A0 ZEND_FETCH_RESOURCE(pgm, php_imap_search_pgm*, &zpgm, -1, "i= mapsearch", le_imap_searchpgm); >> >> =A0 =A0 =A0 mail_criteria_date(&pgm->searchpgm->sentsince, &criterion); >> >> =A0 =A0 =A0 RETURN_TRUE; >> } >> >> etc. etc. >> >> >> And finally, the imap_search function could then accept either the crite= ria 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 t= o this: http://bugs.php.net/bug.php?id=3D21168 >>> >>> Now, how about adding an imap_newsearchpgm function to the PHP imap ext= ension which would do a call to mail_nsewsearchpgm inside c-client and retu= rn a structure allowing to contruct IMAP4 search programs (SEARCHPGM inside= c-client) ? >>> >>> Anyone interested in this ? >>> >>> Dominik >>> >>> On 2010-01-30, at 6:22 PM, Joey Smith wrote: >>> >>>> There's an open bug on this, #15238 (http://bugs.php.net/bug.php?id=3D= 15238&). I'm >>>> sure patches would be welcomed. >>>> >>>> On Fri, Jan 29, 2010 at 03:49:18PM -0500, Dominik Gehl wrote: >>>>> Hi, >>>>> >>>>> I noticed that the imap extension seems to support only IMAP2 search = criteria. >>>>> >>>>> This is caused by the fact that in ext/imap/php_imap.c, the imap_sear= ch function uses a call to mail_criteria. And >>>>> the University of Washington IMAP toolkit mentions in docs/internal.t= xt: >>>>> >>>>> SEARCHPGM *mail_criteria (char *criteria); >>>>> =A0 =A0 criteria IMAP2-format search criteria string >>>>> >>>>> =A0This function accepts an IMAP2-format search criteria string and >>>>> parses it. =A0If the parse is successful, it returns a search program >>>>> suitable for use in mail_search_full(). >>>>> =A0 =A0 WARNING: This function does not accept IMAP4 search criteria. >>>>> >>>>> >>>>> Is there any specific reason why PHP uses this mail_criteria call ? I= t really would be nice to be able to use IMAP4 search criteria ! >>>>> >>>>> Thanks, >>>>> Dominik >>>>> >>>>> -- >>>>> PHP Internals - PHP Runtime Development Mailing List >>>>> To unsubscribe, visit: http://www.php.net/unsub.php >>>>> >>> >> > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > --=20 Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org