From 38555b0dd4b12574f5d571c947ec81fc89658b5e Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sat, 4 Apr 2020 11:08:19 -0400 Subject: [PATCH] strip leading and trailing " in trigger message. Accept a space instead of a + in enable/disable commands to match on/off --- scripts/zmtrigger.pl.in | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/zmtrigger.pl.in b/scripts/zmtrigger.pl.in index c56107276..1ee392c1e 100644 --- a/scripts/zmtrigger.pl.in +++ b/scripts/zmtrigger.pl.in @@ -356,11 +356,16 @@ sub handleMessage { my $connection = shift; my $message = shift; + # CUA - Axis camera send the message quoted with" + # CUA - Also Axis camera cannot save the plus sign which + $message =~ s/^\"//g; + $message =~ s/\"$//g; + my ( $id, $action, $score, $cause, $text, $showtext ) = split( /\|/, $message ); - $score = 0 if ( !defined($score) ); - $cause = '' if ( !defined($cause) ); - $text = '' if ( !defined($text) ); + $score = 0 if !defined($score); + $cause = '' if !defined($cause); + $text = '' if !defined($text); my $monitor = $monitors{$id}; if ( !$monitor ) { @@ -372,7 +377,7 @@ sub handleMessage { next if !zmMemVerify($monitor); Debug("Handling action '$action'"); - if ( $action =~ /^(enable|disable)(?:\+(\d+))?$/ ) { + if ( $action =~ /^(enable|disable)(?:[\+ ](\d+))?$/ ) { my $state = $1; my $delay = $2; if ( $state eq 'enable' ) {