From 0dc47d7ba34d8ea89f210c024863d01b2b32122b Mon Sep 17 00:00:00 2001 From: minima Date: Wed, 16 Oct 2002 17:18:21 +0000 Subject: [PATCH] make sure that sentences are less than the maximum --- cmd/dx.pl | 2 +- perl/DXProtout.pm | 49 +++++++++++++++++++++++++++++------------------ perl/DXUser.pm | 12 ++++++++++++ perl/Messages | 1 + 4 files changed, 44 insertions(+), 20 deletions(-) diff --git a/cmd/dx.pl b/cmd/dx.pl index eefbb860..46d427e0 100644 --- a/cmd/dx.pl +++ b/cmd/dx.pl @@ -103,7 +103,7 @@ return (1, @out) unless $valid; # Store it here (but only if it isn't baddx) my $t = (int ($main::systime/60)) * 60; -return (1, $self->msg('dup')) if Spot::dup($freq, $spotted, $t, $line, $spotter); +return (1, $self->msg('dupspot')) if Spot::dup($freq, $spotted, $t, $line, $spotter); my @spot = Spot::prepare($freq, $spotted, $t, $line, $spotter, $main::mycall); if ($DXProt::baddx->in($spotted) || $freq =~ /^69/ || $localonly) { diff --git a/perl/DXProtout.pm b/perl/DXProtout.pm index 80b1a5d6..1ef9c022 100644 --- a/perl/DXProtout.pm +++ b/perl/DXProtout.pm @@ -25,6 +25,10 @@ $BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0)) $main::build += $VERSION; $main::branch += $BRANCH; +use vars qw($sentencelth); + +$sentencelth = 200; + # # All the PCxx generation routines # @@ -85,15 +89,18 @@ sub pc16 my $ncall = $node->call; my @out; - while (@_) { - my $str = "PC16^$ncall"; - for ( ; @_ && length $str < 200; ) { - my $ref = shift; - $str .= sprintf "^%s %s %d", $ref->call, $ref->conf ? '*' : '-', $ref->here; + my $s = ""; + for (@_) { + next unless $_; + my $ref = $_; + my $str = sprintf "^%s %s %d", $ref->call, $ref->conf ? '*' : '-', $ref->here; + if (length($s) + length($str) >= $sentencelth) { + push @out, "PC16^$ncall" . $s . sprintf "^%s^", get_hops(16); + $s = ""; } - $str .= sprintf "^%s^", get_hops(16); - push @out, $str; + $s .= $str; } + push @out, "PC16^$ncall" . $s . sprintf "^%s^", get_hops(16) if length $s; return @out; } @@ -124,20 +131,24 @@ sub pc18 sub pc19 { my @out; - - while(@_) { - my $str = "PC19"; - for (; @_ && length $str < 200;) { - my $ref = shift; - my $call = $ref->call; - my $here = $ref->here; - my $conf = $ref->conf; - my $version = $ref->version; - $str .= "^$here^$call^$conf^$version"; + my @in; + + my $s = ""; + for (@_) { + next unless $_; + my $ref = $_; + my $call = $ref->call; + my $here = $ref->here; + my $conf = $ref->conf; + my $version = $ref->version; + my $str = "^$here^$call^$conf^$version"; + if (length($s) + length($str) >= $sentencelth) { + push @out, "PC19" . $s . sprintf "^%s^", get_hops(19); + $s = ""; } - $str .= sprintf "^%s^", get_hops(19); - push @out, $str; + $s .= $str; } + push @out, "PC19" . $s . sprintf "^%s^", get_hops(19) if length $s; return @out; } diff --git a/perl/DXUser.pm b/perl/DXUser.pm index afc70cb0..f31b79e6 100644 --- a/perl/DXUser.pm +++ b/perl/DXUser.pm @@ -78,6 +78,8 @@ $lrusize = 2000; 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', lastoper => '9,Last for/oper,cldatetime', nothere => '0,Not Here Text', registered => '9,Registered?,yesno', @@ -583,6 +585,16 @@ sub wantann_talk return _want('ann_talk', @_); } +sub wantusers +{ + return _want('users', @_); +} + +sub wantsendusers +{ + return _want('annsendusers', @_); +} + sub wantlogininfo { my $self = shift; diff --git a/perl/Messages b/perl/Messages index cd9e572b..bfe83a26 100644 --- a/perl/Messages +++ b/perl/Messages @@ -49,6 +49,7 @@ package DXM; disc4 => 'No Channel or connection but orphan $_[0] disconnected', done => 'Done', dup => 'Sorry, this is a duplicate', + dupspot => 'Sorry, this is a duplicate (wait a minute and try again)', dx1 => 'Frequency $_[0] not in band (see show/band); usage: DX [BY call] freq call comments', dx2 => 'Need a callsign; usage: DX [BY call] freq call comments', dx3 => 'The callsign or frequency is invalid', -- 2.43.0