1POE::Component::IRC::PlUusgeirn:C:oAnuttroiJbouitne(d3P)POeEr:l:CDoomcpuomneenntta:t:iIoRnC::Plugin::AutoJoin(3)
2
3
4
6 POE::Component::IRC::Plugin::AutoJoin - A PoCo-IRC plugin which keeps
7 you on your favorite channels
8
10 use POE qw(Component::IRC::State Component::IRC::Plugin::AutoJoin);
11
12 my $nickname = 'Chatter';
13 my $server = 'irc.blahblahblah.irc';
14
15 my %channels = (
16 '#Blah' => '',
17 '#Secret' => 'secret_password',
18 '#Foo' => '',
19 );
20
21 POE::Session->create(
22 package_states => [
23 main => [ qw(_start irc_join) ],
24 ],
25 );
26
27 $poe_kernel->run();
28
29 sub _start {
30 my $irc = POE::Component::IRC::State->spawn(
31 Nick => $nickname,
32 Server => $server,
33 ) or die "Oh noooo! $!";
34
35 $irc->plugin_add('AutoJoin', POE::Component::IRC::Plugin::AutoJoin->new( Channels => \%channels ));
36 $irc->yield(register => qw(join);
37 $irc->yield(connect => { } );
38 }
39
40 sub irc_join {
41 my $chan = @_[ARG1];
42 $irc->yield(privmsg => $chan => "hi $channel!");
43 }
44
46 POE::Component::IRC::Plugin::AutoJoin is a POE::Component::IRC plugin.
47 If you get disconnected, the plugin will join all the channels you were
48 on the next time it gets connected to the IRC server. It can also
49 rejoin a channel if the IRC component gets kicked from it. It keeps
50 track of channel keys so it will be able to rejoin keyed channels in
51 case of reconnects/kicks.
52
53 If a POE::Component::IRC::Plugin::NickServID plugin has been added to
54 the IRC component, then AutoJoin will wait for a reply from NickServ
55 before joining channels on connect.
56
57 This plugin requires the IRC component to be POE::Component::IRC::State
58 or a subclass thereof.
59
61 "new"
62 Takes the following optional arguments:
63
64 'Channels', either an array reference of channel names, or a hash
65 reference keyed on channel name, containing the password for each
66 channel. By default it uses the channels the component is already on if
67 you are using POE::Component::IRC::State.
68
69 'RejoinOnKick', set this to 1 if you want the plugin to try to rejoin a
70 channel (once) if you get kicked from it. Default is 0.
71
72 'Rejoin_delay', the time, in seconds, to wait before rejoining a
73 channel after being kicked (if 'RejoinOnKick' is on). Default is 5.
74
75 'Retry_when_banned', if you can't join a channel due to a ban, set this
76 to the number of seconds to wait between retries. Default is 0
77 (disabled).
78
79 'NickServ_delay', how long (in seconds) to wait for a reply from
80 NickServ before joining channels. Default is 5.
81
82 Returns a plugin object suitable for feeding to POE::Component::IRC's
83 "plugin_add" method.
84
86 Hinrik Örn Sigurðsson, hinrik.sig@gmail.com
87
88
89
90perl v5.36.0 2023-P0O1E-:2:0Component::IRC::Plugin::AutoJoin(3)