add skeletons for new commands Rt, Ping and T.
authorminima <minima>
Mon, 14 Feb 2005 18:27:04 +0000 (18:27 +0000)
committerminima <minima>
Mon, 14 Feb 2005 18:27:04 +0000 (18:27 +0000)
fix padding on spot text.
use output spot filter (not input) for output filtering.

perl/DXProt.pm
perl/Spot.pm
perl/Thingy/Dx.pm
perl/Thingy/Ping.pm [new file with mode: 0644]
perl/Thingy/Rt.pm [new file with mode: 0644]
perl/Thingy/T.pm [new file with mode: 0644]

index 1ae1823bfb3d4747c5572b06e84d4f1e3204d97f..712f933e833f29bd8a4508f79be4df614d4d9dec 100644 (file)
@@ -37,6 +37,9 @@ use Investigate;
 use RouteDB;
 use Thingy;
 use Thingy::Dx;
+use Thingy::Rt;
+use Thingy::Ping;
+use Thingy::T;
 
 use strict;
 
@@ -504,7 +507,7 @@ sub handle_11
        }
 
        # is it 'baddx'
-       if ($baddx->in($_[2]) || BadWords::check($_[2]) || $_[2] =~ /COCK/) {
+       if ($baddx->in($_[2]) || BadWords::check($_[2])) {
                dbg("PCPROT: Bad DX spot, ignored") if isdbg('chanerr');
                return;
        }
index 66652795f49e82a777959ad49ae66a66d0c436a2..ef460a07ec0d036a1923bc3208fd604feb24ef9e 100644 (file)
@@ -122,8 +122,7 @@ sub prepare
        $out[4] =~ s/-\d+$//o;
 
        # remove leading and trailing spaces
-       unpad($out[3]);
-       
+       $out[3] = unpad($out[3]);
        
        # add the 'dxcc' country on the end for both spotted and spotter, then the cluster call
        my @spd = Prefix::cty_data($out[1]);
index 10eee308fd035c6fdf33170b9df1c84695bab41d..b711a256aefa0cbff5e6fd509b3d89395425b2d6 100644 (file)
@@ -143,10 +143,10 @@ sub out_filter
        my $dxchan = shift;
        
        # global spot filtering on INPUT
-       if ($dxchan->{inspotsfilter}) {
-               my ($filter, $hops) = $dxchan->{inspotsfilter}->it($thing->{spotdata});
+       if ($dxchan->{spotsfilter}) {
+               my ($filter, $hops) = $dxchan->{spotsfilter}->it($thing->{spotdata});
                unless ($filter) {
-                       dbg("PCPROT: Rejected by input spot filter") if isdbg('chanerr');
+                       dbg("PCPROT: Rejected by output spot filter") if isdbg('chanerr');
                        return;
                }
                $thing->{hops} = $hops if $hops;
diff --git a/perl/Thingy/Ping.pm b/perl/Thingy/Ping.pm
new file mode 100644 (file)
index 0000000..39fd55b
--- /dev/null
@@ -0,0 +1,114 @@
+#
+# Ping Thingy handling
+#
+# $Id$
+#
+# Copyright (c) 2005 Dirk Koopman G1TLH
+#
+
+use strict;
+
+package Thingy::Ping;
+
+use vars qw($VERSION $BRANCH);
+$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
+$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/  || (0,0));
+$main::build += $VERSION;
+$main::branch += $BRANCH;
+
+use DXChannel;
+use DXDebug;
+use DXUtil;
+use Thingy;
+use Spot;
+
+use vars qw(@ISA);
+@ISA = qw(Thingy);
+
+sub gen_Aranea
+{
+       my $thing = shift;
+       unless ($thing->{Aranea}) {
+               my @items;
+               $thing->{Aranea} = Aranea::genmsg($thing, 'Rloc', @items);
+       }
+       return $thing->{Aranea};
+}
+
+sub from_Aranea
+{
+       my $thing = shift;
+       return unless $thing;
+       return $thing;
+}
+
+sub gen_DXProt
+{
+       my $thing = shift;
+       my $dxchan = shift;
+       return $thing->{DXProt};
+}
+
+sub gen_DXCommandmode
+{
+       my $thing = shift;
+       my $dxchan = shift;
+       my $buf;
+
+       return $buf;
+}
+
+sub from_DXProt
+{
+       my $thing = shift;
+       while (@_) {
+               my $k = shift;
+               $thing->{$k} = shift;
+       }
+       ($thing->{hops}) = $thing->{DXProt} =~ /\^H(\d+)\^?~?$/ if exists $thing->{DXProt};
+       return $thing;
+}
+
+sub handle
+{
+       my $thing = shift;
+       my $dxchan = shift;
+
+       $thing->broadcast($dxchan);
+}
+
+sub in_filter
+{
+       my $thing = shift;
+       my $dxchan = shift;
+       
+       # global route filtering on INPUT
+       if ($dxchan->{inroutefilter}) {
+               my ($filter, $hops) = $dxchan->{inroutefilter}->it($thing->{routedata});
+               unless ($filter) {
+                       dbg("PCPROT: Rejected by input route filter") if isdbg('chanerr');
+                       return;
+               }
+       }
+       return 1;
+}
+
+sub out_filter
+{
+       my $thing = shift;
+       my $dxchan = shift;
+       
+       # global route filtering on INPUT
+       if ($dxchan->{routefilter}) {
+               my ($filter, $hops) = $dxchan->{routefilter}->it($thing->{routedata});
+               unless ($filter) {
+                       dbg("PCPROT: Rejected by output route filter") if isdbg('chanerr');
+                       return;
+               }
+               $thing->{hops} = $hops if $hops;
+       } elsif ($dxchan->{isolate}) {
+               return;
+       }
+       return 1;
+}
+1;
diff --git a/perl/Thingy/Rt.pm b/perl/Thingy/Rt.pm
new file mode 100644 (file)
index 0000000..bf17836
--- /dev/null
@@ -0,0 +1,114 @@
+#
+# Route Thingy handling
+#
+# $Id$
+#
+# Copyright (c) 2005 Dirk Koopman G1TLH
+#
+
+use strict;
+
+package Thingy::Rt;
+
+use vars qw($VERSION $BRANCH);
+$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
+$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/  || (0,0));
+$main::build += $VERSION;
+$main::branch += $BRANCH;
+
+use DXChannel;
+use DXDebug;
+use DXUtil;
+use Thingy;
+use Spot;
+
+use vars qw(@ISA);
+@ISA = qw(Thingy);
+
+sub gen_Aranea
+{
+       my $thing = shift;
+       unless ($thing->{Aranea}) {
+               my @items;
+               $thing->{Aranea} = Aranea::genmsg($thing, 'Rloc', @items);
+       }
+       return $thing->{Aranea};
+}
+
+sub from_Aranea
+{
+       my $thing = shift;
+       return unless $thing;
+       return $thing;
+}
+
+sub gen_DXProt
+{
+       my $thing = shift;
+       my $dxchan = shift;
+       return $thing->{DXProt};
+}
+
+sub gen_DXCommandmode
+{
+       my $thing = shift;
+       my $dxchan = shift;
+       my $buf;
+
+       return $buf;
+}
+
+sub from_DXProt
+{
+       my $thing = shift;
+       while (@_) {
+               my $k = shift;
+               $thing->{$k} = shift;
+       }
+       ($thing->{hops}) = $thing->{DXProt} =~ /\^H(\d+)\^?~?$/ if exists $thing->{DXProt};
+       return $thing;
+}
+
+sub handle
+{
+       my $thing = shift;
+       my $dxchan = shift;
+
+       $thing->broadcast($dxchan);
+}
+
+sub in_filter
+{
+       my $thing = shift;
+       my $dxchan = shift;
+       
+       # global route filtering on INPUT
+       if ($dxchan->{inroutefilter}) {
+               my ($filter, $hops) = $dxchan->{inroutefilter}->it($thing->{routedata});
+               unless ($filter) {
+                       dbg("PCPROT: Rejected by input route filter") if isdbg('chanerr');
+                       return;
+               }
+       }
+       return 1;
+}
+
+sub out_filter
+{
+       my $thing = shift;
+       my $dxchan = shift;
+       
+       # global route filtering on INPUT
+       if ($dxchan->{routefilter}) {
+               my ($filter, $hops) = $dxchan->{routefilter}->it($thing->{routedata});
+               unless ($filter) {
+                       dbg("PCPROT: Rejected by output route filter") if isdbg('chanerr');
+                       return;
+               }
+               $thing->{hops} = $hops if $hops;
+       } elsif ($dxchan->{isolate}) {
+               return;
+       }
+       return 1;
+}
+1;
diff --git a/perl/Thingy/T.pm b/perl/Thingy/T.pm
new file mode 100644 (file)
index 0000000..ee8928a
--- /dev/null
@@ -0,0 +1,114 @@
+#
+# Talk/Announce/Chat Thingy handling
+#
+# $Id$
+#
+# Copyright (c) 2005 Dirk Koopman G1TLH
+#
+
+use strict;
+
+package Thingy::T;
+
+use vars qw($VERSION $BRANCH);
+$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
+$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/  || (0,0));
+$main::build += $VERSION;
+$main::branch += $BRANCH;
+
+use DXChannel;
+use DXDebug;
+use DXUtil;
+use Thingy;
+use Spot;
+
+use vars qw(@ISA);
+@ISA = qw(Thingy);
+
+sub gen_Aranea
+{
+       my $thing = shift;
+       unless ($thing->{Aranea}) {
+               my @items;
+               $thing->{Aranea} = Aranea::genmsg($thing, 'Rloc', @items);
+       }
+       return $thing->{Aranea};
+}
+
+sub from_Aranea
+{
+       my $thing = shift;
+       return unless $thing;
+       return $thing;
+}
+
+sub gen_DXProt
+{
+       my $thing = shift;
+       my $dxchan = shift;
+       return $thing->{DXProt};
+}
+
+sub gen_DXCommandmode
+{
+       my $thing = shift;
+       my $dxchan = shift;
+       my $buf;
+
+       return $buf;
+}
+
+sub from_DXProt
+{
+       my $thing = shift;
+       while (@_) {
+               my $k = shift;
+               $thing->{$k} = shift;
+       }
+       ($thing->{hops}) = $thing->{DXProt} =~ /\^H(\d+)\^?~?$/ if exists $thing->{DXProt};
+       return $thing;
+}
+
+sub handle
+{
+       my $thing = shift;
+       my $dxchan = shift;
+
+       $thing->broadcast($dxchan);
+}
+
+sub in_filter
+{
+       my $thing = shift;
+       my $dxchan = shift;
+       
+       # global route filtering on INPUT
+       if ($dxchan->{inroutefilter}) {
+               my ($filter, $hops) = $dxchan->{inroutefilter}->it($thing->{routedata});
+               unless ($filter) {
+                       dbg("PCPROT: Rejected by input route filter") if isdbg('chanerr');
+                       return;
+               }
+       }
+       return 1;
+}
+
+sub out_filter
+{
+       my $thing = shift;
+       my $dxchan = shift;
+       
+       # global route filtering on INPUT
+       if ($dxchan->{routefilter}) {
+               my ($filter, $hops) = $dxchan->{routefilter}->it($thing->{routedata});
+               unless ($filter) {
+                       dbg("PCPROT: Rejected by output route filter") if isdbg('chanerr');
+                       return;
+               }
+               $thing->{hops} = $hops if $hops;
+       } elsif ($dxchan->{isolate}) {
+               return;
+       }
+       return 1;
+}
+1;