diff options
author | Christian Hesse <mail@eworm.de> | 2019-08-18 18:28:43 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2019-08-18 21:30:59 +0200 |
commit | d457421e1e339d9eeaa7645ab83a71190f9109d7 (patch) | |
tree | ff880b704f14daf87e311ab4051255cab3f7fa7d /global-functions | |
parent | 4210a4909802b7c6c594b0fb1263cb4e06e62ad1 (diff) |
global-functions: split off $SendEMail and $SendTelegram
Diffstat (limited to 'global-functions')
-rw-r--r-- | global-functions | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/global-functions b/global-functions index a139345..b1548a7 100644 --- a/global-functions +++ b/global-functions @@ -89,21 +89,15 @@ } } -# send notification via e-mail and telegram -# Note that attachment is ignored for telegram! -:global SendNotification do={ +# send notification via e-mail +:global SendEMail do={ :local Subject [ :tostr $1 ]; :local Message [ :tostr $2 ]; - :local Attach [ :tostr $3 ]; + :local Attach [ :tostr $3 ]; :global Identity; :global EmailGeneralTo; :global EmailGeneralCc; - :global TelegramTokenId; - :global TelegramChatId; - - :global UrlEncode; - :global CertificateAvailable; :if ([ :len $EmailGeneralTo ] > 0) do={ :do { @@ -118,6 +112,19 @@ :log warning "Failed sending notification mail!"; } } +} + +# send notification via telegram +:global SendTelegram do={ + :local Subject [ :tostr $1 ]; + :local Message [ :tostr $2 ]; + + :global Identity; + :global TelegramTokenId; + :global TelegramChatId; + + :global UrlEncode; + :global CertificateAvailable; :if ([ :len $TelegramTokenId ] > 0 && [ :len $TelegramChatId ] > 0) do={ $CertificateAvailable "Go Daddy Secure Certificate Authority - G2"; @@ -132,6 +139,21 @@ } } +# send notification via e-mail and telegram +# Note that attachment is ignored for telegram! +:global SendNotification do={ + :local Subject [ :tostr $1 ]; + :local Message [ :tostr $2 ]; + :local Attach [ :tostr $3 ]; + + :global SendEMail; + :global SendTelegram; + + $SendEMail $Subject $Message $Attach; + $SendTelegram $Subject $Message; +} + + # get MAC vendor :global GetMacVendor do={ :local Mac [ :tostr $1 ]; |