X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=xmlrtorrent.pl;h=0f50ba9e838dc9ce4e92f2bdce97c4a47aebc112;hb=873a6b45bd8113444349cd0e8c3b3ce7798a021b;hp=3514100995909ca0842dbb2681ff676ae91c590c;hpb=4e9ffeb12d88dfe9d4c480c0995308a93909653a;p=xmlrtorrent.git diff --git a/xmlrtorrent.pl b/xmlrtorrent.pl index 3514100..0f50ba9 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 + s/%/%%/g foreach @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)); } } @@ -218,6 +221,7 @@ sub cmd_remote { $_->{'NAME'}, $_->{'BYTES_DONE'}, $_->{'SIZE_BYTES'}, + $_->{'BYTES_DONE'}*100/$_->{'SIZE_BYTES'}, $_->{'UP_RATE'}, $_->{'DOWN_RATE'}); } @@ -259,7 +263,7 @@ sub cmd_set { return; } } - write_irssi(undef, 'No such module'); + write_irssi('No such module'); } sub cmd_show { @@ -317,13 +321,13 @@ sub cmd_talker { foreach $p (@talkers) { if (($p->{'NAME'} eq $target) && ($p->{'TYPE'} eq 'talker')) { $talker = $p; - $conf->{'videosite'}->{'talker'} = $target; + $conf->{'xmlrtorrent'}->{'talker'} = $target; return; } } write_irssi('No such talker'); } else { - write_irssi('Current talker: %s', $conf->{'videosite'}->{'talker'}); + write_irssi('Current talker: %s', $conf->{'xmlrtorrent'}->{'talker'}); } } @@ -424,9 +428,13 @@ sub init_xmlrtorrent { $talker = $p; } } - write_debug(undef, 'Selected %s as talker', $talker->{'NAME'}); - $conf->{'videosite'}->{'talker'} = $talker->{'NAME'}; + write_debug('Selected %s as talker', $talker->{'NAME'}); + $conf->{'xmlrtorrent'}->{'talker'} = $talker->{'NAME'}; + # Loop through all plugins and load the config + foreach $p (@talkers) { + $conf->{'xmlrtorrent'}->{'config'}->{$p->{'NAME'}} = $p->mergeconfig($conf->{'xmlrtorrent'}->{'config'}->{$p->{'NAME'}}); + } # Restore the queue %torrentlist = %{$conf->{'xmlrtorrent'}->{'_QUEUE'}};