1POE::Component::IRC::PlUusgeirn:C:oNnitcrkiRbeuctPleOadEi:mP:(eC3ro)lmpDoonceunmte:n:tIaRtCi:o:nPlugin::NickReclaim(3)
2
3
4
6 POE::Component::IRC::Plugin::NickReclaim - a plugin for reclaiming
7 nickname.
8
10 use strict;
11 use warnings;
12 use POE qw(Component::IRC Component::IRC::Plugin::NickReclaim);
13
14 my $nickname = 'Flibble' . $$;
15 my $ircname = 'Flibble the Sailor Bot';
16 my $ircserver = 'irc.blahblahblah.irc';
17 my $port = 6667;
18
19 my ($irc) = POE::Component::IRC->spawn(
20 nick => $nickname,
21 server => $ircserver,
22 port => $port,
23 ircname => $ircname,
24 ) or die "Oh noooo! $!";
25
26 POE::Session->create(
27 package_states => [
28 'main' => [ qw(_start) ],
29 ],
30 );
31
32 $poe_kernel->run();
33 exit 0;
34
35 sub _start {
36 $irc->yield( register => 'all' );
37
38 # Create and load our NickReclaim plugin, before we connect
39 $irc->plugin_add( 'NickReclaim' =>
40 POE::Component::IRC::Plugin::NickReclaim->new( poll => 30 ) );
41
42 $irc->yield( connect => { } );
43 undef;
44 }
45
47 POE::Component::IRC::Plugin::NickReclaim - A POE::Component::IRC plugin
48 automagically deals with your bot's nickname being in use and reclaims
49 it when it becomes available again.
50
51 It registers and handles 'irc_433' events. On receiving a 433 event it
52 will reset the nickname to the 'nick' specified with spawn() or con‐
53 nect(), appended with an underscore, and then poll to try and change it
54 to the original nickname.
55
57 new Takes one optional argument:
58
59 'poll', the number of seconds between nick change attempts, default is 30;
60
61 Returns a plugin object suitable for feeding to POE::Compo‐
62 nent::IRC's plugin_add() method.
63
65 Chris 'BinGOs' Williams
66
68 POE::Component::IRC
69
70
71
72perl v5.8.8 20P0O5E-:1:0C-o2m5ponent::IRC::Plugin::NickReclaim(3)