about summary refs log tree commit homepage
path: root/lib/PublicInbox/NewsGroup.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-05-28 01:57:14 +0000
committerEric Wong <e@80x24.org>2016-05-28 01:57:39 +0000
commit528230a0411897a14cbb79d0dae02ea89827bf1e (patch)
treeae71b388a84c8a8526b1908e77b00cb57d2cd340 /lib/PublicInbox/NewsGroup.pm
parent666b537fb9d3984370d75f16eae43c2ced752963 (diff)
downloadpublic-inbox-528230a0411897a14cbb79d0dae02ea89827bf1e.tar.gz
Most of its functionality is in the PublicInbox::Inbox class.

While we're at it, we no longer auto-create newsgroup names
based on the inbox name, since newsgroup names probably deserve
some thought when it comes to hierarchy.
Diffstat (limited to 'lib/PublicInbox/NewsGroup.pm')
-rw-r--r--lib/PublicInbox/NewsGroup.pm84
1 files changed, 0 insertions, 84 deletions
diff --git a/lib/PublicInbox/NewsGroup.pm b/lib/PublicInbox/NewsGroup.pm
deleted file mode 100644
index 500f61e3..00000000
--- a/lib/PublicInbox/NewsGroup.pm
+++ /dev/null
@@ -1,84 +0,0 @@
-# Copyright (C) 2015 all contributors <meta@public-inbox.org>
-# License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt)
-#
-# Used only by the NNTP server to represent a public-inbox git repository
-# as a newsgroup
-package PublicInbox::NewsGroup;
-use strict;
-use warnings;
-use Scalar::Util qw(weaken);
-require Danga::Socket;
-require PublicInbox::Msgmap;
-require PublicInbox::Search;
-require PublicInbox::Git;
-
-sub new {
-        my ($class, $newsgroup, $git_dir, $address, $url) = @_;
-
-        # first email address is preferred
-        $address = $address->[0] if ref($address);
-        if ($url) {
-                # assume protocol-relative URLs which start with '//' means
-                # the server supports both HTTP and HTTPS, favor HTTPS.
-                $url = "https:$url" if $url =~ m!\A//!;
-                $url .= '/' if $url !~ m!/\z!;
-        }
-        my $self = bless {
-                newsgroup => $newsgroup,
-                git_dir => $git_dir,
-                address => $address,
-                url => $url,
-        }, $class;
-        $self->{domain} = ($address =~ /\@(\S+)\z/) ? $1 : 'localhost';
-        $self;
-}
-
-sub weaken_all {
-        my ($self) = @_;
-        weaken($self->{$_}) foreach qw(gcf mm search);
-}
-
-sub gcf {
-        my ($self) = @_;
-        $self->{gcf} ||= eval { PublicInbox::Git->new($self->{git_dir}) };
-}
-
-sub usable {
-        my ($self) = @_;
-        eval {
-                PublicInbox::Msgmap->new($self->{git_dir});
-                PublicInbox::Search->new($self->{git_dir});
-        };
-}
-
-sub mm {
-        my ($self) = @_;
-        $self->{mm} ||= eval { PublicInbox::Msgmap->new($self->{git_dir}) };
-}
-
-sub search {
-        my ($self) = @_;
-        $self->{search} ||= eval { PublicInbox::Search->new($self->{git_dir}) };
-}
-
-sub description {
-        my ($self) = @_;
-        open my $fh, '<', "$self->{git_dir}/description" or return '';
-        my $desc = eval { local $/; <$fh> };
-        chomp $desc;
-        $desc =~ s/\s+/ /smg;
-        $desc;
-}
-
-sub update {
-        my ($self, $new) = @_;
-        $self->{address} = $new->{address};
-        $self->{domain} = $new->{domain};
-        if ($self->{git_dir} ne $new->{git_dir}) {
-                # new git_dir requires a new mm and gcf
-                $self->{mm} = $self->{gcf} = undef;
-                $self->{git_dir} = $new->{git_dir};
-        }
-}
-
-1;