*really* changed the DX Spot to "the way it was"
[spider.git] / perl / DXCommandmode.pm
index 38773783798e61d6191121d79192f3bab9859b06..a5ae268b34c2b601eb176482453057e17e4c6e75 100644 (file)
@@ -155,6 +155,11 @@ sub start
                $self->{registered} = 1;
        }
 
+       # 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;
 
@@ -516,7 +521,7 @@ sub run_cmd
 
                # check cmd
                if ($cmd =~ m|^/| || $cmd =~ m|[^-?\w/]|) {
-                       LogDbg('DXCommand', "cmd: invalid characters in '$cmd'");
+                       LogDbg('DXCommand', "cmd: $self->{call} - invalid characters in '$cmd'");
                        return $self->_error_out('e1');
                }
 
@@ -609,11 +614,17 @@ sub process
                }
                ++$users;
                $maxusers = $users if $users > $maxusers;
-       }
 
-       while (my ($k, $v) = each %nothereslug) {
-               if ($main::systime >= $v + 300) {
-                       delete $nothereslug{$k};
+               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} = [];
                }
        }
 
@@ -959,7 +970,7 @@ sub announce
                $buf = dd(['ann', $to, $target, $text, @_])
        } else {
                $buf = "$to$target de $_[0]: $text";
-               $buf =~ s/\%5E/^/g;
+               #$buf =~ s/\%5E/^/g;
                $buf .= "\a\a" if $self->{beep};
        }
        $self->local_send($target eq 'WX' ? 'W' : 'N', $buf);
@@ -984,7 +995,7 @@ sub chat
                $buf = dd(['chat', $to, $target, $text, @_])
        } else {
                $buf = "$target de $_[0]: $text";
-               $buf =~ s/\%5E/^/g;
+               #$buf =~ s/\%5E/^/g;
                $buf .= "\a\a" if $self->{beep};
        }
        $self->local_send('C', $buf);
@@ -996,10 +1007,12 @@ sub format_dx_spot
 
        my $t = ztime($_[2]);
        my $loc = '';
-       my $clth = 30;
+       my $clth = 30 + $self->{width} - 80;    # allow comment to grow according the screen width 
        #       --$clth if $self->{consort} eq 'local';
        
        my $comment = substr (($_[3] || ''), 0, $clth);
+       $comment =~ s/\t/ /g;
+       
        $comment .= ' ' x ($clth - (length($comment)));
        
     if ($self->{user}->wantgrid) {
@@ -1026,9 +1039,10 @@ sub format_dx_spot
                $comment = substr($comment, 0,  $clth-3) . ' ' . $_[12] if $_[12]; 
        }
 
-       return sprintf "DX de %-9.9s%10.1f %-12.12s %-s $t$loc", "$_[4]:", $_[0], $_[1], $comment;
+       return sprintf "DX de %-9.9s%9.1f  %-12.12s %-s $t$loc", "$_[4]:", $_[0], $_[1], $comment;
 }
 
+
 # send a dx spot
 sub dx_spot
 {
@@ -1070,7 +1084,7 @@ sub dx_spot
        } else {
                $buf = $self->format_dx_spot(@_);
                $buf .= "\a\a" if $self->{beep};
-               $buf =~ s/\%5E/^/g;
+               #$buf =~ s/\%5E/^/g;
        }
 
        $self->local_send('X', $buf);
@@ -1335,11 +1349,16 @@ sub spawn_cmd
                         sub {
                                 my $subpro = shift;
                                 if (isdbg('progress')) {
-                                        my $s = qq{line: "$line"};
+                                        my $s = qq{$call line: "$line"};
                                         $s .= ", args: " . join(', ', map { defined $_ ? qq{'$_'} : q{'undef'} } @$args) if $args && @$args;
                                         dbg($s);
                                 }
-                                eval { @out = $cmdref->(@$args); };
+                                eval {
+                                        ++$self->{_in_sub_process};
+                                        dbg "\$self->{_in_sub_process} = $self->{_in_sub_process}";
+                                        @out = $cmdref->(@$args);
+                                        --$self->{_in_sub_process} if $self->{_in_sub_process} > 0;
+                                };
                                 if ($@) {
                                         DXDebug::dbgprintring(25);
                                         push @out, DXDebug::shortmess($@);