From 9ad153c25d061541329f89761809a4ed1768c41b Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Wed, 14 Sep 2016 08:25:58 -0400 Subject: [PATCH] LP1579144: Give Sip/MsgType.pm a copy of to_bool() from ILS.pm Signed-off-by: Mike Rylander --- Sip/MsgType.pm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Sip/MsgType.pm b/Sip/MsgType.pm index aa894d2..6c9cda3 100644 --- a/Sip/MsgType.pm +++ b/Sip/MsgType.pm @@ -288,6 +288,15 @@ foreach my $i (keys(%handlers)) { } } +# Stolen from ../ILS.pm, useful in here as well +sub to_bool { + my $bool = shift; + + # If it's defined, and matches a true sort of string, or is + # a non-zero number, then it's true. + return defined($bool) && (($bool =~ /true|y|yes/i) || $bool != 0); +} + sub new { my ($class, $msg, $seqno) = @_; my $self = {}; -- 2.11.0