]> git.vpit.fr Git - perl/scripts/xchat.git/blobdiff - opers.pl
Add better context handling helpers
[perl/scripts/xchat.git] / opers.pl
index 87a01c42d1b7c5e8bfa5e3d4b0b7ae011f9bda9c..66c9c0b17974b39253a3c03c8b2e7c0e93eb39b5 100755 (executable)
--- a/opers.pl
+++ b/opers.pl
@@ -7,6 +7,7 @@ use Xchat qw<:all>;
 
 use lib get_info 'xchatdir';
 use Xchat::XPI;
+use Xchat::XPI::Utils qw<save_context>;
 
 our $VERSION = '0.03';
 
@@ -27,7 +28,7 @@ hook_server '352', sub {
  push @{$chans{$_->{type}}}, $_ for grep $_->{server} eq $serv,
                                      get_list 'channels';
 
- my $oldctxt = get_context;
+ my $guard = save_context;
 
  my $onachan;
  for (@{$chans{2}}) {
@@ -45,8 +46,6 @@ hook_server '352', sub {
   print_op $nick, $host;
  }
 
- set_context $oldctxt;
-
  return EAT_NONE;
 };