1POE::Component::IRC::PlUusgeirn:C:oPnrtorxiyb(u3t)ed PerPlOED:o:cCuommepnotnaetnito:n:IRC::Plugin::Proxy(3)
2
3
4
6 POE::Component::IRC::Plugin::Proxy - A lightweight IRC proxy/bouncer
7 for POE::Component::IRC.
8
10 use strict;
11 use warnings;
12 use POE qw(Component::IRC Component::IRC::Plugin::Proxy Component::IRC::Connector);
13
14 my ($irc) = POE::Component::IRC->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 exit 0;
25
26 sub _start {
27 my ($kernel,$heap) = @_[KERNEL,HEAP];
28 $heap->{irc}->yield( register => 'all' );
29 $heap->{proxy} = POE::Component::IRC::Plugin::Proxy->new( bindport => 6969, password => "m00m00" );
30 $heap->{irc}->plugin_add( 'Connector' => POE::Component::IRC::Connector->new() );
31 $heap->{irc}->plugin_add( 'Proxy' => $heap->{proxy} );
32 $heap->{irc}->yield ( connect => { Nick => 'testbot', Server => 'someserver.com' } );
33 undef;
34 }
35
37 POE::Component::IRC::Plugin::Proxy is a POE::Component::IRC plugin that
38 provides lightweight IRC proxy/bouncer server to your POE::Compo‐
39 nent::IRC bots. It enables multiple IRC clients to be hidden behind a
40 single IRC client-server connection.
41
42 Spawn a POE::Component::IRC session and add in a POE::Compo‐
43 nent::IRC::Plugin::Proxy plugin object, specifying a bindport and a
44 password the connecting IRC clients have to use. When the component is
45 connected to an IRC network a listening port is opened by the plugin
46 for multiple IRC clients to connect.
47
48 Neat, huh? >;o)
49
51 new Takes a number of arguments:
52
53 'password', the password to require from connecting clients;
54 'bindaddr', a local address to bind the listener to, default is 'localhost';
55 'bindport', what port to bind to, default is 0, ie. randomly allocated by OS;
56
57 Returns an object suitable for passing to POE::Component::IRC's
58 plugin_add() method.
59
61 current_channels
62 Takes no arguments, returns a list of the channels that the compo‐
63 nent is currently a member of.
64
65 getsockname
66 Takes no arguments. Accesses the listeners getsockname() method.
67 See POE::Wheel::SocketFactory for details of the return value;
68
69 list_wheels
70 Takes no arguments. Returns a list of wheel ids of the current con‐
71 nected clients.
72
73 wheel_info
74 Takes one parameter, a wheel ID to query. Returns undef if an
75 invalid wheel id is passed. In a scalar context returns the time
76 that the client connected in unix time. In a list context returns a
77 list consisting of the peer address, port, tthe connect time and
78 the lag in seconds for that connection.
79
81 The plugin emits the following POE::Component::IRC events:
82
83 irc_proxy_up
84 Emitted when the listener is successfully started. ARG0 is the
85 result of the listener getsockname().
86
87 irc_proxy_connect
88 Emitted when a client connects to the listener. ARG0 is the wheel
89 ID of the client.
90
91 irc_proxy_rw_fail
92 Emitted when the Wheel::ReadWrite fails on a connection. ARG0 is
93 the wheel ID of the client.
94
95 irc_proxy_authed
96 Emitted when a connecting client successfully negotiates an IRC
97 session with the plugin. ARG0 is the wheel ID of the client.
98
99 irc_proxy_close
100 Emitted when a connected client disconnects. ARG0 is the wheel ID
101 of the client.
102
103 irc_proxy_down
104 Emitted when the listener is successfully shutdown. ARG0 is the
105 result of the listener getsockname().
106
108 Connecting IRC clients will not be able to change nickname. This is a
109 feature.
110
112 Chris 'BinGOs' Williams
113
115 POE::Component::IRC
116
117
118
119perl v5.8.8 2005-10-P2O5E::Component::IRC::Plugin::Proxy(3)