From: minima Date: Sun, 30 Jul 2000 16:14:22 +0000 (+0000) Subject: tidied up the talk thing a bit more X-Git-Tag: R_1_43~15 X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=87ebd761d9a6b3d96c88d81109ef0a51293e8a2e;p=spider.git tidied up the talk thing a bit more --- diff --git a/Changes b/Changes index 83531b0e..42cfd27c 100644 --- a/Changes +++ b/Changes @@ -6,6 +6,7 @@ 5. fix talkmode so that it only does 'via' PC10s when it really needs to. 6. SEND now displays a message if you try to do it in not prompt mode. 7. stopped a few more things being done by rcmd (eg send, talk, ann, dx) +8. tidied up the talking a bit more. 29Jul00======================================================================= 1. added forward/latlong which will forward ALL the users that have a latitude and longitude set on them to one or more locally connected nodes - with a hop diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index 70ba4b92..4eca6e74 100644 --- a/perl/DXCommandmode.pm +++ b/perl/DXCommandmode.pm @@ -180,10 +180,7 @@ sub normal } elsif ($self->{state} eq 'talk') { if ($cmdline =~ m{^(?:/EX|/ABORT)}i) { for (@{$self->{talklist}}) { - my $ent = $_; - my ($to, $via) = $ent =~ /(\S+)>(\S+)/; - my $dxchan = DXChannel->get($via); - $dxchan->talk($self->{call}, $to, $via, $self->msg('talkend')) if $dxchan; + $self->send_talks($_, $self->msg('talkend')); } $self->state('prompt'); delete $self->{talklist}; @@ -194,24 +191,7 @@ sub normal } elsif ($self->{talklist} && @{$self->{talklist}}) { # send what has been said to whoever is in this person's talk list for (@{$self->{talklist}}) { - my $ent = $_; - my ($to, $via) = $ent =~ /(\S+)>(\S+)/; - $to = $ent unless $to; - my $call = $via ? $via : $to; - my $clref = DXCluster->get_exact($call); - my $dxchan = $clref->dxchan if $clref; - if ($dxchan) { - $dxchan->talk($self->{call}, $to, $via, $cmdline); - } else { - $self->send($self->msg('disc2', $via ? $via : $to)); - my @l = grep { $_ ne $ent } @{$self->{talklist}}; - if (@l) { - $self->{talklist} = \@l; - } else { - delete $self->{talklist}; - $self->state('prompt'); - } - } + $self->send_talks($_, $cmdline); } $self->send($self->talk_prompt) if $self->{state} eq 'talk'; } else { @@ -226,6 +206,30 @@ sub normal $self->prompt() if $self->{state} =~ /^prompt/o; } +# send out the talk messages taking into account vias and connectivity +sub send_talks +{ + my ($self, $ent, $line) = @_; + + my ($to, $via) = $ent =~ /(\S+)>(\S+)/; + $to = $ent unless $to; + my $call = $via ? $via : $to; + my $clref = DXCluster->get_exact($call); + my $dxchan = $clref->dxchan if $clref; + if ($dxchan) { + $dxchan->talk($self->{call}, $to, $via, $line); + } else { + $self->send($self->msg('disc2', $via ? $via : $to)); + my @l = grep { $_ ne $ent } @{$self->{talklist}}; + if (@l) { + $self->{talklist} = \@l; + } else { + delete $self->{talklist}; + $self->state('prompt'); + } + } +} + sub talk_prompt { my $self = shift;