1 package POE
::Component
::IRC
::Plugin
::Hello
;
6 our $VERSION = '0.001002';
8 use List
::Util qw
/first/;
10 use IRC
::Utils qw
/parse_user/;
11 use POE
::Component
::IRC
::Plugin qw
/PCI_EAT_NONE/;
17 qw
/privet hello salut salutari neata neaţa neața neatza
18 hola hey hi bonjour wassup sup hallo chikmaa
19 tungjatjeta parev salam namaskaar mingalarba ahoy
20 saluton allo moin aloha namaste shalom ciào ciao servus
21 salve ave merhaba witaj hei hola selam sawubona
/,
22 "what's up", 'que tal', 'こんにちは', '你好', 'ni hao'],
30 my ($self, $irc) = @_;
31 $irc->plugin_register($self, SERVER
=> qw
/public/);
35 sub PCI_unregister
{ 1 }
38 my ($self, $irc, $rfullname, $rchannels, $rmessage) = @_;
39 my $nick = parse_user
$$rfullname;
40 my $mynick = $irc->nick_name;
41 my @hello = @
{$self->{greetings
}};
43 my $match = first
{ $$rmessage =~ /^\s*(?:$mynick(?:)[:,])?\s*$_\s*[.!]?\s*$/i } @hello;
44 $irc->yield(privmsg
=> $$rchannels->[0] => $hello[int rand $#hello].", $nick") if $match;
53 POE::Component::IRC::Plugin::Hello - PoCo-IRC plugin that says hello
57 use POE::Component::IRC::Plugin::Hello;
59 my $irc = POE::Component::IRC::State->spawn(...);
60 $irc->plugin_add(Hello => POE::Component::IRC::Plugin::Hello->new);
64 POE::Component::IRC::Plugin::Hello is a PoCo-IRC plugin that greets back
65 who greet him or a channel in public. It knows how to say hello in several
66 languages, and greets people in a randomly chosen language.
68 The list of greetings is configurable by the plugin user.
72 L<POE::Component::IRC::Plugin>
76 Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
78 =head1 COPYRIGHT AND LICENSE
80 Copyright (C) 2013 by Marius Gavrilescu
82 This library is free software; you can redistribute it and/or modify
83 it under the same terms as Perl itself, either Perl version 5.14.2 or,
84 at your option, any later version of Perl 5 you may have available.