]> git.vpit.fr Git - perl/scripts/xchat.git/blobdiff - Xchat/XPI/Events.pm
Pretend that the xchat functions in XPI are called from the script
[perl/scripts/xchat.git] / Xchat / XPI / Events.pm
index d851caaeb961d04e705cd3753527ff4d627cd006..0f120a543e5ed6ef38fe6f2344b530eafe99051d 100644 (file)
@@ -5,6 +5,9 @@ use warnings;
 
 use Xchat qw<:all>;
 
+use lib get_info 'xchatdir';
+use Xchat::XPI::Utils qw<called_from_script>;
+
 use constant DEFAULT_DELAY => 1000;
 
 our $VERSION = '0.04';
@@ -26,7 +29,9 @@ sub delay {
   $delay = DEFAULT_DELAY;
  }
 
- hook_timer $delay, \&_delay_cb, { data => \@_ };
+ called_from_script {
+  hook_timer $delay, \&_delay_cb, { data => \@_ }
+ }
 }
 
 sub _filter_cb {
@@ -44,7 +49,9 @@ sub _filter_cb {
 sub filter {
  my $from = shift;
 
- hook_print $from, \&_filter_cb, { data => \@_ };
+ called_from_script {
+  hook_print $from, \&_filter_cb, { data => \@_ }
+ }
 }
 
 use base qw<Exporter>;