From: Christian Garbs Date: Sun, 28 Dec 2008 11:52:13 +0000 (+0100) Subject: escape % in irssi messages X-Git-Url: https://git.camperquake.de/gitweb.cgi?p=xmlrtorrent.git;a=commitdiff_plain;h=4b3e74ede94f90778d67f0d76e92f42dce846510 escape % in irssi messages --- diff --git a/xmlrtorrent.pl b/xmlrtorrent.pl index c90aeac..3a93181 100644 --- a/xmlrtorrent.pl +++ b/xmlrtorrent.pl @@ -90,12 +90,15 @@ sub write_irssi { my @text = @_; my $output = $outputstack[0]; - $text[0] = '%%mxmlrtorrent: %%n' . $text[0]; + my $format = '%%mxmlrtorrent: %%n' . shift(@text); + + # escape % in parameters from irssi + @text = grep { s/%/%%/g } @text; if (defined($output) and ref($output)) { - $output->print(sprintf(shift(@text), @text), MSGLEVEL_CLIENTCRAP); + $output->print(sprintf($format, @text), MSGLEVEL_CLIENTCRAP); } else { - Irssi::print(sprintf(shift(@text), @text)); + Irssi::print(sprintf($format, @text)); } }