Now (apparent) apparently working
[spider.git] / perl / DXCommandmode.pm
index 6023320d7116bcea918e33c65a0cc102bfc04b36..cf745c4fd6926ca9911d6fb74f3c257c5e7b3bd6 100644 (file)
@@ -92,6 +92,7 @@ sub start
        my $host = $self->{conn}->peerhost;
        $host ||= "AGW Port #$self->{conn}->{agwport}" if exists $self->{conn}->{agwport};
        $host ||= "unknown";
+       $self->{hostname} = $host;
        LogDbg('DXCommand', "$call connected from $host");
 
        $self->{name} = $name ? $name : $call;
@@ -118,6 +119,7 @@ sub start
        $self->{ann_talk} = $user->wantann_talk;
        $self->{here} = 1;
        $self->{prompt} = $user->prompt if $user->prompt;
+       $self->{lastmsgpoll} = 0;
 
        # sort out new dx spot stuff
        $user->wantdxcq(0) unless defined $user->{wantdxcq};
@@ -131,11 +133,16 @@ sub start
                $self->{registered} = $user->registered;
        }
 
+       # establish slug queue, if required
+    $self->{sluggedpcs} = [];
+    $self->{isslugged} = $DXProt::pc92_slug_changes + $DXProt::last_pc92_slug + 5 if $DXProt::pc92_slug_changes;
+    $self->{isslugged} = 0 if $self->{priv} > 0 || $user->registered || $user->homenode eq $main::mycall;
+
        # send the relevant MOTD
        $self->send_motd;
 
        # sort out privilege reduction
-       $self->{priv} = 0 if $line =~ /^(ax|te)/ && !$self->conn->{usedpasswd};
+       $self->{priv} = 0 unless $self->{hostname} eq '127.0.0.1' || $self->{hostname} eq '::1' || $self->conn->{usedpasswd};
 
        # get the filters
        my $nossid = $call;
@@ -207,7 +214,7 @@ sub start
                }
        }
 
-       $self->lastmsgpoll($main::systime);
+       $self->{lastmsgpoll} = $main::systime;
        $self->prompt;
 }
 
@@ -558,12 +565,12 @@ sub process
        my $dxchan;
        
        foreach $dxchan (@dxchan) {
-               next if $dxchan->sort ne 'U';  
+               next unless $dxchan->is_user;  
        
                # send a outstanding message prompt if required
                if ($t >= $dxchan->lastmsgpoll + $msgpolltime) {
                        $dxchan->send($dxchan->msg('m9')) if DXMsg::for_me($dxchan->call);
-                       $dxchan->lastmsgpoll($t);
+                       $dxchan->{lastmsgpoll} = $t;
                }
                
                # send a prompt if no activity out on this channel
@@ -571,6 +578,18 @@ sub process
                        $dxchan->prompt() if $dxchan->{state} =~ /^prompt/o;
                        $dxchan->t($t);
                }
+
+               if ($dxchan->{isslugged} && $main::systime > $dxchan->{isslugged}) {
+                       foreach my $ref (@{$dxchan->{sluggedpcs}}) {
+                               if ($ref->[0] == 61) {
+                                       Spot::add(@{$ref->[2]});
+                                       DXProt::send_dx_spot($dxchan, $ref->[1], @{$ref->[2]});
+                               }
+                       }
+
+                       $dxchan->{isslugged} = 0;
+                       $dxchan->{sluggedpcs} = [];
+               }
        }
 
        while (my ($k, $v) = each %nothereslug) {