From dd1b3a3a59962fa0df742c93de68403aca35619c Mon Sep 17 00:00:00 2001 From: loredo Date: Thu, 4 Aug 2016 16:59:47 +0000 Subject: [PATCH] 75_MSG.pm: improvement in combination with use of RESIDENTS readings like residentsTotalRoommatesPresentDevs as source for recipients. Ignores messages with recipients containing just ,-:| w/o explicit warning git-svn-id: https://svn.fhem.de/fhem/trunk@11891 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/75_MSG.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/fhem/FHEM/75_MSG.pm b/fhem/FHEM/75_MSG.pm index a8f58c93e..b3a0e1e7a 100755 --- a/fhem/FHEM/75_MSG.pm +++ b/fhem/FHEM/75_MSG.pm @@ -134,6 +134,18 @@ s/^[\s\t]*([a-z,]*!?(screen|light|audio|text|push|mail)[a-z,!|]*)[\s\t]+// $types = $1; } + # programatic exception: + # e.g. recipients were given automatically from empty readings + if ( $msg =~ s/^[\s\t]*([!]?(([A-Za-z0-9%+._-])*@([,\-:|]+)))[\s\t]+// ) { + Log3 $globalDevName, 4, + "msg: recipient '$1' contains special characters like" + . " ',-:|' so message won't be sent. This might be okay, e.g. if you are" + . " using something like a reading from RESIDENTS/ROOMMATE/GUEST to" + . " address present or absent residents and this list is simply empty" + . " at this time. ($msg)"; + return; + } + # check for given recipients if ( $msg =~ s/^[\s\t]*([!]?(([A-Za-z0-9%+._-])*@([%+a-z0-9A-Z.-]+))[\w,@.!|:]*)[\s\t]+//