1POE::Component::IRC::PlUusgeirn:C:oPnrtorxiyb(u3t)ed PerPlOED:o:cCuommepnotnaetnito:n:IRC::Plugin::Proxy(3)
2
3
4

NAME

6       POE::Component::IRC::Plugin::Proxy - A PoCo-IRC plugin that provides a
7       lightweight IRC proxy/bouncer
8

SYNOPSIS

10        use strict;
11        use warnings;
12        use POE qw(Component::IRC::State Component::IRC::Plugin::Proxy Component::IRC::Plugin::Connector);
13
14        my $irc = POE::Component::IRC::State->spawn();
15
16        POE::Session->create(
17            package_states => [
18                main => [ qw(_start) ],
19            ],
20            heap => { irc => $irc },
21        );
22
23        $poe_kernel->run();
24
25        sub _start {
26            my ($kernel, $heap) = @_[KERNEL, HEAP];
27            $heap->{irc}->yield( register => 'all' );
28            $heap->{proxy} = POE::Component::IRC::Plugin::Proxy->new( bindport => 6969, password => "m00m00" );
29            $heap->{irc}->plugin_add( 'Connector' => POE::Component::IRC::Plugin::Connector->new() );
30            $heap->{irc}->plugin_add( 'Proxy' => $heap->{proxy} );
31            $heap->{irc}->yield ( connect => { Nick => 'testbot', Server => 'someserver.com' } );
32            return;
33        }
34

DESCRIPTION

36       POE::Component::IRC::Plugin::Proxy is a POE::Component::IRC plugin that
37       provides lightweight IRC proxy/bouncer server to your
38       POE::Component::IRC bots. It enables multiple IRC clients to be hidden
39       behind a single IRC client-server connection.
40
41       Spawn a POE::Component::IRC::State session and add in a
42       POE::Component::IRC::Plugin::Proxy plugin object, specifying a bindport
43       and a password the connecting IRC clients have to use. When the
44       component is connected to an IRC network a listening port is opened by
45       the plugin for multiple IRC clients to connect.
46
47       Neat, huh? >;o)
48
49       This plugin will activate POE::Component::IRC's raw events ("irc_raw")
50       by calling "$irc->raw_events(1)".
51
52       This plugin requires the IRC component to be POE::Component::IRC::State
53       or a subclass thereof.
54

METHODS

56   "new"
57       Takes a number of arguments:
58
59       'password', the password to require from connecting clients;
60
61       'bindaddress', a local address to bind the listener to, default is
62       'localhost';
63
64       'bindport', what port to bind to, default is 0, ie. randomly allocated
65       by OS;
66
67       Returns an object suitable for passing to POE::Component::IRC's
68       "plugin_add" method.
69
70   "getsockname"
71       Takes no arguments. Accesses the listeners "getsockname" method. See
72       POE::Wheel::SocketFactory for details of the return value;
73
74   "list_wheels"
75       Takes no arguments. Returns a list of wheel ids of the current
76       connected clients.
77
78   "wheel_info"
79       Takes one parameter, a wheel ID to query. Returns undef if an invalid
80       wheel id is passed. In a scalar context returns the time that the
81       client connected in unix time. In a list context returns a list
82       consisting of the peer address, port, tthe connect time and the lag in
83       seconds for that connection.
84

OUTPUT

86       The plugin emits the following POE::Component::IRC events:
87
88   "irc_proxy_up"
89       Emitted when the listener is successfully started. "ARG0" is the result
90       of the listener "getsockname".
91
92   "irc_proxy_connect"
93       Emitted when a client connects to the listener. "ARG0" is the wheel ID
94       of the client.
95
96   "irc_proxy_rw_fail"
97       Emitted when the POE::Wheel::ReadWrite fails on a connection. "ARG0" is
98       the wheel ID of the client.
99
100   "irc_proxy_authed"
101       Emitted when a connecting client successfully negotiates an IRC session
102       with the plugin. "ARG0" is the wheel ID of the client.
103
104   "irc_proxy_close"
105       Emitted when a connected client disconnects. "ARG0" is the wheel ID of
106       the client.
107
108   "irc_proxy_down"
109       Emitted when the listener is successfully shutdown. "ARG0" is the
110       result of the listener "getsockname".
111

QUIRKS

113       Connecting IRC clients will not be able to change nickname. This is a
114       feature.
115

AUTHOR

117       Chris 'BinGOs' Williams
118

SEE ALSO

120       POE::Component::IRC
121
122       POE::Component::IRC::State
123
124
125
126perl v5.12.2                      2010-11-P0O5E::Component::IRC::Plugin::Proxy(3)
Impressum