From 030fed38f22b907ce1d13ad3ac254a14b3c7c389 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Sat, 19 Apr 2014 10:35:27 +0000 Subject: [PATCH] Allow kicking from private message --- PBot/ChanOpCommands.pm | 17 +++++++++++++---- PBot/VERSION.pm | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/PBot/ChanOpCommands.pm b/PBot/ChanOpCommands.pm index 582f3524..17ed1baf 100644 --- a/PBot/ChanOpCommands.pm +++ b/PBot/ChanOpCommands.pm @@ -100,15 +100,24 @@ sub kick_user { return ""; } + # used in private message if(not $from =~ /^#/) { - $self->{pbot}->logger->log("$nick!$user\@$host attempted to /msg kick\n"); - return "/msg $nick Kick must be used in the channel."; + if(not $arguments =~ /(^#\S+) (\S+) (.*)/) { + $self->{pbot}->logger->log("$nick!$user\@$host: invalid arguments to kick\n"); + return "/msg $nick Usage from private message: kick "; + } + $self->{pbot}->chanops->add_op_command($1, "kick $1 $2 $3"); + $self->{pbot}->chanops->gain_ops($1); + return "/msg $nick Kicking $2 from $1 with reason '$3'"; } + + # used in channel if(not $arguments =~ /(.*?) (.*)/) { $self->{pbot}->logger->log("$nick!$user\@$host: invalid arguments to kick\n"); - return "/msg $nick Usage: !kick "; + return "/msg $nick Usage: kick "; } - unshift @{ $self->{pbot}->chanops->{op_commands}->{$from} }, "kick $from $1 $2"; + + $self->{pbot}->chanops->add_op_command($from, "kick $from $1 $2"); $self->{pbot}->chanops->gain_ops($from); } diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index e8f07017..907239f3 100644 --- a/PBot/VERSION.pm +++ b/PBot/VERSION.pm @@ -13,7 +13,7 @@ use warnings; # These are set automatically by the build/commit script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 545, + BUILD_REVISION => 546, BUILD_DATE => "2014-04-19", };