| 1 | # -*- Mode: Perl -*- | ||||||||||||||||||||||||||||
| 2 | # Connection.pm -- | ||||||||||||||||||||||||||||
| 3 | # ITIID : $ITI$ $Header $__Header$ | ||||||||||||||||||||||||||||
| 4 | # Author : Ulrich Pfeifer | ||||||||||||||||||||||||||||
| 5 | # Created On : Sat Sep 28 15:24:53 1996 | ||||||||||||||||||||||||||||
| 6 | # Last Modified By: Ulrich Pfeifer | ||||||||||||||||||||||||||||
| 7 | # Last Modified On: Mon Mar 31 09:19:23 1997 | ||||||||||||||||||||||||||||
| 8 | # Language : CPerl | ||||||||||||||||||||||||||||
| 9 | # Update Count : 331 | ||||||||||||||||||||||||||||
| 10 | # Status : Unknown, Use with caution! | ||||||||||||||||||||||||||||
| 11 | # | ||||||||||||||||||||||||||||
| 12 | # (C) Copyright 1996, Universität Dortmund, all rights reserved. | ||||||||||||||||||||||||||||
| 13 | # | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | package NNML::Connection; | ||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use NNML::Active qw($ACTIVE); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use NNML::Config qw($Config); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use Text::Abbrev; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use Time::Local; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | 1 | ▶ | use Socket; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 1 | ▶ | use Sys::Hostname; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | 1 | ▶ | use IO::Select; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 1 | require NNML::Auth; | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 1 | ▶ | use vars qw(%ACMD %CMD %MSG %HELP); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 1 | my $HOST = hostname; | |||||||||||||||||||||||||||
| 30 | { | ||||||||||||||||||||||||||||
| 31 | 1 | ▶ | no strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 32 | 1 | local *stab = *NNML::Connection::; | |||||||||||||||||||||||||||
| 33 | 1 | my ($key,$val); | |||||||||||||||||||||||||||
| 34 | 1 | ▶ | while (($key,$val) = each(%stab)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | 260 | ▶ | next unless $key =~ /^cmd_(.*)/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 36 | 26 | local(*ENTRY) = $val; | |||||||||||||||||||||||||||
| 37 | 26 | ▶ | if (defined &ENTRY) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 38 | 26 | $CMD{$1} = \&ENTRY; | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 1 | abbrev(*ACMD, keys %CMD); | |||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 46 | 0 | my $type = shift; | |||||||||||||||||||||||||||
| 47 | 0 | my $fh = shift; | |||||||||||||||||||||||||||
| 48 | 0 | my $msg = shift; | |||||||||||||||||||||||||||
| 49 | 0 | my $self = {_fh => $fh}; | |||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 0 | my $hersockaddr = $fh->peername(); | |||||||||||||||||||||||||||
| 52 | 0 | my ($port, $iaddr) = unpack_sockaddr_in($hersockaddr); | |||||||||||||||||||||||||||
| 53 | 0 | my $peer = gethostbyaddr($iaddr, AF_INET); | |||||||||||||||||||||||||||
| 54 | 0 | $self->{_peer} = $peer; | |||||||||||||||||||||||||||
| 55 | 0 | $self->{_user} = 'nobody'; | |||||||||||||||||||||||||||
| 56 | 0 | $self->{_passwd} = '*'; | |||||||||||||||||||||||||||
| 57 | 0 | print "Connection from $peer\n"; | |||||||||||||||||||||||||||
| 58 | 0 | bless $self, $type; | |||||||||||||||||||||||||||
| 59 | 0 | $self->msg(200, $msg); | |||||||||||||||||||||||||||
| 60 | 0 | $self; | |||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 0 | ▶ | sub close { | ||||||||||||||||||||||||||
|
Subroutine
close: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 64 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 0 | $self->{_fh}->close; | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 0 | ▶ | sub dispatch { | ||||||||||||||||||||||||||
|
Subroutine
dispatch: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 70 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 71 | 0 | my $cmd = shift; | |||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | 0 | print "$cmd @_\n"; | |||||||||||||||||||||||||||
| 74 | 0 | ▶ | unless (exists $ACMD{$cmd}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 75 | 0 | $self->msg(500); | |||||||||||||||||||||||||||
| 76 | } else { | ||||||||||||||||||||||||||||
| 77 | 0 | ▶ | if (NNML::Auth::perm($self, $ACMD{$cmd})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 78 | 0 | &{$CMD{$ACMD{$cmd}}}($self, @_); | |||||||||||||||||||||||||||
| 79 | } else { | ||||||||||||||||||||||||||||
| 80 | 0 | $self->msg(480); | |||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | 0 | return $ACMD{$cmd}; | |||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | 0 | ▶ | sub msg { | ||||||||||||||||||||||||||
|
Subroutine
msg: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 87 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 88 | 0 | my $code = shift; | |||||||||||||||||||||||||||
| 89 | 0 | ▶ | my $msg = $MSG{$code} || ''; | ||||||||||||||||||||||||||
|
Condition0%0/2
$NNML::Connection::MSG{$code} || ''
MC/DC0%0/1
$NNML::Connection::MSG{$code} || ''
$NNML::Connection::MSG{$code}
Truth table0%0/2
A
A= $NNML::Connection::MSG{$code}
| |||||||||||||||||||||||||||||
| 90 | 0 | printf("%03d $msg\r\n", $code, @_); | |||||||||||||||||||||||||||
| 91 | 0 | $self->{_fh}->datasend(sprintf "%03d $msg\r\n", $code, @_); | |||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | 0 | ▶ | sub end { | ||||||||||||||||||||||||||
|
Subroutine
end: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 95 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 96 | 0 | $self->{_fh}->dataend; | |||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | 1 | ▶ | use IO::Pipe; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 100 | 1 | ▶ | use IO::File; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | 0 | ▶ | sub output { | ||||||||||||||||||||||||||
|
Subroutine
output: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 103 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | 0 | $self->{_fh}->datasend(@_); | |||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | 0 | ▶ | sub cmd_help { | ||||||||||||||||||||||||||
|
Subroutine
cmd_help: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 110 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | 0 | $self->msg(100); | |||||||||||||||||||||||||||
| 113 | 0 | for (sort keys %CMD) { | |||||||||||||||||||||||||||
| 114 | 0 | ▶ | $self->output(sprintf("%-15s %s\r\n", $_, $HELP{$_}||'')); | ||||||||||||||||||||||||||
|
Condition0%0/2
$NNML::Connection::HELP{$_} || ''
MC/DC0%0/1
$NNML::Connection::HELP{$_} || ''
$NNML::Connection::HELP{$_}
Truth table0%0/2
A
A= $NNML::Connection::HELP{$_}
| |||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||
| 116 | 0 | $self->end; | |||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | 0 | ▶ | sub cmd_authinfo { | ||||||||||||||||||||||||||
|
Subroutine
cmd_authinfo: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 120 | 0 | my ($self, $cmd, $arg) = @_; | |||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | 0 | ▶ | if (uc($cmd) eq 'USER') { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 123 | 0 | $self->{_user} = $arg; | |||||||||||||||||||||||||||
| 124 | 0 | ▶ | unless (exists $self->{_passwd} and $self->{_passwd} ne '*') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $self->{"_passwd"} and $self->{"_passwd"} ne "*"
MC/DC0%0/2
exists $self->{"_passwd"} and $self->{"_passwd"} ne "*"
exists $self->{"_passwd"}
$self->{"_passwd"} ne "*"
Truth table0%0/3
A and B
A= exists $self->{"_passwd"}B= $self->{"_passwd"} ne "*"
| |||||||||||||||||||||||||||||
| 125 | 0 | $self->msg(381); | |||||||||||||||||||||||||||
| 126 | 0 | return; | |||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||
| 128 | } elsif (uc($cmd) eq 'PASS') { | ||||||||||||||||||||||||||||
| 129 | 0 | $self->{_passwd} = $arg; | |||||||||||||||||||||||||||
| 130 | 0 | ▶ | unless (exists $self->{_user} and $self->{_user} ne 'nobody') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $self->{"_user"} and $self->{"_user"} ne "nobody"
MC/DC0%0/2
exists $self->{"_user"} and $self->{"_user"} ne "nobody"
exists $self->{"_user"}
$self->{"_user"} ne "nobody"
Truth table0%0/3
A and B
A= exists $self->{"_user"}B= $self->{"_user"} ne "nobody"
| |||||||||||||||||||||||||||||
| 131 | 0 | $self->msg(382); | |||||||||||||||||||||||||||
| 132 | 0 | return; | |||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||
| 134 | } else { | ||||||||||||||||||||||||||||
| 135 | 0 | $self->msg(501); | |||||||||||||||||||||||||||
| 136 | 0 | return; | |||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | 0 | ▶ | if (NNML::Auth::check($self->{_user}, $self->{_passwd})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 140 | 0 | $self->msg(281) | |||||||||||||||||||||||||||
| 141 | } else { | ||||||||||||||||||||||||||||
| 142 | 0 | $self->msg(482); | |||||||||||||||||||||||||||
| 143 | 0 | delete $self->{_passwd}; | |||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | 0 | ▶ | sub cmd_group { | ||||||||||||||||||||||||||
|
Subroutine
cmd_group: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 148 | 0 | my ($self, $groupname) = @_; | |||||||||||||||||||||||||||
| 149 | 0 | my $group = $ACTIVE->group($groupname); | |||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | 0 | ▶ | unless ($group) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 152 | 0 | $self->msg(411); | |||||||||||||||||||||||||||
| 153 | 0 | return; | |||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||
| 155 | 0 | my $max = $group->max; | |||||||||||||||||||||||||||
| 156 | 0 | my $min = $group->min; | |||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | 0 | $self->{_group} = $group; | |||||||||||||||||||||||||||
| 159 | 0 | $self->{_article} = $min; | |||||||||||||||||||||||||||
| 160 | 0 | $self->msg(211, $max-$min+1, $min, $max, $groupname); | |||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | 0 | ▶ | sub cmd_mode { | ||||||||||||||||||||||||||
|
Subroutine
cmd_mode: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 164 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 165 | 0 | my $mode = uc shift; | |||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | 0 | $self->msg(280, $mode); | |||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | 0 | ▶ | sub cmd_quit { | ||||||||||||||||||||||||||
|
Subroutine
cmd_quit: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 171 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 172 | 0 | $self->msg(205); | |||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | 0 | ▶ | sub cmd_list { | ||||||||||||||||||||||||||
|
Subroutine
cmd_list: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 176 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 179 | 0 | my $cmd = shift; | |||||||||||||||||||||||||||
| 180 | 0 | my $match = shift; | |||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | 0 | ▶ | if ($cmd !~ /NEWSGROUPS/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 183 | 0 | $self->msg(500); | |||||||||||||||||||||||||||
| 184 | 0 | return; | |||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||
| 186 | 0 | $self->msg(215); | |||||||||||||||||||||||||||
| 187 | 0 | for ($ACTIVE->list_match($match)) { | |||||||||||||||||||||||||||
| 188 | 0 | $self->output($_->name, "\r\n"); | |||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||
| 190 | 0 | $self->end; | |||||||||||||||||||||||||||
| 191 | } else { | ||||||||||||||||||||||||||||
| 192 | 0 | $self->msg(215); | |||||||||||||||||||||||||||
| 193 | 0 | for ($ACTIVE->groups) { | |||||||||||||||||||||||||||
| 194 | 0 | $self->output(sprintf "%s %d %d %s\r\n", | |||||||||||||||||||||||||||
| 195 | $_->name, $_->max, $_->min, $_->post) | ||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||
| 197 | 0 | $self->end; | |||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | 0 | ▶ | sub cmd_newgroups { | ||||||||||||||||||||||||||
|
Subroutine
cmd_newgroups: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 202 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 203 | 0 | my $ltime = to_time(@_); | |||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | 0 | ▶ | unless (defined $ltime) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 206 | 0 | $self->msg(501); | |||||||||||||||||||||||||||
| 207 | 0 | return; | |||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | 0 | $self->msg(231); | |||||||||||||||||||||||||||
| 211 | 0 | for ($ACTIVE->newgroups($ltime)) { | |||||||||||||||||||||||||||
| 212 | 0 | $self->output($_, "\r\n"); | |||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||
| 214 | 0 | $self->end; | |||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||
| 217 | 0 | ▶ | sub cmd_newnews { | ||||||||||||||||||||||||||
|
Subroutine
cmd_newnews: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 218 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 219 | 0 | my $match = shift; | |||||||||||||||||||||||||||
| 220 | 0 | my $ltime = to_time(@_); | |||||||||||||||||||||||||||
| 221 | 0 | my %msgid; | |||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | 0 | $self->msg(230); | |||||||||||||||||||||||||||
| 224 | 0 | for ($ACTIVE->list_match($match)) { | |||||||||||||||||||||||||||
| 225 | 0 | my %new = $_->newnews($ltime); | |||||||||||||||||||||||||||
| 226 | 0 | for (keys %new) { | |||||||||||||||||||||||||||
| 227 | 0 | ▶ | $msgid{$_} ||= $new{$_}; | ||||||||||||||||||||||||||
|
Condition0%0/3
$msgid{$_} ||= $new{$_}
MC/DC0%0/2
$msgid{$_} ||= $new{$_}
$msgid{$_}
$new{$_}
Truth table0%0/3
A ||= B
A= $msgid{$_}B= $new{$_}
| |||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||
| 230 | 0 | for (sort {$msgid{$a} <=> $msgid{$b}} keys %msgid) { | |||||||||||||||||||||||||||
| 231 | 0 | $self->output($_, "\r\n"); | |||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||
| 233 | 0 | $self->end; | |||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||
| 236 | 0 | ▶ | sub cmd_xover { | ||||||||||||||||||||||||||
|
Subroutine
cmd_xover: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 237 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 238 | 0 | my $parm = shift; | |||||||||||||||||||||||||||
| 239 | 0 | my @range = ($parm =~ m/(\d+)-(\d+)/); | |||||||||||||||||||||||||||
| 240 | 0 | ▶ | unless ($self->{_group}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 241 | 0 | $self->msg(412); | |||||||||||||||||||||||||||
| 242 | 0 | return; | |||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||
| 244 | 0 | my $xover = $self->{_group}->xover(@range); | |||||||||||||||||||||||||||
| 245 | 0 | $self->msg(224); | |||||||||||||||||||||||||||
| 246 | 0 | $self->output("$xover"); | |||||||||||||||||||||||||||
| 247 | 0 | $self->end; | |||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | 1 | my %FLD; | |||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | 1 | ▶ | BEGIN { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 254 | 1 | my $i; | |||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | 1 | my @FLD = qw(ano subject from date message-id references size lines xref); | |||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | 1 | ▶ | for ($i=0;$i<@FLD;$i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 259 | 9 | $FLD{$FLD[$i]} = $i; | |||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||
| 263 | 0 | ▶ | sub cmd_xhdr { | ||||||||||||||||||||||||||
|
Subroutine
cmd_xhdr: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 264 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 265 | 0 | my $fld = shift; | |||||||||||||||||||||||||||
| 266 | 0 | my $fno = $FLD{lc $fld}; | |||||||||||||||||||||||||||
| 267 | 0 | my $parm = shift; | |||||||||||||||||||||||||||
| 268 | 0 | ▶ | my @range = ($parm =~ m/(\d+)-(\d+)/ || ($parm, $parm)); | ||||||||||||||||||||||||||
|
Condition0%0/3
$parm =~ /(\d+)-(\d+)/ || ($parm, $parm)
MC/DC0%0/2
$parm =~ /(\d+)-(\d+)/ || ($parm, $parm)
$parm =~ /(\d+)-(\d+)/
($parm, $parm)
Truth table0%0/3
A || B
A= $parm =~ /(\d+)-(\d+)/B= ($parm, $parm)
| |||||||||||||||||||||||||||||
| 269 | 0 | ▶ | unless ($self->{_group}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 270 | 0 | $self->msg(412); | |||||||||||||||||||||||||||
| 271 | 0 | return; | |||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||
| 273 | 0 | my $xover = $self->{_group}->xover(@range); | |||||||||||||||||||||||||||
| 274 | 0 | $self->msg(221, $fld); | |||||||||||||||||||||||||||
| 275 | 0 | for (split /\n/, $xover) { | |||||||||||||||||||||||||||
| 276 | 0 | my ($ano, $val) = (split /\t/, $_)[0,$fno]; | |||||||||||||||||||||||||||
| 277 | 0 | ▶ | $val = "(none)" unless $val; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||
| 279 | 0 | $self->output("$ano $val\r\n"); | |||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||
| 281 | 0 | $self->end; | |||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | 0 | ▶ | sub cmd_next { | ||||||||||||||||||||||||||
|
Subroutine
cmd_next: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 285 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 286 | 0 | ▶ | unless ($self->{_group}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 287 | 0 | $self->msg(412); | |||||||||||||||||||||||||||
| 288 | 0 | return; | |||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||
| 290 | 0 | ▶ | unless ($self->{_article}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 291 | 0 | $self->msg(420); | |||||||||||||||||||||||||||
| 292 | 0 | return; | |||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||
| 294 | 0 | ▶ | if ($self->{_article} < $self->{_group}->max) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 295 | 0 | $self->{_article}++; | |||||||||||||||||||||||||||
| 296 | } else { | ||||||||||||||||||||||||||||
| 297 | 0 | $self->msg(421); | |||||||||||||||||||||||||||
| 298 | 0 | return; | |||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||
| 300 | $self->msg(223, $self->{_article}, | ||||||||||||||||||||||||||||
| 301 | 0 | $self->{_group}->article_by_no($self->{_article})) | |||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | 0 | ▶ | sub cmd_last { | ||||||||||||||||||||||||||
|
Subroutine
cmd_last: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 305 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 306 | 0 | ▶ | unless ($self->{_group}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 307 | 0 | $self->msg(412); | |||||||||||||||||||||||||||
| 308 | 0 | return; | |||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||
| 310 | 0 | ▶ | unless ($self->{_article}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 311 | 0 | $self->msg(420); | |||||||||||||||||||||||||||
| 312 | 0 | return; | |||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||
| 314 | 0 | ▶ | if ($self->{_article} > $self->{_group}->min) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 315 | 0 | $self->{_article}--; | |||||||||||||||||||||||||||
| 316 | } else { | ||||||||||||||||||||||||||||
| 317 | 0 | $self->msg(422); | |||||||||||||||||||||||||||
| 318 | 0 | return; | |||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||
| 320 | $self->msg(223, $self->{_article}, | ||||||||||||||||||||||||||||
| 321 | 0 | $self->{_group}->article_by_no($self->{_article})) | |||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||
| 324 | 0 | ▶ | sub cmd_slave { | ||||||||||||||||||||||||||
|
Subroutine
cmd_slave: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 325 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 326 | 0 | $self->{timeout} = $Config->mirror_timeout; | |||||||||||||||||||||||||||
| 327 | 0 | $self->{slave} = 1; | |||||||||||||||||||||||||||
| 328 | 0 | $self->msg(202); | |||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | # only article number for is supported | ||||||||||||||||||||||||||||
| 332 | 0 | ▶ | sub cmd_stat { | ||||||||||||||||||||||||||
|
Subroutine
cmd_stat: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 333 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 334 | 0 | my $ano = shift; | |||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||
| 336 | 0 | ▶ | unless (defined $ano) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 337 | 0 | $self->msg(501); | |||||||||||||||||||||||||||
| 338 | 0 | return; | |||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||
| 340 | 0 | ▶ | unless ($self->{_group}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 341 | 0 | $self->msg(412); | |||||||||||||||||||||||||||
| 342 | 0 | return; | |||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||
| 344 | 0 | ▶ | if ($ano >= $self->{_group}->min and $ano <= $self->{_group}->max) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$ano >= $self->{"_group"}->min and $ano <= $self->{"_group"}->max
MC/DC0%0/2
$ano >= $self->{"_group"}->min and $ano <= $self->{"_group"}->max
$ano >= $self->{"_group"}->min
$ano <= $self->{"_group"}->max
Truth table0%0/3
A and B
A= $ano >= $self->{"_group"}->minB= $ano <= $self->{"_group"}->max
| |||||||||||||||||||||||||||||
| 345 | 0 | $self->{_article} = $ano; | |||||||||||||||||||||||||||
| 346 | } else { | ||||||||||||||||||||||||||||
| 347 | 0 | $self->msg(423, $self->{_group}->name); | |||||||||||||||||||||||||||
| 348 | 0 | return; | |||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||
| 350 | $self->msg(223, $self->{_article}, | ||||||||||||||||||||||||||||
| 351 | 0 | $self->{_group}->article_by_no($self->{_article})) | |||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||
| 354 | 0 | ▶ | sub cmd_xdelete { | ||||||||||||||||||||||||||
|
Subroutine
cmd_xdelete: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 355 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 356 | 0 | ▶ | my $ano = shift || $self->{_article}; | ||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $self->{'_article'}
MC/DC0%0/2
shift() || $self->{'_article'}
shift()
$self->{'_article'}
Truth table0%0/3
A || B
A= shift()B= $self->{'_article'}
| |||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||
| 358 | 0 | ▶ | unless (defined $ano) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 359 | 0 | $self->msg(501); | |||||||||||||||||||||||||||
| 360 | 0 | return; | |||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||
| 362 | 0 | ▶ | unless ($self->{_group}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 363 | 0 | $self->msg(412); | |||||||||||||||||||||||||||
| 364 | 0 | return; | |||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||
| 366 | 0 | ▶ | if ($self->{_group}->delete($ano)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 367 | 0 | $self->msg(285); | |||||||||||||||||||||||||||
| 368 | } else { | ||||||||||||||||||||||||||||
| 369 | 0 | $self->msg(485); | |||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||
| 373 | 0 | ▶ | sub cmd_xdeletegroup { | ||||||||||||||||||||||||||
|
Subroutine
cmd_xdeletegroup: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 374 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||
| 376 | 0 | ▶ | unless ($self->{_group}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 377 | 0 | $self->msg(412); | |||||||||||||||||||||||||||
| 378 | 0 | return; | |||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||
| 380 | 0 | ▶ | if ($ACTIVE->delete_group($self->{_group}->name)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 381 | 0 | $self->msg(286); | |||||||||||||||||||||||||||
| 382 | } else { | ||||||||||||||||||||||||||||
| 383 | 0 | $self->msg(486); | |||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||
| 387 | 0 | ▶ | sub cmd_xmovefrom { | ||||||||||||||||||||||||||
|
Subroutine
cmd_xmovefrom: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 388 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 389 | 0 | ▶ | my $ano = shift || $self->{_article}; | ||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $self->{'_article'}
MC/DC0%0/2
shift() || $self->{'_article'}
shift()
$self->{'_article'}
Truth table0%0/3
A || B
A= shift()B= $self->{'_article'}
| |||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||
| 391 | 0 | ▶ | unless ($self->{_group}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 392 | 0 | $self->msg(412); | |||||||||||||||||||||||||||
| 393 | 0 | return; | |||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||
| 396 | 0 | ▶ | unless ($ano) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 397 | 0 | $self->msg(420); | |||||||||||||||||||||||||||
| 398 | 0 | return; | |||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||
| 401 | 0 | my ($head, $body) = $self->{_group}->get($ano); | |||||||||||||||||||||||||||
| 402 | 0 | ▶ | unless ($head) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 403 | 0 | $self->msg(423, $self->{_group}->name); | |||||||||||||||||||||||||||
| 404 | 0 | return; | |||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||
| 406 | 0 | ▶ | unless ($self->{_group}->delete($ano)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 407 | 0 | $self->msg(285); | |||||||||||||||||||||||||||
| 408 | 0 | return; | |||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||
| 410 | 0 | my ($msgid) = ($head =~ /^Message-Id:\s*(<\S+>)/m); | |||||||||||||||||||||||||||
| 411 | 0 | $self->msg(220,$ano, $msgid); | |||||||||||||||||||||||||||
| 412 | 0 | $self->output($head, "\n", $body); | |||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||
| 415 | 0 | ▶ | sub cmd_xaccept { | ||||||||||||||||||||||||||
|
Subroutine
cmd_xaccept: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 416 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||
| 418 | 0 | ▶ | unless ($self->{_group}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 419 | 0 | $self->msg(412); | |||||||||||||||||||||||||||
| 420 | 0 | return; | |||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||
| 423 | 0 | ▶ | unless ($self->post) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 424 | 0 | $self->msg(440); | |||||||||||||||||||||||||||
| 425 | 0 | return; | |||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||
| 427 | 0 | $self->msg(340); | |||||||||||||||||||||||||||
| 428 | 0 | $self->accept_article(undef,$self->{_group}->name); | |||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||
| 431 | 0 | ▶ | sub cmd_article { my $self = shift; $self->article('article', join ' ', @_)}; | ||||||||||||||||||||||||||
|
Subroutine
cmd_article: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 432 | 0 | ▶ | sub cmd_head { my $self = shift; $self->article('head', join ' ', @_)}; | ||||||||||||||||||||||||||
|
Subroutine
cmd_head: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 433 | 0 | ▶ | sub cmd_body { my $self = shift; $self->article('body', join ' ', @_)}; | ||||||||||||||||||||||||||
|
Subroutine
cmd_body: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 434 | 0 | ▶ | sub cmd_xdate { my $self = shift; $self->article('date', join ' ', @_)}; | ||||||||||||||||||||||||||
|
Subroutine
cmd_xdate: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||
| 436 | 0 | ▶ | sub article { | ||||||||||||||||||||||||||
|
Subroutine
article: not called CC=13 SCAR=52.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 437 | 0 | my ($self, $cmd, $parm) = @_; | |||||||||||||||||||||||||||
| 438 | 0 | ▶ | if (defined $parm and $parm =~ /^\s*<.*>\s*$/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $parm and $parm =~ /^\s*<.*>\s*$/
MC/DC0%0/2
defined $parm and $parm =~ /^\s*<.*>\s*$/
defined $parm
$parm =~ /^\s*<.*>\s*$/
Truth table0%0/3
A and B
A= defined $parmB= $parm =~ /^\s*<.*>\s*$/
| |||||||||||||||||||||||||||||
| 439 | 0 | my ($head, $body) = article_msgid($parm); | |||||||||||||||||||||||||||
| 440 | 0 | ▶ | if ($head) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 441 | 0 | ▶ | if ($cmd eq 'article') { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 442 | 0 | $self->msg(220,0,$parm); | |||||||||||||||||||||||||||
| 443 | 0 | $self->output($head, "\n", $body); | |||||||||||||||||||||||||||
| 444 | } elsif ($cmd eq 'head') { | ||||||||||||||||||||||||||||
| 445 | 0 | $self->msg(225,0,$parm); | |||||||||||||||||||||||||||
| 446 | 0 | $self->output($head); | |||||||||||||||||||||||||||
| 447 | } else { | ||||||||||||||||||||||||||||
| 448 | 0 | $self->msg(222,0,$parm); | |||||||||||||||||||||||||||
| 449 | 0 | $self->output($body); | |||||||||||||||||||||||||||
| 450 | } | ||||||||||||||||||||||||||||
| 451 | 0 | $self->end; | |||||||||||||||||||||||||||
| 452 | } else { | ||||||||||||||||||||||||||||
| 453 | 0 | $self->msg(430); | |||||||||||||||||||||||||||
| 454 | } | ||||||||||||||||||||||||||||
| 455 | } else { | ||||||||||||||||||||||||||||
| 456 | 0 | ▶ | unless ($self->{_group}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 457 | 0 | $self->msg(412); | |||||||||||||||||||||||||||
| 458 | 0 | return; | |||||||||||||||||||||||||||
| 459 | } | ||||||||||||||||||||||||||||
| 460 | 0 | ▶ | my $ano = $parm || $self->{_article}; | ||||||||||||||||||||||||||
|
Condition0%0/3
$parm || $self->{'_article'}
MC/DC0%0/2
$parm || $self->{'_article'}
$parm
$self->{'_article'}
Truth table0%0/3
A || B
A= $parmB= $self->{'_article'}
| |||||||||||||||||||||||||||||
| 461 | 0 | ▶ | unless ($ano =~ /^\d+$/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 462 | 0 | $self->msg(420); | |||||||||||||||||||||||||||
| 463 | 0 | return; | |||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||
| 466 | 0 | my ($head, $body, $date) = $self->{_group}->get($ano); | |||||||||||||||||||||||||||
| 467 | 0 | my ($msgid) = ($head =~ /^Message-Id:\s*(<\S+>)/im); | |||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||
| 469 | { # fake nnml header | ||||||||||||||||||||||||||||
| 470 | 0 | my %ano = msgid_to_anos($msgid); | |||||||||||||||||||||||||||
| 471 | 0 | my @newsgroups = keys %ano; | |||||||||||||||||||||||||||
| 472 | 0 | $head =~ s/^X-nnml-groups:.*\n//mig; | |||||||||||||||||||||||||||
| 473 | 0 | my $newsgroups = sprintf("X-nnml-groups: %s\n", join(', ', @newsgroups)); | |||||||||||||||||||||||||||
| 474 | 0 | $head .= $newsgroups; | |||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||
| 477 | 0 | ▶ | if ($body) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 478 | 0 | $self->{_article} = $ano; | |||||||||||||||||||||||||||
| 479 | 0 | ▶ | if ($cmd eq 'article') { | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 480 | 0 | $self->msg(220,$ano, $msgid); | |||||||||||||||||||||||||||
| 481 | 0 | $self->output($head, "\n", $body); | |||||||||||||||||||||||||||
| 482 | } elsif ($cmd eq 'head') { | ||||||||||||||||||||||||||||
| 483 | 0 | $self->msg(225,$ano, $msgid); | |||||||||||||||||||||||||||
| 484 | 0 | $self->output($head); | |||||||||||||||||||||||||||
| 485 | } elsif ($cmd eq 'date') { | ||||||||||||||||||||||||||||
| 486 | 0 | $self->msg(288,$date >> 16, $date & 0xfffff, $ano, $msgid); | |||||||||||||||||||||||||||
| 487 | 0 | return; | |||||||||||||||||||||||||||
| 488 | } else { | ||||||||||||||||||||||||||||
| 489 | 0 | $self->msg(222,$ano, $msgid); | |||||||||||||||||||||||||||
| 490 | 0 | $self->output($body); | |||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||
| 492 | 0 | $self->end; | |||||||||||||||||||||||||||
| 493 | } else { | ||||||||||||||||||||||||||||
| 494 | 0 | $self->msg(423, $self->{_group}->name); | |||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||||
| 497 | } | ||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||
| 499 | 0 | ▶ | sub post {1;} # tbs | ||||||||||||||||||||||||||
|
Subroutine
post: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||
| 501 | 0 | ▶ | sub cmd_ihave { | ||||||||||||||||||||||||||
|
Subroutine
cmd_ihave: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 502 | 0 | my ($self, $msgid) = @_; | |||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||
| 504 | 0 | ▶ | unless ($self->post) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 505 | 0 | $self->msg(437); | |||||||||||||||||||||||||||
| 506 | 0 | return; | |||||||||||||||||||||||||||
| 507 | } | ||||||||||||||||||||||||||||
| 508 | 0 | ▶ | if (article_msgid($msgid)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 509 | 0 | $self->msg(435); | |||||||||||||||||||||||||||
| 510 | 0 | return; | |||||||||||||||||||||||||||
| 511 | } | ||||||||||||||||||||||||||||
| 512 | 0 | $self->msg(335); | |||||||||||||||||||||||||||
| 513 | 0 | $self->accept_article($msgid); | |||||||||||||||||||||||||||
| 514 | } | ||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||
| 516 | 0 | ▶ | sub cmd_post { | ||||||||||||||||||||||||||
|
Subroutine
cmd_post: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 517 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||
| 519 | 0 | ▶ | unless ($self->post) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 520 | 0 | $self->msg(440); | |||||||||||||||||||||||||||
| 521 | 0 | return; | |||||||||||||||||||||||||||
| 522 | } | ||||||||||||||||||||||||||||
| 523 | 0 | $self->msg(340); | |||||||||||||||||||||||||||
| 524 | 0 | $self->accept_article(); | |||||||||||||||||||||||||||
| 525 | } | ||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||
| 528 | 0 | ▶ | sub accept_article { # $extra_group also allows overwriting | ||||||||||||||||||||||||||
|
Subroutine
accept_article: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 529 | 0 | my ($self, $msgid, $extra_group) = @_; | |||||||||||||||||||||||||||
| 530 | 0 | my $art; | |||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||
| 532 | 0 | ▶ | if ($art = $self->{_fh}->read_until_dot()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 533 | 0 | $art = join '', @$art; | |||||||||||||||||||||||||||
| 534 | } else { # won't work? | ||||||||||||||||||||||||||||
| 535 | 0 | print "accept_article() timed out\n"; | |||||||||||||||||||||||||||
| 536 | 0 | $self->msg(441); | |||||||||||||||||||||||||||
| 537 | 0 | return; | |||||||||||||||||||||||||||
| 538 | } | ||||||||||||||||||||||||||||
| 539 | 0 | my $create = NNML::Auth::perm($self,'create'); | |||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||
| 541 | 0 | ▶ | if ($self->{slave}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 542 | 0 | $self->msg(spool_article($Config->spool, $art, $msgid, | |||||||||||||||||||||||||||
| 543 | $extra_group, $create)); | ||||||||||||||||||||||||||||
| 544 | } else { | ||||||||||||||||||||||||||||
| 545 | 0 | my ($code, @msg) = inject_article($art, $msgid, $extra_group, $create); | |||||||||||||||||||||||||||
| 546 | 0 | ▶ | unless ($code =~ /^2/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 547 | 0 | spool_article($Config->bad, $art, $msgid, $extra_group, $create); | |||||||||||||||||||||||||||
| 548 | } | ||||||||||||||||||||||||||||
| 549 | 0 | $self->msg($code, @msg); | |||||||||||||||||||||||||||
| 550 | } | ||||||||||||||||||||||||||||
| 551 | } | ||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||
| 553 | 0 | ▶ | sub spool_article { | ||||||||||||||||||||||||||
|
Subroutine
spool_article: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 554 | 0 | my ($spool, $art, $msgid, $extra_group, $create) = @_; | |||||||||||||||||||||||||||
| 555 | 0 | my $sf = new IO::File ">> $spool"; | |||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||
| 557 | 0 | ▶ | if ($sf) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 558 | 0 | $sf->printf("$;$;$;$;\t%s\t%s\t%d\n", $msgid, $extra_group, $create); | |||||||||||||||||||||||||||
| 559 | 0 | $sf->print($art); | |||||||||||||||||||||||||||
| 560 | 0 | return(240); | |||||||||||||||||||||||||||
| 561 | } else { | ||||||||||||||||||||||||||||
| 562 | 0 | return(441, "Could not spool article: $!") | |||||||||||||||||||||||||||
| 563 | } | ||||||||||||||||||||||||||||
| 564 | } | ||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||
| 566 | 0 | ▶ | sub cmd_xunspool { # 289 %d/%d articles unspooled | ||||||||||||||||||||||||||
|
Subroutine
cmd_xunspool: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 567 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||
| 569 | 0 | ▶ | unless (NNML::Auth::perm($self,'create')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 570 | 0 | $self->msg(480, "'Need create power'"); | |||||||||||||||||||||||||||
| 571 | 0 | return; | |||||||||||||||||||||||||||
| 572 | } | ||||||||||||||||||||||||||||
| 573 | 0 | my ($no_art, $bad) = NNML::Server::unspool(); | |||||||||||||||||||||||||||
| 574 | 0 | $self->msg(289, $no_art, $no_art-$bad); | |||||||||||||||||||||||||||
| 575 | } | ||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||
| 577 | 0 | ▶ | sub NNML::Server::unspool { | ||||||||||||||||||||||||||
|
Subroutine
unspool: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 578 | 0 | my ($no_art, $bad); | |||||||||||||||||||||||||||
| 579 | 0 | my $spool = $Config->spool; | |||||||||||||||||||||||||||
| 580 | 0 | my $sf = new IO::File "< $spool"; | |||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||
| 582 | 0 | NNML::Auth::_update(); # just for the message | |||||||||||||||||||||||||||
| 583 | 0 | NNML::Active::_update(); # just to make sure | |||||||||||||||||||||||||||
| 584 | 0 | ▶ | if ($sf) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 585 | 0 | local $/ = "$;$;$;$;\t"; | |||||||||||||||||||||||||||
| 586 | 0 | my $ent; | |||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||
| 588 | 0 | ▶ | while (defined ($ent = <$sf>)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 589 | 0 | chomp($ent); | |||||||||||||||||||||||||||
| 590 | 0 | ▶ | next unless $ent; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 591 | 0 | my($ctl, $art) = split /\n/, $ent, 2; | |||||||||||||||||||||||||||
| 592 | 0 | my ($msgid, $extra_group, $create) = split /\t/, $ctl; | |||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||
| 594 | 0 | $no_art++; | |||||||||||||||||||||||||||
| 595 | 0 | my ($code, @msg) = inject_article($art, $msgid, $extra_group, $create); | |||||||||||||||||||||||||||
| 596 | 0 | ▶ | unless ($code =~ /^2/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 597 | 0 | spool_article($Config->bad, $art, $msgid, $extra_group, $create); | |||||||||||||||||||||||||||
| 598 | 0 | $bad++; | |||||||||||||||||||||||||||
| 599 | } | ||||||||||||||||||||||||||||
| 600 | } | ||||||||||||||||||||||||||||
| 601 | 0 | $sf->close; | |||||||||||||||||||||||||||
| 602 | 0 | ▶ | rename $spool, "$spool~" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 603 | or warn "Could not rename '$spool': $!\n"; | ||||||||||||||||||||||||||||
| 604 | } | ||||||||||||||||||||||||||||
| 605 | 0 | return($no_art, $bad); | |||||||||||||||||||||||||||
| 606 | } | ||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||
| 608 | 0 | ▶ | sub inject_article { | ||||||||||||||||||||||||||
|
Subroutine
inject_article: not called CC=19 SCAR=59.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 609 | 0 | my ($art, $msgid, $extra_group, $create) = @_; | |||||||||||||||||||||||||||
| 610 | 0 | ▶ | my %head = ( | ||||||||||||||||||||||||||
|
Condition0%0/2
$msgid || ''
MC/DC0%0/1
$msgid || ''
$msgid
Truth table0%0/2
A
A= $msgid
| |||||||||||||||||||||||||||||
| 611 | subject => '', | ||||||||||||||||||||||||||||
| 612 | from => '', | ||||||||||||||||||||||||||||
| 613 | date => '', | ||||||||||||||||||||||||||||
| 614 | 'message-id' => $msgid || '', | ||||||||||||||||||||||||||||
| 615 | references => '', | ||||||||||||||||||||||||||||
| 616 | lines => 0, | ||||||||||||||||||||||||||||
| 617 | xref => '', | ||||||||||||||||||||||||||||
| 618 | 'x-nnml-groups' => '', | ||||||||||||||||||||||||||||
| 619 | newsgroups => '', | ||||||||||||||||||||||||||||
| 620 | ); | ||||||||||||||||||||||||||||
| 621 | 0 | my $header; | |||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||
| 623 | # done by Net::Cmd now | ||||||||||||||||||||||||||||
| 624 | #$art =~ s/\.\r?\n$//; | ||||||||||||||||||||||||||||
| 625 | #$art =~ s/\r//g; | ||||||||||||||||||||||||||||
| 626 | #$art =~ s/^\.\././mg; | ||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||
| 628 | 0 | my ($head, $body) = split /^$/m, $art, 2; | |||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||
| 630 | 0 | my $headcopy = $head; | |||||||||||||||||||||||||||
| 631 | 0 | $headcopy =~ s{\s*\n\s+}{ }g; # fold continue lines | |||||||||||||||||||||||||||
| 632 | 0 | my ($fron, %thead) = split /^(\S+):/m, $headcopy; | |||||||||||||||||||||||||||
| 633 | 0 | for (keys %thead) { | |||||||||||||||||||||||||||
| 634 | 0 | my $val = $thead{$_}; | |||||||||||||||||||||||||||
| 635 | 0 | $val =~ s/\s/ /; | |||||||||||||||||||||||||||
| 636 | 0 | $val =~ s/^\s+//; | |||||||||||||||||||||||||||
| 637 | 0 | $val =~ s/\s+$//; | |||||||||||||||||||||||||||
| 638 | 0 | ▶ | $head{lc $_} = $val if exists $head{lc $_}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 639 | } | ||||||||||||||||||||||||||||
| 640 | 0 | ▶ | unless ($head{lines}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 641 | 0 | $head{lines} = ($body =~ m/(\n)/g); | |||||||||||||||||||||||||||
| 642 | } | ||||||||||||||||||||||||||||
| 643 | 0 | ▶ | unless ($head{'message-id'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 644 | 0 | $head{'message-id'} = sprintf "<%d\@unknown%s>", time, $HOST; | |||||||||||||||||||||||||||
| 645 | 0 | $head .= "Message-Id: $head{'message-id'}\n"; | |||||||||||||||||||||||||||
| 646 | } else { | ||||||||||||||||||||||||||||
| 647 | 0 | $head{'message-id'} =~ s/^\s+//; | |||||||||||||||||||||||||||
| 648 | 0 | $head{'message-id'} =~ s/\s+$//; | |||||||||||||||||||||||||||
| 649 | } | ||||||||||||||||||||||||||||
| 650 | 0 | for (keys %head) { | |||||||||||||||||||||||||||
| 651 | 0 | ▶ | printf "%-15s %s\n", $_, $head{$_} if $head{$_}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 652 | } | ||||||||||||||||||||||||||||
| 653 | 0 | my @newsgroups = split /,\s*/, $head{'x-nnml-groups'}; | |||||||||||||||||||||||||||
| 654 | 0 | ▶ | unless (@newsgroups) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 655 | 0 | @newsgroups = split /,\s*/, $head{newsgroups}; | |||||||||||||||||||||||||||
| 656 | } | ||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||
| 658 | 0 | my $file; | |||||||||||||||||||||||||||
| 659 | 0 | ▶ | if ($extra_group) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 660 | 0 | my %all = msgid_to_anos($head{'message-id'}); | |||||||||||||||||||||||||||
| 661 | 0 | @newsgroups = keys %all; | |||||||||||||||||||||||||||
| 662 | 0 | for (@newsgroups) { | |||||||||||||||||||||||||||
| 663 | 0 | my $any = $newsgroups[0]; | |||||||||||||||||||||||||||
| 664 | 0 | my $group = $ACTIVE->group($any); | |||||||||||||||||||||||||||
| 665 | 0 | my $dir = $group->dir; | |||||||||||||||||||||||||||
| 666 | 0 | ▶ | if (-f "$dir/$all{$any}") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 667 | 0 | $file = "$dir/$all{$any}"; | |||||||||||||||||||||||||||
| 668 | 0 | last; | |||||||||||||||||||||||||||
| 669 | } | ||||||||||||||||||||||||||||
| 670 | } | ||||||||||||||||||||||||||||
| 671 | 0 | ▶ | push @newsgroups, $extra_group unless exists $all{$extra_group}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 672 | } | ||||||||||||||||||||||||||||
| 673 | 0 | ▶ | unless (@newsgroups) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 674 | 0 | return(441, "No newsgroups specified"); | |||||||||||||||||||||||||||
| 675 | } | ||||||||||||||||||||||||||||
| 676 | 0 | ▶ | if (!$extra_group and article_msgid($head{'message-id'})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $extra_group and article_msgid($head{"message-id"})
MC/DC0%0/2
not $extra_group and article_msgid($head{"message-id"})
not $extra_group
article_msgid($head{"message-id"})
Truth table0%0/3
not(A) and B
A= not $extra_groupB= article_msgid($head{"message-id"})
| |||||||||||||||||||||||||||||
| 677 | 0 | print "POSTER lied about 'message-id'}\n"; | |||||||||||||||||||||||||||
| 678 | 0 | return(441, "alreday have $head{'message-id'}"); | |||||||||||||||||||||||||||
| 679 | } | ||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||
| 681 | 0 | ▶ | unless ($ACTIVE->accept_article(\%head, $head, $body, $create, $file, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 682 | $extra_group, | ||||||||||||||||||||||||||||
| 683 | @newsgroups)) { | ||||||||||||||||||||||||||||
| 684 | 0 | return(441, "Something went wrong"); | |||||||||||||||||||||||||||
| 685 | } | ||||||||||||||||||||||||||||
| 686 | 0 | ▶ | if ($extra_group) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 687 | 0 | my %all = msgid_to_anos($head{'message-id'}); | |||||||||||||||||||||||||||
| 688 | 0 | ▶ | if ($all{$extra_group}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 689 | 0 | return(287,$all{$extra_group},$extra_group); | |||||||||||||||||||||||||||
| 690 | } else { | ||||||||||||||||||||||||||||
| 691 | 0 | return(441, "Article '$head{'message-id'}' not arrived in $extra_group"); | |||||||||||||||||||||||||||
| 692 | } | ||||||||||||||||||||||||||||
| 693 | } else { | ||||||||||||||||||||||||||||
| 694 | 0 | return(240); | |||||||||||||||||||||||||||
| 695 | } | ||||||||||||||||||||||||||||
| 696 | } | ||||||||||||||||||||||||||||
| 697 | |||||||||||||||||||||||||||||
| 698 | 0 | ▶ | sub article_msgid { | ||||||||||||||||||||||||||
|
Subroutine
article_msgid: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 699 | 0 | my $msgid = shift; | |||||||||||||||||||||||||||
| 700 | 0 | my ($groupname); | |||||||||||||||||||||||||||
| 701 | 0 | my %ano = msgid_to_anos($msgid); | |||||||||||||||||||||||||||
| 702 | 0 | my @newsgroups = keys %ano; | |||||||||||||||||||||||||||
| 703 | 0 | my ($head, $body); | |||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||
| 705 | 0 | for $groupname (@newsgroups) { | |||||||||||||||||||||||||||
| 706 | 0 | my $group = $ACTIVE->group($groupname); | |||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||
| 708 | 0 | ($head, $body) = $group->get($ano{$groupname}); | |||||||||||||||||||||||||||
| 709 | 0 | ▶ | last if defined $head; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 710 | } | ||||||||||||||||||||||||||||
| 711 | 0 | ▶ | return unless $head; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 712 | 0 | $head =~ s/^X-nnml-groups:.*\n//mig; | |||||||||||||||||||||||||||
| 713 | 0 | my $newsgroups = sprintf("X-nnml-groups: %s\n", join(', ', @newsgroups)); | |||||||||||||||||||||||||||
| 714 | 0 | return $head . $newsgroups, $body; | |||||||||||||||||||||||||||
| 715 | } | ||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||
| 717 | 0 | ▶ | sub msgid_to_anos { | ||||||||||||||||||||||||||
|
Subroutine
msgid_to_anos: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 718 | 0 | my $msgid = shift; | |||||||||||||||||||||||||||
| 719 | 0 | my $group; | |||||||||||||||||||||||||||
| 720 | my %ano; | ||||||||||||||||||||||||||||
| 721 | 0 | for $group ($ACTIVE->groups) { | |||||||||||||||||||||||||||
| 722 | 0 | my $ano = $group->article_by_id($msgid); | |||||||||||||||||||||||||||
| 723 | 0 | ▶ | if (defined $ano) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 724 | 0 | $ano{$group->name} = $ano; | |||||||||||||||||||||||||||
| 725 | } | ||||||||||||||||||||||||||||
| 726 | } | ||||||||||||||||||||||||||||
| 727 | 0 | %ano; | |||||||||||||||||||||||||||
| 728 | } | ||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||
| 730 | 0 | ▶ | sub cmd_xtest { | ||||||||||||||||||||||||||
|
Subroutine
cmd_xtest: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 731 | 0 | my ($self,$msgid) = @_; | |||||||||||||||||||||||||||
| 732 | 0 | my %anos = msgid_to_anos(@_); | |||||||||||||||||||||||||||
| 733 | 0 | my ($grp, $ano); | |||||||||||||||||||||||||||
| 734 | |||||||||||||||||||||||||||||
| 735 | 0 | ▶ | while (($grp, $ano) = each %anos) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 736 | 0 | printf "%s %d\n", $grp, $anos{$grp}; | |||||||||||||||||||||||||||
| 737 | } | ||||||||||||||||||||||||||||
| 738 | } | ||||||||||||||||||||||||||||
| 739 | |||||||||||||||||||||||||||||
| 740 | 0 | ▶ | sub to_time { | ||||||||||||||||||||||||||
|
Subroutine
to_time: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 741 | 0 | my ($date, $time, $gmt) = @_; | |||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||
| 743 | 0 | ▶ | return unless defined $date; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 744 | 0 | ▶ | if (length($date)<8) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 745 | 0 | $date =~ m/^(\d\d)/; | |||||||||||||||||||||||||||
| 746 | 0 | ▶ | if ($1 > 30) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 747 | 0 | $date = "19$date"; # not strictly RCS 977 | |||||||||||||||||||||||||||
| 748 | } else { | ||||||||||||||||||||||||||||
| 749 | 0 | $date = "20$date"; # not strictly RCS 977 | |||||||||||||||||||||||||||
| 750 | } | ||||||||||||||||||||||||||||
| 751 | } | ||||||||||||||||||||||||||||
| 752 | 0 | ▶ | unless (defined $time) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 753 | 0 | $time = "000000"; | |||||||||||||||||||||||||||
| 754 | } | ||||||||||||||||||||||||||||
| 755 | |||||||||||||||||||||||||||||
| 756 | 0 | $date .= $time; | |||||||||||||||||||||||||||
| 757 | 0 | my ($year,$mon,$mday,$hours,$min,$sec) = | |||||||||||||||||||||||||||
| 758 | ($date =~ m/^(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/); | ||||||||||||||||||||||||||||
| 759 | 0 | ▶ | return unless defined $sec; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||
| 761 | 0 | my $ltime; | |||||||||||||||||||||||||||
| 762 | 0 | $mon--; | |||||||||||||||||||||||||||
| 763 | 0 | ▶ | if (defined $gmt) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 764 | 0 | eval { $ltime = timegm($sec,$min,$hours,$mday,$mon,$year) }; | |||||||||||||||||||||||||||
| 765 | } else { | ||||||||||||||||||||||||||||
| 766 | 0 | eval { $ltime = timelocal($sec,$min,$hours,$mday,$mon,$year)}; | |||||||||||||||||||||||||||
| 767 | } | ||||||||||||||||||||||||||||
| 768 | 0 | ▶ | return if $@ ne ''; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 769 | 0 | return $ltime; | |||||||||||||||||||||||||||
| 770 | } | ||||||||||||||||||||||||||||
| 771 | |||||||||||||||||||||||||||||
| 772 | |||||||||||||||||||||||||||||
| 773 | # read status messages | ||||||||||||||||||||||||||||
| 774 | my $line; | ||||||||||||||||||||||||||||
| 775 | 1 | ▶ | while (defined ($line = <DATA>)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 776 | 28 | chomp($line); | |||||||||||||||||||||||||||
| 777 | 28 | my ($cmd, $msg) = split ' ', $line, 2; | |||||||||||||||||||||||||||
| 778 | 28 | ▶ | last unless $cmd; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 779 | 27 | $HELP{$cmd} = $msg; | |||||||||||||||||||||||||||
| 780 | } | ||||||||||||||||||||||||||||
| 781 | 1 | ▶ | while (defined ($line = <DATA>)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 782 | 50 | chomp($line); | |||||||||||||||||||||||||||
| 783 | 50 | ▶ | next unless $line =~ /^\d/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 784 | 49 | my ($code, $msg) = split ' ', $line, 2; | |||||||||||||||||||||||||||
| 785 | 49 | $MSG{$code} = $msg; | |||||||||||||||||||||||||||
| 786 | } | ||||||||||||||||||||||||||||
| 787 | |||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||
| 789 | 1 | 1; | |||||||||||||||||||||||||||
| 790 | |||||||||||||||||||||||||||||
| 791 | __DATA__ | ||||||||||||||||||||||||||||