our @EXPORT = qw/addUser whois flags flag laston addPoints chattrG setHost setPNick deactivateUser getShips/;
sub addUser {
- my ($nick,$pnick) = @_;
- DB();
+ 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";
}
sub chattrG {
- my ($nick, $flags) = @_;
- DB();
- if (hc() || ($flags =~ /^(\+|-)?x$/ && $ND::address eq 'Assassin.users.netgamers.org')){
+ my ($msg, $command) = @_;
+
+ my ($nick, $flags);
+ if(defined $msg && $msg =~ /^(\S+) ((\+|-)?\w+)$/){
+ $nick = $1;
+ $flags = $2;
+ }else{
+ $ND::server->command("notice $ND::nick syntax: .chattr nick [-]flags | % can be used for wildcards \%arro% will match barrow, if a - is given then flags will be removed, otherwise added");
+ return;
+ }
+ if (hc()){# || ($flags =~ /^(\+|-)?x$/ && $ND::address eq 'Assassin.users.netgamers.org')){
my $f = $ND::DBH->prepare("SELECT uid,username FROM users WHERE username ILIKE ?");
$f->execute($nick);
my @user = $f->fetchrow();
}
sub deactivateUser {
- my ($nick) = @_;
- DB();
+ my ($msg, $command) = @_;
+
+ my $nick;
+ if(defined $msg && $msg =~ /^(\S+)$/){
+ $nick = $1;
+ }else{
+ $ND::server->command("notice $ND::nick syntax: .$command user");
+ return;
+ }
if (hc()){
my $f = $ND::DBH->prepare("SELECT uid,username FROM users WHERE username ILIKE ?");
$f->execute($nick);