X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FPOE%2FComponent%2FIRC%2FPlugin%2FHello.pm;h=7a5cfe388ededa5edad82c51dc97a9261fed015a;hb=ea15051e359e183affc2576c5797df27ec412e5f;hp=75e2f5b3829bc0a43581451c4233600e2b0fc764;hpb=a5a095f29b8675080c2252b7a15792dab7d820d0;p=poe-component-irc-plugin-hello.git diff --git a/lib/POE/Component/IRC/Plugin/Hello.pm b/lib/POE/Component/IRC/Plugin/Hello.pm index 75e2f5b..7a5cfe3 100644 --- a/lib/POE/Component/IRC/Plugin/Hello.pm +++ b/lib/POE/Component/IRC/Plugin/Hello.pm @@ -5,8 +5,9 @@ use strict; use warnings; use utf8; use Encode qw/encode decode/; +use Unicode::Normalize qw/NFC/; -our $VERSION = '0.001002'; +our $VERSION = '0.001003'; use List::Util qw/first/; @@ -23,7 +24,7 @@ sub new { saluton allo moin aloha namaste shalom ciào ciao servus salve ave merhaba witaj hei hola selam sawubona geodemorgen hoi καλημέρα/, - "what's up", 'que tal', 'こんにちは', '你好', 'ni hao', + 'what\'s up', 'que tal', 'こんにちは', '你好', 'ni hao', 'добро јутро', 'γεια σας', 'bom dia', 'hyvää huomenta'], @_ }; @@ -43,10 +44,10 @@ sub S_public{ my ($self, $irc, $rfullname, $rchannels, $rmessage) = @_; my $nick = parse_user $$rfullname; my $mynick = $irc->nick_name; - my $message = decode 'UTF-8', $$rmessage; + my $message = NFC decode 'UTF-8', $$rmessage; my @hello = @{$self->{greetings}}; - my $match = first { $message =~ /^\s*(?:$mynick(?:)[:,])?\s*$_\s*[.!]?\s*$/i } @hello; + my $match = first { $message =~ /^\s*(?:$mynick(?:)[:,])?\s*$_\s*[.!]?\s*$/is } @hello; my $randhello = encode 'UTF-8', $hello[int rand $#hello]; $irc->yield(privmsg => $$rchannels->[0] => "$randhello, $nick") if $match; PCI_EAT_NONE @@ -84,7 +85,7 @@ Marius Gavrilescu, Emarius@ieval.roE =head1 COPYRIGHT AND LICENSE -Copyright (C) 2013 by Marius Gavrilescu +Copyright (C) 2013-2015 by Marius Gavrilescu This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or,