Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45848 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 43830 invoked from network); 20 Oct 2009 22:13:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Oct 2009 22:13:11 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass; domainkeys=bad 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:36779] helo=fg-out-1718.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 90/AA-39240-3F53EDA4 for ; Tue, 20 Oct 2009 18:13:08 -0400 Received: by fg-out-1718.google.com with SMTP id d23so2631929fga.11 for ; Tue, 20 Oct 2009 15:13:04 -0700 (PDT) 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=mGzERX0hvWkr0keGzjWS7l4b1yXdXlBHvE58nBlQDqg=; b=BVD9gAaRnHVVNS/3CD8r7XmhU6m13qeoerGOwPT9qWa8/X8P2UOxgdGL/9t5/okNe6 D9coO0NNrt2bOV+d/LxjiWsZlChL/HwQm3N6oaA/IntvhCFPNLgKW2PpKjVPntQIOayN yasluUy1C3VnPF5L4fq/VWE9eCZP0rd2Iz0PQ= 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=FnTO11a4DX8RvgN5N7VnP9YjBFO017qqZCDuV+vsOVSj+1xEIg332wMmbemdkr8IWi +HDQ2pnEArJWxLAgvi6OHycLckb+2cqE3YzICMhZS851qRf+MZ5kQLiDZmwNt+qTqFIr tbsTVOn+ZqooBnazOYUbrXCft+cwx+mPEZ2uQ= MIME-Version: 1.0 Received: by 10.86.230.30 with SMTP id c30mr321754fgh.68.1256076784634; Tue, 20 Oct 2009 15:13:04 -0700 (PDT) In-Reply-To: <1256076610.69357406@192.168.1.71> References: <1256076610.69357406@192.168.1.71> Date: Wed, 21 Oct 2009 00:13:04 +0200 Message-ID: To: Nick Fortenberry Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Patch: Add INTERNALDATE to imap_append() From: pierre.php@gmail.com (Pierre Joye) hi, Can you open a bug report and post a link to the patch please? So we won't loose it in the ML archive. A test case would also be useful. Cheers, On Wed, Oct 21, 2009 at 12:10 AM, Nick Fortenberry wro= te: > Hey everyone, > > Jake Levitt and I created this patch which adds the option to set a messa= ge's INTERNALDATE when appending it to a mail server using imap. =A0Any cha= nce we can get this included into the php 5.3 and 6 development branches? = =A0The diff below was done against the php-src/branches/PHP_5_3 branch. =A0= If you guys need me to apply the changes to a different branch or snapshot,= please let me know. > > Here's the svn diff (done in my repo)... if you need something else pleas= e let me know: > > > Index: ext/imap/php_imap.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- ext/imap/php_imap.c =A0 =A0 =A0 =A0(revision 3405) > +++ ext/imap/php_imap.c =A0 =A0 =A0 =A0(revision 3406) > @@ -41,6 +41,7 @@ > #include "ext/standard/info.h" > #include "ext/standard/file.h" > #include "ext/standard/php_smart_str.h" > +#include "ext/pcre/php_pcre.h" > > #ifdef ERROR > #undef ERROR > @@ -118,6 +119,7 @@ > =A0 =A0 =A0 ZEND_ARG_INFO(0, folder) > =A0 =A0 =A0 ZEND_ARG_INFO(0, message) > =A0 =A0 =A0 ZEND_ARG_INFO(0, options) > + =A0 =A0 =A0 =A0ZEND_ARG_INFO(0, date) > ZEND_END_ARG_INFO() > > ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_num_msg, 0, 0, 1) > @@ -1270,20 +1272,43 @@ > PHP_FUNCTION(imap_append) > { > =A0 =A0 =A0 zval *streamind; > - =A0 =A0 =A0 =A0char *folder, *message, *flags =3D NULL; > - =A0 =A0 =A0 =A0int folder_len, message_len, flags_len =3D 0; > + =A0 =A0 =A0 =A0char *folder, *message, *date =3D NULL, *flags =3D NULL; > + =A0 =A0 =A0 =A0int folder_len, message_len, date_len =3D 0, flags_len = =3D 0; > =A0 =A0 =A0 pils *imap_le_struct; > =A0 =A0 =A0 STRING st; > > - =A0 =A0 =A0 =A0if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs= s|s", &streamind, &folder, &folder_len, &message, &message_len, &flags, &fl= ags_len) =3D=3D FAILURE) { > + =A0 =A0 =A0 =A0if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs= s|ss", &streamind, &folder, &folder_len, &message, &message_len, &flags, &f= lags_len, &date, &date_len) =3D=3D FAILURE) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 return; > =A0 =A0 =A0 } > > + =A0 =A0 =A0 =A0char* regex =3D "/[ 0-3][0-9]-((Jan)|(Feb)|(Mar)|(Apr)|(= May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec))-[0-9]{4} [0-2][0-9]:[0-5][0= -9]:[0-5][0-9] [+-][0-9]{4}/"; > + =A0 =A0 =A0 =A0int regex_len =3D strlen(regex); > + =A0 =A0 =A0 =A0pcre_cache_entry *pce; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0//Compiled regex > + =A0 =A0 =A0 =A0zval *subpats =3D NULL; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0//Parts (not used) > + =A0 =A0 =A0 =A0long regex_flags =3D 0; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0//Flags (not used) > + =A0 =A0 =A0 =A0long start_offset =3D 0; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0//Start offset (not used) > + =A0 =A0 =A0 =A0int global =3D 0; > + > + =A0 =A0 =A0 =A0if (date) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0//Make sure the given date string matche= s the RFC specified format > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if ((pce =3D pcre_get_compiled_regex_cac= he(regex, regex_len TSRMLS_CC)) =3D=3D NULL) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0RETURN_FALSE; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0php_pcre_match_impl(pce, date, date_len,= return_value, subpats, global, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A00, regex_flags, start_of= fset TSRMLS_CC); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (!Z_LVAL_P(return_value)) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0php_error_docref(NULL TS= RMLS_CC, E_WARNING, "internal date not correctly formatted"); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0date =3D NULL; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > + =A0 =A0 =A0 =A0} > + > =A0 =A0 =A0 ZEND_FETCH_RESOURCE(imap_le_struct, pils *, &streamind, -1, "= imap", le_imap); > > =A0 =A0 =A0 INIT (&st, mail_string, (void *) message, message_len); > > - =A0 =A0 =A0 =A0if (mail_append_full(imap_le_struct->imap_stream, folder= , (flags ? flags : NIL), NIL, &st)) { > + =A0 =A0 =A0 =A0if (mail_append_full(imap_le_struct->imap_stream, folder= , (flags ? flags : NIL), (date ? date : NIL), &st)) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 RETURN_TRUE; > =A0 =A0 =A0 } else { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 RETURN_FALSE; > > > > Thanks, > > - Nick Fortenberry > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 Pierre http://blog.thepimp.net | http://www.libgd.org