From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 1F16920802 for ; Thu, 22 Jun 2017 22:02:11 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 1/2] filter/rubylang: reuse altid entry from inbox object Date: Thu, 22 Jun 2017 22:02:10 +0000 Message-Id: <20170622220211.8956-1-e@80x24.org> In-Reply-To: <20170622071136.GA8242@dcvr> References: <20170622071136.GA8242@dcvr> List-Id: This allows users to DRY up their config a bit and avoid specifying altid twice when reusing the NNTP-centric msgmap for [ruby-*:\d+] serial numbers. My current work-in-progress ~/.public-inbox/config entry for the ruby-core list is: ------8<------- [publicinbox "ruby-core"] address = ruby-core@ruby-lang.org url = //public-inbox.org/ruby-core mainrepo = /path/to/ruby-core.git newsgroup = inbox.comp.lang.ruby.core watchheader = List-Id: altid = serial:ruby-core:file=msgmap.sqlite3 watch = maildir:/path/to/Maildir/.INBOX.ruby filter = PublicInbox::Filter::RubyLang --- lib/PublicInbox/Filter/RubyLang.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/Filter/RubyLang.pm b/lib/PublicInbox/Filter/RubyLang.pm index ec4bc32..5240e8d 100644 --- a/lib/PublicInbox/Filter/RubyLang.pm +++ b/lib/PublicInbox/Filter/RubyLang.pm @@ -15,10 +15,13 @@ sub new { my ($class, %opts) = @_; my $altid = delete $opts{-altid}; my $self = $class->SUPER::new(%opts); + my $ibx = $self->{-inbox}; # altid = serial:ruby-core:file=msgmap.sqlite3 + if (!$altid && $ibx && $ibx->{altid}) { + $altid ||= $ibx->{altid}->[0]; + } if ($altid) { require PublicInbox::MID; # mid_clean - my $ibx = $self->{-inbox}; require PublicInbox::AltId; $self->{-altid} = PublicInbox::AltId->new($ibx, $altid, 1); } -- EW