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: AS24940 5.9.0.0/16 X-Spam-Status: No, score=-1.5 required=3.0 tests=BAYES_00,RCVD_IN_XBL,SPF_FAIL, SPF_HELO_FAIL,URIBL_BLOCKED shortcircuit=no autolearn=no autolearn_force=no version=3.4.0 Received: from 80x24.org (tor-relay.zwiebeltoralf.de [5.9.158.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 8B0641FCB7 for ; Sun, 15 May 2016 23:51:39 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] rename most instances of "list" to "inbox" Date: Sun, 15 May 2016 23:51:37 +0000 Message-Id: <20160515235137.17688-1-e@80x24.org> List-Id: A public-inbox is NOT necessarily a mailing list, but it could serve as an input point for zero, one, or infinite mailing lists :D --- Documentation/design_www.txt | 34 ++++++------- lib/PublicInbox/Config.pm | 10 ++-- lib/PublicInbox/ExtMsg.pm | 12 ++--- lib/PublicInbox/Feed.pm | 8 +-- lib/PublicInbox/NewsWWW.pm | 10 ++-- lib/PublicInbox/View.pm | 2 +- lib/PublicInbox/WWW.pm | 114 +++++++++++++++++++++---------------------- script/public-inbox-init | 4 +- script/public-inbox-learn | 2 +- script/public-inbox-mda | 4 +- scripts/import_maildir | 4 +- scripts/import_slrnspool | 4 +- t/cgi.t | 2 +- t/config.t | 4 +- t/feed.t | 2 +- 15 files changed, 108 insertions(+), 108 deletions(-) diff --git a/Documentation/design_www.txt b/Documentation/design_www.txt index 3cf6ea8..67a9093 100644 --- a/Documentation/design_www.txt +++ b/Documentation/design_www.txt @@ -2,46 +2,46 @@ URL and anchor naming --------------------- ### Unstable endpoints -/$LISTNAME/?r=$GIT_COMMIT -> HTML only -/$LISTNAME/new.atom -> Atom feed +/$INBOX/?r=$GIT_COMMIT -> HTML only +/$INBOX/new.atom -> Atom feed #### Optional, relies on Search::Xapian -/$LISTNAME/$MESSAGE_ID/t/ -> HTML content of thread +/$INBOX/$MESSAGE_ID/t/ -> HTML content of thread anchors: #u location of $MESSAGE_ID in URL #m per-message links, where is of the Message-ID of each message (stable) #s relative numeric position of message in thread (unstable) -/$LISTNAME/$MESSAGE_ID/t.atom -> Atom feed for thread -/$LISTNAME/$MESSAGE_ID/t.mbox.gz -> gzipped mbox of thread +/$INBOX/$MESSAGE_ID/t.atom -> Atom feed for thread +/$INBOX/$MESSAGE_ID/t.mbox.gz -> gzipped mbox of thread ### Stable endpoints -/$LISTNAME/$MESSAGE_ID/ -> HTML content +/$INBOX/$MESSAGE_ID/ -> HTML content anchors: #r location of the current message in thread skeleton (requires Xapian search) #b start of the message body (linked from thread skeleton) -/$LISTNAME/$MESSAGE_ID -> 301 to /$LISTNAME/$MESSAGE_ID/ -/$LISTNAME/$MESSAGE_ID/raw -> raw mbox -/$LISTNAME/$MESSAGE_ID/R/ -> HTML reply instructions +/$INBOX/$MESSAGE_ID -> 301 to /$INBOX/$MESSAGE_ID/ +/$INBOX/$MESSAGE_ID/raw -> raw mbox +/$INBOX/$MESSAGE_ID/R/ -> HTML reply instructions # Covering up a pre-1.0 design mistake: -/$LISTNAME/$MESSAGE_ID/f/ -> 301 to /$LISTNAME/$MESSAGE_ID/ +/$INBOX/$MESSAGE_ID/f/ -> 301 to /$INBOX/$MESSAGE_ID/ ### Legacy endpoints (may be ambiguous given Message-IDs with similar suffixes) -/$LISTNAME/m/$MESSAGE_ID/ -> 301 to /$LISTNAME/$MESSAGE_ID/ -/$LISTNAME/m/$MESSAGE_ID.html -> 301 to /$LISTNAME/$MESSAGE_ID/ -/$LISTNAME/m/$MESSAGE_ID.txt -> 301 to /$LISTNAME/$MESSAGE_ID/raw -/$LISTNAME/f/$MESSAGE_ID.html -> 301 to /$LISTNAME/$MESSAGE_ID/ -/$LISTNAME/f/$MESSAGE_ID.txt [1] -> 301 to /$LISTNAME/$MESSAGE_ID/raw +/$INBOX/m/$MESSAGE_ID/ -> 301 to /$INBOX/$MESSAGE_ID/ +/$INBOX/m/$MESSAGE_ID.html -> 301 to /$INBOX/$MESSAGE_ID/ +/$INBOX/m/$MESSAGE_ID.txt -> 301 to /$INBOX/$MESSAGE_ID/raw +/$INBOX/f/$MESSAGE_ID.html -> 301 to /$INBOX/$MESSAGE_ID/ +/$INBOX/f/$MESSAGE_ID.txt [1] -> 301 to /$INBOX/$MESSAGE_ID/raw -/$LISTNAME/atom.xml [2] -> identical to /$LISTNAME/new.atom +/$INBOX/atom.xml [2] -> identical to /$INBOX/new.atom Additionally, we support git clone/fetch over HTTP (dumb and smart): - git clone --mirror http://$HOSTNAME/$LISTNAME + git clone --mirror http://$HOSTNAME/$INBOX FIXME: we must refactor/cleanup/add tests for most of our CGI before adding more endpoints and features. diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm index f84a955..331d25c 100644 --- a/lib/PublicInbox/Config.pm +++ b/lib/PublicInbox/Config.pm @@ -45,18 +45,18 @@ sub lookup { my $v = $self->{"$pfx.$k"}; $rv{$k} = $v if defined $v; } - my $listname = $pfx; - $listname =~ s/\Apublicinbox\.//; - $rv{listname} = $listname; + my $inbox = $pfx; + $inbox =~ s/\Apublicinbox\.//; + $rv{inbox} = $inbox; my $v = $rv{address}; $rv{-primary_address} = ref($v) eq 'ARRAY' ? $v->[0] : $v; \%rv; } sub get { - my ($self, $listname, $key) = @_; + my ($self, $inbox, $key) = @_; - $self->{"publicinbox.$listname.$key"}; + $self->{"publicinbox.$inbox.$key"}; } sub config_dir { $ENV{PI_DIR} || expand_filename('~/.public-inbox') } diff --git a/lib/PublicInbox/ExtMsg.pm b/lib/PublicInbox/ExtMsg.pm index 6356c32..e15abab 100644 --- a/lib/PublicInbox/ExtMsg.pm +++ b/lib/PublicInbox/ExtMsg.pm @@ -24,7 +24,7 @@ our @EXT_URL = ( sub ext_msg { my ($ctx) = @_; my $pi_config = $ctx->{pi_config}; - my $listname = $ctx->{listname}; + my $inbox = $ctx->{inbox}; my $mid = $ctx->{mid}; my $cgi = $ctx->{cgi}; my $env = $cgi->{env}; @@ -35,13 +35,13 @@ sub ext_msg { foreach my $k (keys %$pi_config) { $k =~ /\Apublicinbox\.([A-Z0-9a-z-]+)\.url\z/ or next; - my $list = $1; - next if $list eq $listname; + my $name = $1; + next if $name eq $inbox; - my $git_dir = $pi_config->{"publicinbox.$list.mainrepo"}; + my $git_dir = $pi_config->{"publicinbox.$name.mainrepo"}; defined $git_dir or next; - my $url = $pi_config->{"publicinbox.$list.url"}; + my $url = $pi_config->{"publicinbox.$name.url"}; defined $url or next; $url =~ s!/+\z!!; @@ -93,7 +93,7 @@ sub ext_msg { my $tmp_mid = $mid; my $url; again: - $url = $base_url . $listname; + $url = $base_url . $inbox; unshift @pfx, { git_dir => $ctx->{git_dir}, url => $url }; foreach my $pfx (@pfx) { my $git_dir = delete $pfx->{git_dir} or next; diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index d433726..0d3bc81 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -260,7 +260,7 @@ sub each_recent_blob { sub get_feedopts { my ($ctx) = @_; my $pi_config = $ctx->{pi_config}; - my $listname = $ctx->{listname}; + my $inbox = $ctx->{inbox}; my $cgi = $ctx->{cgi}; my %rv; if (open my $fh, '<', "$ctx->{git_dir}/description") { @@ -269,8 +269,8 @@ sub get_feedopts { $rv{description} = '($GIT_DIR/description missing)'; } - if ($pi_config && defined $listname && $listname ne '') { - my $addr = $pi_config->get($listname, 'address') || ""; + if ($pi_config && defined $inbox && $inbox ne '') { + my $addr = $pi_config->get($inbox, 'address') || ""; $rv{address} = $addr; $addr = $addr->[0] if ref($addr); $rv{id_addr} = $addr; @@ -279,7 +279,7 @@ sub get_feedopts { my $url_base; if ($cgi) { - $url_base = $cgi->base->as_string . $listname; + $url_base = $cgi->base->as_string . $inbox; if (my $mid = $ctx->{mid}) { # per-thread feed: $rv{atomurl} = "$url_base/$mid/t.atom"; } else { diff --git a/lib/PublicInbox/NewsWWW.pm b/lib/PublicInbox/NewsWWW.pm index dfc0021..19eb596 100644 --- a/lib/PublicInbox/NewsWWW.pm +++ b/lib/PublicInbox/NewsWWW.pm @@ -2,7 +2,7 @@ # License: AGPL-3.0+ # # Plack app redirector for mapping /$NEWSGROUP requests to -# the appropriate /$LISTNAME in PublicInbox::WWW because some +# the appropriate /$INBOX in PublicInbox::WWW because some # auto-linkifiers cannot handle nntp:// redirects properly. # This is also used directly by PublicInbox::WWW package PublicInbox::NewsWWW; @@ -64,11 +64,11 @@ sub newsgroup_map { my %ng_map; foreach my $k (keys %$pi_config) { $k =~ /\Apublicinbox\.([^\.]+)\.mainrepo\z/ or next; - my $listname = $1; - my $git_dir = $pi_config->{"publicinbox.$listname.mainrepo"}; - my $url = $pi_config->{"publicinbox.$listname.url"}; + my $inbox = $1; + my $git_dir = $pi_config->{"publicinbox.$inbox.mainrepo"}; + my $url = $pi_config->{"publicinbox.$inbox.url"}; defined $url or next; - my $ng = $pi_config->{"publicinbox.$listname.newsgroup"}; + my $ng = $pi_config->{"publicinbox.$inbox.newsgroup"}; next if (!defined $ng) || ($ng eq ''); # disabled $url =~ m!/\z! or $url .= '/'; diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 70eb44e..d559cae 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -35,7 +35,7 @@ sub msg_html { ''; } -# /$LISTNAME/$MESSAGE_ID/R/ +# /$INBOX/$MESSAGE_ID/R/ sub msg_reply { my ($ctx, $hdr, $footer) = @_; my $s = $hdr->header('Subject'); diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm index ce00e34..85cb234 100644 --- a/lib/PublicInbox/WWW.pm +++ b/lib/PublicInbox/WWW.pm @@ -20,7 +20,7 @@ use constant SSOMA_URL => '//ssoma.public-inbox.org/'; use constant PI_URL => '//public-inbox.org/'; require PublicInbox::Git; use PublicInbox::GitHTTPBackend; -our $LISTNAME_RE = qr!\A/([\w\.\-]+)!; +our $INBOX_RE = qr!\A/([\w\.\-]+)!; our $MID_RE = qr!([^/]+)!; our $END_RE = qr!(T/|t/|R/|t\.mbox(?:\.gz)?|t\.atom|raw|)!; @@ -44,9 +44,9 @@ sub call { my $method = $cgi->method; if ($method eq 'POST' && - $path_info =~ m!$LISTNAME_RE/(git-upload-pack)\z!) { + $path_info =~ m!$INBOX_RE/(git-upload-pack)\z!) { my $path = $2; - return (invalid_list($self, $ctx, $1) || + return (invalid_inbox($self, $ctx, $1) || serve_git($cgi, $ctx->{git}, $path)); } elsif ($method !~ /\AGET|HEAD\z/) { @@ -56,32 +56,32 @@ sub call { # top-level indices and feeds if ($path_info eq '/') { r404(); - } elsif ($path_info =~ m!$LISTNAME_RE\z!o) { - invalid_list($self, $ctx, $1) || r301($ctx, $1); - } elsif ($path_info =~ m!$LISTNAME_RE(?:/|/index\.html)?\z!o) { - invalid_list($self, $ctx, $1) || get_index($ctx); - } elsif ($path_info =~ m!$LISTNAME_RE/(?:atom\.xml|new\.atom)\z!o) { - invalid_list($self, $ctx, $1) || get_atom($ctx); - - } elsif ($path_info =~ m!$LISTNAME_RE/ + } elsif ($path_info =~ m!$INBOX_RE\z!o) { + invalid_inbox($self, $ctx, $1) || r301($ctx, $1); + } elsif ($path_info =~ m!$INBOX_RE(?:/|/index\.html)?\z!o) { + invalid_inbox($self, $ctx, $1) || get_index($ctx); + } elsif ($path_info =~ m!$INBOX_RE/(?:atom\.xml|new\.atom)\z!o) { + invalid_inbox($self, $ctx, $1) || get_atom($ctx); + + } elsif ($path_info =~ m!$INBOX_RE/ ($PublicInbox::GitHTTPBackend::ANY)\z!ox) { my $path = $2; - invalid_list($self, $ctx, $1) || + invalid_inbox($self, $ctx, $1) || serve_git($cgi, $ctx->{git}, $path); - } elsif ($path_info =~ m!$LISTNAME_RE/$MID_RE/$END_RE\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/$MID_RE/$END_RE\z!o) { msg_page($self, $ctx, $1, $2, $3); # in case people leave off the trailing slash: - } elsif ($path_info =~ m!$LISTNAME_RE/$MID_RE/(T|t|R)\z!o) { - my ($listname, $mid, $suffix) = ($1, $2, $3); + } elsif ($path_info =~ m!$INBOX_RE/$MID_RE/(T|t|R)\z!o) { + my ($inbox, $mid, $suffix) = ($1, $2, $3); $suffix .= $suffix =~ /\A[tT]\z/ ? '/#u' : '/'; - r301($ctx, $listname, $mid, $suffix); + r301($ctx, $inbox, $mid, $suffix); - } elsif ($path_info =~ m!$LISTNAME_RE/$MID_RE/f/?\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/$MID_RE/f/?\z!o) { r301($ctx, $1, $2); # convenience redirects order matters - } elsif ($path_info =~ m!$LISTNAME_RE/([^/]{2,})\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/([^/]{2,})\z!o) { r301($ctx, $1, $2); } else { @@ -121,13 +121,13 @@ sub r404 { sub r { [ $_[0], ['Content-Type' => 'text/plain'], [ join(' ', @_, "\n") ] ] } # returns undef if valid, array ref response if invalid -sub invalid_list { - my ($self, $ctx, $listname, $mid) = @_; - my $git_dir = $ctx->{pi_config}->get($listname, "mainrepo"); +sub invalid_inbox { + my ($self, $ctx, $inbox, $mid) = @_; + my $git_dir = $ctx->{pi_config}->get($inbox, "mainrepo"); if (defined $git_dir) { $ctx->{git_dir} = $git_dir; $ctx->{git} = PublicInbox::Git->new($git_dir); - $ctx->{listname} = $listname; + $ctx->{inbox} = $inbox; return; } @@ -139,9 +139,9 @@ sub invalid_list { } # returns undef if valid, array ref response if invalid -sub invalid_list_mid { - my ($self, $ctx, $listname, $mid) = @_; - my $ret = invalid_list($self, $ctx, $listname, $mid); +sub invalid_inbox_mid { + my ($self, $ctx, $inbox, $mid) = @_; + my $ret = invalid_inbox($self, $ctx, $inbox, $mid); return $ret if $ret; $ctx->{mid} = $mid = uri_unescape($mid); @@ -157,14 +157,14 @@ sub invalid_list_mid { undef; } -# /$LISTNAME/new.atom -> Atom feed, includes replies +# /$INBOX/new.atom -> Atom feed, includes replies sub get_atom { my ($ctx) = @_; require PublicInbox::Feed; PublicInbox::Feed::generate($ctx); } -# /$LISTNAME/?r=$GIT_COMMIT -> HTML only +# /$INBOX/?r=$GIT_COMMIT -> HTML only sub get_index { my ($ctx) = @_; require PublicInbox::Feed; @@ -186,7 +186,7 @@ sub mid2blob { $ctx->{git}->cat_file("HEAD:$path"); } -# /$LISTNAME/$MESSAGE_ID/raw -> raw mbox +# /$INBOX/$MESSAGE_ID/raw -> raw mbox sub get_mid_txt { my ($ctx) = @_; my $x = mid2blob($ctx) or return r404($ctx); @@ -194,7 +194,7 @@ sub get_mid_txt { PublicInbox::Mbox::emit1($ctx, $x); } -# /$LISTNAME/$MESSAGE_ID/ -> HTML content (short quotes) +# /$INBOX/$MESSAGE_ID/ -> HTML content (short quotes) sub get_mid_html { my ($ctx) = @_; my $x = mid2blob($ctx) or return r404($ctx); @@ -208,7 +208,7 @@ sub get_mid_html { [ PublicInbox::View::msg_html($ctx, $mime, $foot) ] ]; } -# /$LISTNAME/$MESSAGE_ID/R/ -> HTML content (fullquotes) +# /$INBOX/$MESSAGE_ID/R/ -> HTML content (fullquotes) sub get_reply_html { my ($ctx) = @_; my $x = mid2blob($ctx) or return r404($ctx); @@ -221,7 +221,7 @@ sub get_reply_html { [ PublicInbox::View::msg_reply($ctx, $hdr, $foot)] ]; } -# /$LISTNAME/$MESSAGE_ID/t/ +# /$INBOX/$MESSAGE_ID/t/ sub get_thread { my ($ctx, $flat) = @_; my $srch = searcher($ctx) or return need_search($ctx); @@ -252,7 +252,7 @@ sub footer { } # auto-generate a footer - my $listname = ctx_get($ctx, 'listname'); + my $inbox = ctx_get($ctx, 'inbox'); my $desc = try_cat("$git_dir/description"); $desc = '$GIT_DIR/description missing' unless defined $desc; chomp $desc; @@ -261,7 +261,7 @@ sub footer { my @urls = split(/\r?\n/, $urls || ''); my %seen = map { $_ => 1 } @urls; my $cgi = $ctx->{cgi}; - my $http = $cgi->base->as_string . $listname; + my $http = $cgi->base->as_string . $inbox; $seen{$http} or unshift @urls, $http; my $ssoma_url = PublicInbox::Hval::prurl($cgi->{env}, SSOMA_URL); if (scalar(@urls) == 1) { @@ -273,7 +273,7 @@ sub footer { join("\n", map { "\tgit clone --mirror $_" } @urls); } - my $addr = $ctx->{pi_config}->get($listname, 'address'); + my $addr = $ctx->{pi_config}->get($inbox, 'address'); if (ref($addr) eq 'ARRAY') { $addr = $addr->[0]; # first address is primary } @@ -311,8 +311,8 @@ EOF [ 501, [ 'Content-Type' => 'text/html; charset=UTF-8' ], [ $msg ] ]; } -# /$LISTNAME/$MESSAGE_ID/t.mbox -> thread as mbox -# /$LISTNAME/$MESSAGE_ID/t.mbox.gz -> thread as gzipped mbox +# /$INBOX/$MESSAGE_ID/t.mbox -> thread as mbox +# /$INBOX/$MESSAGE_ID/t.mbox.gz -> thread as gzipped mbox # note: I'm not a big fan of other compression formats since they're # significantly more expensive on CPU than gzip and less-widely available, # especially on older systems. Stick to zlib since that's what git uses. @@ -324,7 +324,7 @@ sub get_thread_mbox { } -# /$LISTNAME/$MESSAGE_ID/t.atom -> thread as Atom feed +# /$INBOX/$MESSAGE_ID/t.atom -> thread as Atom feed sub get_thread_atom { my ($ctx) = @_; searcher($ctx) or return need_search($ctx); @@ -337,54 +337,54 @@ sub legacy_redirects { my ($self, $ctx, $path_info) = @_; # single-message pages - if ($path_info =~ m!$LISTNAME_RE/m/(\S+)/\z!o) { + if ($path_info =~ m!$INBOX_RE/m/(\S+)/\z!o) { r301($ctx, $1, $2); - } elsif ($path_info =~ m!$LISTNAME_RE/m/(\S+)/raw\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/m/(\S+)/raw\z!o) { r301($ctx, $1, $2, 'raw'); - } elsif ($path_info =~ m!$LISTNAME_RE/f/(\S+)/\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/f/(\S+)/\z!o) { r301($ctx, $1, $2); # thread display - } elsif ($path_info =~ m!$LISTNAME_RE/t/(\S+)/\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/t/(\S+)/\z!o) { r301($ctx, $1, $2, 't/#u'); - } elsif ($path_info =~ m!$LISTNAME_RE/t/(\S+)/mbox(\.gz)?\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/t/(\S+)/mbox(\.gz)?\z!o) { r301($ctx, $1, $2, "t.mbox$3"); # even older legacy redirects - } elsif ($path_info =~ m!$LISTNAME_RE/m/(\S+)\.html\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/m/(\S+)\.html\z!o) { r301($ctx, $1, $2); - } elsif ($path_info =~ m!$LISTNAME_RE/t/(\S+)\.html\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/t/(\S+)\.html\z!o) { r301($ctx, $1, $2, 't/#u'); - } elsif ($path_info =~ m!$LISTNAME_RE/f/(\S+)\.html\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/f/(\S+)\.html\z!o) { r301($ctx, $1, $2); - } elsif ($path_info =~ m!$LISTNAME_RE/(?:m|f)/(\S+)\.txt\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/(?:m|f)/(\S+)\.txt\z!o) { r301($ctx, $1, $2, 'raw'); - } elsif ($path_info =~ m!$LISTNAME_RE/t/(\S+)(\.mbox(?:\.gz)?)\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/t/(\S+)(\.mbox(?:\.gz)?)\z!o) { r301($ctx, $1, $2, "t$3"); # legacy convenience redirects, order still matters - } elsif ($path_info =~ m!$LISTNAME_RE/m/(\S+)\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/m/(\S+)\z!o) { r301($ctx, $1, $2); - } elsif ($path_info =~ m!$LISTNAME_RE/t/(\S+)\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/t/(\S+)\z!o) { r301($ctx, $1, $2, 't/#u'); - } elsif ($path_info =~ m!$LISTNAME_RE/f/(\S+)\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/f/(\S+)\z!o) { r301($ctx, $1, $2); # some Message-IDs have slashes in them and the HTTP server # may try to be clever and unescape them :< - } elsif ($path_info =~ m!$LISTNAME_RE/(\S+/\S+)/$END_RE\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/(\S+/\S+)/$END_RE\z!o) { msg_page($self, $ctx, $1, $2, $3); # in case people leave off the trailing slash: - } elsif ($path_info =~ m!$LISTNAME_RE/(\S+/\S+)/(T|t)\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/(\S+/\S+)/(T|t)\z!o) { r301($ctx, $1, $2, $3 eq 't' ? 't/#u' : $3); - } elsif ($path_info =~ m!$LISTNAME_RE/(\S+/\S+)/f\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/(\S+/\S+)/f\z!o) { r301($ctx, $1, $2); } else { $self->news_www->call($ctx->{cgi}->{env}); @@ -392,11 +392,11 @@ sub legacy_redirects { } sub r301 { - my ($ctx, $listname, $mid, $suffix) = @_; + my ($ctx, $inbox, $mid, $suffix) = @_; my $cgi = $ctx->{cgi}; my $url; my $qs = $cgi->env->{QUERY_STRING}; - $url = $cgi->base->as_string . $listname . '/'; + $url = $cgi->base->as_string . $inbox . '/'; $url .= (uri_escape_utf8($mid) . '/') if (defined $mid); $url .= $suffix if (defined $suffix); $url .= "?$qs" if $qs ne ''; @@ -407,9 +407,9 @@ sub r301 { } sub msg_page { - my ($self, $ctx, $list, $mid, $e) = @_; + my ($self, $ctx, $inbox, $mid, $e) = @_; my $ret; - $ret = invalid_list_mid($self, $ctx, $list, $mid) and return $ret; + $ret = invalid_inbox_mid($self, $ctx, $inbox, $mid) and return $ret; '' eq $e and return get_mid_html($ctx); 't/' eq $e and return get_thread($ctx); 't.atom' eq $e and return get_thread_atom($ctx); diff --git a/script/public-inbox-init b/script/public-inbox-init index d66361d..ca0f9dd 100755 --- a/script/public-inbox-init +++ b/script/public-inbox-init @@ -43,10 +43,10 @@ if (-e $pi_config) { foreach my $addr (@address) { my $found = $cfg->lookup($addr); if ($found) { - if ($found->{listname} ne $name) { + if ($found->{inbox} ne $name) { print STDERR "`$addr' already defined for ", - "`$found->{listname}',\n", + "`$found->{inbox}',\n", "does not match intend `$name'\n"; $conflict = 1; } else { diff --git a/script/public-inbox-learn b/script/public-inbox-learn index 0af1e94..1c051ec 100755 --- a/script/public-inbox-learn +++ b/script/public-inbox-learn @@ -51,7 +51,7 @@ foreach my $recipient (keys %dests) { my $git = PublicInbox::Git->new($git_dir); # We do not touch GIT_COMMITTER_* env here so we can track # who trained the message. - my $name = $ENV{GIT_COMMITTER_NAME} || $dst->{listname}; + my $name = $ENV{GIT_COMMITTER_NAME} || $dst->{inbox}; my $email = $ENV{GIT_COMMITTER_EMAIL} || $recipient; my $im = PublicInbox::Import->new($git, $name, $email); diff --git a/script/public-inbox-mda b/script/public-inbox-mda index 611e7c3..8e224a5 100755 --- a/script/public-inbox-mda +++ b/script/public-inbox-mda @@ -49,7 +49,7 @@ if (PublicInbox::MDA->precheck($filter, $dst->{address}) && } elsif ($fcfg eq 'scrub') { $filter_arg = undef; # the default for legacy versions } else { - warn "publicinbox.$dst->{listname}.filter=$fcfg invalid\n"; + warn "publicinbox.$dst->{inbox}.filter=$fcfg invalid\n"; warn "must be either 'scrub' or 'reject' (the default)\n"; } @@ -65,7 +65,7 @@ if (PublicInbox::MDA->precheck($filter, $dst->{address}) && }; my $git = PublicInbox::Git->new($main_repo); my $im = PublicInbox::Import->new($git, - $dst->{listname}, $recipient); + $dst->{inbox}, $recipient); if (defined $im->add($msg)) { $im->done; $filter->ignore; # exits diff --git a/scripts/import_maildir b/scripts/import_maildir index aaabe80..c87ca1b 100755 --- a/scripts/import_maildir +++ b/scripts/import_maildir @@ -9,8 +9,8 @@ export ORIGINAL_RECIPIENT='list@example.com' git init --bare $MAINREPO export GIT_CONFIG=$HOME/.public-inbox/config - git config publicinbox.$LISTNAME.address $ORIGINAL_RECIPIENT - git config publicinbox.$LISTNAME.mainrepo $MAINREPO + git config publicinbox.$INBOX.address $ORIGINAL_RECIPIENT + git config publicinbox.$INBOX.mainrepo $MAINREPO unset GIT_CONFIG ./import_maildir /path/to/maildir/ =cut diff --git a/scripts/import_slrnspool b/scripts/import_slrnspool index f8271f5..687809b 100755 --- a/scripts/import_slrnspool +++ b/scripts/import_slrnspool @@ -5,7 +5,7 @@ # Incremental (or one-shot) importer of a slrnpull news spool =begin usage export ORIGINAL_RECIPIENT=address@example.com - public-inbox-init $LISTNAME $GIT_DIR $HTTP_URL $ORIGINAL_RECIPIENT + public-inbox-init $INBOX $GIT_DIR $HTTP_URL $ORIGINAL_RECIPIENT ./import_slrnspool SLRNPULL_ROOT/news/foo/bar =cut use strict; @@ -33,7 +33,7 @@ if ($ENV{'FILTER'}) { sub key { my ($cfg) = @_; - "publicinbox.$cfg->{listname}.importslrnspoolstate"; + "publicinbox.$cfg->{inbox}.importslrnspoolstate"; } sub get_min { diff --git a/t/cgi.t b/t/cgi.t index fbdbfbf..9d2d87f 100644 --- a/t/cgi.t +++ b/t/cgi.t @@ -141,7 +141,7 @@ EOF $idx->{body} = [ split(/\n/, $idx->{body}) ]; $res->{body} = [ split(/\n/, $res->{body}) ]; is_deeply($res, $idx, - '/$LISTNAME/ and /$LISTNAME/index.html are nearly identical'); + '/$INBOX/ and /$INBOX/index.html are nearly identical'); # more checks in t/feed.t } diff --git a/t/config.t b/t/config.t index 48df087..7a63aa7 100644 --- a/t/config.t +++ b/t/config.t @@ -29,7 +29,7 @@ my $tmpdir = tempdir('pi-config-XXXXXX', TMPDIR => 1, CLEANUP => 1); 'mainrepo' => '/home/pi/meta-main.git', 'address' => 'meta@public-inbox.org', -primary_address => 'meta@public-inbox.org', - 'listname' => 'meta', + 'inbox' => 'meta', }, "lookup matches expected output"); is($cfg->lookup('blah@example.com'), undef, @@ -42,7 +42,7 @@ my $tmpdir = tempdir('pi-config-XXXXXX', TMPDIR => 1, CLEANUP => 1); 'test@public-inbox.org'], -primary_address => 'try@public-inbox.org', 'mainrepo' => '/home/pi/test-main.git', - 'listname' => 'test', + 'inbox' => 'test', }, "lookup matches expected output for test"); } diff --git a/t/feed.t b/t/feed.t index 61f0dc7..ab92039 100644 --- a/t/feed.t +++ b/t/feed.t @@ -184,7 +184,7 @@ EOF my $feed = string_feed({ git_dir => $git_dir, max => 3, - listname => 'asdf', + inbox => 'asdf', pi_config => bless({ 'publicinbox.asdf.address' => $addr, }, 'PublicInbox::Config'),