use strict;
use warnings;
+use Xchat qw<:all>;
+
+use lib get_info 'xchatdir';
+use Xchat::XPI::Utils qw<called_from_script>;
+
use IO::Socket::INET;
use Net::DNS;
-use Xchat qw<:all>;
-
our $VERSION = '0.03';
my $res;
return unless $sock;
$sock->autoflush(1);
- return Xchat::hook_fd($sock, \&_dns_recv, {
- flags => FD_READ,
- data => [ $callback, $args ],
- });
+ return called_from_script {
+ Xchat::hook_fd($sock, \&_dns_recv, {
+ flags => FD_READ,
+ data => [ $callback, $args ],
+ });
+ }
}
sub _dns_recv {
print $sock "$host\x0D\x0A";
$sock->shutdown(1); # stop writing
- return Xchat::hook_fd($sock, \&_whois_recv, {
- flags => FD_READ,
- data => [ $callback, $args ],
- });
+ return called_from_script {
+ Xchat::hook_fd($sock, \&_whois_recv, {
+ flags => FD_READ,
+ data => [ $callback, $args ],
+ });
+ }
}
sub _whois_recv {