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 PoCo-IRC plugin for
7 reclaiming your 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
34 sub _start {
35 $irc->yield( register => 'all' );
36
37 # Create and load our NickReclaim plugin, before we connect
38 $irc->plugin_add( 'NickReclaim' =>
39 POE::Component::IRC::Plugin::NickReclaim->new( poll => 30 ) );
40
41 $irc->yield( connect => { } );
42 return;
43 }
44
46 POE::Component::IRC::Plugin::NickReclaim - A POE::Component::IRC plugin
47 automagically deals with your bot's nickname being in use and reclaims
48 it when it becomes available again.
49
50 It registers and handles 'irc_433' events. On receiving a 433 event it
51 will reset the nickname to the 'nick' specified with "spawn" or
52 "connect", appendedwith an underscore, and then poll to try and change
53 it to the original nickname. If someone in your channel who has the
54 nickname you're after quits or changes nickname, the plugin will try to
55 reclaim it immediately.
56
58 "new"
59 Takes one optional argument:
60
61 'poll', the number of seconds between nick change attempts, default is
62 30;
63
64 Returns a plugin object suitable for feeding to POE::Component::IRC's
65 "plugin_add" method.
66
68 Chris 'BinGOs' Williams
69
70 With amendments applied by Zoffix Znet
71
73 POE::Component::IRC
74
75
76
77perl v5.12.2 20P1O0E-:1:1C-o0m5ponent::IRC::Plugin::NickReclaim(3)