Browse files

don't show last newline in msg & notices

  • Loading branch information...
1 parent 3409f23 commit 964d8b1a8905e2ce74635d96c7794e1a7e86e2fe @typester committed Mar 22, 2013
Showing with 5 additions and 2 deletions.
  1. +5 −2 lingr.pl
View
7 lingr.pl
@@ -88,6 +88,9 @@ sub cmd_start {
my $win_name = 'lingr/' . $msg->{room};
my $win = Irssi::window_find_name($win_name);
+ # strip trailing new lines
+ (my $text = encode_utf8($msg->{text})) =~ s/(\r?\n)+$//s;
+
if ($win) {
if ($msg->{type} eq 'user') {
my $member = $NICKMAP{ $msg->{room} }{ $msg->{speaker_id} };
@@ -99,12 +102,12 @@ sub cmd_start {
$win->printformat(
MSGLEVEL_PUBLIC,
$msg->{speaker_id} eq $lingr->user ? 'ownmsg' : 'pubmsg',
- $msg->{speaker_id}, $msg->{text},
+ $msg->{speaker_id}, $text,
$is_owner ? '@' : ' ');
}
else {
$win->printformat(MSGLEVEL_NOTICES, 'notice_public',
- $msg->{speaker_id}, $msg->{room}, $msg->{text});
+ $msg->{speaker_id}, $msg->{room}, $text);
}
}
}

0 comments on commit 964d8b1

Please sign in to comment.