diff options
author | Yorhel <git@yorhel.nl> | 2009-08-09 10:58:37 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2009-08-09 10:59:19 +0200 |
commit | ed515875f2fc77a3c77deaf94fe5de619cb53e01 (patch) | |
tree | 4bde06b65e1a855efdb2ffac2d6ea6f4618168d8 | |
parent | f22af6be086ebb0bf6f63dc65a0cc984eed71f06 (diff) |
Multi::IRC: Fixed authentication level checking bug
Everyone had access to the commands with the |8 flag enabled. Oops!
-rw-r--r-- | lib/Multi/IRC.pm | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Multi/IRC.pm b/lib/Multi/IRC.pm index 6b3a1dbb..ff122405 100644 --- a/lib/Multi/IRC.pm +++ b/lib/Multi/IRC.pm @@ -218,12 +218,13 @@ sub command { # mask, dest, msg my($cmd, $arg) = ($1, $2); return 0 if !exists $_[HEAP]{commands}{$cmd} || ($_[HEAP]{commands}{$cmd} & 8) && !$addressed; + my $lvl = $_[HEAP]{commands}{$cmd} & ~8; my $usr = parse_user($mask); return $_[KERNEL]->yield(reply => $dest, - $dest eq $_[HEAP]{channels}[0] ? 'Only OPs can do that!' : "Only $_[HEAP]{channel}[0] OPs can do that!", $usr) || 1 - if $_[HEAP]{commands}{$cmd} == 1 && !$irc->is_channel_operator($_[HEAP]{channels}[0], $usr); + $dest->[0] eq $_[HEAP]{channels}[0] ? 'Only OPs can do that!' : "Only $_[HEAP]{channel}[0] OPs can do that!", $usr) || 1 + if $lvl == 1 && !$irc->is_channel_operator($_[HEAP]{channels}[0], $usr); return $_[KERNEL]->yield(reply => $dest, 'You are not my master!', $usr) || 1 - if $_[HEAP]{commands}{$cmd} == 2 && !grep matches_mask($_, $mask), @{$_[HEAP]{masters}}; + if $lvl == 2 && !grep matches_mask($_, $mask), @{$_[HEAP]{masters}}; return $_[KERNEL]->yield('cmd_'.$cmd, $usr, $dest, $arg, $mask) || 1; } |