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' => '',
} else {
write_irssi(undef, <<'EOT');
Supported commands:
- save: Save the current configuration
- help [modulename]: Display this help, or module specific help
- show [modulename]: Show loaded modules, or the current parameters of a module
+ save: save the current configuration
+ help [modulename]: display this help, or module specific help
+ show [modulename]: show loaded modules, or the current parameters of a module
set modulename parameter value: set a module parameter to a new value
getter [modulename]: display or set the getter to use
enable [modulename]: enable the usage of this module (grabbers only)
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;
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});
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();
}
}
-unshift(@INC, $plugindir);
+unshift(@INC, $scriptdir);
init_videosite(1);