issue update
[videosite.git] / videosite.pl
index bf14b95..70b3ffb 100644 (file)
@@ -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' => '',
@@ -272,9 +273,9 @@ sub cmd_help {
     } 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)
@@ -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});
@@ -492,5 +493,5 @@ sub cmdhandler {
     }
 }
 
-unshift(@INC, $plugindir);
+unshift(@INC, $scriptdir);
 init_videosite(1);