X-Git-Url: https://git.camperquake.de/gitweb.cgi?p=videosite.git;a=blobdiff_plain;f=videosite-irssi.pl;h=aa838c0897430e1ea78aa78b1236890cbe405d57;hp=441ad3ecb541993cdb584300ff3ae82d461d3bd4;hb=HEAD;hpb=ba69db073455cd39baf7ff3834a4475ed7536a6e diff --git a/videosite-irssi.pl b/videosite-irssi.pl index 441ad3e..aa838c0 100644 --- a/videosite-irssi.pl +++ b/videosite-irssi.pl @@ -9,6 +9,9 @@ use File::Spec; use Module::Load; use XML::Simple; use JSON -support_by_pp; +use Carp; + +$SIG{ __DIE__ } = sub { Carp::confess( @_ ) }; # # List of foreground colors. This list is not complete, it just @@ -211,7 +214,8 @@ sub videosite_hook { my ($cmdline, $server, $witem) = @_; my %event = ( message => $cmdline, - ewpf => sub { defined($witem)?$witem->print($_[0]):Irssi::print($_[0]) }, + io => sub { defined($witem)?$witem->print($_[0], MSGLEVEL_CLIENTCRAP):Irssi::print($_[0]) }, + window => defined($witem)?$witem->{server}->{real_address} . "/" . $witem->{name}:"", ); libvideosite::handle_command(\%event); @@ -223,10 +227,11 @@ sub videosite_hook { # sub message_hook { my ($server, $msg, $nick, $userhost, $channel) = @_; - my $evitem = $server->window_item_find($channel); + my $witem = $server->window_item_find($channel); my %event = ( message => $msg, - ewpf => sub { defined($evitem)?$evitem->print($_[0]):Irssi::print($_[0]) }, + io => sub { defined($witem)?$witem->print($_[0], MSGLEVEL_CLIENTCRAP):Irssi::print($_[0]) }, + window => defined($witem)?$witem->{server}->{real_address} . "/" . $witem->{name}:"", ); libvideosite::check_for_link(\%event); @@ -255,13 +260,14 @@ sub videosite_reset { config_get => \&config_get, config_set => \&config_set, config_has => \&config_has, - config_save => \&config_save, + config_save => sub { 1 }, config_del => \&config_del, color => \&colorpair, module_path => sub { return File::Spec->catfile(Irssi::get_irssi_dir(), 'scripts') }, quote => sub { s/%/%%/g; return $_ }, reload => \&videosite_reset, - _debug => sub { 1 }, + # irssi needs this to prevent fork()ed child processes becoming zombies: + wait_for_child => sub { Irssi::pidwait_add($_[0]) }, })) { Irssi::print(sprintf("videosite API register failed: %s", $libvideosite::error)); return 0;