SYNOPSIS
use strict;
use warnings;
use POE qw(Component::IRC::State Component::IRC::Plugin::Proxy Component::IRC::Plugin::Connector);
my $irc = POE::Component::IRC::State->spawn();
POE::Session->create(
package_states => [
main => [ qw(_start) ],
],
heap => { irc => $irc },
);
$poe_kernel->run();
sub _start {
my ($kernel, $heap) = @_[KERNEL, HEAP];
$heap->{irc}->yield( register => 'all' );
$heap->{proxy} = POE::Component::IRC::Plugin::Proxy->new( bindport => 6969, password => "m00m00" );
$heap->{irc}->plugin_add( 'Connector' => POE::Component::IRC::Plugin::Connector->new() );
$heap->{irc}->plugin_add( 'Proxy' => $heap->{proxy} );
$heap->{irc}->yield ( connect => { Nick => 'testbot', Server => 'someserver.com' } );
return;
}
DESCRIPTION
POE::Component::IRC::Plugin::Proxy is a POE::Component::IRC plugin that provides lightweight IRC proxy/bouncer server to your POE::Component::IRC bots. It enables multiple IRC clients to be hidden behind a single IRC client-server connection.Spawn a POE::Component::IRC::State session and add in a POE::Component::IRC::Plugin::Proxy plugin object, specifying a bindport and a password the connecting IRC clients have to use. When the component is connected to an IRC network a listening port is opened by the plugin for multiple IRC clients to connect.
Neat, huh? >;o)
This plugin will activate POE::Component::IRC's raw events ("irc_raw") by calling "$irc->raw_events(1)".
This plugin requires the IRC component to be POE::Component::IRC::State or a subclass thereof.
METHODS
new
Takes a number of arguments:'password', the password to require from connecting clients;
'bindaddress', a local address to bind the listener to, default is 'localhost';
'bindport', what port to bind to, default is 0, ie. randomly allocated by OS;
Returns an object suitable for passing to POE::Component::IRC's "plugin_add" method.