1. fixed a problem with DXLogPrint repeating log entries.
[spider.git] / cmd / init.pl
1 #
2 # reinit a cluster connection
3 #
4 my ($self, $line) = @_;
5 my @calls = split /\s+/, $line;
6 my $call;
7 my @out;
8
9 return (1, $self->msg('e5')) if $self->priv < 5;
10
11 foreach $call (@calls) {
12         $call = uc $call;
13         next if $call eq $main::mycall;
14         my $dxchan = DXChannel->get($call);
15         if ($dxchan) {
16                 if ($dxchan->is_ak1a) {
17                         
18                         # first clear out any nodes on this dxchannel
19                         my @gonenodes = map { $_->dxchan == $dxchan ? $_ : () } DXNode::get_all();
20                         foreach my $node (@gonenodes) {
21                                 next if $dxchan == $DXProt::me;
22                                 DXProt::broadcast_ak1a(DXProt::pc21($node->call, 'Gone, re-init') , $dxchan) unless $dxchan->{isolate}; 
23                                 $node->del();
24                         }
25                         $dxchan->send(DXProt::pc38());
26                         $dxchan->send(DXProt::pc18());
27                         push @out, $self->msg('init1', $call);
28                 } 
29         } else {
30                 push @out, $self->msg('e10', $call);
31         }
32 }
33
34 return (1, @out);
35