X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=Xchat%2FXPI%2FEvents.pm;h=0f120a543e5ed6ef38fe6f2344b530eafe99051d;hb=7e00cc69db0ee7a4379b5378f1673efc4b531ae8;hp=52fb57c753e657f4691cda2e0a72c731a7932ab5;hpb=b99caf8b93311fb2f0bec1fa724008fcd7e551d6;p=perl%2Fscripts%2Fxchat.git diff --git a/Xchat/XPI/Events.pm b/Xchat/XPI/Events.pm index 52fb57c..0f120a5 100644 --- a/Xchat/XPI/Events.pm +++ b/Xchat/XPI/Events.pm @@ -5,6 +5,9 @@ use warnings; use Xchat qw<:all>; +use lib get_info 'xchatdir'; +use Xchat::XPI::Utils qw; + use constant DEFAULT_DELAY => 1000; our $VERSION = '0.04'; @@ -18,7 +21,7 @@ sub _delay_cb { } sub delay { - my $delay = $_[0]; + my $delay = shift; if (defined $delay) { $delay = int $delay; @@ -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 { @@ -42,7 +47,11 @@ sub _filter_cb { } sub filter { - hook_print $_[0], \&_filter_cb, { data => \@_ }; + my $from = shift; + + called_from_script { + hook_print $from, \&_filter_cb, { data => \@_ } + } } use base qw;