add set/local_node.
fix warning for empty version in PC19.
+06Mar06=======================================================================
+1. Fix warning on empty PC19s.
+2. Add new command set/local_node to allow people to see logins/outs on other
+related nodes.
+3. Add new command set/buddy to allow people to see when their favorite
+chum(s) logins/out.
14Feb06=======================================================================
1. Turn R and SFI around in mrtg.pl.
13Feb06=======================================================================
'^set/user', 'unset/node', 'unset/node',
'^set$', 'apropos set', 'apropos',
'^sho?w?/u$', 'show/user', 'show/user',
- '^sho?w?/bu', 'show/files bulletins', 'show/files',
+ '^sho?w?/bul', 'show/files bulletins', 'show/files',
'^sho?w?/co?n?\w*/a', 'show/configuration all', 'show/configuration',
'^sho?w?/co?n?\w*/n', 'show/configuration nodes', 'show/configuration',
'^sho?w?/c$', 'show/configuration', 'show/configuration',
=== 5^SET/BBS <call> [<call>..]^Make the callsign a BBS
+=== 0^SET/BUDDY <call> [<call>..]^Add this call to my buddy list
+=== 0^UNSET/BUDDY <call> [<call>..]^Remove this call from my buddy list
+A notification message
+is sent to you automatically if anybody on your buddy list logs in or
+out of any node in this cluster.
+
=== 5^SET/CLX <call> [<call>..]^Make the callsign an CLX node
=== 9^SET/DEBUG <name>^Add a debug level to the debug set
the languages available are en (English), de (German), es (Spanish),
Czech (cz), French (fr), Portuguese (pt), Italian (it) and nl (Dutch).
+=== 5^SET/LOCAL_NODE^Add node to the local_node group
+=== 5^UNSET/LOCAL_NODE^Remove node from the local_node group
+The 'local_node' group is a group of nodes that you want a user
+to perceive as effectively one big node. At the moment, this extends
+only to announcing whenever a user is logging in or out of one of
+the nodes in the group (if those users have SET/LOGININFO).
+
+The local node group is as setup on this node. If you want the other
+nodes to also include this node and all the other nodes specified, then
+you must get those nodes to also run this command (or rcmd them to do
+so).
+
+In principle, therefore, each node determines its own local node group
+and these can overlap with other nodes' views.
+
=== 0^SET/LOCATION <lat & long>^Set your latitude and longitude
=== 9^SET/SYS_LOCATION <lat & long>^Set your cluster latitude and longitude
In order to get accurate headings and such like you must tell the system
Display all the bad words in the system, see SET/BADWORD
for more information.
+=== 0^SHOW/BUDDY^Show your list of buddies
+See SET/BUDDY for more information about buddies.
+
=== 0^SHOW/CHAT [<group>] [<lines>]^Show any chat or conferencing
This command allows you to see any chat or conferencing that has
occurred whilst you were away. SHOW/CHAT on its own will show data for
#
-# join a group
+# join a group (note this applies only to users)
#
# Copyright (c) 2003 - Dirk Koopman G1TLH
#
--- /dev/null
+#
+# add a buddy
+#
+# Copyright (c) 2006 - Dirk Koopman G1TLH
+#
+# $Id$
+#
+
+my ($self, $line) = @_;
+my @args = split /\s+/, uc $line;
+my $group;
+my @out;
+
+my $buddies = $self->user->buddies || [];
+
+foreach my $call (@args) {
+ push(@out, $self->msg('e22', $call)), next unless is_callsign($call);
+ next if $call eq $self->call;
+ push @$buddies, $call unless grep $_ eq $call, @$buddies;
+ push @out, $self->msg('buddya', $call);
+}
+
+$self->user->put;
+
+return (1, @out);
--- /dev/null
+#
+# add these nodes to the 'local_node' group
+#
+# Copyright (c) 2006 - Dirk Koopman G1TLH
+#
+# $Id$
+#
+
+my ($self, $line) = @_;
+my @args = split /\s+/, uc $line;
+my @out;
+
+return (1, $self->msg('e5')) unless $self->priv >= 5;
+
+foreach my $call (@args) {
+ my $user = DXUser->get_current($call);
+ push(@out, $self->msg('e3', 'set/localnode', $call)), next unless $user;
+ push(@out, $self->msg('e13', $call)), next unless $user->is_node;
+ my $group = $user->group || [];
+ push @$group, 'local_node' unless grep $_ eq 'local_node', @$group;
+ my $dxchan = DXChannel::get($call);
+ $dxchan->group($group) if $dxchan;
+ push @out, $self->msg('lgset', $call);
+ $user->put;
+}
+
+return (1, @out);
--- /dev/null
+#
+# show your buddies
+#
+# Copyright (c) 2006 - Dirk Koopman G1TLH
+#
+# $Id$
+#
+
+my ($self) = @_;
+my $buddies = $self->user->buddies || [];
+my @out;
+my @l;
+
+foreach my $call (@$buddies) {
+ if (@l >= 5) {
+ push @out, sprintf "%-12s %-12s %-12s %-12s %-12s", @l;
+ @l = ();
+ }
+ push @l, $call;
+}
+push @l, "" while @l < 5;
+push @out, sprintf "%-12s %-12s %-12s %-12s %-12s", @l;
+return (1, @out);
$call = "($call)" unless $dxchan->here;
push @l, $call;
- my $i = 0;
foreach my $ref (@val) {
- if ($i >= 5) {
+ if (@l >= 5) {
push @out, sprintf "%-12s %-12s %-12s %-12s %-12s %-12s", @l;
@l = ();
push @l, "";
- $i = 0;
}
my $s = $ref->call;
$s ||= '???';
$s = sprintf "(%s)", $s unless $ref->here;
push @l, $s;
- $i++;
}
- push @l, "" while ($i++ < 5);
+ push @l, "" while @l < 5;
push @out, sprintf "%-12s %-12s %-12s %-12s %-12s %-12s", @l;
}
} else {
push @l, $call;
@val = sort $node->users;
- my $i = 0;
if (@val == 0 && $node->usercount) {
push @l, sprintf "(%d users)", $node->usercount;
}
foreach $call (@val) {
- if ($i >= 5) {
+ if (@l >= 5) {
push @out, sprintf "%-12s %-12s %-12s %-12s %-12s %-12s", @l;
@l = ();
push @l, "";
- $i = 0;
}
my $uref = Route::User::get($call);
my $s = $call;
$s = "$call?";
}
push @l, $s;
- $i++;
}
- push @l, "" while ($i++ < 5);
+ push @l, "" while @l < 5;
push @out, sprintf "%-12s %-12s %-12s %-12s %-12s %-12s", @l;
}
}
my $node = $main::routeroot;
push @out, join(' ', $self->msg('userconn'), $main::mycall);
my $call;
- my $i = 0;
my @l;
my @val = sort $node->users;
foreach $call (@val) {
- if ($i >= 5) {
+ if (@l >= 5) {
push @out, sprintf "%-12s %-12s %-12s %-12s %-12s", @l;
@l = ();
- $i = 0;
}
my $uref = Route::User::get($call);
my $s = $call;
$s = "$call?";
}
push @l, $s;
- $i++;
}
- push @l, "" while $i++ < 5;
+ push @l, "" while @l < 5;
push @out, sprintf "%-12s %-12s %-12s %-12s %-12s", @l;
}
--- /dev/null
+#
+# remove a buddy from the list
+#
+# Copyright (c) 2006 - Dirk Koopman G1TLH
+#
+# $Id$
+#
+
+my ($self, $line) = @_;
+my @args = split /\s+/, uc $line;
+my $buddies;
+my @out;
+
+my @buddies = @{$self->user->buddies};
+
+foreach my $call (@args) {
+ push(@out, $self->msg('e22', $call)), next unless is_callsign($call);
+ next if $call eq $self->call;
+ @buddies = grep $_ ne $call, @buddies;
+ push @out, $self->msg('buddyu', $call);
+}
+
+$self->user->buddies(\@buddies);
+$self->user->put;
+
+return (1, @out);
--- /dev/null
+#
+# remove these nodes from the 'local_node' group
+#
+# Copyright (c) 2006 - Dirk Koopman G1TLH
+#
+# $Id$
+#
+
+my ($self, $line) = @_;
+my @args = split /\s+/, uc $line;
+my @out;
+
+return (1, $self->msg('e5')) unless $self->priv >= 5;
+
+foreach my $call (@args) {
+ my $user = DXUser->get_current($call);
+ push(@out, $self->msg('e3', 'set/localnode', $call)), next unless $user;
+ push(@out, $self->msg('e13', $call)), next unless $user->is_node;
+ my $group = $user->group || [];
+ my @new = grep {$_ ne 'local_node'} @$group;
+ $user->group(\@new);
+ my $dxchan = DXChannel::get($call);
+ $dxchan->group(\@new) if $dxchan;
+ push @out, $self->msg('lgunset', $call);
+ $user->put;
+}
+
+return (1, @out);
[ '^[-A-Z0-9]+ de [-A-Z0-9]+ \d\d-\w\w\w-\d\d\d\d \d\d\d\dZ', COLOR_PAIR(0) ],
[ '^[-A-Z0-9]+ de [-A-Z0-9]+ ', COLOR_PAIR(6) ],
[ '^WX', COLOR_PAIR(3) ],
- [ '^(User|Node)\b', COLOR_PAIR(8) ],
+ [ '^(User|Node|Buddy)\b', COLOR_PAIR(8) ],
[ '^New mail', A_BOLD|COLOR_PAIR(5) ],
);
if (defined $user) {
$self->{user} = $user;
$self->{lang} = $user->lang;
- $user->new_group() if !$user->group;
+ $user->new_group unless $user->group;
+ $user->new_buddies unless $user->buddies;
$self->{group} = $user->group;
$self->{sort} = $user->sort;
}
#
sub tell_login
{
- my ($self, $m) = @_;
+ my ($self, $m, $call) = @_;
+
+ $call ||= $self->{call};
+
+ # send info to all logged in thingies
+ my @dxchan = get_all_users();
+ my $dxchan;
+ foreach $dxchan (@dxchan) {
+ next if $dxchan == $self;
+ next if $dxchan->{call} eq $main::mycall;
+ $dxchan->send($dxchan->msg($m, $call)) if $dxchan->{logininfo};
+ }
+}
+
+#
+# Tell all the users if a buddy is logged or out
+#
+sub tell_buddies
+{
+ my ($self, $m, $call) = @_;
+
+ $call ||= $self->{call};
# send info to all logged in thingies
my @dxchan = get_all_users();
foreach $dxchan (@dxchan) {
next if $dxchan == $self;
next if $dxchan->{call} eq $main::mycall;
- $dxchan->send($dxchan->msg($m, $self->{call})) if $dxchan->{logininfo};
+ $dxchan->send($dxchan->msg($m, $call)) if grep $_ eq $call, @{$dxchan->user->buddies} ;
}
}
}
$self->tell_login('loginu');
+ $self->tell_buddies('loginb');
# do we need to send a forward/opernam?
my $lastoper = $user->lastoper || 0;
# send info to all logged in thingies
$self->tell_login('logoutu');
+ $self->tell_login('logoutb');
LogDbg('DXCommand', "$call disconnected");
push @rout, $parent->add_user($call, $flags);
}
+ # send info to all logged in thingies
+ $self->tell_login('loginu', $call) if DXUser->get_current($ncall)->is_local_node;
+ $self->tell_buddies('loginb', $call);
# add this station to the user database, if required
- $call =~ s/-\d+$//o; # remove ssid for users
+# $call =~ s/-\d+$//o; # remove ssid for users
my $user = DXUser->get_current($call);
$user = DXUser->new($call) if !$user;
$user->homenode($parent->call) if !$user->homenode;
$parent = Route->new($ncall); # throw away
}
+ # send info to all logged in thingies
+ $self->tell_login('logoutu', $ucall) if DXUser->get_current($ncall)->is_local_node;
+ $self->tell_buddies('logoutb', $ucall);
+
if (eph_dup($line)) {
dbg("PCPROT: dup PC17 detected") if isdbg('chanerr');
return;
# check for sane parameters
# $ver = 5000 if $ver eq '0000';
+ next unless $ver && $ver =~ /^\d+$/;
next if $ver < 5000; # only works with version 5 software
next if length $call < 3; # min 3 letter callsigns
next if $call eq $main::mycall;
annok => '9,Accept Announces?,yesno', # accept his announces?
lang => '0,Language',
hmsgno => '0,Highest Msgno',
- group => '0,Chat Group,parray', # used to create a group of users/nodes for some purpose or other
+ group => '0,Group,parray', # used to create a group of users/nodes for some purpose or other
+ buddies => '0,Buddies,parray',
isolate => '9,Isolate network,yesno',
wantbeep => '0,Req Beep,yesno',
wantann => '0,Req Announce,yesno',
$self->{group} = [ 'local' ];
}
+# set up empty buddies (only happens for them's that connect direct)
+sub new_buddies
+{
+ my $self = shift;
+ $self->{buddies} = [ ];
+}
+
#
# return a prompt for a field
#
return $self->{sort} =~ /[ACRSX]/;
}
+sub is_local_node
+{
+ my $self = shift;
+ return grep $_ eq 'local_node', @{$self->{group}};
+}
+
sub is_user
{
my $self = shift;
beepon => 'Beeps are now on',
believes => 'Believe node $_[0] via $_[1]',
believeu => 'Don\'t believe node $_[0] via $_[1]',
+ buddya => '$_[0] has been added to your buddies',
+ buddyu => '$_[0] has been removed from your buddies',
call1 => 'Callsign lookup via $_[0]:',
conother => 'Sorry $_[0] you are connected to me on another port',
concluster => 'Sorry $_[0] you are already connected elsewhere on the cluster (on $_[1])',
lange2 => 'failed to set language on $_[0]',
lastconn => 'Last connect',
leave => 'leaving group $_[0]',
+ lgset => 'Added $_[0] to the local node group',
+ lgunset => 'Removed $_[0] from the local node group',
lh1 => '$main::data/hop_table.pl doesn\'t exist',
local1 => 'Local',
loce1 => 'Please enter your location,, set/location <latitude longitude>',
lockoutc => '$_[0] Created and Locked out',
lockoutun => '$_[0] Unlocked',
lockoutuse => 'usage: sh/lockout <call>|ALL',
+ loginb => 'Buddy $_[0] has logged in',
+ logoutb => 'Buddy $_[0] has logged out',
loginu => 'User $_[0] has logged in',
logoutu => 'User $_[0] has logged out',
loginn => 'Node $_[0] has logged in',