X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXCommandmode.pm;h=e429654c3de92d592955f5da5623ff58564b3383;hb=4f4cd7ea04f04162f2e755981b4c716deb792cef;hp=639820ad15fff7ce177f95432574a2df862769cd;hpb=a9b7071fedfdb2150f3ef3d74e0d626b4f2dc0ea;p=spider.git diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index 639820ad..e429654c 100644 --- a/perl/DXCommandmode.pm +++ b/perl/DXCommandmode.pm @@ -19,6 +19,7 @@ use DXDebug; use DXM; use DXLog; use DXLogPrint; +use DXBearing; use CmdAlias; use FileHandle; use Carp; @@ -38,7 +39,7 @@ $errstr = (); # error string from eval sub new { my $self = DXChannel::alloc(@_); - $self->{sort} = 'U'; # in absence of how to find out what sort of an object I am + $self->{'sort'} = 'U'; # in absence of how to find out what sort of an object I am return $self; } @@ -81,6 +82,12 @@ sub start # send prompts and things my $info = DXCluster::cluster(); $self->send("Cluster:$info"); + $self->send($self->msg('namee1')) if !$user->name; + $self->send($self->msg('qthe1')) if !$user->qth; + $self->send($self->msg('qll')) if !$user->qra || (!$user->lat && !$user->long); + $self->send($self->msg('hnodee1')) if !$user->qth; + + $self->send($self->msg('pr', $call)); } @@ -230,16 +237,16 @@ sub run_cmd sub process { my $t = time; - my @chan = DXChannel->get_all(); - my $chan; + my @dxchan = DXChannel->get_all(); + my $dxchan; - foreach $chan (@chan) { - next if $chan->sort ne 'U'; + foreach $dxchan (@dxchan) { + next if $dxchan->sort ne 'U'; # send a prompt if no activity out on this channel - if ($t >= $chan->t + $main::user_interval) { - $chan->prompt() if $chan->{state} =~ /^prompt/o; - $chan->t($t); + if ($t >= $dxchan->t + $main::user_interval) { + $dxchan->prompt() if $dxchan->{state} =~ /^prompt/o; + $dxchan->t($t); } } } @@ -251,12 +258,21 @@ sub finish { my $self = shift; my $call = $self->call; - + + # log out text + if (-e "$main::data/logout") { + open(I, "$main::data/logout") or confess; + my @in = ; + close(I); + $self->send_now('D', @in); + sleep(1); + } + if ($call eq $main::myalias) { # unset the channel if it is us really my $node = DXNode->get($main::mycall); $node->{dxchan} = 0; } - my $ref = DXNodeuser->get($call); + my $ref = DXCluster->get_exact($call); # issue a pc17 to everybody interested my $nchan = DXChannel->get($main::mycall); @@ -274,9 +290,7 @@ sub finish sub prompt { my $self = shift; - my $call = $self->{call}; - $self->send($self->msg('pr', $call)); - #DXChannel::msg($self, 'pr', $call); + $self->send($self->msg($self->here ? 'pr' : 'pr2', $self->call)); } # broadcast a message to all users [except those mentioned after buffer] @@ -286,14 +300,14 @@ sub broadcast my $s = shift; # the line to be rebroadcast my @except = @_; # to all channels EXCEPT these (dxchannel refs) my @list = DXChannel->get_all(); # just in case we are called from some funny object - my ($chan, $except); + my ($dxchan, $except); - L: foreach $chan (@list) { - next if !$chan->sort eq 'U'; # only interested in user channels + L: foreach $dxchan (@list) { + next if !$dxchan->sort eq 'U'; # only interested in user channels foreach $except (@except) { - next L if $except == $chan; # ignore channels in the 'except' list + next L if $except == $dxchan; # ignore channels in the 'except' list } - chan->send($s); # send it + $dxchan->send($s); # send it } } @@ -326,7 +340,7 @@ sub search return () if $short_cmd =~ /\/$/; # return immediately if we have it - my ($apath, $acmd) = split ',', $cmd_cache{$short_cmd}; + ($apath, $acmd) = split ',', $cmd_cache{$short_cmd} if $cmd_cache{$short_cmd}; if ($apath && $acmd) { dbg('command', "cached $short_cmd = ($apath, $acmd)\n"); return ($apath, $acmd); @@ -362,6 +376,7 @@ sub search pop @lparts; # remove the suffix $l = join '.', @lparts; # chop $dirfn; # remove trailing / + $dirfn = "" unless $dirfn; $cmd_cache{"$short_cmd"} = join(',', ($path, "$dirfn$l")); # cache it dbg('command', "got path: $path cmd: $dirfn$l\n"); return ($path, "$dirfn$l");