Set timeout for URL shortener to 5 seconds
[videosite.git] / videosite.pl
index 6689929..6ea4892 100644 (file)
@@ -176,7 +176,7 @@ sub expand_url_shortener {
         'shar\.es/[[:alnum:]]+',
         'goo\.gl/[[:alnum:]]+',
         );
-    my $ua = LWP::UserAgent->new(agent => 'Mozilla', max_redirect => 0);
+    my $ua = LWP::UserAgent->new(agent => 'Mozilla', max_redirect => 0, timeout => 5);
     my $i = 10;
 
     OUTER: while (($os ne $s) and ($i > 0)) {
@@ -386,6 +386,7 @@ Supported commands:
  disable [modulename]: disable the usage of this module (grabbers only)
  reload: reload all modules (this is somewhat experimental)
  mode [modename]: display or set the operation mode (download/display)
+ connector [subcommand]: manage connectors (proxies)
  debug: enable debugging messages
  nodebug: disable debugging messages
 EOT
@@ -479,13 +480,13 @@ sub cmd_connector {
 
         $name = lc($name);
 
-        if ($name eq 'direct') {
-            write_irssi("Cannot remove direct connector");
+        unless (exists($connconf->{$name})) {
+            write_irssi("Connector does not exist");
             return;
         }
 
-        unless (exists($connconf->{$_})) {
-            write_irssi("Connector does not exist");
+        if (exists($connconf->{$name}->{'_immutable'})) {
+            write_irssi("Connector cannot be removed");
             return;
         }
 
@@ -509,8 +510,8 @@ sub cmd_connector {
 
         $conn = lc($conn);
 
-        if ($conn eq 'direct') {
-            write_irssi("Connector is not modifiable");
+        if (exists($connconf->{$conn}->{'_immutable'})) {
+            write_irssi("Connector cannot be modified");
             return;
         }
 
@@ -542,8 +543,8 @@ sub cmd_connector {
 
         $conn = lc($conn);
 
-        if ($conn eq 'direct') {
-            write_irssi("Connector is not modifiable");
+        if (exists($connconf->{$conn}->{'_immutable'})) {
+            write_irssi("Connector cannot be modified");
             return;
         }
 
@@ -681,6 +682,7 @@ sub init_videosite {
     unless (exists($conf->{'videosite'}->{'connectors'}->{'direct'})) {
         $conf->{'videosite'}->{'connectors'}->{'direct'} = {
                 'name' => 'direct',
+                '_immutable' => '1',
                 'schemas' => {},
         };
     }