- Add feedback for /videosite save
authorRalf Ertzinger <sun@ryoko.camperquake.de>
Sat, 12 Jan 2008 10:19:11 +0000 (11:19 +0100)
committerRalf Ertzinger <sun@ryoko.camperquake.de>
Sat, 12 Jan 2008 10:19:11 +0000 (11:19 +0100)
videosite.pl

index 847e627..0c5b650 100644 (file)
@@ -96,9 +96,16 @@ sub check_for_link {
 
 sub cmd_save {
 
-    open(CONF, '>'.$conffile);
-    print CONF XML::Simple::XMLout($conf, KeepRoot => 1, KeyAttr => {'config' => 'module', 'option' => 'key'});
-    close(CONF);
+    eval {
+        open(CONF, '>'.$conffile) or die 'Could not open config file';
+        print CONF XML::Simple::XMLout($conf, KeepRoot => 1, KeyAttr => {'config' => 'module', 'option' => 'key'});
+        close(CONF);
+    };
+    if ($@) {
+        write_irssi(undef, 'Could not save config: %s', $@);
+    } else {
+        write_irssi(undef, 'Saved config');
+    }
 }
 
 sub cmd_set {