]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/NewsGroup.pm
nntp: append Archived-At and List-Archive headers
[public-inbox.git] / lib / PublicInbox / NewsGroup.pm
index adac919fe0b2e15143528d113b2d122f25266a5a..98a3595ad918931b7b3c8b4c319d02b5a479e79c 100644 (file)
@@ -13,12 +13,21 @@ require PublicInbox::Search;
 require PublicInbox::Git;
 
 sub new {
-       my ($class, $name, $git_dir, $address) = @_;
+       my ($class, $name, $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 {
                name => $name,
                git_dir => $git_dir,
                address => $address,
+               url => $url,
        }, $class;
        $self->{domain} = ($address =~ /\@(\S+)\z/) ? $1 : 'localhost';
        $self;