fix <user> prefix before messages
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 30 Aug 2010 17:39:07 +0000 (17:39 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 30 Aug 2010 17:39:07 +0000 (17:39 +0000)
Include as little information as possible, but still tries to be useful

scripts/mqr-irc-client.pl
scripts/mqr-xmpp-client.pl

index 5e491be..fdfae80 100755 (executable)
@@ -29,8 +29,8 @@ $sub->psubscribe( "MSG $subscribe", sub {
        my ( $message, $from ) = @_;
        return unless $from !~ m/\Q($nick|$room)\E/; # FIXME: skip our messages
        warn "#Q<< ",dump( $from, $message );
-       my ( undef, $channel, $user ) = split(/ /,$from,3);
-       $con->send_msg( 'PRIVMSG', $room => join(' ',$channel, $user, $message) );
+       my ( undef, $gw, $user ) = split(/ /,$from,3);
+       $con->send_msg( 'PRIVMSG', $room => "<$user> $message" );
 });
 
 $con->reg_cb (
index 95d7814..f501940 100755 (executable)
@@ -53,7 +53,9 @@ $sub->psubscribe( "MSG $subscribe", sub {
 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
+               $user =~ s{!.+}{};
+               $gw   =~ s{^.+\/#}{#};
+               my $body = "<$user$gw> $message"; # FIXME
                $cl->send_message( $body, $to => $jid, defined $muc_rooms->{$to} ? 'groupchat' : 'chat' );
        }
 });