X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=Usermgm.pm;fp=Usermgm.pm;h=d3083f482ce1485a75c98e2b60709e5198b6cb12;hb=1305a2fbb95ce9ba58ab7e2f90df92715aa7f28e;hp=6771d65cf4dbd00a20912cfdaf5283b76f03f743;hpb=66ce902aff4400269e2c2de3b9dbeee61448e3d5;p=NDIRC.git diff --git a/Usermgm.pm b/Usermgm.pm index 6771d65..d3083f4 100644 --- a/Usermgm.pm +++ b/Usermgm.pm @@ -25,38 +25,8 @@ require Exporter; our @ISA = qw/Exporter/; -our @EXPORT = qw/addUser whois flags flag laston addPoints chattrG setHost setPNick deactivateUser getShips getFleet/; +our @EXPORT = qw/whois flags flag laston addPoints chattrG setHost setPNick deactivateUser getShips getFleet/; -sub addUser { - my ($msg, $command) = @_; - - my ($nick,$pnick); - if(defined $msg && $msg =~ /^(\w+)(?: ([^.\s]+))?$/){ - $nick = $1; - $pnick = $2; - }else{ - $ND::server->command("notice $ND::nick syntax: .$command nick [pnick] | nick must be alphanum characters, if no pnick is given then it will be set to nick"); - return; - } - if (hc()){ - $pnick = $nick unless $pnick; - my $host = "$pnick.users.netgamers.org"; - my ($username,$hostname,$p_nick) = $ND::DBH->selectrow_array(q{SELECT username, hostmask,pnick - FROM users WHERE username ILIKE ? OR hostmask ILIKE ? OR pnick ILIKE ?} - ,undef,$nick,$host,$pnick); - if ((not defined $username) && $ND::DBH->do("INSERT INTO users (username,hostmask,pnick,password) VALUES(?,?,?,'')" - ,undef,$nick,$host,$pnick)){ - $ND::server->command("msg $ND::target Added $ND::B$nick(/$pnick)$ND::B with host: $ND::B$host$ND::B"); - }elsif(defined $username){ - $ND::server->command("msg $ND::target $ND::B$username ($p_nick)$ND::B already exists with host: $ND::B$hostname$ND::B."); - - }else{ - $ND::server->command("msg $ND::target Something went wrong when trying to add $ND::B$nick ($pnick)$ND::B with host: $ND::B$host$ND::B, ".$ND::DBH->errstr); - } - }else{ - $ND::server->command("msg $ND::target Only HCs are allowed to add users"); - } -} sub whois { my ($msg, $command) = @_;