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

Modif mineure dans Yessir

Nouveau module pour usurper l'identité d'un utilisateur (à utiliser pour le débug surtout)
parent 8fb5da2e
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
package Usurp; # right = owner ; command = usurp
use strict;
use warnings;
# ###
# usurp_main
# Usurpe l'identité d'un autre utilisateur le temps d'une commande, si le user
# est admin
#
# Usage :
# !usurp [#chan] nick!user@host command ...
# ###
sub usurp_main
{
my ($conn, $event, $reply_to, $ref_params) = @_;
return 0 unless defined($ref_params->[1]);
my $chan = $reply_to;
if(substr($ref_params->[0], 0, 1) eq '#')
{
$chan = shift @{$ref_params};
return 0 unless defined($ref_params->[1]);
}
my $unh = shift @{$ref_params};
my $commande = shift @{$ref_params};
if($unh =~ /^(.*?)!(.*?)\@(.*?)$/i)
{
my ($nick, $user, $host) = ($1, $2, $3);
$event->{'from'} = $unh;
$event->{'nick'} = $nick;
$event->{'user'} = $user;
$event->{'host'} = $host;
$event->{'userhost'} = $user.'@'.$host;
}
else
{
return 0;
}
$event->{'to'} = $chan;
$event->{'args'} = [
$Config::command_sign.$commande.' '.join(' ', @{$ref_params})
];
$::logger->debug("Running process_command with identity '$unh'");
$conn->{'cmdtool'}->process_command($commande, $ref_params, $conn, $event, $reply_to);
return 1;
} # Fin usurp_main
# ###
# usurp_help
# Affiche l'aide de la commande '!usurp'
# ###
sub usurp_help
{
my ($self, $event, $reply_to, $ref_params) = @_;
$self->privmsg($reply_to, "`".$Config::command_sign."usurp [#chan] ".
"nick!user\@host command ...` ".
"=> usurp a user, and a chan if provided, for a command");
return 1;
} # Fin usurp_help
1;
__END__
...@@ -20,7 +20,7 @@ sub yessir_main ...@@ -20,7 +20,7 @@ sub yessir_main
$self->privmsg($reply_to, " / \\"); $self->privmsg($reply_to, " / \\");
return 1; return 1;
} } # Fin yessir_main
# ### # ###
......
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