};
# activate debug here
-my $debug = 1;
+my $debug = 0;
# "message public", SERVER_REC, char *msg, char *nick, char *address, char *target
signal_add_last("message public" => sub {check_for_link(\@_,1,4,2,0);});
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));
}
}
my $message = ($parammessage == -1) ? '' : $signal->[$parammessage];
my $nick = ($paramnick == -1)?defined($server)?$server->{'nick'}:'':$signal->[$paramnick];
my $g;
- my $m;
my $p;
my $witem;
} else {
$witem = Irssi::window_item_find($target);
}
-
+
# Look if we should ignore this line
if ($message =~ m,(?:\s|^)/nosave(?:\s|$),) {
return;
}
-
+
push_output($witem);
# Look if there is a torrent link in there
- $message =~ m,(http://\S*\.(?:torrent|penis)),;
- $m = $1;
- while (defined($m)) {
- write_debug('Torrent-URL: %s', $m);
- $torrentlist{$torrentindex++} = {'CHANNEL' => $target, 'NICK' => $nick, 'URL' => $m};
-
- # Remove the matched part from the message and try again (there may be
- # more!)
- $message =~ s/$m//;
-
- $message =~ m|(http://.*\.torrent)|;
- $m = $1;
+
+ while ($message =~ m,(http://\S*\.(?:torrent|penis)),g) {
+ write_debug('Torrent-URL: %s', $1);
+ $torrentlist{$torrentindex++} = {'CHANNEL' => $target, 'NICK' => $nick, 'URL' => $1};
}
pop_output();
$_->{'NAME'},
$_->{'BYTES_DONE'},
$_->{'SIZE_BYTES'},
+ $_->{'BYTES_DONE'}*100/$_->{'SIZE_BYTES'},
$_->{'UP_RATE'},
$_->{'DOWN_RATE'});
}
return;
}
}
- write_irssi(undef, 'No such module');
+ write_irssi('No such module');
}
sub cmd_show {
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'});
}
}
$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'}};