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=08a9610ae083b68b6376caaaf1c7681543fd891c escape % in irssi messages --- diff --git a/xmlrtorrent.pl b/xmlrtorrent.pl index 3514100..7adc01f 100644 --- a/xmlrtorrent.pl +++ b/xmlrtorrent.pl @@ -94,12 +94,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)); } }