]> dxcluster.org Git - spider.git/commitdiff
tidied up the talk thing a bit more
authorminima <minima>
Sun, 30 Jul 2000 16:14:22 +0000 (16:14 +0000)
committerminima <minima>
Sun, 30 Jul 2000 16:14:22 +0000 (16:14 +0000)
Changes
perl/DXCommandmode.pm

diff --git a/Changes b/Changes
index 83531b0e189eca5eaac5fd5102239093cf27ee71..42cfd27c91957c0be68f93b2696454325aa23f70 100644 (file)
--- 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
index 70ba4b9201b9fc278876fe860da702cdbbd33193..4eca6e74abfc930b6c7408bc5d453be1f2e7b2b2 100644 (file)
@@ -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;