From 08a9610ae083b68b6376caaaf1c7681543fd891c Mon Sep 17 00:00:00 2001 From: Christian Garbs Date: Sun, 28 Dec 2008 12:52:13 +0100 Subject: [PATCH] escape % in irssi messages --- xmlrtorrent.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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)); } } -- 1.8.3.1