--- deliantra/server/ext/irc.ext 2008/09/23 14:41:26 1.14 +++ deliantra/server/ext/irc.ext 2009/06/26 16:02:15 1.17 @@ -2,7 +2,7 @@ use Time::HiRes; use AnyEvent::IRC::Client; -use AnyEvent::IRC::Util; +use AnyEvent::IRC::Util qw/filter_colors/; # requires: commands.ext @@ -70,6 +70,10 @@ return if $CON; $CON = AnyEvent::IRC::Client->new; + $CON->set_exception_cb (sub { + my ($exp, $ev) = @_; + warn "IRC: IRC EXCEPTION (event $ev): $exp\n"; + }); $CON->connect ($BOTSERVER, $BOTPORT, { nick => $BOTNAME, user => $BOTNAME, @@ -83,7 +87,7 @@ my $nick = AnyEvent::IRC::Util::prefix_nick ($msg); my $NOW = Time::HiRes::time; - my $tmsg = $msg->{params}->[-1]; + my $tmsg = filter_colors ($msg->{params}->[-1]); $tmsg =~ s/\x01[^\x01]*\x01//g; $tmsg =~ s/\015?\012/ /g; @@ -99,7 +103,15 @@ } }, connect => sub { - warn "IRC: connected to IRC server: $BOTSERVER:$BOTPORT\n"; + my ($con, $error) = @_; + + if ($error) { + warn "IRC: CONNECT ERROR to IRC server: $BOTSERVER:$BOTPORT: $error\n"; + undef $CON; + + } else { + warn "IRC: connected to IRC server: $BOTSERVER:$BOTPORT\n"; + } }, registered => sub { warn "IRC: successfully logged into IRC server: $BOTSERVER:$BOTPORT\n";