add unset/privilege command to relinquish any sysop privileges you might
[spider.git] / perl / DXCommandmode.pm
index c7ce8c3c7f6699e8313740a7d95afd4766ba6eaa..c1a461ff640791c40cb5b9e90d5d13a5afcf1976 100644 (file)
@@ -32,7 +32,7 @@ use Sun;
 use Internet;
 
 use strict;
-use vars qw(%Cache %cmd_cache $errstr %aliases $scriptbase $maxerrors);
+use vars qw(%Cache %cmd_cache $errstr %aliases $scriptbase $maxerrors %nothereslug);
 
 %Cache = ();                                   # cache of dynamically loaded routine's mod times
 %cmd_cache = ();                               # cache of short names
@@ -105,8 +105,6 @@ sub start
                $user->qra(DXBearing::lltoqra($lat, $long)) if (defined $lat && defined $long);  
        }
 
-       $DXProt::me->conn($self->conn) if $call eq $main::myalias; # send all output for mycall to myalias
-
        Log('DXCommand', "$call connected");
 
        # send prompts and things
@@ -393,6 +391,12 @@ sub process
                        $dxchan->t($t);
                }
        }
+
+       while (my ($k, $v) = each %nothereslug) {
+               if ($main::systime >= $v + 300) {
+                       delete $nothereslug{$k};
+               }
+       }
 }
 
 #
@@ -403,11 +407,6 @@ sub disconnect
        my $self = shift;
        my $call = $self->call;
 
-       # reset the redirection of messages back to 'normal' if we are the sysop
-       if ($call eq $main::myalias) {
-               $DXProt::me->conn(undef);
-       }
-
        my @rout = $main::routeroot->del_user($call);
        dbg("B/C PC17 on $main::mycall for: $call") if isdbg('route');
 
@@ -646,11 +645,15 @@ sub talk
        Log('talk', $to, $from, $main::mycall, $line);
        # send a 'not here' message if required
        unless ($self->{here} && $from ne $to) {
-               my ($ref, $dxchan);
-               if (($ref = Route::get($from)) && ($dxchan = $ref->dxchan)) {
-                       my $name = $self->user->name || $to;
-                       my $s = $self->user->nothere || $dxchan->msg('nothere', $name);
-                       $dxchan->talk($to, $from, undef, $s);
+               my $key = "$to$from";
+               unless (exists $nothereslug{$key}) {
+                       my ($ref, $dxchan);
+                       if (($ref = Route::get($from)) && ($dxchan = $ref->dxchan)) {
+                               my $name = $self->user->name || $to;
+                               my $s = $self->user->nothere || $dxchan->msg('nothere', $name);
+                               $nothereslug{$key} = $main::systime;
+                               $dxchan->talk($to, $from, undef, $s);
+                       }
                }
        }
 }