aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2018-09-21 23:58:51 +1200
committerDavid Phillips <david@sighup.nz>2018-09-21 23:58:51 +1200
commit31624f13d0768ecf67fcf457fe717b5fad41f6e6 (patch)
tree519347019a0678bf0713b17c849838f22ee0871f
parent53dc3a3a10c7d81406eae60aec84028da53b2f0a (diff)
downloadidalius-31624f13d0768ecf67fcf457fe717b5fad41f6e6.tar.xz
Admin: Allow in-channel kick without specifying channel
-rw-r--r--Plugin/Admin.pm9
1 files 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 <channel> <nick> [reason]" unless @arguments >= 2;
+ return "Syntax: kick <channel> <nick> [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];