X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=services.pl;h=e9f13d687f3ecf2acfdfb256351b9133c71e070c;hb=edd1cbfd1a969e16d8df9988eb448a53c97c02e7;hp=8fd3b9065d256cc4baefbafdcb0f658020c2bb33;hpb=b9c3e00cbf52ff5ddb0d79fd66a6877f6feb508d;p=perl%2Fscripts%2Fxchat.git diff --git a/services.pl b/services.pl index 8fd3b90..e9f13d6 100755 --- a/services.pl +++ b/services.pl @@ -3,10 +3,11 @@ package Xchat::VPIT::Services; use strict; use warnings; -use Xchat qw/:all/; +use Xchat qw<:all>; use lib get_info 'xchatdir'; use Xchat::XPI; +use Xchat::XPI::Utils qw; our $VERSION = '0.03'; @@ -32,15 +33,14 @@ hook_command 'ID', sub { hook_command 'AID', sub { my $forcepasswd = $_[0][1]; - my $oldctxt = get_context; - my @contexts = get_servers_ctxt; + my @contexts = get_servers_ctxt; + my $guard = save_context; for (@contexts) { set_context $_; my $passwd = $forcepasswd || get_info 'nickserv'; next unless $passwd; command 'ID ' . $passwd; } - set_context $oldctxt; return EAT_ALL; }, { help_text => 'AID [password], identify you on all servers' @@ -63,8 +63,8 @@ hook_command 'AGHOST', sub { my $target = $_[0][1] || get_prefs 'irc_nick1'; return EAT_ALL unless $target; my $forcepasswd = $_[0][2]; - my $oldctxt = get_context; - my @contexts = get_servers_ctxt; + my @contexts = get_servers_ctxt; + my $guard = save_context; for (@contexts) { set_context $_; my $passwd = $forcepasswd || get_info 'nickserv'; @@ -73,7 +73,6 @@ hook_command 'AGHOST', sub { command join ' ', 'GHOST', $target, $passwd; } } - set_context $oldctxt; return EAT_ALL; }, { help_text => 'AGHOST [nick] [password], kill usurping clients on all servers' @@ -92,7 +91,7 @@ hook_command "C$_", \&csmode, { data => $_, help_text => join ' ', $_, '[nicks] ,', (lc $_), 'the specified targets (or you if none) on the current channel via ChanServ' -} for map { $_, "DE$_" } qw/VOICE HALFOP OP PROTECT/; +} for map { $_, "DE$_" } qw; $ph = Xchat::XPI->new( name => 'IRC Services',