Skip to content
Extraits de code Groupes Projets
Valider fbdfe0f7 rédigé par TC's avatar TC
Parcourir les fichiers

Bugfix+taking reply_to into account

parent 15a1f984
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -11,7 +11,7 @@ use warnings; ...@@ -11,7 +11,7 @@ use warnings;
# est admin # est admin
# #
# Usage : # Usage :
# !usurp [#chan] nick!user@host command ... # !usurp [<reply to>] nick!user@host command ...
# ### # ###
sub usurp_main sub usurp_main
{ {
...@@ -19,11 +19,11 @@ sub usurp_main ...@@ -19,11 +19,11 @@ sub usurp_main
return 0 unless defined($ref_params->[1]); return 0 unless defined($ref_params->[1]);
my $chan = lc $reply_to; $reply_to = lc $reply_to;
if(substr($ref_params->[0], 0, 1) eq '#')
if($ref_params->[0] !~ /^(.*?)!(.*?)\@(.*?)$/i)
{ {
$chan = lc shift @{$ref_params}; $reply_to = shift @{$ref_params};
return 0 unless defined($ref_params->[1]);
} }
my $unh = shift @{$ref_params}; my $unh = shift @{$ref_params};
...@@ -44,7 +44,7 @@ sub usurp_main ...@@ -44,7 +44,7 @@ sub usurp_main
return 0; return 0;
} }
$event->{'to'} = $chan; $event->{'to'}[0] = $reply_to;
$event->{'args'} = [ $event->{'args'} = [
$Config::command_sign.$commande.' '.join(' ', @{$ref_params}) $Config::command_sign.$commande.' '.join(' ', @{$ref_params})
]; ];
...@@ -64,7 +64,7 @@ sub usurp_help ...@@ -64,7 +64,7 @@ sub usurp_help
{ {
my ($self, $event, $reply_to, $ref_params) = @_; my ($self, $event, $reply_to, $ref_params) = @_;
$self->privmsg($reply_to, "`".$Config::command_sign."usurp [#chan] ". $self->privmsg($reply_to, "`".$Config::command_sign."usurp [<reply to>] ".
"nick!user\@host command ...` ". "nick!user\@host command ...` ".
"=> usurp a user, and a chan if provided, for a command"); "=> usurp a user, and a chan if provided, for a command");
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter