put duplicate checking into respective modules and out of DXProt.
[spider.git] / perl / DXCommandmode.pm
index 99e2bfe5fe55692b5d70adc418f6e1b235ff7719..b76493db31aacb90aab65ff5cc3f3d85f8600843 100644 (file)
@@ -24,9 +24,9 @@ use DXLogPrint;
 use DXBearing;
 use CmdAlias;
 use Filter;
-use Carp;
 use Minimuf;
 use DXDb;
+use AnnTalk;
 use Sun;
 
 use strict;
@@ -84,7 +84,7 @@ sub start
        my $node = DXNode->get($main::mycall) or die "$main::mycall not allocated in DXNode database";
        my $cuser = DXNodeuser->new($self, $node, $call, 0, 1);
        $node->dxchan($self) if $call eq $main::myalias; # send all output for mycall to myalias
-       
+
        # issue a pc16 to everybody interested
        my $nchan = DXChannel->get($main::mycall);
        my @pc16 = DXProt::pc16($nchan, $cuser);
@@ -246,7 +246,7 @@ sub run_cmd
                                        unless (exists $Cache{$package}->{'sub'}) {
                                                $c = eval $Cache{$package}->{'eval'};
                                                if ($@) {
-                                                       return ("Syserr: Syntax error in $package", $@);
+                                                       return DXDebug::shortmess($@);
                                                }
                                                $Cache{$package}->{'sub'} = $c;
                                        }
@@ -255,7 +255,10 @@ sub run_cmd
                                                @ans = &{$c}($self, $args);
                                    };
                                        
-                                       return ($@) if $@;
+                                       if ($@) {
+                                               cluck($@);
+                                               return (DXDebug::shortmess($@));
+                                       };
                                }
                        } else {
                                dbg('command', "cmd: $cmd not found");
@@ -297,6 +300,9 @@ sub finish
        my $self = shift;
        my $call = $self->call;
 
+       # I was the last node visited
+    $self->user->node($main::mycall);
+               
        # log out text
        if (-e "$main::data/logout") {
                open(I, "$main::data/logout") or confess;