Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 1 file changed
  • 0 comments
  • 1 contributor

Showing 1 changed file with 15 additions and 2 deletions. Show diff stats Hide diff stats

  1. +15 2 lingr.pl
17 lingr.pl
@@ -88,6 +88,9 @@ sub cmd_start {
88 88 my $win_name = 'lingr/' . $msg->{room};
89 89 my $win = Irssi::window_find_name($win_name);
90 90
  91 + # strip trailing new lines
  92 + (my $text = encode_utf8($msg->{text})) =~ s/(\r?\n)+$//s;
  93 +
91 94 if ($win) {
92 95 if ($msg->{type} eq 'user') {
93 96 my $member = $NICKMAP{ $msg->{room} }{ $msg->{speaker_id} };
@@ -99,12 +102,12 @@ sub cmd_start {
99 102 $win->printformat(
100 103 MSGLEVEL_PUBLIC,
101 104 $msg->{speaker_id} eq $lingr->user ? 'ownmsg' : 'pubmsg',
102   - $msg->{speaker_id}, $msg->{text},
  105 + $msg->{speaker_id}, $text,
103 106 $is_owner ? '@' : ' ');
104 107 }
105 108 else {
106 109 $win->printformat(MSGLEVEL_NOTICES, 'notice_public',
107   - $msg->{speaker_id}, $msg->{room}, $msg->{text});
  110 + $msg->{speaker_id}, $msg->{room}, $text);
108 111 }
109 112 }
110 113 }
@@ -171,6 +174,15 @@ sub sig_complete_word {
171 174 }
172 175 }
173 176
  177 +sub cmd_update_room_info {
  178 + unless ($lingr) {
  179 + Irssi::print("Lingr: ERROR: lingr session does not started");
  180 + return;
  181 + }
  182 +
  183 + $lingr->update_room_info;
  184 +}
  185 +
174 186 sub cmd_update_theme {
175 187 Irssi::theme_register([
176 188 'pubmsg' => Irssi::current_theme()->get_format('fe-common/core', 'pubmsg'),
@@ -186,6 +198,7 @@ sub cmd_update_theme {
186 198 Irssi::command_bind('lingr start', \&cmd_start);
187 199 Irssi::command_bind('lingr stop', \&cmd_stop);
188 200 Irssi::command_bind('lingr update_theme', \&cmd_update_theme);
  201 +Irssi::command_bind('lingr update_room_info', \&cmd_update_room_info);
189 202
190 203 Irssi::settings_add_str('lingr', 'lingr_user', q[]);
191 204 Irssi::settings_add_str('lingr', 'lingr_password', q[]);

No commit comments for this range

Something went wrong with that request. Please try again.