From 54e164e542bcd5b220ed3cbb3ad866d53f052efe Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 26 Nov 2020 22:02:39 +0100 Subject: global-functions: $SendTelegram: try to get the line breaks right --- global-functions | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'global-functions') diff --git a/global-functions b/global-functions index a058d69..ee13de8 100644 --- a/global-functions +++ b/global-functions @@ -776,9 +776,10 @@ :global TelegramFixedWidthFont; :global CharacterReplace; + :global IfThenElse; :if ($TelegramFixedWidthFont != true) do={ - :return $1; + :return ($1 . [ $IfThenElse ($2 = "fixed") "\n" "" ]); } :local Return $1; @@ -810,7 +811,7 @@ :local Text ("[" . $Identity . "] " . $Subject . "\n\n" . $Message); :if ([ :len $Text ] > 3968) do={ :set Text ([ $EscapeMD ([ :pick $Text 0 3840 ] . "...") "fixed" ] . \ - "\n\n" . [ $SymbolForNotification "scissors" ] . \ + "\n" . [ $SymbolForNotification "scissors" ] . \ [ $EscapeMD "The Telegram message was too long and has been truncated!" "hint" ]); } else={ :set Text [ $EscapeMD $Text "fixed" ]; @@ -832,7 +833,7 @@ :if ([ :typeof $TelegramQueue ] = "nothing") do={ :set TelegramQueue [ :toarray "" ]; } - :set Text ($Text . [ $UrlEncode ("\n\n" . [ $SymbolForNotification "alarm-clock" ] . \ + :set Text ($Text . [ $UrlEncode ("\n" . [ $SymbolForNotification "alarm-clock" ] . \ [ $EscapeMD ("This message was queued since " . [ / system clock get date ] . \ " " . [ / system clock get time ] . " and may be obsolete.") "hint" ]) ]); :set ($TelegramQueue->[ :len $TelegramQueue ]) { -- cgit v1.2.3-70-g09d2