]> dxcluster.net Git - spider.git/commitdiff
added loginfo stuff
authordjk <djk>
Sun, 21 Nov 1999 15:26:48 +0000 (15:26 +0000)
committerdjk <djk>
Sun, 21 Nov 1999 15:26:48 +0000 (15:26 +0000)
added time to console
added setting ping interval and obscount

14 files changed:
Changes
cmd/set/logininfo.pl [new file with mode: 0644]
cmd/set/obscount.pl [new file with mode: 0644]
cmd/set/pinginterval.pl [new file with mode: 0644]
cmd/show/configuration.pl
cmd/unset/logininfo.pl [new file with mode: 0644]
perl/DXChannel.pm
perl/DXCommandmode.pm
perl/DXMsg.pm
perl/DXProt.pm
perl/DXUser.pm
perl/Messages
perl/cluster.pl
perl/console.pl

diff --git a/Changes b/Changes
index 446a850093c063d52653e81a47468187dc302167..01abe248bd34eefb36e32453cad927c9a3986e26 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,8 @@
+20Nov99=======================================================================
+1. Added set/unset logininfo which will tell anybody that has this set when
+someone has either logged in or out of this node.
+2. Added set/pinginterval command which alters the length of time between
+pings sent to nodes.
 19Nov99=======================================================================
 1. Added new version of sh/sun and also sh/moon from Steve K9AN
 2. Added rtt to who.
diff --git a/cmd/set/logininfo.pl b/cmd/set/logininfo.pl
new file mode 100644 (file)
index 0000000..0e0c658
--- /dev/null
@@ -0,0 +1,11 @@
+#
+# set the logininfo option for users
+#
+# Copyright (c) 1999 Dirk Koopman G1TLH
+#
+# $Id$
+#
+my $self = shift;
+$self->user->wantlogininfo(1);
+$self->logininfo(1);
+return (1, $self->msg('ok'));
diff --git a/cmd/set/obscount.pl b/cmd/set/obscount.pl
new file mode 100644 (file)
index 0000000..4579037
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# set ping interval for this node
+#
+# Copyright (c) 1998 - Dirk Koopman
+#
+# $Id$
+#
+
+my ($self, $line) = @_;
+my @args = split /\s+/, $line;
+my $call;
+my @out;
+my $user;
+my $val = int shift @args if @args;
+
+
+return (1, $self->msg('e5')) if $self->priv < 9;
+return (1, $self->msg('e14')) unless defined $val;
+return (1, $self->msg('e12')) unless @args;
+
+$val *= 60 if $val < 120;
+
+foreach $call (@args) {
+       $call = uc $call;
+       my $dxchan = DXChannel->get($call);
+       $user = $dxchan->user if $dxchan;
+       $user = DXUser->get($call) unless $user;
+       if ($user) {
+               unless ($user->sort eq 'A' || $user->sort eq 'S') {
+                       push @out, $self->msg('e13', $call);
+                       next;
+               }
+               $user->pingint($val);
+               if ($dxchan) {
+                       $dxchan->pingint($val);
+               } else {
+                       $user->close();
+               }
+               push @out, $self->msg('pingint', $call, $val);
+       } else {
+               push @out, $self->msg('e3', "Set/Pinginterval", $call);
+       }
+}
+return (1, @out);
diff --git a/cmd/set/pinginterval.pl b/cmd/set/pinginterval.pl
new file mode 100644 (file)
index 0000000..4579037
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# set ping interval for this node
+#
+# Copyright (c) 1998 - Dirk Koopman
+#
+# $Id$
+#
+
+my ($self, $line) = @_;
+my @args = split /\s+/, $line;
+my $call;
+my @out;
+my $user;
+my $val = int shift @args if @args;
+
+
+return (1, $self->msg('e5')) if $self->priv < 9;
+return (1, $self->msg('e14')) unless defined $val;
+return (1, $self->msg('e12')) unless @args;
+
+$val *= 60 if $val < 120;
+
+foreach $call (@args) {
+       $call = uc $call;
+       my $dxchan = DXChannel->get($call);
+       $user = $dxchan->user if $dxchan;
+       $user = DXUser->get($call) unless $user;
+       if ($user) {
+               unless ($user->sort eq 'A' || $user->sort eq 'S') {
+                       push @out, $self->msg('e13', $call);
+                       next;
+               }
+               $user->pingint($val);
+               if ($dxchan) {
+                       $dxchan->pingint($val);
+               } else {
+                       $user->close();
+               }
+               push @out, $self->msg('pingint', $call, $val);
+       } else {
+               push @out, $self->msg('e3', "Set/Pinginterval", $call);
+       }
+}
+return (1, @out);
index 6f2e1e935a8014f06c5373138675fc0de94d7307..6fe170a002b4311fc0f577dc901baa54da87209e 100644 (file)
@@ -16,7 +16,7 @@ my @val;
 
 push @out, "Node         Callsigns";
 if ($list[0] && $list[0] =~ /^NOD/) {
-       my @ch = sort {$a->call cmp $b->call} DXProt::get_all_ak1a();
+       my @ch = sort {$a->call cmp $b->call} DXChannel::get_all_ak1a();
        my $dxchan;
        
        foreach $dxchan (@ch) {
diff --git a/cmd/unset/logininfo.pl b/cmd/unset/logininfo.pl
new file mode 100644 (file)
index 0000000..1f2aa99
--- /dev/null
@@ -0,0 +1,12 @@
+#
+# unset the logininfo option for users
+#
+# Copyright (c) 1999 Dirk Koopman G1TLH
+#
+# $Id$
+#
+my $self = shift;
+$self->user->wantlogininfo(0);
+$self->logininfo(0);
+return (1, $self->msg('ok'));
+
index 9f7b8d180fefec8ce6f9184b0bbc122b5fc9bbc6..de9ecaa7540c5a9386853ad4610d19ebd86fbfbf 100644 (file)
@@ -78,11 +78,12 @@ use vars qw(%channels %valid);
                  inwwvfilter => '5,Input WWV Filter',
                  inspotfilter => '5,Input Spot Filter',
                  passwd => '9,Passwd List,parray',
-                 pingint => '9,Ping Interval ',
-                 nopings => '9,Ping Obs Count',
-                 lastping => '9,Ping last sent,atime',
-                 pingtime => '9,Ping totaltime,parray',
+                 pingint => '5,Ping Interval ',
+                 nopings => '5,Ping Obs Count',
+                 lastping => '5,Ping last sent,atime',
+                 pingtime => '5,Ping totaltime,parray',
                  pingave => '0,Ping ave time',
+                 logininfo => '9,Login info req,yesno',
                 );
 
 # object destruction
@@ -149,6 +150,44 @@ sub get_all
        return values(%channels);
 }
 
+#
+# gimme all the ak1a nodes
+#
+sub get_all_ak1a
+{
+       my @list = DXChannel->get_all();
+       my $ref;
+       my @out;
+       foreach $ref (@list) {
+               push @out, $ref if $ref->is_ak1a;
+       }
+       return @out;
+}
+
+# return a list of all users
+sub get_all_users
+{
+       my @list = DXChannel->get_all();
+       my $ref;
+       my @out;
+       foreach $ref (@list) {
+               push @out, $ref if $ref->is_user;
+       }
+       return @out;
+}
+
+# return a list of all user callsigns
+sub get_all_user_calls
+{
+       my @list = DXChannel->get_all();
+       my $ref;
+       my @out;
+       foreach $ref (@list) {
+               push @out, $ref->call if $ref->is_user;
+       }
+       return @out;
+}
+
 # obtain a channel object by searching for its connection reference
 sub get_by_cnum
 {
@@ -331,6 +370,22 @@ sub closeall
        }
 }
 
+#
+# Tell all the users that we have come in or out (if they want to know)
+#
+sub tell_login
+{
+       my ($self, $m) = @_;
+       
+       # send info to all logged in thingies
+       my @dxchan = get_all_users();
+       my $dxchan;
+       foreach $dxchan (@dxchan) {
+               next if $dxchan == $self;
+               $dxchan->send($dxchan->msg($m, $self->{call})) if $dxchan->{logininfo};
+       }
+}
+
 # various access routines
 
 #
index c516dc489049f85ee57d6cc0ae50671de48b666d..99e2bfe5fe55692b5d70adc418f6e1b235ff7719 100644 (file)
@@ -77,6 +77,7 @@ sub start
        $self->{talk} = $user->wanttalk;
        $self->{wx} = $user->wantwx;
        $self->{dx} = $user->wantdx;
+       $self->{logininfo} = $user->wantlogininfo;
        $self->{here} = 1;
        
        # add yourself to the database
@@ -91,7 +92,7 @@ sub start
                DXProt::broadcast_all_ak1a($_);
        }
        Log('DXCommand', "$call connected");
-       
+
        # send prompts and things
        my $info = DXCluster::cluster();
        $self->send("Cluster:$info");
@@ -100,9 +101,10 @@ sub start
        $self->send($self->msg('qll')) if !$user->qra || (!$user->lat && !$user->long);
        $self->send($self->msg('hnodee1')) if !$user->qth;
        $self->send($self->msg('m9')) if DXMsg::for_me($call);
-
-       
        $self->send($self->msg('pr', $call));
+       
+       $self->tell_login('loginu');
+       
 }
 
 #
@@ -308,14 +310,17 @@ sub finish
                my $node = DXNode->get($main::mycall);
                $node->{dxchan} = 0;
        }
-       my $ref = DXCluster->get_exact($call);
        
        # issue a pc17 to everybody interested
        my $nchan = DXChannel->get($main::mycall);
        my $pc17 = $nchan->pc17($self);
        DXProt::broadcast_all_ak1a($pc17);
-       
+
+       # send info to all logged in thingies
+       $self->tell_login('logoutu');
+
        Log('DXCommand', "$call disconnected");
+       my $ref = DXCluster->get_exact($call);
        $ref->del() if $ref;
 }
 
index 98c41ef1d7f935f899f2688a6aca1b06f1a1c195..a3c0798e73f948cfcebdf74665da8b069dc243fd 100644 (file)
@@ -575,7 +575,7 @@ sub queue_msg
        my $call = shift;
        my $ref;
        my $clref;
-       my @nodelist = DXProt::get_all_ak1a();
+       my @nodelist = DXChannel::get_all_ak1a();
        
        # bat down the message list looking for one that needs to go off site and whose
        # nearest node is not busy.
index ff746b5e116667eb1bcd3954eaae913da5182155..64727b8a7d993b3e9ba480ac1871ae780dcaf922 100644 (file)
@@ -127,8 +127,10 @@ sub start
        $self->send_now('E',"0");
        
        # ping neighbour node stuff
-       $self->pingint($user->pingint || 3*60);
-       $self->nopings(3);
+       my $ping = $user->pingint;
+       $ping = 5*60 unless defined $ping;
+       $self->pingint($ping);
+       $self->nopings($user->nopings || 2);
        $self->pingtime([ ]);
 
        # send initialisation string
@@ -144,6 +146,9 @@ sub start
        $self->state('init');
        $self->pc50_t(time);
 
+       # send info to all logged in thingies
+       $self->tell_login('loginn');
+
        Log('DXProt', "$call connected");
 }
 
@@ -775,7 +780,7 @@ sub process
                } 
 
                # send a ping out on this channel
-               if ($t >= $dxchan->pingint + $dxchan->lastping) {
+               if ($dxchan->pingint && $t >= $dxchan->pingint + $dxchan->lastping) {
                        if ($dxchan->nopings <= 0) {
                                $dxchan->disconnect;
                        } else {
@@ -836,7 +841,10 @@ sub finish
        
        # now broadcast to all other ak1a nodes that I have gone
        broadcast_ak1a(pc21($call, 'Gone.'), $self) unless $self->{isolate};
-       
+
+       # send info to all logged in thingies
+       $self->tell_login('logoutn');
+
        Log('DXProt', $call . " Disconnected");
        $ref->del() if $ref;
 }
@@ -1068,7 +1076,7 @@ sub broadcast_ak1a
 {
        my $s = shift;                          # the line to be rebroadcast
        my @except = @_;                        # to all channels EXCEPT these (dxchannel refs)
-       my @dxchan = get_all_ak1a();
+       my @dxchan = DXChannel::get_all_ak1a();
        my $dxchan;
        
        # send it if it isn't the except list and isn't isolated and still has a hop count
@@ -1085,7 +1093,7 @@ sub broadcast_all_ak1a
 {
        my $s = shift;                          # the line to be rebroadcast
        my @except = @_;                        # to all channels EXCEPT these (dxchannel refs)
-       my @dxchan = get_all_ak1a();
+       my @dxchan = DXChannel::get_all_ak1a();
        my $dxchan;
        
        # send it if it isn't the except list and isn't isolated and still has a hop count
@@ -1104,7 +1112,7 @@ sub broadcast_users
        my $sort = shift;           # the type of transmission
        my $fref = shift;           # a reference to an object to filter on
        my @except = @_;                        # to all channels EXCEPT these (dxchannel refs)
-       my @dxchan = get_all_users();
+       my @dxchan = DXChannel::get_all_users();
        my $dxchan;
        my @out;
        
@@ -1145,43 +1153,6 @@ sub broadcast_list
        }
 }
 
-#
-# gimme all the ak1a nodes
-#
-sub get_all_ak1a
-{
-       my @list = DXChannel->get_all();
-       my $ref;
-       my @out;
-       foreach $ref (@list) {
-               push @out, $ref if $ref->is_ak1a;
-       }
-       return @out;
-}
-
-# return a list of all users
-sub get_all_users
-{
-       my @list = DXChannel->get_all();
-       my $ref;
-       my @out;
-       foreach $ref (@list) {
-               push @out, $ref if $ref->is_user;
-       }
-       return @out;
-}
-
-# return a list of all user callsigns
-sub get_all_user_calls
-{
-       my @list = DXChannel->get_all();
-       my $ref;
-       my @out;
-       foreach $ref (@list) {
-               push @out, $ref->call if $ref->is_user;
-       }
-       return @out;
-}
 
 #
 # obtain the hops from the list for this callsign and pc no 
index 9d534ae9d1835f6b2eaaeb4ab6b0fc33a2378260..956957e8260f1218f8eebeacd677b76795f98ef4 100644 (file)
@@ -58,6 +58,8 @@ $filename = undef;
                  wantwx => '0,Rec WX,yesno',
                  wantdx => '0,Rec DX Spots,yesno',
                  pingint => '9,Node Ping interval',
+                 nopings => '9,Ping Obs Count',
+                 wantlogininfo => '9,Login info req,yesno',
                 );
 
 no strict;
@@ -359,5 +361,10 @@ sub wanttalk
        return _want('talk', @_);
 }
 
+sub wantlogininfo
+{
+       return _want('logininfo', @_);
+}
+
 1;
 __END__
index 570e4e7580d50375f4c218ea629f5ef95b189439..efbc033f5ad1c24e0041fe297b65a7871b1e1e69 100644 (file)
@@ -53,6 +53,8 @@ package DXM;
                                e11 => 'Can\'t use $main:mycall as target',
                                e12 => 'Need a node callsign',
                                e13 => '$_[0] is not a node',
+                               e14 => 'First argument must be numeric and > 0',
+                               
                                emaile1 => 'Please enter your email address, set/email <your e-mail address>',
                                emaila => 'Your E-Mail Address is now \"$_[0]\"',
                                email => 'E-mail address set to: $_[0]',
@@ -82,6 +84,10 @@ package DXM;
                                lockout => '$_[0] Locked out',
                                lockoutc => '$_[0] Created and Locked out',
                                lockoutun => '$_[0] Unlocked',
+                               loginu => 'User $_[0] has logged in',
+                               logoutu => 'User $_[0] has logged out',
+                               loginn => 'Node $_[0] has logged in',
+                               logoutn => 'Node $_[0] has logged out',
                                m1 => 'Enter Subject (30 characters):',
                                m2 => 'Copy of msg $_[0] sent to $_[1]',
                                m3 => 'Sorry, $_[0] is an unacceptable TO address',
@@ -120,6 +126,8 @@ package DXM;
                                pingo => 'Ping Started to $_[0]',
                                pingi => 'Ping Returned from $_[0] $_[1] (Ave $_[2]) secs',
                                pinge1 => 'Cannot ping yourself!',
+                               pingint => 'Ping interval on $_[0] set to $_[1] secs',
+
                                pr => '$_[0] de $main::mycall $main::cldate $main::ztime >',
                                pr2 => '($_[0]) de $main::mycall $main::cldate $main::ztime >',
                                priv => 'Privilege level changed on $_[0]',
index dd12a9dfe22dc564058cadadb463bde7994f281a..64cbab11ed1d6efc69ed2adc3f6896eb85ca8dee 100755 (executable)
@@ -305,7 +305,7 @@ STDOUT->autoflush(1);
 Log('cluster', "DXSpider V$version started");
 
 # banner
-print "DXSpider DX Cluster Version $version\nCopyright (c) 1998 Dirk Koopman G1TLH\n";
+print "DXSpider DX Cluster Version $version\nCopyright (c) 1998-1999 Dirk Koopman G1TLH\n";
 
 # load Prefixes
 print "loading prefixes ...\n";
index 887600e31ee6438ca9f96188b13fd5c2e60b5d93..594bc67eea73c0c8762b1c6598a455616b50ba52 100755 (executable)
@@ -28,6 +28,7 @@ BEGIN {
 use Msg;
 use DXVars;
 use DXDebug;
+use DXUtil;
 use IO::File;
 use Curses;
 
@@ -176,7 +177,10 @@ sub show_screen
        }
     my $shl = @shistory;
        my $add = "-$spos-$shl";
-    $scr->addstr(LINES()-4, 0, '-' x (COLS() - (length($call) + length($add))));
+    my $time = ztime(time);
+       my $str =  "-" . $time . '-' x (COLS() - (length($call) + length($add) + length($time) + 1));
+       $scr->addstr(LINES()-4, 0, $str);
+       
        $scr->attrset($mycallcolor) if $has_colors;
        $scr->addstr("$call");
        $scr->attrset(COLOR_PAIR(0)) if $has_colors;
@@ -429,12 +433,13 @@ Msg->set_event_handler(\*STDIN, "read" => \&rec_stdin);
 for (;;) {
        my $t;
        Msg->event_loop(1, 1);
-       $top->refresh() if $top->is_wintouched;
-       $bot->refresh();
        $t = time;
        if ($t > $lasttime) {
+               show_screen();
                $lasttime = $t;
        }
+       $top->refresh() if $top->is_wintouched;
+       $bot->refresh();
 }
 
 exit(0);