From 1d1f80a530acf6957054c327a32b11c0335f009e Mon Sep 17 00:00:00 2001 From: markusbloch <> Date: Thu, 3 Jan 2013 22:47:57 +0000 Subject: [PATCH] fixing some race conditions within regexp extraction git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@2423 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/72_FB_CALLMONITOR.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/FHEM/72_FB_CALLMONITOR.pm b/FHEM/72_FB_CALLMONITOR.pm index a595279bb..42c056199 100755 --- a/FHEM/72_FB_CALLMONITOR.pm +++ b/FHEM/72_FB_CALLMONITOR.pm @@ -464,12 +464,12 @@ sub FB_CALLMONITOR_loadInternalPhonebookFile($) { $phonebook = join('', ); - if($phonebook =~ // and $phonebook =~ // and $phonebook =~ //) + if($phonebook =~ // and $phonebook =~ //) { Log GetLogLevel($name, 2), "FB_CALLMONITOR: $name found FritzBox phonebook $phonebook_file"; - while($phonebook =~ m/(.+?)<\/contact>/gs) + while($phonebook =~ m/]*>(.+?)<\/contact>/gs) { $contact = $1; @@ -478,11 +478,15 @@ sub FB_CALLMONITOR_loadInternalPhonebookFile($) $contact_name = $1; Log GetLogLevel($name, 4), "FB_CALLMONITOR: $name found $contact_name"; - while($contact =~ m/]*?>(.+?)<\/number>/gs) { if($1 ne "intern" and $1 ne "memo") { $number = $2; + + $number =~ s/\D//g unless($number =~ /@/); + $number =~ s/\s//g if($number =~ /@/); + if(not $number =~ /^0/ and not $number =~ /@/ and $area_code ne "") { if($area_code =~ /^0[1-9]\d+$/)