]> git.vpit.fr Git - perl/scripts/xchat.git/blobdiff - Xchat/XPI/Events.pm
Fix callback argument passing in Xchat::XPI::Events
[perl/scripts/xchat.git] / Xchat / XPI / Events.pm
index 3bb797ffd1930287f46b0c9b696449dc2ce9984b..3b3963b32f502359a748ecbd0d26972bdc103b48 100644 (file)
@@ -6,7 +6,7 @@ use warnings;
 use Xchat qw<:all>;
 
 use lib get_info 'xchatdir';
-use Xchat::XPI;
+use Xchat::XPI::Utils qw<called_from_script>;
 
 use constant DEFAULT_DELAY => 1000;
 
@@ -21,7 +21,7 @@ sub _delay_cb {
 }
 
 sub delay {
- my $delay = $_[0];
+ my ($delay, @args) = @_;
 
  if (defined $delay) {
   $delay = int $delay;
@@ -29,7 +29,9 @@ sub delay {
   $delay = DEFAULT_DELAY;
  }
 
- hook_timer $delay, \&_delay_cb, { data => \@_ };
+ called_from_script {
+  hook_timer $delay, \&_delay_cb, { data => \@args }
+ }
 }
 
 sub _filter_cb {
@@ -45,7 +47,11 @@ sub _filter_cb {
 }
 
 sub filter {
- hook_print $_[0], \&_filter_cb, { data => \@_ };
+ my ($from, $cb, $to) = @_;
+
+ called_from_script {
+  hook_print $from, \&_filter_cb, { data => [ $cb, $to ] }
+ }
 }
 
 use base qw<Exporter>;