From 70f9c7926b31d7d7e4e48157e83e0e3acf8352e0 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Wed, 8 Sep 2021 14:33:02 +0200 Subject: 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... --- global-functions | 12 ++++++------ global-functions.d/notification-matrix | 2 +- global-functions.d/notification-telegram | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/global-functions b/global-functions index 30512f6..e6b6527 100644 --- a/global-functions +++ b/global-functions @@ -310,7 +310,7 @@ } :local Return ""; - :local Chars "^.[]\$()|*+\?{}\\"; + :local Chars ("^.[]\$()|*+\?{}\\"); :for I from=0 to=([ :len $Input ] - 1) do={ :local Char [ :pick $Input $I ]; @@ -503,7 +503,7 @@ } :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 = "error") do={ :log error $Log; } :if ($Severity = "info" ) do={ :log info $Log; } @@ -588,7 +588,7 @@ attach=($Notification->"attach"); remove-attach=($Notification->"remove-attach") }; :if ([ :len [ / system scheduler find where name="FlushEmailQueue" ] ] = 0) do={ / 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 ($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; } :return false; @@ -782,7 +782,7 @@ :if ($ScriptVal->"name" = "global-config") do={ :set ReloadGlobalConfig true; } - :if ($ScriptVal->"name" ~ "^global-functions(\$|\\.d/.)") do={ + :if ($ScriptVal->"name" ~ ("^global-functions(\$|\\.d/.)")) do={ :set ReloadGlobalFunctions true; } } else={ @@ -1183,7 +1183,7 @@ } :local Return ""; - :local Chars "\n\r !\"#\$%&'()*+,:;<=>\?@[\\]^`{|}~"; + :local Chars ("\n\r !\"#\$%&'()*+,:;<=>\?@[\\]^`{|}~"); :local Subs { "%0A"; "%0D"; "%20"; "%21"; "%22"; "%23"; "%24"; "%25"; "%26"; "%27"; "%28"; "%29"; "%2A"; "%2B"; "%2C"; "%3A"; "%3B"; "%3C"; "%3D"; "%3E"; "%3F"; "%40"; "%5B"; "%5C"; "%5D"; "%5E"; "%60"; "%7B"; "%7C"; "%7D"; "%7E" }; diff --git a/global-functions.d/notification-matrix b/global-functions.d/notification-matrix index 962924e..a2f7af0 100644 --- a/global-functions.d/notification-matrix +++ b/global-functions.d/notification-matrix @@ -135,7 +135,7 @@ plain=$Plain; formatted=$Formatted }; :if ([ :len [ / system scheduler find where name="FlushMatrixQueue" ] ] = 0) do={ / system scheduler add name=FlushMatrixQueue interval=1m start-time=startup \ - on-event=":global FlushMatrixQueue; \$FlushMatrixQueue;"; + on-event=(":global FlushMatrixQueue; \$FlushMatrixQueue;"); } } } diff --git a/global-functions.d/notification-telegram b/global-functions.d/notification-telegram index 4a05c9a..d8fe448 100644 --- a/global-functions.d/notification-telegram +++ b/global-functions.d/notification-telegram @@ -141,7 +141,7 @@ parsemode=$ParseMode; text=$Text; silent=($Notification->"silent") }; :if ([ :len [ / system scheduler find where name="FlushTelegramQueue" ] ] = 0) do={ / system scheduler add name=FlushTelegramQueue interval=1m start-time=startup \ - on-event=":global FlushTelegramQueue; \$FlushTelegramQueue;"; + on-event=(":global FlushTelegramQueue; \$FlushTelegramQueue;"); } } } -- cgit v1.2.3-54-g00ecf