line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package POE::Component::IRC::Plugin::Hello; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
22263
|
use 5.014000; |
|
1
|
|
|
|
|
5
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
16
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
6
|
1
|
|
|
1
|
|
464
|
use utf8; |
|
1
|
|
|
|
|
13
|
|
|
1
|
|
|
|
|
4
|
|
7
|
1
|
|
|
1
|
|
464
|
use Encode qw/encode decode/; |
|
1
|
|
|
|
|
9830
|
|
|
1
|
|
|
|
|
79
|
|
8
|
1
|
|
|
1
|
|
2784
|
use Unicode::Normalize qw/NFC/; |
|
1
|
|
|
|
|
12938
|
|
|
1
|
|
|
|
|
183
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.001004'; |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
16
|
use List::Util qw/first/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
92
|
|
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
688
|
use IRC::Utils qw/parse_user/; |
|
1
|
|
|
|
|
10384
|
|
|
1
|
|
|
|
|
102
|
|
15
|
1
|
|
|
1
|
|
692
|
use POE::Component::IRC::Plugin qw/PCI_EAT_NONE/; |
|
1
|
|
|
|
|
419
|
|
|
1
|
|
|
|
|
350
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub new { |
18
|
2
|
|
|
2
|
0
|
646
|
my $class = shift; |
19
|
2
|
|
|
|
|
42
|
my $self = { |
20
|
|
|
|
|
|
|
greetings => [ |
21
|
|
|
|
|
|
|
qw/privet hello salut salutari neata neaţa neața neatza |
22
|
|
|
|
|
|
|
hola hey hi bonjour wassup sup hallo chikmaa |
23
|
|
|
|
|
|
|
tungjatjeta parev salam namaskaar mingalarba ahoy |
24
|
|
|
|
|
|
|
saluton allo moin aloha namaste shalom ciào ciao servus |
25
|
|
|
|
|
|
|
salve ave merhaba witaj hei hola selam sawubona |
26
|
|
|
|
|
|
|
goedemorgen mogge hoi καλημέρα/, |
27
|
|
|
|
|
|
|
'what\'s up', 'que tal', 'こんにちは', '你好', 'ni hao', |
28
|
|
|
|
|
|
|
'добро јутро', 'γεια σας', 'bom dia', 'hyvää huomenta'], |
29
|
|
|
|
|
|
|
@_ |
30
|
|
|
|
|
|
|
}; |
31
|
|
|
|
|
|
|
|
32
|
2
|
|
|
|
|
11
|
bless $self, $class |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub PCI_register { |
36
|
0
|
|
|
0
|
0
|
0
|
my ($self, $irc) = @_; |
37
|
0
|
|
|
|
|
0
|
$irc->plugin_register($self, SERVER => qw/public/); |
38
|
0
|
|
|
|
|
0
|
1 |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
0
|
0
|
0
|
sub PCI_unregister { 1 } |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub S_public{ |
44
|
18
|
|
|
18
|
0
|
9848
|
my ($self, $irc, $rfullname, $rchannels, $rmessage) = @_; |
45
|
18
|
|
|
|
|
78
|
my $nick = parse_user $$rfullname; |
46
|
18
|
|
|
|
|
383
|
my $mynick = $irc->nick_name; |
47
|
18
|
|
|
|
|
1447
|
my $message = NFC decode 'UTF-8', $$rmessage; |
48
|
18
|
|
|
|
|
1448
|
my @hello = @{$self->{greetings}}; |
|
18
|
|
|
|
|
151
|
|
49
|
|
|
|
|
|
|
|
50
|
1
|
|
|
1
|
|
12
|
my $match = first { $message =~ /^\s*(?:$mynick(?:)[:,])?\s*$_\s*[.!]?\s*$/is } @hello; |
|
1
|
|
|
325
|
|
4
|
|
|
1
|
|
|
|
|
17
|
|
|
18
|
|
|
|
|
120
|
|
|
325
|
|
|
|
|
9777
|
|
51
|
18
|
|
|
|
|
39520
|
my $randhello = encode 'UTF-8', $hello[int rand $#hello]; |
52
|
18
|
100
|
|
|
|
1107
|
$irc->yield(privmsg => $$rchannels->[0] => "$randhello, $nick") if $match; |
53
|
18
|
|
|
|
|
1197
|
PCI_EAT_NONE |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
__END__ |