use AnyEvent::XMPP::Namespaces qw/xmpp_ns/;
use AnyEvent::Redis;
use Data::Dump qw(dump);
+use Encode;
binmode STDOUT, ":utf8";
$cl->add_account ($jid, $pw);
warn "connecting to $jid...\n";
-my $pub = AnyEvent::Redis->new( host => $ENV{REDIS_HOST}, port => $ENV{REDIS_PORT} );
-my $sub = AnyEvent::Redis->new( host => $ENV{REDIS_HOST}, port => $ENV{REDIS_PORT} );
+my $pub = AnyEvent::Redis->new( host => $ENV{REDIS_HOST}, port => $ENV{REDIS_PORT}, on_error => sub { warn @_ } );
+my $sub = AnyEvent::Redis->new( host => $ENV{REDIS_HOST}, port => $ENV{REDIS_PORT}, on_error => sub { warn @_ } );
our $contacts;
$sub->psubscribe( 'channel *', sub {
my ( $message, $from ) = @_;
return unless $from !~ m/\Q$jid\E/; # skip our messages
- warn "#Q<< $from [$jid] | $message\n";
+ Encode::_utf8_on($message);
+ warn "#Q<< ", dump( $from, $message );
my ( undef, $channel, $user ) = split(/ /,$from,3);
warn "# contacts ",dump($contacts);
foreach my $contact ( keys %$contacts ) {
warn "# contacts ",dump($contacts);
my $channel = join(' ', 'channel', $msg->from);
+ Encode::_utf8_off($body);
$pub->publish( $channel, $body );
- warn "#X<< $channel | $body\n";
+ warn "#X<< ",dump($channel, $body);
# my $repl = $msg->make_reply;
# $repl->add_body( $response );