- my ( undef, $channel, $user ) = split(/ /,$from,3);
-warn "# contacts ",dump($contacts);
- foreach my $contact ( keys %$contacts ) {
- next if $from =~ m/\Q$contact\E/;
- warn "# $jid [$from] -> [$contact] | $message\n";
- $cl->send_message( join(' ',$channel, $user, $message), $contact => $jid, 'chat' );
+ my ( undef, $gw, $user ) = split(/ /,$from,3);
+ foreach my $to ( keys %$contacts, keys %$muc_rooms ) {
+warn "XXX send to $to\n";
+ next if $from =~ m/\Q$to\E/; # FIXME
+ warn "# $jid [$from] -> [$to] | $message\n";
+ my $body = "<$user\@$gw> | $message"; # FIXME
+ $cl->send_message( $body, $to => $jid, defined $muc_rooms->{$to} ? 'groupchat' : 'chat' );