From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 3FED06DE0115 for ; Thu, 18 May 2017 15:25:50 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.057 X-Spam-Level: X-Spam-Status: No, score=-0.057 tagged_above=-999 required=5 tests=[AWL=-0.036, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4d000W5vjPsC for ; Thu, 18 May 2017 15:25:49 -0700 (PDT) Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51]) by arlo.cworth.org (Postfix) with ESMTPS id 8B4596DE00AC for ; Thu, 18 May 2017 15:25:46 -0700 (PDT) Received: by mail-wm0-f51.google.com with SMTP id 70so62300158wmq.1 for ; Thu, 18 May 2017 15:25:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adirat-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=rPHByfvf03eMnwgLbnELr7V/1eDcC9XS6pZXRDr4Fgw=; b=l8Gk7GzdNh+HM4ZW1e8EaIQNgZ1gwdv+ox5W7nhkHsldtIwJhuuShJx+2P7Wgunsce E+rv8imb9L+647KWQ9gmMl2ef7pGmGd/gZIZ3s+ooDr8Zf1uiXku5F81i6TjlC8wQJ94 Kkt74bPzGB4VpkIrj+GXXjbYNpFenNMOYsoEDGr3gdC/0dtRVMUWmLSGjOMsjlQgPWlm R/p08ZXEoJILFZF4SQjcxzFMLb5X1ONapEbxM3eEw7UfWL0+nkVYi86Axp+Ati/Ror3H RNUhJIbNtLgXHwxtxY7F1D+45w012gYW4L2MTE/EDTtd+Y1pwbDzhUAMF1Dlhtj5mTvF Af4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=rPHByfvf03eMnwgLbnELr7V/1eDcC9XS6pZXRDr4Fgw=; b=SELwEyT7/yM06LTLYrdXuI36RqoaeL0TXe3IhcnA9wyluYXr2X99Yvg9pQdjngOyoA igJpz6UDEM+3qNZNV5jRS1OvwdY29zHMcLWSGsF7jPokxBFk1Q0wDczmDpWaGDauQZ07 7WwRklxm+8YJMyRZ9826nYgL+YfFd+Ai0mLAw/mSseWfJbQEigk0qrWXQn8ryphFFoCD kXQkg2NiNyXfAeZORHBhEAQS6z0ZMeyk85dibMdhH2zgtnIRsCe7CjPuwqgaXW6B3jkE LthwFHT6won5J6AUt4Osa3YGHobDWGxEDYsHgPfi5aKBXmCEeaGhmFDeYPeNeuBXwWZh dTkw== X-Gm-Message-State: AODbwcDRyyGJo3SYTNvCAqVjxPcshryUSOT/MbdsXfkVoWY/ayFu4w7x K+tta7Z+0ecVppJ7+9c= X-Received: by 10.28.238.67 with SMTP id m64mr15478722wmh.57.1495146345000; Thu, 18 May 2017 15:25:45 -0700 (PDT) Received: from adiPC.adirat.com ([82.137.23.239]) by smtp.gmail.com with ESMTPSA id q16sm8141390wmg.2.2017.05.18.15.25.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 May 2017 15:25:44 -0700 (PDT) From: Ioan-Adrian Ratiu To: notmuch@notmuchmail.org Subject: [PATCH v2 08/11] notmuch-search: output total_filesize thread result Date: Fri, 19 May 2017 01:27:05 +0300 Message-Id: <20170518222708.30032-9-adi@adirat.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170518222708.30032-1-adi@adirat.com> References: <20170518222708.30032-1-adi@adirat.com> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 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: Thu, 18 May 2017 22:25:50 -0000 This works for all the search output formats (sexp, json, text). Signed-off-by: Ioan-Adrian Ratiu --- devel/schemata | 1 + notmuch-search.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/devel/schemata b/devel/schemata index 00ebb7a6..c9e05623 100644 --- a/devel/schemata +++ b/devel/schemata @@ -153,6 +153,7 @@ search_tags = [string*] thread_summary = { thread: threadid, + total_filesize: unsigned long, timestamp: unix_time, date_relative: string, # user-friendly timestamp matched: int, # number of matched messages diff --git a/notmuch-search.c b/notmuch-search.c index 65ecfaab..3cf2a65a 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@ -161,6 +161,7 @@ do_search_threads (search_context_t *ctx) const char *thread_id = notmuch_thread_get_thread_id (thread); int matched = notmuch_thread_get_matched_messages (thread); int total = notmuch_thread_get_total_messages (thread); + unsigned long total_filesize = notmuch_thread_get_total_filesize (thread); const char *relative_date = NULL; notmuch_bool_t first_tag = TRUE; @@ -175,8 +176,9 @@ do_search_threads (search_context_t *ctx) if (format->is_text_printer) { /* Special case for the text formatter */ - printf ("thread:%s %12s [%d/%d] %s; %s (", + printf ("thread:%s %lu %12s [%d/%d] %s; %s (", thread_id, + total_filesize, relative_date, matched, total, @@ -185,6 +187,8 @@ do_search_threads (search_context_t *ctx) } else { /* Structured Output */ format->map_key (format, "thread"); format->string (format, thread_id); + format->map_key (format, "total_filesize"); + format->unsigned_long (format, total_filesize); format->map_key (format, "timestamp"); format->integer (format, date); format->map_key (format, "date_relative"); -- 2.13.0