1. decrease the default max length of PC16/19 to around 180 characters to be
slightly friendlier to ARC, which seems to have a difficulty reconstructing
lines from multiple packets. Also make the value settable via set/var.
+2. strip off blank spaces from the ends of lines of command output.
15Oct02=======================================================================
1. made some detail changes to the raw USDB data and the routines that
generate and operate on them. There were some bugs involving a few 'missing'
--- /dev/null
+#
+# set the send PC16 flag
+#
+# Copyright (c) 2002 - Dirk Koopman
+#
+# $Id$
+#
+
+my ($self, $line) = @_;
+my @args = split /\s+/, uc $line;
+my $call;
+my @out;
+
+return (1, $self->msg('e5')) if $self->priv < 9;
+
+foreach $call (@args) {
+ return (1, $self->msg('e12')) unless is_callsign($call);
+
+ my $user = DXUser->get_current($call);
+ if ($user) {
+ $user->wantsendpc16(1);
+ $user->put;
+ push @out, $self->msg('wspc16s', $call);
+ } else {
+ push @out, $self->msg('e3', "set/sendpc16", $call);
+ }
+}
+return (1, @out);
--- /dev/null
+#
+# set the want PC16 flag
+#
+# Copyright (c) 2002 - Dirk Koopman
+#
+# $Id$
+#
+
+my ($self, $line) = @_;
+my @args = split /\s+/, uc $line;
+my $call;
+my @out;
+
+return (1, $self->msg('e5')) if $self->priv < 9;
+
+foreach $call (@args) {
+ return (1, $self->msg('e12')) unless is_callsign($call);
+
+ my $user = DXUser->get_current($call);
+ if ($user) {
+ $user->wantpc16(1);
+ $user->put;
+ push @out, $self->msg('wpc16s', $call);
+ } else {
+ push @out, $self->msg('e3', "set/wantpc16", $call);
+ }
+}
+return (1, @out);
--- /dev/null
+#
+# unset the send PC16 flag
+#
+# Copyright (c) 2002 - Dirk Koopman
+#
+# $Id$
+#
+
+my ($self, $line) = @_;
+my @args = split /\s+/, uc $line;
+my $call;
+my @out;
+
+return (1, $self->msg('e5')) if $self->priv < 9;
+
+foreach $call (@args) {
+ return (1, $self->msg('e12')) unless is_callsign($call);
+
+ my $user = DXUser->get_current($call);
+ if ($user) {
+ $user->wantsendpc16(0);
+ $user->put;
+ push @out, $self->msg('wspc16u', $call);
+ } else {
+ push @out, $self->msg('e3', "unset/sendpc16", $call);
+ }
+}
+return (1, @out);
--- /dev/null
+#
+# unset the want PC16 flag
+#
+# Copyright (c) 2002 - Dirk Koopman
+#
+# $Id$
+#
+
+my ($self, $line) = @_;
+my @args = split /\s+/, uc $line;
+my $call;
+my @out;
+
+return (1, $self->msg('e5')) if $self->priv < 9;
+
+foreach $call (@args) {
+ return (1, $self->msg('e12')) unless is_callsign($call);
+
+ my $user = DXUser->get_current($call);
+ if ($user) {
+ $user->wantpc16(0);
+ $user->put;
+ push @out, $self->msg('wpc16u', $call);
+ } else {
+ push @out, $self->msg('e3', "unset/wantpc16", $call);
+ }
+}
+return (1, @out);
return ();
}
}
- return (@ans);
+ return map {s/[^\s]\s+$//; $_} @ans;
}
#
my $ncall = $field[1];
my $newline = "PC16^";
+ # do I want users from this channel?
+ unless ($self->user->wantpc16) {
+ dbg("PCPROT: don't send users to $self->{call}") if isdbg('chanerr');
+ return;
+ }
+ # is it me?
if ($ncall eq $main::mycall) {
dbg("PCPROT: trying to alter config on this node from outside!") if isdbg('chanerr');
return;
eph_del_regex("^PC16\\^$ncall.*$ucall");
+ # do I want users from this channel?
+ unless ($self->user->wantpc16) {
+ dbg("PCPROT: don't send users to $self->{call}") if isdbg('chanerr');
+ return;
+ }
if ($ncall eq $main::mycall) {
dbg("PCPROT: trying to alter config on this node from outside!") if isdbg('chanerr');
return;
sub send_local_config
{
my $self = shift;
- my $n;
+ my $node;
my @nodes;
my @localnodes;
my @remotenodes;
my @intcalls = map { $_->nodes } @localnodes if @localnodes;
my $ref = Route::Node::get($self->{call});
my @rnodes = $ref->nodes;
- for my $n (@intcalls) {
- push @remotenodes, Route::Node::get($n) unless grep $n eq $_, @rnodes;
+ for my $node (@intcalls) {
+ push @remotenodes, Route::Node::get($node) unless grep $node eq $_, @rnodes;
}
unshift @localnodes, $main::routeroot;
}
- send_route($self, \&pc19, scalar(@localnodes)+scalar(@remotenodes), @localnodes, @remotenodes);
+ $self->send_route(\&pc19, scalar(@localnodes)+scalar(@remotenodes), @localnodes, @remotenodes);
# get all the users connected on the above nodes and send them out
- foreach $n (@localnodes, @remotenodes) {
- if ($n) {
- send_route($self, \&pc16, 1, $n, map {my $r = Route::User::get($_); $r ? ($r) : ()} $n->users);
+ foreach $node (@localnodes, @remotenodes) {
+ if ($node) {
+ $self->send_route(\&pc16, 1, $node,
+ map {my $r = Route::User::get($_); $r ? ($r) : ()} $node->users)
+ if $self->user->wantsendpc16;
} else {
dbg("sent a null value") if isdbg('chanerr');
}
next if $dxchan == $self;
next if $dxchan == $main::me;
next if $dxchan->user->wantnp;
-
+ next if ($generate == \&pc16 || $generate==\&pc17) && !$dxchan->user->wantsendpc16;
+
$dxchan->send_route($generate, @_);
}
}
sub route_pc16
{
my $self = shift;
+ return unless $self->user->wantpc16;
broadcast_route($self, \&pc16, 1, @_);
}
sub route_pc17
{
my $self = shift;
+ return unless $self->user->wantpc16;
broadcast_route($self, \&pc17, 1, @_);
}
wantann_talk => '0,Talklike Anns,yesno',
wantpc90 => '1,Req PC90,yesno',
wantnp => '1,Req New Protocol,yesno',
- wantusers => '9,Want Users from node,yesno',
- wantsendusers => '9,Send users to node,yesno',
+ wantpc16 => '9,Want Users from node,yesno',
+ wantsendpc16 => '9,Send users to node,yesno',
lastoper => '9,Last for/oper,cldatetime',
nothere => '0,Not Here Text',
registered => '9,Registered?,yesno',
return _want('ann_talk', @_);
}
-sub wantusers
+sub wantpc16
{
- return _want('users', @_);
+ return _want('pc16', @_);
}
-sub wantsendusers
+sub wantsendpc16
{
- return _want('annsendusers', @_);
+ return _want('sendpc16', @_);
}
sub wantlogininfo
unsethop1 => 'usage: unset/hops <call> ann|spots|wwv|wcy',
unsethop2 => 'hops unset on $_[1] for $_[0]',
usernf => '*** User record for $_[0] not found ***',
+ wpc16s => 'Want PC16 enabled for $_[0]',
+ wpc16u => 'Want PC16 disabled for $_[0]',
+ wspc16s => 'Send PC16 enabled for $_[0]',
+ wspc16u => 'Send PC16 disabled for $_[0]',
wcy1 => '$_[0] is missing or out of range',
wcy2 => 'Duplicate WCY',
wcys => 'WCY enabled for $_[0]',