add on_unload script routines to clean out hooks
This commit is contained in:
@@ -13,6 +13,7 @@ sub cdlfunc($); # thread, that checks and downloads stuff
|
|||||||
sub is_picture($);
|
sub is_picture($);
|
||||||
sub urlencode($);
|
sub urlencode($);
|
||||||
sub hookfn;
|
sub hookfn;
|
||||||
|
sub freehooks;
|
||||||
|
|
||||||
my $wgetpath;
|
my $wgetpath;
|
||||||
|
|
||||||
@@ -25,13 +26,14 @@ if (-f "/bin/wget") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
my $script_name = "Image URL Auto Grabber and Downloader, wget flavour";
|
my $script_name = "Image URL Auto Grabber and Downloader, wget flavour";
|
||||||
HexChat::register($script_name, '0.8', 'Automatically grabs and downloads image URLs via wget');
|
HexChat::register($script_name, '0.8.1', 'Automatically grabs and downloads image URLs via wget', \&freehooks);
|
||||||
|
|
||||||
HexChat::print("$script_name loaded\n");
|
HexChat::print("$script_name loaded\n");
|
||||||
HexChat::hook_print('Channel Message', \&hookfn);
|
my @hooks;
|
||||||
HexChat::hook_print('Channel Msg Hilight', \&hookfn);
|
push @hooks, HexChat::hook_print('Channel Message', \&hookfn);
|
||||||
HexChat::hook_print('Channel Action', \&hookfn);
|
push @hooks, HexChat::hook_print('Channel Msg Hilight', \&hookfn);
|
||||||
HexChat::hook_print('Channel Action Hilight', \&hookfn);
|
push @hooks, HexChat::hook_print('Channel Action', \&hookfn);
|
||||||
|
push @hooks, HexChat::hook_print('Channel Action Hilight', \&hookfn);
|
||||||
|
|
||||||
my $active = 0;
|
my $active = 0;
|
||||||
share($active);
|
share($active);
|
||||||
@@ -127,3 +129,11 @@ sub urlencode($) {
|
|||||||
undef $urlobj;
|
undef $urlobj;
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub freehooks {
|
||||||
|
foreach (@hooks) {
|
||||||
|
HexChat::unhook($_);
|
||||||
|
}
|
||||||
|
|
||||||
|
return HexChat::EAT_ALL;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user