-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} );
+warn "# server:$ENV{IRC_SERVER}:$ENV{IRC_PORT} room:$room nick:$nick subscribe:$subscribe\n";
+
+MQR::Redis->redis->psubscribe( "MSG $subscribe", sub {
+ my ( $message, $from ) = @_;
+ warn "<<<< ",dump( $from, $message );
+ return unless $from !~ m/\Q($nick|$room)\E/; # FIXME: skip our messages
+ my ( undef, $gw, $type, $user ) = split(/ /,$from);
+ MQR::Redis->publish( "SEND $nick\@$server $room $user" => "<$user> $message" );
+});