log agw port on connection
[spider.git] / perl / DXCommandmode.pm
index 7b69ad22c1b17d4e462f588b196418e5121c04d0..eae67c7237024a85fb8a3b396731b727d39a6a04 100644 (file)
@@ -87,7 +87,9 @@ sub start
        my $name = $user->{name};
        
        # log it
-       my $host = $self->{conn}->{peerhost} || "unknown";
+       my $host = $self->{conn}->{peerhost};
+       $host ||= "AGW Port #$self->{conn}->{agwport}" if exists $self->{conn}->{agwport};
+       $host ||= "unknown";
        Log('DXCommand', "$call connected from $host");
 
        $self->{name} = $name ? $name : $call;
@@ -129,7 +131,12 @@ sub start
 
 
        # decide which motd to send
-       my $motd = "${main::motd}_nor" unless $self->{registered};
+       my $motd;
+       unless ($self->{registered}) {
+               $motd = "${main::motd}_nor_$self->{lang}";
+               $motd = "${main::motd}_nor" unless -e $motd;
+       }
+       $motd = "${main::motd}_$self->{lang}" unless $motd && -e $motd;
        $motd = $main::motd unless $motd && -e $motd;
        $self->send_file($motd) if -e $motd;
 
@@ -489,7 +496,7 @@ sub run_cmd
 sub process
 {
        my $t = time;
-       my @dxchan = DXChannel->get_all();
+       my @dxchan = DXChannel::get_all();
        my $dxchan;
        
        foreach $dxchan (@dxchan) {
@@ -577,7 +584,7 @@ sub broadcast
        my $pkg = shift;                        # ignored
        my $s = shift;                          # the line to be rebroadcast
        
-    foreach my $dxchan (DXChannel->get_all()) {
+    foreach my $dxchan (DXChannel::get_all()) {
                next unless $dxchan->{sort} eq 'U'; # only interested in user channels  
                next if grep $dxchan == $_, @_;
                $dxchan->send($s);                      # send it
@@ -587,7 +594,7 @@ sub broadcast
 # gimme all the users
 sub get_all
 {
-       return grep {$_->{sort} eq 'U'} DXChannel->get_all();
+       return grep {$_->{sort} eq 'U'} DXChannel::get_all();
 }
 
 # run a script for this user
@@ -942,7 +949,7 @@ sub broadcast_debug
 {
        my $s = shift;                          # the line to be rebroadcast
        
-       foreach my $dxchan (DXChannel->get_all) {
+       foreach my $dxchan (DXChannel::get_all) {
                next unless $dxchan->{enhanced} && $dxchan->{senddbg};
                $dxchan->send_later('L', $s);
        }
@@ -958,7 +965,7 @@ sub do_entry_stuff
                my $loc = $self->{loc} || confess "local var gone missing" ;
                if ($line eq "\032" || $line eq '%1A' || uc $line eq "/EX") {
                        no strict 'refs';
-                       push @out, $loc->{endaction}($self);
+                       push @out, &{$loc->{endaction}}($self);          # like this for < 5.8.0
                        $self->func(undef);
                        $self->state('prompt');
                } elsif ($line eq "\031" || uc $line eq "/ABORT" || uc $line eq "/QUIT") {