telegram-chat: log warning only when trying to activate

This commit is contained in:
Christian Hesse 2023-02-03 09:56:30 +01:00
parent 9d1cf87489
commit 4bc5b9cf5f

View file

@ -125,13 +125,16 @@ $WaitFullyConnected;
} }
} }
} else={ } else={
$LogPrintExit2 warning $0 ("Received a message from untrusted contact " . \ :local Message ("Received a message from untrusted contact " . \
[ $IfThenElse ($FromUserName = false) "without username" ("'" . $FromUserName . "'") ] . \ [ $IfThenElse ($FromUserName = false) "without username" ("'" . $FromUserName . "'") ] . \
" (ID " . $FromID . ")!") false; " (ID " . $FromID . ")!");
:if ($Text ~ ("^! *" . [ $EscapeForRegEx $Identity ] . "\$")) do={ :if ($Text ~ ("^! *" . [ $EscapeForRegEx $Identity ] . "\$")) do={
$LogPrintExit2 warning $0 $Message false;
$SendTelegram2 ({ origin=$0; chatid=$ChatID; silent=false; \ $SendTelegram2 ({ origin=$0; chatid=$ChatID; silent=false; \
subject=([ $SymbolForNotification "speech-balloon" ] . "Telegram Chat"); \ subject=([ $SymbolForNotification "speech-balloon" ] . "Telegram Chat"); \
message=("You are not trusted.") }); message=("You are not trusted.") });
} else={
$LogPrintExit2 info $0 $Message false;
} }
} }
} }