From 8395a06df5874b66beb2c0fe668edaa9dbc81670 Mon Sep 17 00:00:00 2001
From: ElTata <eltata@firemail.cc>
Date: Fri, 12 Jun 2020 16:29:17 +0200
Subject: [PATCH] bugfix in STATUS command

asking for the command while not being logged in
used to throw a warning, not anymore
---
 Irpg/Users.pm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/Irpg/Users.pm b/Irpg/Users.pm
index b251082..5d80c20 100644
--- a/Irpg/Users.pm
+++ b/Irpg/Users.pm
@@ -97,7 +97,7 @@ sub register {
                 $rps->{$arg[0]}{stats}{$_} = 1;
             }
             $rps->{$arg[0]}{class} = Irpg::Classes::Farmer->new($rps->{$arg[0]}{stats});
-            $rps->{$arg[0]}{points} = 1;
+            $rps->{$arg[0]}{points} = 0;
             $rps->{$arg[0]}{actions} = 0;
             $rps->{$arg[0]}{next_f} = 0;
             $rps->{$arg[0]}{online} = 1;
@@ -210,7 +210,10 @@ sub logout {
 sub status {
     return unless ($opts->{statuscmd});
     my ($userhost, $usernick, $username, $source, @arg) = @_;
-    my $asked = exists($arg[0]) ? $arg[0] : $username;
+    my $asked = exists($arg[0]) ?
+                    $arg[0] :
+                    (defined($username) ?
+                        $username : $usernick);
 
     $asked = Irpg::Main::finduser($asked) unless (exists($rps->{$asked}));
     $asked = Irpg::Main::finduser($asked, 1) unless ($asked);
-- 
GitLab