--- trunk/irc-logger.pl 2006/03/12 14:19:00 13 +++ trunk/irc-logger.pl 2006/03/12 14:36:12 14 @@ -18,7 +18,7 @@ ## CONFIG -my $NICK = 'irc-logger-dev'; +my $NICK = 'irc-logger'; my $CONNECT = {Server => 'irc.freenode.net', Nick => $NICK, @@ -35,6 +35,8 @@ my $DSN = 'DBI:Pg:dbname=irc-logger'; +my $ENCODING = 'ISO-8859-2'; + ## END CONFIG @@ -196,7 +198,7 @@ my $channel = $_[ARG1]->[0]; my $msg = $_[ARG2]; - from_to($msg, 'UTF-8', 'ISO-8859-2'); + from_to($msg, 'UTF-8', $ENCODING); print "$channel: <$nick> $msg\n"; $sth->execute($channel, $nick, $msg); @@ -205,7 +207,7 @@ my $kernel = $_[KERNEL]; my $nick = (split /!/, $_[ARG0])[0]; my $msg = $_[ARG2]; - from_to($msg, 'UTF-8', 'ISO-8859-2'); + from_to($msg, 'UTF-8', $ENCODING); my $res = "unknown command '$msg', try /msg $NICK help!"; my @out; @@ -240,7 +242,7 @@ foreach my $res (get_from_log( limit => $1 )) { print "last: $res\n"; - from_to($res, 'ISO-8859-2', 'UTF-8'); + from_to($res, $ENCODING, 'UTF-8'); $_[KERNEL]->post( $IRC_ALIAS => privmsg => $nick, $res ); } @@ -252,7 +254,7 @@ foreach my $res (get_from_log( limit => 20, search => "%${what}%" )) { print "search [$what]: $res\n"; - from_to($res, 'ISO-8859-2', 'UTF-8'); + from_to($res, $ENCODING, 'UTF-8'); $_[KERNEL]->post( $IRC_ALIAS => privmsg => $nick, $res ); } @@ -262,7 +264,7 @@ if ($res) { print ">> [$nick] $res\n"; - from_to($res, 'ISO-8859-2', 'UTF-8'); + from_to($res, $ENCODING, 'UTF-8'); $_[KERNEL]->post( $IRC_ALIAS => privmsg => $nick, $res ); } @@ -378,7 +380,7 @@ # http server my $httpd = POE::Component::Server::HTTP->new( - Port => 8000, + Port => $NICK =~ m/-dev/ ? 8001 : 8000, ContentHandler => { '/' => \&root_handler }, Headers => { Server => 'irc-logger' }, ); @@ -392,7 +394,7 @@ sub root_handler { my ($request, $response) = @_; $response->code(RC_OK); - $response->content_type('text/html'); + $response->content_type("text/html; charset=$ENCODING"); $response->content( qq{$NICK} . "irc-logger url: " . $request->uri . '
' .