From 8e22c48319ad033993a55b9cc6bc49c4c6617da9 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 2 Jan 2016 22:07:41 +1600 Subject: [PATCH] [PATCH v2 2/4] nmbug-status: Add meta.message-url config setting --- 1a/422694578ad2fde79c4b8027724eeac0d3cb32 | 161 ++++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 1a/422694578ad2fde79c4b8027724eeac0d3cb32 diff --git a/1a/422694578ad2fde79c4b8027724eeac0d3cb32 b/1a/422694578ad2fde79c4b8027724eeac0d3cb32 new file mode 100644 index 000000000..77bb7d64b --- /dev/null +++ b/1a/422694578ad2fde79c4b8027724eeac0d3cb32 @@ -0,0 +1,161 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id 360ED6DE1A2F + for ; Fri, 1 Jan 2016 22:10:04 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" +X-Spam-Flag: NO +X-Spam-Score: 0.04 +X-Spam-Level: +X-Spam-Status: No, score=0.04 tagged_above=-999 required=5 tests=[AWL=0.041, + DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, + 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 2oM1C5ZRy7NK for ; + Fri, 1 Jan 2016 22:10:02 -0800 (PST) +Received: from resqmta-po-03v.sys.comcast.net (resqmta-po-03v.sys.comcast.net + [96.114.154.162]) + by arlo.cworth.org (Postfix) with ESMTPS id D412D6DE1A32 + for ; Fri, 1 Jan 2016 22:09:52 -0800 (PST) +Received: from resomta-po-18v.sys.comcast.net ([96.114.154.242]) + by resqmta-po-03v.sys.comcast.net with comcast + id 0u9m1s0025E3ZMc01u9m5T; Sat, 02 Jan 2016 06:09:46 +0000 +Received: from mail.tremily.us ([73.221.72.168]) + by resomta-po-18v.sys.comcast.net with comcast + id 0u7j1s00G3dr3C901u7k59; Sat, 02 Jan 2016 06:07:46 +0000 +Received: from ullr.tremily.us (unknown [192.168.10.7]) + by mail.tremily.us (Postfix) with ESMTPS id B77FF1B2F575; + Fri, 1 Jan 2016 22:07:43 -0800 (PST) +Received: (nullmailer pid 15113 invoked by uid 1000); + Sat, 02 Jan 2016 06:07:51 -0000 +From: "W. Trevor King" +To: notmuch@notmuchmail.org +Cc: David Bremner , + Tomi Ollila , Jani Nikula , + Carl Worth , "W. Trevor King" +Subject: [PATCH v2 2/4] nmbug-status: Add meta.message-url config setting +Date: Fri, 1 Jan 2016 22:07:41 -0800 +Message-Id: + <9377a4c1265b13f9588d21ec0ea591ea9f61a05f.1451683912.git.wking@tremily.us> +X-Mailer: git-send-email 2.1.0.60.g85f0837 +In-Reply-To: +References: +In-Reply-To: +References: +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; + s=q20140121; t=1451714986; + bh=Nnq9N1s17J4Xjz52SmfpWDWNd2bbsmDF/Pmv79592wg=; + h=Received:Received:Received:Received:From:To:Subject:Date: + Message-Id; + b=UzYBVpXGDwsggIk1yrXgzkqaEM0NC5VlATayi/nHxM1ZckSTgaO6vXurtLrSz84FX + 826+/+kaAED7dlBn5asowwmTqqf/gIsLO2QLjTKBowV6SLk5oIp/W5zam+lDJ/KaP0 + jh2gaZ0G0Lc4EhcjmLX2MrS8HH5TwCXu6E+xziHczL+mkgFP3i4EuOfbCmXtgVYy5u + nlFLikhd93unaqqh/GxM1raD37upbUxCWAtJmAzq1et58UW9/kEiohfTVb4QI0635p + Xyl/gKo9E3FijMaMpGwT779tlWoQnEai9CuzgxET7iNv+zbZFsg+KIAV9ECOaZVDdx + FxurScC1b0c3Q== +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.20 +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: Sat, 02 Jan 2016 06:10:04 -0000 + +So you can link to archives other than Gmane. For example, I'm doing +this in [1]. + +[1]: https://github.com/wking/nmbug-oci +--- + NEWS | 20 ++++++++++++++++++++ + devel/nmbug/nmbug-status | 13 ++++++++++--- + 2 files changed, 30 insertions(+), 3 deletions(-) + +diff --git a/NEWS b/NEWS +index 0a7a0e0..9f2e860 100644 +--- a/NEWS ++++ b/NEWS +@@ -1,3 +1,23 @@ ++Notmuch 0.22 (UNRELEASED) ++========================= ++ ++nmbug-status ++------------ ++ ++`nmbug-status` now supports `meta.message-url` to override the Gmane ++template. For example, you can use: ++ ++ { ++ "meta": { ++ "message-url": "https://groups.google.com/a/opencontainers.org/forum/#!search/messageid$3A%22{message-id}%22" ++ ... ++ }, ++ ... ++ } ++ ++To link to messages in the [opencontainers.org Google ++Groups](https://groups.google.com/a/opencontainers.org/forum/#!overview). ++ + Notmuch 0.21 (2015-10-29) + ========================= + +diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status +index b36b6ad..d72f1db 100755 +--- a/devel/nmbug/nmbug-status ++++ b/devel/nmbug/nmbug-status +@@ -19,11 +19,11 @@ + # You should have received a copy of the GNU General Public License + # along with this program. If not, see http://www.gnu.org/licenses/ . + +-"""Generate HTML for one or more notmuch searches. ++"""Generate text and/or HTML for one or more notmuch searches. + + Messages matching each search are grouped by thread. Each message + that contains both a subject and message-id will have the displayed +-subject link to the Gmane view of the message. ++subject link to an archive view of the message (defaulting to Gmane). + """ + + from __future__ import print_function +@@ -232,6 +232,10 @@ class Page (object): + class HtmlPage (Page): + _slug_regexp = re.compile('\W+') + ++ def __init__(self, message_url_template, **kwargs): ++ self.message_url_template = message_url_template ++ super(HtmlPage, self).__init__(**kwargs) ++ + def _write_header(self, views, stream): + super(HtmlPage, self)._write_header(views=views, stream=stream) + stream.write('
    \n') +@@ -292,8 +296,9 @@ class HtmlPage (Page): + 'message-id': quote(display_data['message-id']), + 'subject': xml.sax.saxutils.escape(display_data['subject']), + } ++ d['url'] = self.message_url_template.format(**d) + display_data['subject'] = ( +- '{subject}' ++ '{subject}' + ).format(**d) + for key in ['message-id', 'from']: + if key in display_data: +@@ -395,6 +400,8 @@ _PAGES['text'] = Page() + _PAGES['html'] = HtmlPage( + header=header_template.format(**context), + footer=footer_template.format(**context), ++ message_url_template=config['meta'].get( ++ 'message-url', 'http://mid.gmane.org/{message-id}'), + ) + + if args.list_views: +-- +2.1.0.60.g85f0837 + -- 2.26.2