X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=videosite.pl;h=8f56fa1605c0ccf23063343e6aeb096ca2d9da08;hb=b8b430497f9015b88686d189838d30267f1c6ac2;hp=1a348eea27ae1c1b12adafd8ba558446b5235f12;hpb=52382d520ce9bc33042e30b6eeee48b35d37bd45;p=videosite.git diff --git a/videosite.pl b/videosite.pl index 1a348ee..8f56fa1 100644 --- a/videosite.pl +++ b/videosite.pl @@ -19,7 +19,8 @@ my @getters; my $getter; my $conf; my $conffile = File::Spec->catfile(Irssi::get_irssi_dir(), 'videosite.xml'); -my $plugindir = File::Spec->catfile(Irssi::get_irssi_dir(), 'scripts', 'videosite'); +my $scriptdir = File::Spec->catfile(Irssi::get_irssi_dir(), 'scripts'); +my $plugindir = File::Spec->catfile($scriptdir, 'videosite'); my $PARAMS = { 'getter' => '', @@ -292,8 +293,8 @@ sub cmd_getter { my $p; if (defined($target)) { - foreach $p (@getters, @grabbers) { - if (($p->{'NAME'} eq $target) && ($p->{'TYPE'} eq 'getter')) { + foreach $p (@getters) { + if ($p->{'NAME'} eq $target) { $getter = $p; $conf->{'videosite'}->{'getter'} = $target; return; @@ -346,13 +347,13 @@ sub ploader { foreach $p (@list) { write_debug(undef, "Trying to load $p:"); $p =~ s/\.pm$//; - eval qq{ require $p; }; + eval qq{ require videosite::$p; }; if ($@) { write_irssi(undef, "Failed to load plugin: $@"); next; } - $g = eval $p.q{->new();}; + $g = eval qq{ videosite::$p->new(); }; if ($@) { write_irssi(undef, "Failed to instanciate: $@"); delete($INC{$p}); @@ -449,15 +450,35 @@ sub sig_complete { if ('/videosite' eq $linestart) { # No command enterd so far. Produce a list of possible follow-ups - @matches = sort grep {/^$word/} keys (%{$videosite_commands}); + @matches = grep {/^$word/} keys (%{$videosite_commands}); } elsif ('/videosite set' eq $linestart) { # 'set' command entered. Produce a list of modules foreach (@grabbers, @getters) { push(@matches, $_->{'NAME'}) if $_->{'NAME'} =~ m|^$word|; }; + } elsif ($linestart =~ m|^/videosite set (\w+)$|) { + my $module = $1; + + foreach my $p (@getters, @grabbers) { + if ($p->{'NAME'} eq $module) { + @matches = $p->getparamlist($word); + last; + } + } + } elsif ($linestart =~ m|/videosite set (\w+) (\w+)$|) { + my $module = $1; + my $param = $2; + + foreach my $p (@getters, @grabbers) { + if ($p->{'NAME'} eq $module) { + @matches = $p->getparamvalues($param, $word); + last; + } + } } - push(@{$complist}, @matches); + + push(@{$complist}, sort @matches); ${$want_space} = 0; Irssi::signal_stop(); @@ -472,5 +493,5 @@ sub cmdhandler { } } -unshift(@INC, $plugindir); +unshift(@INC, $scriptdir); init_videosite(1);