X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXChannel.pm;h=6495e7a7edde6ed7e9ff32ac5630e755d9053816;hb=d8187e68f181966eea2dca949ca13e2cbbaf072e;hp=b3929c1f2a2d5b45b53a09169294b29aa952952f;hpb=fb554d0fdb1d30120dbfff15514c51f683dc17a8;p=spider.git diff --git a/perl/DXChannel.pm b/perl/DXChannel.pm index b3929c1f..6495e7a7 100644 --- a/perl/DXChannel.pm +++ b/perl/DXChannel.pm @@ -70,8 +70,28 @@ use vars qw(%channels %valid); group => '0,Access Group,parray', # used to create a group of users/nodes for some purpose or other isolate => '9,Isolate network,yesno', delayed => '9,Delayed messages,parray', + annfilter => '9,Announce Filter', + wwvfilter => '9,WWV Filter', + spotfilter => '9,Spot Filter', + passwd => '9,Passwd List,parray', ); +# 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->{spotfilter}; + undef $self->{passwd}; +} + # create a new channel object [$obj = DXChannel->new($call, $msg_conn_obj, $user_obj)] sub alloc { @@ -80,6 +100,7 @@ sub alloc die "trying to create a duplicate channel for $call" if $channels{$call}; $self->{call} = $call; + $self->{priv} = 0; $self->{conn} = $conn if defined $conn; # if this isn't defined then it must be a list if (defined $user) { $self->{user} = $user; @@ -207,7 +228,7 @@ sub msg return DXM::msg($self->{lang}, @_); } -# stick a broadcast on the delayed queue +# stick a broadcast on the delayed queue (but only up to 20 items) sub delay { my $self = shift; @@ -215,6 +236,9 @@ sub delay $self->{delayed} = [] unless $self->{delayed}; push @{$self->{delayed}}, $s; + if (@{$self->{delayed}} >= 20) { + shift @{$self->{delayed}}; # lose oldest one + } } # change the state of the channel - lots of scope for debugging here :-) @@ -229,9 +253,7 @@ sub state # if there is any queued up broadcasts then splurge them out here if ($self->{delayed} && ($self->{state} eq 'prompt' || $self->{state} eq 'convers')) { - for (@{$self->{delayed}}) { - $self->send($_); - } + $self->send (@{$self->{delayed}}); delete $self->{delayed}; } }