X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXChannel.pm;h=e702222267a6b12e404c6d5647add1deb9b40d89;hb=3517495c96b980bf3b9364ae2b218505b2b40582;hp=779139fc3a5c5b20b8869103e0271d2c82f18b18;hpb=dc016a0633cdb15d29b9a71fdec2c230fbad201b;p=spider.git diff --git a/perl/DXChannel.pm b/perl/DXChannel.pm index 779139fc..e7022222 100644 --- a/perl/DXChannel.pm +++ b/perl/DXChannel.pm @@ -4,7 +4,7 @@ # This is the base class for all channel operations, which is everything to do # with input and output really. # -# The instance variable in the outside world will be generally be called $dxchann +# The instance variable in the outside world will be generally be called $dxchan # # This class is 'inherited' (if that is the goobledegook for what I am doing) # by various other modules. The point to understand is that the 'instance variable' @@ -31,11 +31,13 @@ use DXUtil; use DXVars; use DXDebug; use Filter; +use Prefix; use strict; -use vars qw(%channels %valid); +use vars qw(%channels %valid @ISA $count); %channels = (); +$count = 0; %valid = ( call => '0,Callsign', @@ -57,7 +59,7 @@ use vars qw(%channels %valid); talk => '0,Want Talk,yesno', ann => '0,Want Announce,yesno', here => '0,Here?,yesno', - confmode => '0,In Conference?,yesno', + conf => '0,In Conference?,yesno', dx => '0,DX Spots,yesno', redirect => '0,Redirect messages to', lang => '0,Language', @@ -76,10 +78,12 @@ use vars qw(%channels %valid); wwvfilter => '5,WWV Filter', wcyfilter => '5,WCY Filter', spotsfilter => '5,Spot Filter', + routefilter => '5,route Filter', inannfilter => '5,Input Ann Filter', inwwvfilter => '5,Input WWV Filter', inwcyfilter => '5,Input WCY Filter', inspotsfilter => '5,Input Spot Filter', + inroutefilter => '5,Input Route Filter', passwd => '9,Passwd List,parray', pingint => '5,Ping Interval ', nopings => '5,Ping Obs Count', @@ -90,26 +94,24 @@ use vars qw(%channels %valid); talklist => '0,Talk List,parray', cluster => '5,Cluster data', isbasic => '9,Internal Connection', + errors => '9,Errors', + route => '9,Route Data', + dxcc => '0,Country Code', + itu => '0,ITU Zone', + cq => '0,CQ Zone', ); # object destruction sub DESTROY { my $self = shift; - undef $self->{user}; - undef $self->{conn}; - undef $self->{loc}; - undef $self->{pagedata}; - undef $self->{group}; - undef $self->{delayed}; - undef $self->{annfilter}; - undef $self->{wwvfilter}; - undef $self->{spotsfilter}; - undef $self->{inannfilter}; - undef $self->{inwwvfilter}; - undef $self->{inspotsfilter}; - undef $self->{passwd}; - undef $self->{node}; + for (keys %$self) { + if (ref($self->{$_})) { + delete $self->{$_}; + } + } + dbg('chan', "DXChannel $self->{call} destroyed ($count)"); + $count--; } # create a new channel object [$obj = DXChannel->new($call, $msg_conn_obj, $user_obj)] @@ -135,6 +137,16 @@ sub alloc $self->{lang} = $main::lang if !$self->{lang}; $self->{func} = ""; + # add in all the dxcc, itu, zone info + my @dxcc = Prefix::extract($call); + if (@dxcc > 0) { + $self->{dxcc} = $dxcc[1]->dxcc; + $self->{itu} = $dxcc[1]->itu; + $self->{cq} = $dxcc[1]->cq; + } + + $count++; + dbg('chan', "DXChannel $self->{call} created ($count)"); bless $self, $pkg; return $channels{$call} = $self; } @@ -370,12 +382,9 @@ sub disconnect { my $self = shift; my $user = $self->{user}; - my $conn = $self->{conn}; - my $call = $self->{call}; - $self->finish($conn); $user->close() if defined $user; - $conn->disconnect() if $conn; + $self->{conn}->disconnect; $self->del(); } @@ -443,7 +452,7 @@ sub decode_input # the above regexp must work unless (defined $sort && defined $call && defined $line) { - $data =~ s/([\x00-\x1f\x7f-\xff])/uc sprintf("%%%02x",ord($1))/eg; +# $data =~ s/([\x00-\x1f\x7f-\xff])/uc sprintf("%%%02x",ord($1))/eg; dbg('err', "DUFF Line on $chcall: $data"); return (); }