aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2018-09-22 20:02:02 +1200
committerDavid Phillips <david@sighup.nz>2018-09-22 20:18:54 +1200
commit8a590377ea2066e247b03fde5f2a205c02049956 (patch)
tree2565b0fac8d0fc84dd3d501400342bdb43d83735
parent8c885fc58ab739de5d4f54d90d9741d0adf8e83a (diff)
downloadidalius-8a590377ea2066e247b03fde5f2a205c02049956.tar.xz
Admin: Don't deref scalar in /q
-rw-r--r--Plugin/Admin.pm22
1 files changed, 14 insertions, 8 deletions
diff --git a/Plugin/Admin.pm b/Plugin/Admin.pm
index a9a4c3c..518a076 100644
--- a/Plugin/Admin.pm
+++ b/Plugin/Admin.pm
@@ -106,13 +106,15 @@ sub join_channel {
sub part {
my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
+ $where = $where->[0] if ref($where) eq "ARRAY";
+
return unless is_admin($logger, $who, $ided);
return "Syntax: part <channel1> [channel2 ...] [partmsg]" unless
- is_channel($where->[0]) or
+ is_channel($where) or
(@arguments >= 1 and is_channel($arguments[0]));
- if ((@arguments == 0 and is_channel($where->[0])) or @arguments >= 1 and not is_channel($arguments[0])) {
- $rest = "$where->[0] $rest";
+ if ((@arguments == 0 and is_channel($where)) or @arguments >= 1 and not is_channel($arguments[0])) {
+ $rest = "$where $rest";
}
my $nick = (split /!/, $who)[0];
@@ -125,11 +127,13 @@ sub part {
sub mode {
my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
+ $where = $where->[0] if ref($where) eq "ARRAY";
+
return unless is_admin($logger, $who, $ided);
return "Syntax: mode <everything>" unless @arguments > 0;
- if (not is_channel($arguments[0] and is_channel($where->[0]))) {
- $rest = "$where->[0] $rest";
+ if (not is_channel($arguments[0]) and is_channel($where)) {
+ $rest = "$where $rest";
}
$irc->yield(mode => $rest);
@@ -138,13 +142,15 @@ sub mode {
sub kick {
my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
+ $where = $where->[0] if ref($where) eq "ARRAY";
+
return unless is_admin($logger, $who, $ided);
return "Syntax: kick <channel> <nick> [reason]" unless
@arguments >= 2 and is_channel($arguments[0])
- or @arguments >= 1 and is_channel($where->[0]);
+ or @arguments >= 1 and is_channel($where);
- if (is_channel($where->[0]) and not is_channel($arguments[0])) {
- $rest = "$where->[0] $rest";
+ if (is_channel($where) and not is_channel($arguments[0])) {
+ $rest = "$where $rest";
}
my ($channel, $kickee, undef, $reason) = $rest =~ /^(\S+)\s(\S+)((?:\s)(.*))?$/;