mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
fixing some race conditions within regexp extraction
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@2423 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
a13f565757
commit
1d1f80a530
@ -464,12 +464,12 @@ sub FB_CALLMONITOR_loadInternalPhonebookFile($)
|
|||||||
{
|
{
|
||||||
|
|
||||||
$phonebook = join('', <PHONEBOOK>);
|
$phonebook = join('', <PHONEBOOK>);
|
||||||
if($phonebook =~ /<contact>/ and $phonebook =~ /<realName>/ and $phonebook =~ /<number/ and $phonebook =~ /<phonebook/ and $phonebook =~ /<\/phonebook>/)
|
if($phonebook =~ /<contact/ and $phonebook =~ /<realName>/ and $phonebook =~ /<number/ and $phonebook =~ /<phonebook/ and $phonebook =~ /<\/phonebook>/)
|
||||||
{
|
{
|
||||||
Log GetLogLevel($name, 2), "FB_CALLMONITOR: $name found FritzBox phonebook $phonebook_file";
|
Log GetLogLevel($name, 2), "FB_CALLMONITOR: $name found FritzBox phonebook $phonebook_file";
|
||||||
|
|
||||||
|
|
||||||
while($phonebook =~ m/<contact[a-z0-9="\n- ]*>(.+?)<\/contact>/gs)
|
while($phonebook =~ m/<contact[^>]*>(.+?)<\/contact>/gs)
|
||||||
{
|
{
|
||||||
|
|
||||||
$contact = $1;
|
$contact = $1;
|
||||||
@ -478,11 +478,15 @@ sub FB_CALLMONITOR_loadInternalPhonebookFile($)
|
|||||||
$contact_name = $1;
|
$contact_name = $1;
|
||||||
Log GetLogLevel($name, 4), "FB_CALLMONITOR: $name found $contact_name";
|
Log GetLogLevel($name, 4), "FB_CALLMONITOR: $name found $contact_name";
|
||||||
|
|
||||||
while($contact =~ m/<number[a-z0-9="\n- ]+?type="(\w+?)"[a-z0-9="\n- ]*?>(.+?)<\/number>/gs)
|
while($contact =~ m/<number[^>]+?type="(\w+?)"[^>]*?>(.+?)<\/number>/gs)
|
||||||
{
|
{
|
||||||
if($1 ne "intern" and $1 ne "memo")
|
if($1 ne "intern" and $1 ne "memo")
|
||||||
{
|
{
|
||||||
$number = $2;
|
$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(not $number =~ /^0/ and not $number =~ /@/ and $area_code ne "")
|
||||||
{
|
{
|
||||||
if($area_code =~ /^0[1-9]\d+$/)
|
if($area_code =~ /^0[1-9]\d+$/)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user