From 080b3cbf9d8ff6cde9aeb08650ead5c3eeb9e7b7 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 10 Oct 2023 12:08:17 +0200 Subject: global-functions: make $ParseJson global --- telegram-chat.rsc | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) (limited to 'telegram-chat.rsc') diff --git a/telegram-chat.rsc b/telegram-chat.rsc index 73fe6fe..6083fee 100644 --- a/telegram-chat.rsc +++ b/telegram-chat.rsc @@ -26,6 +26,7 @@ :global IfThenElse; :global LogPrintExit2; :global MkDir; +:global ParseJson; :global ScriptLock; :global SendTelegram2; :global SymbolForNotification; @@ -45,32 +46,6 @@ $WaitFullyConnected; $LogPrintExit2 warning $0 ("Downloading required certificate failed.") true; } -:local ParseJson do={ - :local Input [ :toarray $1 ]; - - :local Return ({}); - :local Skip 0; - - :for I from=0 to=([ :len $Input ] - 1) do={ - :if ($Skip > 0 || $Input->$I = "\n" || $Input->$I = "\r\n") do={ - :if ($Skip > 0) do={ - :set $Skip ($Skip - 1); - } - } else={ - :local Key ($Input->$I); - :if ($Input->($I + 1) = ":") do={ - :set ($Return->$Key) ($Input->($I + 2)); - :set Skip 2; - } else={ - :set ($Return->$Key) [ :pick ($Input->($I + 1)) 1 [ :len ($Input->($I + 1)) ] ]; - :set Skip 1; - } - } - } - - :return $Return; -} - :local Data; :do { :set Data ([ /tool/fetch check-certificate=yes-without-crl output=user \ -- cgit v1.2.3-54-g00ecf