Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45849 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45211 invoked from network); 20 Oct 2009 22:17:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Oct 2009 22:17:14 -0000 Authentication-Results: pb1.pair.com header.from=nick@mailtrust.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nick@mailtrust.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain mailtrust.com designates 207.97.245.163 as permitted sender) X-PHP-List-Original-Sender: nick@mailtrust.com X-Host-Fingerprint: 207.97.245.163 smtp163.iad.emailsrvr.com Linux 2.4/2.6 Received: from [207.97.245.163] ([207.97.245.163:47462] helo=smtp163.iad.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 97/FA-39240-9E63EDA4 for ; Tue, 20 Oct 2009 18:17:13 -0400 Received: from relay26.relay.iad.mlsrvr.com (localhost [127.0.0.1]) by relay26.relay.iad.mlsrvr.com (SMTP Server) with ESMTP id EF7BD1B402D for ; Tue, 20 Oct 2009 18:17:10 -0400 (EDT) Received: from dynamic1.wm-web.iad.mlsrvr.com (dynamic1.wm-web.iad.mlsrvr.com [192.168.2.150]) by relay26.relay.iad.mlsrvr.com (SMTP Server) with ESMTP id EA4111B4849 for ; Tue, 20 Oct 2009 18:17:10 -0400 (EDT) Received: from mailtrust.com (localhost [127.0.0.1]) by dynamic1.wm-web.iad.mlsrvr.com (Postfix) with ESMTP id DB847C980A6 for ; Tue, 20 Oct 2009 18:17:10 -0400 (EDT) Received: by apps.rackspace.com (Authenticated sender: nick@mailtrust.com, from: nick@mailtrust.com) with HTTP; Tue, 20 Oct 2009 18:17:10 -0400 (EDT) Date: Tue, 20 Oct 2009 18:17:10 -0400 (EDT) To: internals@lists.php.net MIME-Version: 1.0 Content-Type: text/plain;charset=UTF-8 Content-Transfer-Encoding: quoted-printable Importance: Normal X-Priority: 3 (Normal) X-Type: plain In-Reply-To: References: <1256076610.69357406@192.168.1.71> Message-ID: <1256077030.8975573@192.168.1.71> X-Mailer: webmail7.0b Subject: =?UTF-8?Q?Re:=20[PHP-DEV]=20Patch:=20Add=20INTERNALDATE=20to=20imap=5Fap?= =?UTF-8?Q?pend()?= From: nick@mailtrust.com ("Nick Fortenberry") Hey Pierre,=0A=0ANo problem. We'll work on a test case and post a bug repo= rt when we've created it.=0A=0AThanks,=0ANick Fortenberry=0A=0A=0A-----Orig= inal Message-----=0AFrom: "Pierre Joye" =0ASent: Tues= day, October 20, 2009 6:13pm=0ATo: "Nick Fortenberry" = =0ACc: internals@lists.php.net=0ASubject: Re: [PHP-DEV] Patch: Add INTERNAL= DATE to imap_append()=0A=0Ahi,=0A=0ACan you open a bug report and post a li= nk to the patch please? So we=0Awon't loose it in the ML archive. A test ca= se would also be useful.=0A=0ACheers,=0A=0AOn Wed, Oct 21, 2009 at 12:10 AM= , Nick Fortenberry wrote:=0A> Hey everyone,=0A>=0A> Ja= ke Levitt and I created this patch which adds the option to set a message's= INTERNALDATE when appending it to a mail server using imap. =C2=A0Any chan= ce we can get this included into the php 5.3 and 6 development branches? = =C2=A0The diff below was done against the php-src/branches/PHP_5_3 branch. = =C2=A0If you guys need me to apply the changes to a different branch or sna= pshot, please let me know.=0A>=0A> Here's the svn diff (done in my repo)...= if you need something else please let me know:=0A>=0A>=0A> Index: ext/imap= /php_imap.c=0A> =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=0A> -= -- ext/imap/php_imap.c =C2=A0 =C2=A0 =C2=A0 =C2=A0(revision 3405)=0A> +++ e= xt/imap/php_imap.c =C2=A0 =C2=A0 =C2=A0 =C2=A0(revision 3406)=0A> @@ -41,6 = +41,7 @@=0A> #include "ext/standard/info.h"=0A> #include "ext/standard/file= .h"=0A> #include "ext/standard/php_smart_str.h"=0A> +#include "ext/pcre/php= _pcre.h"=0A>=0A> #ifdef ERROR=0A> #undef ERROR=0A> @@ -118,6 +119,7 @@=0A> = =C2=A0 =C2=A0 =C2=A0 ZEND_ARG_INFO(0, folder)=0A> =C2=A0 =C2=A0 =C2=A0 ZEND= _ARG_INFO(0, message)=0A> =C2=A0 =C2=A0 =C2=A0 ZEND_ARG_INFO(0, options)=0A= > + =C2=A0 =C2=A0 =C2=A0 =C2=A0ZEND_ARG_INFO(0, date)=0A> ZEND_END_ARG_INFO= ()=0A>=0A> ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_num_msg, 0, 0, 1)=0A> @@ -12= 70,20 +1272,43 @@=0A> PHP_FUNCTION(imap_append)=0A> {=0A> =C2=A0 =C2=A0 =C2= =A0 zval *streamind;=0A> - =C2=A0 =C2=A0 =C2=A0 =C2=A0char *folder, *messag= e, *flags =3D NULL;=0A> - =C2=A0 =C2=A0 =C2=A0 =C2=A0int folder_len, messag= e_len, flags_len =3D 0;=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0char *folder, *mes= sage, *date =3D NULL, *flags =3D NULL;=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0int= folder_len, message_len, date_len =3D 0, flags_len =3D 0;=0A> =C2=A0 =C2= =A0 =C2=A0 pils *imap_le_struct;=0A> =C2=A0 =C2=A0 =C2=A0 STRING st;=0A>=0A= > - =C2=A0 =C2=A0 =C2=A0 =C2=A0if (zend_parse_parameters(ZEND_NUM_ARGS() TS= RMLS_CC, "rss|s", &streamind, &folder, &folder_len, &message, &message_len,= &flags, &flags_len) =3D=3D FAILURE) {=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0if = (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss|ss", &streamind, &fo= lder, &folder_len, &message, &message_len, &flags, &flags_len, &date, &date= _len) =3D=3D FAILURE) {=0A> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 return;=0A> =C2=A0 =C2=A0 =C2=A0 }=0A>=0A> + =C2=A0 =C2=A0 =C2=A0 =C2= =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}/";=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0int regex_len =3D strlen(re= gex);=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0pcre_cache_entry *pce; =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0//Compiled regex=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0z= val *subpats =3D NULL; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0//Parts (not use= d)=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0long regex_flags =3D 0; =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0//Flags (not used)=0A> + =C2=A0 =C2=A0 =C2=A0 =C2= =A0long start_offset =3D 0; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0//Start o= ffset (not used)=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0int global =3D 0;=0A> += =0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0if (date) {=0A> + =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0//Make sure the given date string matches= the RFC specified format=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0if ((pce =3D pcre_get_compiled_regex_cache(regex, regex_len TS= RMLS_CC)) =3D=3D NULL) {=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0RETURN_FALSE;=0A> + =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}=0A> +=0A> + =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0php_pcre_match_impl(pce, date, date_len,= return_value, subpats, global,=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A00, regex_flags, start_offse= t TSRMLS_CC);=0A> +=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0if (!Z_LVAL_P(return_value)) {=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0php_error_docref(NULL T= SRMLS_CC, E_WARNING, "internal date not correctly formatted");=0A> + =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0date =3D NULL;=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0}=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0}=0A> +=0A> =C2=A0 =C2=A0 =C2=A0 Z= END_FETCH_RESOURCE(imap_le_struct, pils *, &streamind, -1, "imap", le_imap)= ;=0A>=0A> =C2=A0 =C2=A0 =C2=A0 INIT (&st, mail_string, (void *) message, me= ssage_len);=0A>=0A> - =C2=A0 =C2=A0 =C2=A0 =C2=A0if (mail_append_full(imap_= le_struct->imap_stream, folder, (flags ? flags : NIL), NIL, &st)) {=0A> + = =C2=A0 =C2=A0 =C2=A0 =C2=A0if (mail_append_full(imap_le_struct->imap_stream= , folder, (flags ? flags : NIL), (date ? date : NIL), &st)) {=0A> =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 RETURN_TRUE;=0A> =C2=A0 =C2=A0 = =C2=A0 } else {=0A> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 RETURN= _FALSE;=0A>=0A>=0A>=0A> Thanks,=0A>=0A> - Nick Fortenberry=0A>=0A>=0A>=0A> = --=0A> PHP Internals - PHP Runtime Development Mailing List=0A> To unsubscr= ibe, visit: http://www.php.net/unsub.php=0A>=0A>=0A=0A=0A=0A-- =0APierre=0A= =0Ahttp://blog.thepimp.net | http://www.libgd.org=0A