X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXChannel.pm;h=7a27a8f2bc3bd3a90eda6efaaf388e9c6bc312fc;hb=970d8ae5f1c263bc78390ca35ee876aa41382f21;hp=df74bfc89302fdf00f398735bd53df5b5985a546;hpb=72e9dcbade3fdb51d9291a2856ca1cc998241f9b;p=spider.git diff --git a/perl/DXChannel.pm b/perl/DXChannel.pm index df74bfc8..7a27a8f2 100644 --- a/perl/DXChannel.pm +++ b/perl/DXChannel.pm @@ -86,6 +86,7 @@ use vars qw(%channels %valid); pingtime => '5,Ping totaltime,parray', pingave => '0,Ping ave time', logininfo => '9,Login info req,yesno', + talklist => '0,Talk List,parray', ); # object destruction @@ -285,7 +286,7 @@ sub send_now my $call = $self->{call}; for (@_) { - chomp; +# chomp; my @lines = split /\n/; for (@lines) { $conn->send_now("$sort$call|$_"); @@ -306,7 +307,7 @@ sub send # this is always later and always data my $call = $self->{call}; for (@_) { - chomp; +# chomp; my @lines = split /\n/; for (@lines) { $conn->send_later("D$call|$_"); @@ -361,7 +362,7 @@ sub state dbg('state', "$self->{call} channel func $self->{func} state $self->{oldstate} -> $self->{state}\n"); # if there is any queued up broadcasts then splurge them out here - if ($self->{delayed} && ($self->{state} eq 'prompt' || $self->{state} eq 'convers')) { + if ($self->{delayed} && ($self->{state} eq 'prompt' || $self->{state} eq 'talk')) { $self->send (@{$self->{delayed}}); delete $self->{delayed}; } @@ -441,7 +442,7 @@ sub decode_input { my $dxchan = shift; my $data = shift; - my ($sort, $call, $line) = $data =~ /^([A-Z])([A-Z1-9\-]{3,9})\|(.*)$/; + my ($sort, $call, $line) = $data =~ /^([A-Z])([A-Z0-9\-]{3,9})\|(.*)$/; my $chcall = (ref $dxchan) ? $dxchan->call : "UN.KNOWN"; @@ -465,8 +466,13 @@ sub AUTOLOAD $name =~ s/.*:://o; confess "Non-existant field '$AUTOLOAD'" if !$valid{$name}; - @_ ? $self->{$name} = shift : $self->{$name} ; + + # this clever line of code creates a subroutine which takes over from autoload + # from OO Perl - Conway + *{$AUTOLOAD} = sub {@_ > 1 ? $_[0]->{$name} = $_[1] : $_[0]->{$name}} ; + @_ ? $self->{$name} = shift : $self->{$name} ; } + 1; __END__;