From: djk Date: Sun, 21 Nov 1999 15:26:48 +0000 (+0000) Subject: added loginfo stuff X-Git-Tag: R_1_35~10 X-Git-Url: http://dxspider.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=bca5cd40374f12da5e0d46980e54bffc61fdc9c9;p=spider.git added loginfo stuff added time to console added setting ping interval and obscount --- diff --git a/Changes b/Changes index 446a8500..01abe248 100644 --- 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 index 00000000..0e0c6589 --- /dev/null +++ b/cmd/set/logininfo.pl @@ -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 index 00000000..45790377 --- /dev/null +++ b/cmd/set/obscount.pl @@ -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 index 00000000..45790377 --- /dev/null +++ b/cmd/set/pinginterval.pl @@ -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/show/configuration.pl b/cmd/show/configuration.pl index 6f2e1e93..6fe170a0 100644 --- a/cmd/show/configuration.pl +++ b/cmd/show/configuration.pl @@ -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 index 00000000..1f2aa995 --- /dev/null +++ b/cmd/unset/logininfo.pl @@ -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')); + diff --git a/perl/DXChannel.pm b/perl/DXChannel.pm index 9f7b8d18..de9ecaa7 100644 --- a/perl/DXChannel.pm +++ b/perl/DXChannel.pm @@ -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 # diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index c516dc48..99e2bfe5 100644 --- a/perl/DXCommandmode.pm +++ b/perl/DXCommandmode.pm @@ -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; } diff --git a/perl/DXMsg.pm b/perl/DXMsg.pm index 98c41ef1..a3c0798e 100644 --- a/perl/DXMsg.pm +++ b/perl/DXMsg.pm @@ -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. diff --git a/perl/DXProt.pm b/perl/DXProt.pm index ff746b5e..64727b8a 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -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 diff --git a/perl/DXUser.pm b/perl/DXUser.pm index 9d534ae9..956957e8 100644 --- a/perl/DXUser.pm +++ b/perl/DXUser.pm @@ -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__ diff --git a/perl/Messages b/perl/Messages index 570e4e75..efbc033f 100644 --- a/perl/Messages +++ b/perl/Messages @@ -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 ', 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]', diff --git a/perl/cluster.pl b/perl/cluster.pl index dd12a9df..64cbab11 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -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"; diff --git a/perl/console.pl b/perl/console.pl index 887600e3..594bc67e 100755 --- a/perl/console.pl +++ b/perl/console.pl @@ -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);