]> dxcluster.org Git - spider.git/commitdiff
add some Hello and Bye
authorminima <minima>
Sat, 19 Feb 2005 22:27:48 +0000 (22:27 +0000)
committerminima <minima>
Sat, 19 Feb 2005 22:27:48 +0000 (22:27 +0000)
add some pc16/17

cmd/show/425.pl
data/bands.pl
perl/Aranea.pm
perl/DXChannel.pm
perl/DXCommandmode.pm
perl/DXProt.pm
perl/DXProtout.pm
perl/DXUser.pm
perl/Thingy.pm
perl/Thingy/Bye.pm [new file with mode: 0644]
perl/Thingy/Hello.pm

index 9fb8d968f55863633b0a4d16fb2b2dd73219a362..044950d05d5ce89e1546214a22aec5f3cb888566 100644 (file)
@@ -14,9 +14,11 @@ my @out;
 return (1, $self->msg('e24')) unless $Internet::allow;
 return (1, "SHOW/425 <callsign>, e.g. SH/425 3B9FR") unless @list;
 my $target = $Internet::http_proxy || $Internet::dx425_url || "www.ariscandicci.it";
+#my $target = $Internet::http_proxy || $Internet::dx425_url || "192.168.0.2";
 my $port = $Internet::http_proxy_port || 80;
 my $url = '';
 $url = 'http://' . ($Internet::dx425_url || 'www.ariscandicci.it'); #  if $Internet::http_proxy; 
+#$url = 'http://' . ($Internet::dx425_url || '192.168.0.2'); #  if $Internet::http_proxy; 
 
 use Net::Telnet;
 
@@ -31,16 +33,23 @@ foreach $l (@list) {
        if (!$t || $@) {
                push @out, $self->msg('e18', 'Open(425.org)');
        } else {
-               my $s = "GET $url/modules.php?name=425dxn&op=spider&query=$l";
+               my $s = "GET $url/modules.php?name=425dxn&op=spider&query=$l HTTP/1.0\n"
+               ."User-Agent:DxSpider;$main::version;$main::build;$^O;$main::mycall;$call;$l)\n\n";
                dbg($s) if isdbg('425');
                $t->print($s);
                Log('call', "$call: show/425 \U$l");
                my $state = "blank";
+               my $count = 1;
+#              push @out, $s;
                while (my $result = eval { $t->getline(Timeout => 30) } || $@) {
                        dbg($result) if isdbg('425') && $result;
-                               chomp $result;
+                               ++$count;
+                               if ($count > 10)
+                               {
+                                 #chomp $result;
                                push @out, $result;
                }
+               }
                $t->close;
                push @out, $self->msg('e3', 'Search(425.org)', uc $l) unless @out;
        }
index 9d98a173262696a5d2490f3753d8149afd98b301..5fadf9160455a9185356edea3f6eda13254b89c9 100644 (file)
@@ -44,7 +44,7 @@
                                                        cw => [ 7000, 7034 ], 
                                                        data => [ 7035, 7044], 
                                                        rtty => [ 7035, 7044], 
-                                                       ssb => [ 7051, 7400 ] 
+                                                       ssb => [ 7045, 7400 ] 
                                                  }, 'Bands'),
 
                  '30m' => bless( { band => [ 10100, 10150 ], 
index f4d9a1ec1a33af09c959304c67e8e2ff0b2007d8..ed1c99cda1e429ce27928c5099e9a2e856206596 100644 (file)
@@ -152,9 +152,12 @@ sub disconnect
        my $call = $self->call;
 
        return if $self->{disconnecting}++;
-       
+
+       my $thing = Thingy::Bye->new(origin=>$main::mycall, user=>$call);
+       $thing->process($self);
+
        # get rid of any PC16/17/19
-#      eph_del_regex("^PC1[679]*$call");
+       eph_del_regex("^PC1[679]*$call");
 
        # do routing stuff, remove me from routing table
        my $node = Route::Node::get($call);
@@ -165,7 +168,7 @@ sub disconnect
                # and all my ephemera as well
                for (@rout) {
                        my $c = $_->call;
-#                      eph_del_regex("^PC1[679].*$c");
+                       eph_del_regex("^PC1[679].*$c");
                }
        }
 
index e2e3f0d2d2b4aefd4d371259581ee2890353633e..90e19ef9e2bb433c3d80b397286ed757a7db8c97 100644 (file)
@@ -121,10 +121,8 @@ $count = 0;
                 );
 
 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;
+
+main::mkver($VERSION = q$Revision$);
 
 # object destruction
 sub DESTROY
index 7371a8690ab781391150847d33b86d02747d0a9e..f451a434d0ebe239ba388d568fe2cf478af71fe7 100644 (file)
@@ -37,6 +37,8 @@ use DB_File;
 use VE7CC;
 use Thingy;
 use Thingy::Dx;
+use Thingy::Hello;
+use Thingy::Bye;
 
 use strict;
 use vars qw(%Cache %cmd_cache $errstr %aliases $scriptbase $maxerrors %nothereslug $maxbadcount $msgpolltime);
@@ -52,10 +54,8 @@ $msgpolltime = 3600;                 # the time between polls for new messages
 
 
 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;
+
+main::mkver($VERSION = q$Revision$);
 
 #
 # obtain a new connection this is derived from dxchannel
@@ -71,9 +71,11 @@ sub new
        my @rout = $main::routeroot->add_user($call, Route::here(1));
 
        # ALWAYS output the user
+       my $thing = Thingy::Hello->new(user => $self->{call});
+       $thing->broadcast($self);
+       
        my $ref = Route::User::get($call);
        $main::me->route_pc16($main::mycall, undef, $main::routeroot, $ref) if $ref;
-
        return $self;
 }
 
@@ -542,6 +544,9 @@ sub disconnect
 
                # issue a pc17 to everybody interested
                $main::me->route_pc17($main::mycall, undef, $main::routeroot, $uref);
+
+               my $thing = Thingy::Bye->new(user=>$call);
+               $thing->broadcast($self);
        } else {
                confess "trying to disconnect a non existant user $call";
        }
index 05111d40ba11e2456635fdbf14f4281782030365..0484d8fc5773c9012501c728c1b2eea8ea1ba6a6 100644 (file)
@@ -40,6 +40,8 @@ use Thingy::Dx;
 use Thingy::Rt;
 use Thingy::Ping;
 use Thingy::T;
+use Thingy::Hello;
+use Thingy::Bye;
 
 use strict;
 
@@ -237,7 +239,9 @@ sub new
        my $pkg = shift;
        my $call = shift;
        $main::routeroot->add($call, '5000', Route::here(1)) if $call ne $main::mycall;
-
+       my $thing = Thingy::Hello->new(user=>$call);
+       $thing->broadcast($self);
+       
        return $self;
 }
 
@@ -533,7 +537,7 @@ sub handle_11
 
        my $thing = Thingy::Dx->new(origin=>$main::mycall);
        $thing->from_DXProt(DXProt=>$line,spotdata=>\@spot);
-       $thing->queue($self);
+       $thing->process($self);
 
        # this goes after the input filtering, but before the add
        # so that if it is input filtered, it isn't added to the dup
@@ -591,20 +595,6 @@ sub handle_11
                        }
                }
        }
-                               
-       # local processing 
-       my $r;
-       eval {
-               $r = Local::spot($self, @spot);
-       };
-       #                       dbg("Local::spot1 error $@") if isdbg('local') if $@;
-       return if $r;
-
-       # DON'T be silly and send on PC26s!
-       return if $pcno == 26;
-
-       # send out the filtered spots
-#      send_dx_spot($self, $line, @spot) if @spot;
 }
                
 # announces
@@ -746,14 +736,15 @@ sub handle_16
                        eph_del_regex("^PC17\\^$call\\^$ncall");
                                
                        my $flags = $here ? 1 : 0;
-                       $rout .= ":U$flags$call";
+                       $rout .= "$flags$call:";
                }
                
 
                if ($rout) {
+                       chop $rout;
                        my $thing = Thingy::Rt->new(origin=>$main::mycall, user=>$self->{call});
-                       $thing->from_DXProt(t=>'eau', d=>"N1$ncall$rout", DXProt=>$line);
-                       $thing->queue($self);
+                       $thing->from_DXProt(t=>'au', $ncall eq $self->{call} ? () : ('n', "1$ncall"), u=>$rout, DXProt=>$line);
+                       $thing->process($self);
                } else {
                        dbg("PCPROT: No usable users") if isdbg('chanerr');
                }
@@ -819,8 +810,8 @@ sub handle_17
 
        $uref = Route->new($ucall) unless $uref; # throw away
        my $thing = Thingy::Rt->new(origin=>$main::mycall, user=>$self->{call});
-       $thing->from_DXProt(t=>'edu', d=>"N1$ncall:U1$ucall", DXProt=>$line);
-       $thing->queue($self);
+       $thing->from_DXProt(t=>'du', $ncall eq $self->{call} ? () : ('n', "1$ncall"), u=>"1$ucall", DXProt=>$line);
+       $thing->process($self);
 }
                
 # link request
@@ -2217,6 +2208,9 @@ sub disconnect
        
        # broadcast to all other nodes that all the nodes connected to via me are gone
        unless ($pc39flag && $pc39flag == 2) {
+               my $thing = Thingy::Bye->new(user=>$call);
+               $thing->broadcast($self);
+
                $self->route_pc21($main::mycall, undef, @rout) if @rout;
        }
 
index 27b547002548448b5d79b874e78a93e1b65a939f..0e12aa10cfe587e89dccab7a9a539c6966ce37c0 100644 (file)
@@ -20,10 +20,8 @@ use DXDebug;
 use strict;
 
 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;
+
+main::mkver($VERSION = q$Revision$);
 
 use vars qw($sentencelth);
 
index d2a0a12a31d51b4a519bbd6e4283dac8a0818c2b..a349f6ab41f9d3c90629c3c1cb20f038e9ba2256 100644 (file)
@@ -20,10 +20,8 @@ use LRU;
 use strict;
 
 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;
+
+main::mkver($VERSION = q$Revision$);
 
 use vars qw(%u $dbm $filename %valid $lastoperinterval $lasttime $lru $lrusize $tooold $v3);
 
index ed33fde027491b84b041187d6e464aedcfc8771c..522e4b136d0c7ea80ff55f8c31c2e3d4f5fb3acc 100644 (file)
@@ -96,11 +96,21 @@ sub queue
        push @queue, $thing;
 }
 
+#
 # this is the main commutator loop. In due course it will
-# become the *only* commutator loop
+# become the *only* commutator loop, This can be called in one
+# of two ways: either with 2 args or with none.
+#
+# The two arg form is an immediate "queue and handle" and does
+# a full cycle, immediately
+#
 sub process
 {
        my $thing;
+       if (@_ == 2) {
+               $thing = shift;
+               $thing->queue(shift);
+       }
        while (@queue) {
                $thing = shift @queue;
                my $dxchan = DXChannel->get($thing->{dxchan});
diff --git a/perl/Thingy/Bye.pm b/perl/Thingy/Bye.pm
new file mode 100644 (file)
index 0000000..22b7d4c
--- /dev/null
@@ -0,0 +1,94 @@
+#
+# Bye Thingy handling
+#
+# $Id$
+#
+# Copyright (c) 2005 Dirk Koopman G1TLH
+#
+
+use strict;
+
+package Thingy::Bye;
+
+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 Verify;
+use Thingy;
+
+use vars qw(@ISA);
+@ISA = qw(Thingy);
+
+sub gen_Aranea
+{
+       my $thing = shift;
+       unless ($thing->{Aranea}) {
+               my $s = sprintf "%X", int(rand() * 100000000);
+               my $auth = Verify->new("DXSp,$main::mycall,$s");
+               $thing->{Aranea} = Aranea::genmsg($thing, 'Bye',
+                                                                                 's'=>$s,
+                                                                                 auth=>$auth->challenge($main::me->user->passphrase)
+                                                                         );
+       }
+       return $thing->{Aranea};
+}
+
+sub handle
+{
+       my $thing = shift;
+       my $dxchan = shift;
+       
+       # verify authenticity
+       if ($dxchan->{call} eq $thing->{origin}) {
+
+               # for directly connected calls
+#              if ($Thingy::Hello::verify_on_login) {
+#                      my $pp = $dxchan->user->passphrase;
+#                      unless ($pp) {
+#                              dbglog('err', "Thingy::Bye::handle: verify on and $thing->{origin} has no passphrase");
+#                              return;
+#                      }
+#                      my $auth = Verify->new("DXSp,$thing->{origin},$thing->{s}");
+#                      unless ($auth->verify($thing->{auth}, $dxchan->user->passphrase)) {
+#                              dbglog('err', "Thingy::Bye::handle: verify on and $thing->{origin} failed auth check");
+#                              return;
+#                      }
+#              }
+               
+               my $int = $thing->{user} || $thing->{origin};
+               RouteDB::delete_interface($int);
+       } else {
+               
+               # for otherwise connected calls, that come in relayed from other nodes
+               # note that we cannot do any connections at this point
+               my $nref = Route::Node::get($thing->{origin});
+               if ($nref) {
+                       if (my $user = $thing->{user}) {
+                               my $ur = Route::get($user);
+                               if ($ur) {
+                                       if ($ur->isa('Route::Node')) {
+                                               $nref->del($ur);
+                                       } elsif ($ur->isa('Route::User')) {
+                                               $nref->del_user($ur);
+                                       }
+                               }
+                       }
+               }
+       }
+
+               
+       $thing->broadcast($dxchan);
+}
+
+sub new
+{
+       my $pkg = shift;
+       my $thing = $pkg->SUPER::new(origin=>$main::mycall, @_);
+       return $thing;
+}
+1;
index c098ca944edfb97825184cf8ab6543107826dbf5..f2938c1fdb3840436f40052f2c4804045af643db 100644 (file)
@@ -11,10 +11,8 @@ use strict;
 package Thingy::Hello;
 
 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;
+
+main::mkver($VERSION = q$Revision$);
 
 use DXChannel;
 use DXDebug;
@@ -103,7 +101,7 @@ sub handle
 sub new
 {
        my $pkg = shift;
-       my $thing = $pkg->SUPER::new(origin=>$main::mycall);
+       my $thing = $pkg->SUPER::new(origin=>$main::mycall, @_);
        return $thing;
 }
 1;