From 56fd7417545aa9de3101434bc88156b5eebb37ab Mon Sep 17 00:00:00 2001 From: Dirk Koopman Date: Tue, 18 Jan 2022 21:02:52 +0000 Subject: [PATCH] fix (un)set/registered --- Changes | 2 ++ perl/DXProtHandle.pm | 9 ++++++--- perl/DXUser.pm | 9 +++++++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Changes b/Changes index f07bfcd1..f0dd66b2 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,5 @@ +18Jan22======================================================================= +1. fix (un)set/registered. 09Jan22======================================================================= 1. Add the New Year CTY-3201 prefix data. 08Jan22======================================================================= diff --git a/perl/DXProtHandle.pm b/perl/DXProtHandle.pm index 23c17f0c..b051fad3 100644 --- a/perl/DXProtHandle.pm +++ b/perl/DXProtHandle.pm @@ -1562,13 +1562,16 @@ sub _decode_pc92_call my $build = $part[2] || 0; my $ip = $part[3] || ''; - if ($version =~ /[,.]/) { + if (is_ipaddr($version)) { $ip = $version; $version = 0; } - $version =~ s/\D+//g; + $version =~ s/\D//g; $build =~ s/^0\.//; - $build =~ s/\D+//g; + $build =~ s/\D//g; + $version ||= 0; + $build ||= 0; + if ($ip) { $ip =~ s/,/:/g; $ip =~ s/^::ffff://i; diff --git a/perl/DXUser.pm b/perl/DXUser.pm index dd56498e..ef447562 100644 --- a/perl/DXUser.pm +++ b/perl/DXUser.pm @@ -899,10 +899,15 @@ sub lastping sub registered { my $self = shift; + my $val; + if (defined $_[0]) { + $val = unpad($_[0]); + $self->{registered} = $val; + } if (exists $self->{registered}) { - return $self->{registered} || 0; + $val = $self->{registered} // 0; } - return ''; # to stop undef warnings + return $val // 0 ; # to stop undef warnings } 1; -- 2.43.0