X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=libvideosite.pm;h=bc41e5c136c06b39304be8b5efc436513d3ef18b;hb=88757bf7a37a953e33c37721eb086789a5e5e169;hp=da5aefa4c24c606f705dcda57e061fcad3875f41;hpb=1bc44dd403d1b6430a94adf9c6050d396bd89463;p=videosite.git diff --git a/libvideosite.pm b/libvideosite.pm index da5aefa..bc41e5c 100644 --- a/libvideosite.pm +++ b/libvideosite.pm @@ -319,6 +319,13 @@ sub _config_has { return $b; } +sub _config_del { + my $path = shift; + + _debug("config: removing %s", join('.', @{$path})); + $remote_api->{config_del}->($path); +} + # # The _config_list_* are helper functions taking a path to a comma separated # string. The string is interpreted as a list and the action performed @@ -360,9 +367,9 @@ sub _config_list_del { } _debug("Removing %s from list %s", $item, join('.', @{$path})); - @c = map { $item ne $_ } split(/\s*,\s*/, _config_get($path)); + @c = grep { $item ne $_ } split(/\s*,\s*/, _config_get($path)); - _config_set($path, join('.', @c)); + _config_set($path, join(',', @c)); } # @@ -714,6 +721,11 @@ sub _cmd_connector { $name = lc($name); + unless($name =~ m|^[a-z]+$|) { + _io("%s is not a valid connector name (only letters are allowed)", $name); + return; + } + if (_config_list_has(['defined-connectors'], $name)) { _io("Connector already exists"); return; @@ -980,11 +992,15 @@ sub check_for_link { my $m; my $p; my $skip; + my $mode = _config_get(['mode']); - # Look if we should ignore this line + # + # If /nosave is present in the message switch to display mode, regardless + # of config setting + # if ($message =~ m,(?:\s|^)/nosave(?:\s|$),) { - return; + $mode = 'display'; } _push_output($event->{ewpf}); @@ -1002,7 +1018,7 @@ sub check_for_link { $skip = $remote_api->{link_callback}->($m); } unless($skip) { - if ('download' eq _config_get(['mode'])) { + if ('download' eq $mode) { _io( sprintf('%s>>> %sSaving %s%%s%s %s%%s', _colorpair('*red'), @@ -1017,7 +1033,7 @@ sub check_for_link { unless($getter->get($m)) { _io(sprintf('%s>>> FAILED', _colorpair('*red'))); } - } elsif ('display' eq _config_get(['mode'])) { + } elsif ('display' eq $mode) { _io( sprintf('%s>>> %sSaw %s%%s%s %s%%s', _colorpair('*magenta'),