--- /dev/null
+Return-Path: <m.walters@qmul.ac.uk>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id C1A8D6DE1006\r
+ for <notmuch@notmuchmail.org>; Fri, 17 Apr 2015 11:56:44 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.093\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.093 tagged_above=-999 required=5 tests=[AWL=1.741, \r
+ DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+ NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3,\r
+ RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01,\r
+ RP_MATCHES_RCVD=-0.55, T_FREEMAIL_FORGED_FROMDOMAIN=0.01,\r
+ T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id Z6C9YGvHAQ3u for <notmuch@notmuchmail.org>;\r
+ Fri, 17 Apr 2015 11:56:41 -0700 (PDT)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 4E57B6DE0FB0\r
+ for <notmuch@notmuchmail.org>; Fri, 17 Apr 2015 11:56:41 -0700 (PDT)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+ by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1YjBRI-0001zq-Db; Fri, 17 Apr 2015 19:56:34 +0100\r
+Received: from 5751dfa2.skybroadband.com ([87.81.223.162] helo=localhost)\r
+ by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1YjBRI-0001Ww-5R; Fri, 17 Apr 2015 19:56:32 +0100\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org\r
+Subject: Re: [RFC] lib: add support for date:<query>..! to\r
+ mean date:<query>..<query>\r
+In-Reply-To: <1425732959-2282-1-git-send-email-jani@nikula.org>\r
+References: <1425732959-2282-1-git-send-email-jani@nikula.org>\r
+User-Agent: Notmuch/0.18.1+86~gef5e66a (http://notmuchmail.org) Emacs/24.4.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Fri, 17 Apr 2015 19:57:27 +0100\r
+Message-ID: <87a8y6fuqw.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: quoted-printable\r
+X-Sender-Host-Address: 87.81.223.162\r
+X-QM-Geographic: According to ripencc,\r
+ this message was delivered by a machine in Britain (UK) (GB).\r
+X-QM-SPAM-Info: Sender has good ham record. :)\r
+X-QM-Body-MD5: 96ee783ea36004e61c3f2388004b0221 (of first 20000 bytes)\r
+X-SpamAssassin-Score: -0.0\r
+X-SpamAssassin-SpamBar: /\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+ determine if it is\r
+ spam. We require at least 5.0 points to mark a message as spam.\r
+ This message scored -0.0 points.\r
+ Summary of the scoring: \r
+ * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider\r
+ * (markwalters1009[at]gmail.com)\r
+ * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
+ * domain\r
+X-QM-Scan-Virus: ClamAV says the message is clean\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 17 Apr 2015 18:56:44 -0000\r
+\r
+\r
+Hi\r
+\r
+On Sat, 07 Mar 2015, Jani Nikula <jani@nikula.org> wrote:\r
+> Up to debate:\r
+>\r
+> 1) Is something like this useful at all as an intermediate step before\r
+> we can have support for date:<query>? (This can be done with a future\r
+> version of Xapian, or with a custom query query parser.)\r
+\r
+This looks good to me. Yes it may not be needed in the future but the\r
+patch is very small. It passes all tests. +1 from me.\r
+\r
+> 2) If yes, are there better alternatives to "!" as the end point? (Or\r
+> should the special case be the start point?) Also "@" and "same" have\r
+> been suggested. Examples: date:yesterday..! date:today..@\r
+> date:@..monday date:january..same.\r
+\r
+I would be happy with any of these.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+>\r
+> Idea from Mark Walters <markwalters1009@gmail.com>.\r
+> ---\r
+> lib/parse-time-vrp.cc | 5 +++++\r
+> test/T500-search-date.sh | 4 ++++\r
+> 2 files changed, 9 insertions(+)\r
+>\r
+> diff --git a/lib/parse-time-vrp.cc b/lib/parse-time-vrp.cc\r
+> index 33f07db3410e..03804cf50fa8 100644\r
+> --- a/lib/parse-time-vrp.cc\r
+> +++ b/lib/parse-time-vrp.cc\r
+> @@ -31,6 +31,7 @@ Xapian::valueno\r
+> ParseTimeValueRangeProcessor::operator() (std::string &begin, std::strin=\r
+g &end)\r
+> {\r
+> time_t t, now;\r
+> + std::string b;\r
+>=20=20\r
+> /* Require date: prefix in start of the range... */\r
+> if (STRNCMP_LITERAL (begin.c_str (), PREFIX))\r
+> @@ -38,6 +39,7 @@ ParseTimeValueRangeProcessor::operator() (std::string &=\r
+begin, std::string &end)\r
+>=20=20\r
+> /* ...and remove it. */\r
+> begin.erase (0, sizeof (PREFIX) - 1);\r
+> + b =3D begin;\r
+>=20=20\r
+> /* Use the same 'now' for begin and end. */\r
+> if (time (&now) =3D=3D (time_t) -1)\r
+> @@ -51,6 +53,9 @@ ParseTimeValueRangeProcessor::operator() (std::string &=\r
+begin, std::string &end)\r
+> }\r
+>=20=20\r
+> if (!end.empty ()) {\r
+> + if (end =3D=3D "!" && ! b.empty ())\r
+> + end =3D b;\r
+> +\r
+> if (parse_time_string (end.c_str (), &t, &now, PARSE_TIME_ROUND_UP_INCL=\r
+USIVE))\r
+> return Xapian::BAD_VALUENO;\r
+>=20=20\r
+> diff --git a/test/T500-search-date.sh b/test/T500-search-date.sh\r
+> index 70bcf344b4f7..18a47b114fa9 100755\r
+> --- a/test/T500-search-date.sh\r
+> +++ b/test/T500-search-date.sh\r
+> @@ -8,6 +8,10 @@ test_begin_subtest "Absolute date range"\r
+> output=3D$(notmuch search date:2010-12-16..12/16/2010 | notmuch_search_s=\r
+anitize)\r
+> test_expect_equal "$output" "thread:XXX 2010-12-16 [1/1] Olivier Berge=\r
+r; Essai accentu=C3=A9 (inbox unread)"\r
+>=20=20\r
+> +test_begin_subtest "Absolute date range with 'same' operator"\r
+> +output=3D$(notmuch search date:2010-12-16..! | notmuch_search_sanitize)\r
+> +test_expect_equal "$output" "thread:XXX 2010-12-16 [1/1] Olivier Berge=\r
+r; Essai accentu=C3=A9 (inbox unread)"\r
+> +\r
+> test_begin_subtest "Absolute time range with TZ"\r
+> notmuch search date:18-Nov-2009_02:19:26-0800..2009-11-18_04:49:52-06:00=\r
+ | notmuch_search_sanitize > OUTPUT\r
+> cat <<EOF >EXPECTED\r
+> --=20\r
+> 2.1.4\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r