Skip Menu |

This queue is for tickets about the POE-Session-Irssi CPAN distribution.

Report information
The Basics
Id: 29119
Status: open
Priority: 0/
Queue: POE-Session-Irssi

People
Owner: martijn [...] cpan.org
Requestors: immute [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Delayed handlers issue
During some irssi signal handlers, you cannot stop the signal or access data inside irssi that was available when the signal was fired. Ie, info about the kicked nick in a "message kick" handler. Solution: POE::Session::Irssi::_connect_stuff should use $session->callback() rather than $session->postback()
I'm not sure what you mean by "access data inside irssi that was available when the signal was fired. Ie, info about the kicked nick in a "message kick" handler.". Please add some defailed information(code?) on what you are trying to do and how that fails.
This is taken from the included file: 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 ).
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 ).