From 254cfbd78a3e63272445a22840c80d7db5899511 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Sun, 23 Feb 2014 18:55:21 +0200 Subject: [PATCH] [PATCH 1/3] cli: export function for illegal tag checking --- 34/d794b8473a9a82f8aa87b515923d5462fff8ed | 124 ++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 34/d794b8473a9a82f8aa87b515923d5462fff8ed diff --git a/34/d794b8473a9a82f8aa87b515923d5462fff8ed b/34/d794b8473a9a82f8aa87b515923d5462fff8ed new file mode 100644 index 000000000..701936144 --- /dev/null +++ b/34/d794b8473a9a82f8aa87b515923d5462fff8ed @@ -0,0 +1,124 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id BCDB6429E25 + for ; Sun, 23 Feb 2014 08:55:36 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id M6l9nxrmGNOd for ; + Sun, 23 Feb 2014 08:55:31 -0800 (PST) +Received: from mail-ea0-f171.google.com (mail-ea0-f171.google.com + [209.85.215.171]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 1461B431FD6 + for ; Sun, 23 Feb 2014 08:55:30 -0800 (PST) +Received: by mail-ea0-f171.google.com with SMTP id f15so2614044eak.30 + for ; Sun, 23 Feb 2014 08:55:29 -0800 (PST) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to + :references:in-reply-to:references; + bh=dx4WrF/ZtNCUFjz/4BqO7mkXMhuunVzf9KCaGKJINE0=; + b=ky43dG7bJdNZdspyGurjuD/lVLp5I08HrfhbHEwzjhSujmgKswrPFTwZXoh3vGSfcu + E0mRQRd6oysR/WrVPffa8Qn34xkIiZ9vAn5+EvZrqJyNODXt6n6JiTFWhd2FgcGmHEez + ud+4uP1+I0iMwaonRrXWhcgQlNti2SJV/7xceEAUKEu7+3yY1Y1enw7gtpf/1/huNSxE + 0NBntR7OD9vaz6XMY8XhEJunBsObaL3rfqobGRsGHgmCwTM48gF+dO5OEdDHD65LzOQm + 4FZf0Uv00vjURjI/DFAAFD5HQgl3tnwp9yFKCZf2BJ2qo3Mzl0QFmT0CAIARBNFpYEAZ + dbHw== +X-Gm-Message-State: + ALoCoQlVcXkJTiJEWOj6mzEPYGKbyH6phwvmJRhN3ALcUYnLIpF67iXxPwUbM4VMk+Y0DUANcrMe +X-Received: by 10.14.95.134 with SMTP id p6mr19825249eef.73.1393174529804; + Sun, 23 Feb 2014 08:55:29 -0800 (PST) +Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi. + [88.195.111.91]) by mx.google.com with ESMTPSA id + j41sm53051047eey.15.2014.02.23.08.55.28 for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Sun, 23 Feb 2014 08:55:29 -0800 (PST) +From: Jani Nikula +To: notmuch@notmuchmail.org, + Rob Browning +Subject: [PATCH 1/3] cli: export function for illegal tag checking +Date: Sun, 23 Feb 2014 18:55:21 +0200 +Message-Id: + <9143b898e9112f07988c2db2d50a57f8638a3082.1393174108.git.jani@nikula.org> +X-Mailer: git-send-email 1.8.5.3 +In-Reply-To: +References: <87ha7qfto7.fsf@trouble.defaultvalue.org> + +In-Reply-To: +References: +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sun, 23 Feb 2014 16:55:36 -0000 + +This lets us check for forbidden tags consistently across the cli. No +functional changes. +--- + tag-util.c | 9 +-------- + tag-util.h | 12 ++++++++++++ + 2 files changed, 13 insertions(+), 8 deletions(-) + +diff --git a/tag-util.c b/tag-util.c +index 3bde4097372a..e2d5b795acc3 100644 +--- a/tag-util.c ++++ b/tag-util.c +@@ -31,14 +31,7 @@ line_error (tag_parse_status_t status, + return status; + } + +-/* +- * Test tags for some forbidden cases. +- * +- * return: NULL if OK, +- * explanatory message otherwise. +- */ +- +-static const char * ++const char * + illegal_tag (const char *tag, notmuch_bool_t remove) + { + +diff --git a/tag-util.h b/tag-util.h +index 4628f1630ad6..8a4074ce168f 100644 +--- a/tag-util.h ++++ b/tag-util.h +@@ -90,6 +90,18 @@ parse_tag_command_line (void *ctx, int argc, char **argv, + char **query_str, tag_op_list_t *ops); + + /* ++ * Test tags for some forbidden cases. ++ * ++ * Relax the checks if 'remove' is true to allow removal of previously ++ * added forbidden tags. ++ * ++ * return: NULL if OK, ++ * explanatory message otherwise. ++ */ ++const char * ++illegal_tag (const char *tag, notmuch_bool_t remove); ++ ++/* + * Create an empty list of tag operations + * + * ctx is passed to talloc +-- +1.8.5.3 + -- 2.26.2