use lib get_info 'xchatdir';
use Xchat::XPI;
-use Xchat::XPI::Net qw<resolve whois>;
+use Xchat::XPI::Net qw<resolve whois>;
+use Xchat::XPI::Utils qw<save_context>;
our $VERSION = '0.02';
sub dig_print {
my $p = $_[0];
my ($context, $req) = @{$_[1]};
- my $oldctxt = get_context;
+ my $guard = save_context;
set_context $context;
if ($p) {
my @a = $p->answer;
} else {
print $ph 'Request ' . $req->{host} . " timed out\n";
}
- set_context $oldctxt;
}
hook_command 'NETWHOIS', sub {
sub netwhois_print {
my $raw = $_[0];
my ($context, $req) = @{$_[1]};
- my $oldctxt = get_context;
+ my $guard = save_context;
set_context $context;
if ($raw) {
$raw =~ s/.*(Domain|inetnum)/$1/s;
} else {
output '*', 'No results for ' . $req->{host};
}
- set_context $oldctxt;
}
hook_command 'TLD', sub {