use strict;
use Irssi::Irc;
use Irssi;
use Glib;
use POE qw(Loop::Glib);
use POE::Session::Irssi;
POE::Session::Irssi->create(
irssi_signals => {
# "message kick", SERVER_REC, char *channel, char *nick, char *kicker, char *address, char *reason
"message kick" => sub {
my ($server, $channel, $kicked_nick, $kicker_nick, $kicker_address, $reason) = @{ $_[ARG1] };
my ($kicker_ident, $kicker_host) = split /@/, $kicker_address, 2;
my $kicked_address = eval { $server->channel_find( $channel )->nick_find( $kicked_nick )->{host} };
my ($kicked_ident, $kicked_host) = split /@/, $kicked_address, 2; # EH?
my $network = $server->{chatnet};
print Dumper([
$kicked_nick, $kicked_ident, $kicked_host,
$kicker_nick, $kicker_ident, $kicker_host,
]);
#$_[KERNEL]->yield('insert', ['kick', time(), $kicked_nick, $kicked_ident, $kicked_host, $kicker_nick, $kicker_ident, $kicker_host, $network, $channel, $reason]);
},
},
);
__END__
Basically, because POE::Session::Irssi uses $session->postback(), when that handler finally gets around to running,
C< $server->channel_find( $channel )->nick_find( $kicked_nick )->{host} >
will fail because Irssis has deleted that nick from its internal data structures.
If you use callback() rather than postback(), the handler will get called before "the signal handler goes out of scope"
( from Irssi's Point of View anyway ).