global-functions*: syntax for ROS 7.x

Strings with escape sequence have to be enclosed in parentheses. Looks
like RouterOS 7.x is stricter here...
This commit is contained in:
Christian Hesse 2021-09-08 14:33:02 +02:00
parent 150c228197
commit 70f9c7926b
3 changed files with 8 additions and 8 deletions

View file

@ -310,7 +310,7 @@
} }
:local Return ""; :local Return "";
:local Chars "^.[]\$()|*+\?{}\\"; :local Chars ("^.[]\$()|*+\?{}\\");
:for I from=0 to=([ :len $Input ] - 1) do={ :for I from=0 to=([ :len $Input ] - 1) do={
:local Char [ :pick $Input $I ]; :local Char [ :pick $Input $I ];
@ -503,7 +503,7 @@
} }
:local Log ($Name . ": " . $Message); :local Log ($Name . ": " . $Message);
:if ($Severity ~ "^(debug|error|info)\$") do={ :if ($Severity ~ ("^(debug|error|info)\$")) do={
:if ($Severity = "debug") do={ :log debug $Log; } :if ($Severity = "debug") do={ :log debug $Log; }
:if ($Severity = "error") do={ :log error $Log; } :if ($Severity = "error") do={ :log error $Log; }
:if ($Severity = "info" ) do={ :log info $Log; } :if ($Severity = "info" ) do={ :log info $Log; }
@ -588,7 +588,7 @@
attach=($Notification->"attach"); remove-attach=($Notification->"remove-attach") }; attach=($Notification->"attach"); remove-attach=($Notification->"remove-attach") };
:if ([ :len [ / system scheduler find where name="FlushEmailQueue" ] ] = 0) do={ :if ([ :len [ / system scheduler find where name="FlushEmailQueue" ] ] = 0) do={
/ system scheduler add name=FlushEmailQueue interval=1s start-time=startup \ / system scheduler add name=FlushEmailQueue interval=1s start-time=startup \
on-event=":global FlushEmailQueue; \$FlushEmailQueue;"; on-event=(":global FlushEmailQueue; \$FlushEmailQueue;");
} }
} }
@ -666,7 +666,7 @@
:if ([ $VersionToNum $Required ] > [ $VersionToNum [ / system package update get installed-version ] ]) do={ :if ([ $VersionToNum $Required ] > [ $VersionToNum [ / system package update get installed-version ] ]) do={
:if ($Warn = true) do={ :if ($Warn = true) do={
$LogPrintExit2 warning $0 ("This " . [ $IfThenElse ([ :pick $Caller 0 ] = "\$") "function" "script" ] . \ $LogPrintExit2 warning $0 ("This " . [ $IfThenElse ([ :pick $Caller 0 ] = ("\$")) "function" "script" ] . \
" '" . $Caller . "' (at least specific functionality) requires RouterOS " . $Required . ". Please update!") false; " '" . $Caller . "' (at least specific functionality) requires RouterOS " . $Required . ". Please update!") false;
} }
:return false; :return false;
@ -782,7 +782,7 @@
:if ($ScriptVal->"name" = "global-config") do={ :if ($ScriptVal->"name" = "global-config") do={
:set ReloadGlobalConfig true; :set ReloadGlobalConfig true;
} }
:if ($ScriptVal->"name" ~ "^global-functions(\$|\\.d/.)") do={ :if ($ScriptVal->"name" ~ ("^global-functions(\$|\\.d/.)")) do={
:set ReloadGlobalFunctions true; :set ReloadGlobalFunctions true;
} }
} else={ } else={
@ -1183,7 +1183,7 @@
} }
:local Return ""; :local Return "";
:local Chars "\n\r !\"#\$%&'()*+,:;<=>\?@[\\]^`{|}~"; :local Chars ("\n\r !\"#\$%&'()*+,:;<=>\?@[\\]^`{|}~");
:local Subs { "%0A"; "%0D"; "%20"; "%21"; "%22"; "%23"; "%24"; "%25"; "%26"; "%27"; :local Subs { "%0A"; "%0D"; "%20"; "%21"; "%22"; "%23"; "%24"; "%25"; "%26"; "%27";
"%28"; "%29"; "%2A"; "%2B"; "%2C"; "%3A"; "%3B"; "%3C"; "%3D"; "%3E"; "%3F"; "%28"; "%29"; "%2A"; "%2B"; "%2C"; "%3A"; "%3B"; "%3C"; "%3D"; "%3E"; "%3F";
"%40"; "%5B"; "%5C"; "%5D"; "%5E"; "%60"; "%7B"; "%7C"; "%7D"; "%7E" }; "%40"; "%5B"; "%5C"; "%5D"; "%5E"; "%60"; "%7B"; "%7C"; "%7D"; "%7E" };

View file

@ -135,7 +135,7 @@
plain=$Plain; formatted=$Formatted }; plain=$Plain; formatted=$Formatted };
:if ([ :len [ / system scheduler find where name="FlushMatrixQueue" ] ] = 0) do={ :if ([ :len [ / system scheduler find where name="FlushMatrixQueue" ] ] = 0) do={
/ system scheduler add name=FlushMatrixQueue interval=1m start-time=startup \ / system scheduler add name=FlushMatrixQueue interval=1m start-time=startup \
on-event=":global FlushMatrixQueue; \$FlushMatrixQueue;"; on-event=(":global FlushMatrixQueue; \$FlushMatrixQueue;");
} }
} }
} }

View file

@ -141,7 +141,7 @@
parsemode=$ParseMode; text=$Text; silent=($Notification->"silent") }; parsemode=$ParseMode; text=$Text; silent=($Notification->"silent") };
:if ([ :len [ / system scheduler find where name="FlushTelegramQueue" ] ] = 0) do={ :if ([ :len [ / system scheduler find where name="FlushTelegramQueue" ] ] = 0) do={
/ system scheduler add name=FlushTelegramQueue interval=1m start-time=startup \ / system scheduler add name=FlushTelegramQueue interval=1m start-time=startup \
on-event=":global FlushTelegramQueue; \$FlushTelegramQueue;"; on-event=(":global FlushTelegramQueue; \$FlushTelegramQueue;");
} }
} }
} }