From 390ee9875f1841badf8663993cad9a1fa50f09fb Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 31 Dec 2015 11:16:57 +1600 Subject: [PATCH] [PATCH 2/5] nmbug-status: Add meta.message-url config setting --- e3/fec0324260493b126e60aec2f8c441d0026e38 | 168 ++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 e3/fec0324260493b126e60aec2f8c441d0026e38 diff --git a/e3/fec0324260493b126e60aec2f8c441d0026e38 b/e3/fec0324260493b126e60aec2f8c441d0026e38 new file mode 100644 index 000000000..fdb61f674 --- /dev/null +++ b/e3/fec0324260493b126e60aec2f8c441d0026e38 @@ -0,0 +1,168 @@ +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 ED65A6DE1A20 + for ; Wed, 30 Dec 2015 11:29:21 -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.012 +X-Spam-Level: +X-Spam-Status: No, score=-0.012 tagged_above=-999 required=5 tests=[AWL=0.089, + DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-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 sOeknRauquNS for ; + Wed, 30 Dec 2015 11:29:20 -0800 (PST) +Received: from resqmta-po-10v.sys.comcast.net (resqmta-po-10v.sys.comcast.net + [96.114.154.169]) + by arlo.cworth.org (Postfix) with ESMTPS id C2A836DE1A0E + for ; Wed, 30 Dec 2015 11:29:19 -0800 (PST) +Received: from resomta-po-03v.sys.comcast.net ([96.114.154.227]) + by resqmta-po-10v.sys.comcast.net with comcast + id zvQK1r0024ueUHc01vQKt6; Wed, 30 Dec 2015 19:24:19 +0000 +Received: from mail.tremily.us ([73.221.72.168]) + by resomta-po-03v.sys.comcast.net with comcast + id zvNJ1r00D3dr3C901vNJEo; Wed, 30 Dec 2015 19:22:19 +0000 +Received: by mail.tremily.us (Postfix, from userid 1000) + id 6A98E1B2C3DE; Wed, 30 Dec 2015 11:22:18 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tremily.us; s=odin; + t=1451503338; bh=tk+6BE9cwA7KEGMk/RW7QHXvxUJjWFx0oRrqkFUFt1Q=; + h=Resent-From:Resent-Date:Resent-To:From:To:Cc:Subject:Date: + In-Reply-To:References:In-Reply-To:References; + b=Tb2jozfeQz/E1iJDZySQ44y1ZR+WtGgtBP8QZucXOevKJNMM7fMNaU/aq083GI4nU + kkA6FZ3t7W00ZcbkkB0II7JVrxWH6kRnhMRcXqsjjOvlYToNVtv6v5ELvunJTRVbso + Lmty72cI82dJuUIf76qu15Cg+T5/kGYD3A2GZtZY= +Resent-From: "W. Trevor King" +Resent-Date: Wed, 30 Dec 2015 11:22:18 -0800 +Resent-Message-ID: <20151230192218.GC2452@odin.tremily.us> +Resent-To: notmuch@notmuchmail.org +From: "W. Trevor King" +To: notmuch@notmuchmail.org +Cc: David Bremner , + Tomi Ollila , Jani Nikula , + Carl Worth , "W. Trevor King" +Subject: [PATCH 2/5] nmbug-status: Add meta.message-url config setting +Date: Wed, 30 Dec 2015 11:16:57 -0800 +Message-Id: + <9377a4c1265b13f9588d21ec0ea591ea9f61a05f.1451502495.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=1451503459; + bh=Nnq9N1s17J4Xjz52SmfpWDWNd2bbsmDF/Pmv79592wg=; + h=Received:Received:Received:From:To:Subject:Date:Message-Id; + b=BmDgaFIIapYcKVf9vWLhtfRzPQ7tfdMcZUZtuwhxJJ9V9d0BKi9fQgR5z9D2WH6tl + LHfWfISkQ1AszZ6jM5fDT+s3nGnIgJI0gyn1R8lYtALxDOJz0Qm611w2oG9Aht//zI + tWa9VjRo5QK4uT//fgZjscj7IRl3KxMTJ5jTJxxGXqolmVR9dRdtzjDxGPtHLctRh2 + pOJO7yoh7VhFgR3T8IO4XYU9oKm3g0fRSgg6L01YJbQFVh7iLF9/19JcP6f7T8XzvG + Bz6Yp+jh1vCkI8W0LJLF5cPnAEVAi6F7Mimm9lax0MJHA7Rof2gBmHVY2EktxIPYeH + Vl8NRy0F+jVmA== +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: Wed, 30 Dec 2015 19:29:22 -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