hi,
i just copy some pieces from my unreleased ho_challenge.pl
i open my own window. if its already open we switch to it.
sub get_passphrase_window {
my ( $server ) = @_;
my ( $win ) = Irssi::window_find_name ( $win_name );
if ( ref( $win ) ) {
$win->change_server ( $server );
$win->set_active ();
} else {
$win = Irssi::Windowitem::window_create( $win_name, 0 );
$win = Irssi::active_win ();
$win->set_name ( $win_name );
$win->set_history ( $win_name );
$win->change_server ( $server );
$win->set_active ();
}
return $win;
}
this signal handler does the prompt handling. it catches any input from
my own window.
signal_add_first 'send command', =>sub {
my ( $command, $server, $witem ) = @_;
my ( $win ) = Irssi::active_win();
if ( $win->{name} eq $win_name ) {
signal_stop ();
#
# do your stuff here.
#
}
};
i create the window on some signal handler. of course you can do it from
some command aswell. friends-peder.pl shows it. ;) oh yeah... some of
the code is borrowed from peder's script. :)
signal_add 'event 386' => sub {
my ( $server, $args, $sender_nick, $sender_address ) = @_;
my $win = get_passphrase_window( $server );
my $ph = $win->create_handle(['CRAP']);
print ( $ph "dont worry of leading command chars (". Irssi::parse_special ('$K')
."). the whole string is used as passphrase. even if it starts with your command
chars. if you have an empty pass just press enter.");
print ( $ph "%9%R%7press return to get to the password prompt%9" );
};
you can catch me on ircnet/quakenet/efnet/freenode as darix, if you have
any questions.
darix
--
irssi - the client of the smart and beautiful people
http://www.irssi.de/