add portuguese and french languages
[spider.git] / perl / DXProt.pm
index 1b361d0602b19563ea00851fd6c63d96dfc98af5..a3049ee329e502b416de681a37129a595b7d5136 100644 (file)
@@ -607,8 +607,16 @@ sub handle_12
 
        my $dxchan;
        
-       if ($_[2] eq '*' || $_[2] eq $main::mycall) {
+       if ((($dxchan = DXChannel->get($_[2])) && $dxchan->is_user) || $_[4] =~ /^[\#\w.]+$/){
+               $self->send_chat($line, @_[1..6]);
+       } elsif ($_[2] eq '*' || $_[2] eq $main::mycall) {
 
+               # ignore something that looks like a chat line coming in with sysop
+               # flag - this is a kludge...
+               if ($_[3] =~ /^\#\d+ / && $_[4] eq '*') {
+                       dbg('PCPROT: Probable chat rewrite, dropped') if isdbg('chanerr');
+                       return;
+               }
 
                # here's a bit of fun, convert incoming ann with a callsign in the first word
                # or one saying 'to <call>' to a talk if we can route to the recipient
@@ -626,8 +634,6 @@ sub handle_12
        
                # send it
                $self->send_announce($line, @_[1..6]);
-       } elsif ((($dxchan = DXChannel->get($_[2])) && $dxchan->is_user) || $_[4] =~ /^[\#\w]+$/){
-               $self->send_chat($line, @_[1..6]);
        } else {
                $self->route($_[2], $line);
        }
@@ -1056,7 +1062,7 @@ sub handle_23
        my $pcno = shift;
        my $line = shift;
                        
-       # route 'foreign' pc27s 
+       # route foreign' pc27s 
        if ($pcno == 27) {
                if ($_[8] ne $main::mycall) {
                        $self->route($_[8], $line);
@@ -1386,7 +1392,7 @@ sub handle_51
                                                $dxchan->send($dxchan->msg('pingi', $from, $s, $ave))
                                        } elsif ($dxchan->is_node) {
                                                if ($tochan) {
-                                                       my $nopings = $tochan->user->nopings || 2;
+                                                       my $nopings = $tochan->user->nopings || $obscount;
                                                        push @{$tochan->{pingtime}}, $t;
                                                        shift @{$tochan->{pingtime}} if @{$tochan->{pingtime}} > 6;
 
@@ -1479,7 +1485,7 @@ sub handle_85
        my $line = shift;
        $self->process_rcmd_reply($_[1], $_[2], $_[3], $_[4]);
 }
-        
+       
 # if get here then rebroadcast the thing with its Hop count decremented (if
 # there is one). If it has a hop count and it decrements to zero then don't
 # rebroadcast it.
@@ -1498,7 +1504,7 @@ sub handle_default
                dbg("PCPROT: Ephemeral dup, dropped") if isdbg('chanerr');
        } else {
                unless ($self->{isolate}) {
-                       DXChannel::broadcast_nodes($line, $self); # send it to everyone but me
+                       DXChannel::broadcast_nodes($line, $self) if $line =~ /\^H\d+\^?~?$/; # send it to everyone but me
                }
        }
 }
@@ -1525,7 +1531,7 @@ sub process
                next unless $dxchan->is_node();
                next if $dxchan == $main::me;
 
-               # send the pc50 or PC90
+               # send the pc50
                $dxchan->send($pc50s) if $pc50s;
                
                # send a ping out on this channel
@@ -1792,7 +1798,13 @@ sub send_chat
        my $dxchan;
        my $target = $_[3];
        my $text = unpad($_[2]);
+       my $ak1a_line;
                                
+       # munge the group and recast the line if required
+       if ($target =~ s/\.LST$//) {
+               $ak1a_line = $line;
+       }
+       
        # obtain country codes etc 
        my ($ann_dxcc, $ann_itu, $ann_cq, $org_dxcc, $org_itu, $org_cq) = (0..0);
        my ($ann_state, $org_state) = ("", "");
@@ -1833,10 +1845,19 @@ sub send_chat
        # send it if it isn't the except list and isn't isolated and still has a hop count
        # taking into account filtering and so on
        foreach $dxchan (@dxchan) {
-               next if $dxchan == $main::me;
-               next if $dxchan == $self && $self->is_node;
-               next if $target eq 'LOCAL' && $dxchan->is_node;
-               $dxchan->chat($line, $self->{isolate}, $target, $_[1], $text, @_, $self->{call}, $ann_dxcc, $ann_itu, $ann_cq, $org_dxcc, $org_itu, $org_cq);
+               my $is_ak1a = $dxchan->is_ak1a;
+               
+               if ($dxchan->is_node) {
+                       next if $dxchan == $main::me;
+                       next if $dxchan == $self;
+                       next unless $dxchan->is_spider || $is_ak1a;
+                       next if $target eq 'LOCAL';
+                       if (!$ak1a_line && $is_ak1a) {
+                               $ak1a_line = DXProt::pc12($_[0], $text, $_[1], "$target.LST");
+                       }
+               }
+               
+               $dxchan->chat($is_ak1a ? $ak1a_line : $line, $self->{isolate}, $target, $_[1], $text, @_, $self->{call}, $ann_dxcc, $ann_itu, $ann_cq, $org_dxcc, $org_itu, $org_cq);
        }
 }
 
@@ -2292,12 +2313,6 @@ sub route_pc50
        broadcast_route($self, \&pc50, 1, @_);
 }
 
-sub route_pc90
-{
-       my $self = shift;
-       broadcast_route($self, \&pc90, 1, @_);
-}
-
 sub in_filter_route
 {
        my $self = shift;