X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=Bot.pm;h=53cdf94a0cf5cc983d64bf8d04a937e99cf5e802;hb=8a4ea372a6296ecbd4f271c036aa5f2015e64c2a;hp=c90f8339d0d061e6009c10c5dd88ac6729ed8860;hpb=921132036eac2233472b1b315e4ee39f5ab17fbd;p=NDIRC.git diff --git a/Bot.pm b/Bot.pm index c90f833..53cdf94 100644 --- a/Bot.pm +++ b/Bot.pm @@ -24,6 +24,7 @@ use feature ':5.10'; use Moose; +use POE::Component::IRC::Common qw/irc_to_utf8/; use POE::Session; use POE::Component::IRC::Plugin::Logger; use POE::Component::IRC::Plugin::BotTraffic; @@ -32,6 +33,7 @@ use POE::Component::IRC::Plugin::AutoJoin; use POE::Component::IRC::Plugin::NickReclaim; use NDIRC::Dispatcher; +use NDIRC::Context; use IO::File; @@ -79,11 +81,12 @@ sub _start { Sort_by_date => 1, Strip_color => 1, Strip_formatting => 1, + Notices => 1, )); $heap->{connector} = POE::Component::IRC::Plugin::Connector->new( - servers => ['irc.netgamers.org', 'underworld.no.eu.netgamers.org' - ,'firefly.no.eu.netgamers.org', 'underworld.ca.us.netgamers.org' ] + servers => [['irc.netgamers.org'], ['underworld.no.eu.netgamers.org'] + ,['firefly.no.eu.netgamers.org'], ['underworld.ca.us.netgamers.org'] ] ); $irc->plugin_add( 'Connector' => $heap->{connector} ); @@ -128,7 +131,7 @@ sub _build_disp { $disp->load(@commands); } - my $channels = new IO::File 'channels'; + my $channels = new IO::File 'channels' or die $!;; while (<$channels>){ my ($chan, @types) = split /\s+/; say "$chan - @types"; @@ -196,16 +199,18 @@ sub irc_001 { } sub irc_invite { - my ($self,$sender, $who, $channel) = @_[OBJECT,SENDER, HEAP, ARG0 .. ARG1]; + my ($self,$sender, $who, $channel) = @_[OBJECT,SENDER, ARG0 .. ARG1]; my $irc = $sender->get_heap(); $irc->yield( join => $_ ) for grep /^$channel$/i, keys %{$self->disp->channels} } sub irc_public { + $_[ARG2] = irc_to_utf8 $_[ARG2]; } sub irc_msg { + $_[ARG2] = irc_to_utf8 $_[ARG2]; } sub refresh {