From 4a4b1dbf2e8c2e4fe984a312b370f79294d7e34b Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Sat, 25 Jul 2015 15:44:11 +0200 Subject: [PATCH] Fix room config updates --- vroom.pl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/vroom.pl b/vroom.pl index 62b2e28..ccef298 100755 --- a/vroom.pl +++ b/vroom.pl @@ -427,12 +427,14 @@ helper modify_room => sub { ($room->{max_members} > $config->{'rooms.max_members'} && $config->{'rooms.max_members'} > 0)){ $room->{max_members} = 0; } - if ((!$room->{locked} || $room->{locked} !~ m/^0|1$/) || - (!$room->{ask_for_name} || $room->{ask_for_name} !~ m/^0|1$/) || - (!$room->{persistent} || $room->{persistent} !~ m/^0|1$/) || - $room->{max_members} !~ m/^\d+$/){ + if (($room->{locked} && $room->{locked} !~ m/^0|1$/) || + ($room->{ask_for_name} && $room->{ask_for_name} !~ m/^0|1$/) || + ($room->{persistent} && $room->{persistent} !~ m/^0|1$/) || + $room->{max_members} !~ m/^\d+$/){ return 0; } + # Merge old and new params + $room = { %$old_room, %$room }; my $sth = eval { $self->db->prepare('UPDATE `rooms` SET `locked`=?,