From 31624f13d0768ecf67fcf457fe717b5fad41f6e6 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Fri, 21 Sep 2018 23:58:51 +1200 Subject: Admin: Allow in-channel kick without specifying channel --- Plugin/Admin.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Plugin/Admin.pm b/Plugin/Admin.pm index b4c4768..c2c4f55 100644 --- a/Plugin/Admin.pm +++ b/Plugin/Admin.pm @@ -136,9 +136,14 @@ sub kick { my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_; return unless is_admin($logger, $who, $ided); - return "Syntax: kick [reason]" unless @arguments >= 2; + return "Syntax: kick [reason]" unless + @arguments >= 2 and is_channel($arguments[0]) + or @arguments >= 1 and is_channel($where->[0]); + + if (is_channel($where->[0]) and not is_channel($arguments[0])) { + $rest = "$where->[0] $rest"; + } - # FIXME should use $where if it's a channel (?) my ($channel, $kickee, undef, $reason) = $rest =~ /^(\S+)\s(\S+)((?:\s)(.*))?$/; if ($channel and $kickee) { my $nick = (split /!/, $who)[0]; -- cgit v1.1