diff --git a/global-config b/global-config index fded46f..bd632a1 100644 --- a/global-config +++ b/global-config @@ -9,6 +9,9 @@ # Set this to 'true' to disable news and change notifications. :global NoNewsAndChangesNotification false; +# Add extra text (or emojis) in notification tags. +:global IdentityExtra ""; + # This is used for DNS and backup file. :global Domain "example.com"; :global HostNameInZone true; diff --git a/global-config.changes b/global-config.changes index 357dede..5dd7616 100644 --- a/global-config.changes +++ b/global-config.changes @@ -95,6 +95,7 @@ 84="Support for e-mail notifications moved to a module. It is installed automatically if required."; 85="Dropped 'netwatch-syslog', filtering in firewall is advised."; 86="Added support for hooks in 'sms-forward'. This now provides similar functionality to 'sms-action', but is more flexible."; + 87="Added support for extra text (or emojis \F0\9F\9A\80) in notification tags."; }; # Migration steps to be applied on script updates diff --git a/global-functions b/global-functions index d070e39..9e89670 100644 --- a/global-functions +++ b/global-functions @@ -10,7 +10,7 @@ :local 0 "global-functions"; # expected configuration version -:global ExpectedConfigVersion 86; +:global ExpectedConfigVersion 87; # global variables not to be changed by user :global GlobalFunctionsReady false; diff --git a/mod/notification-email b/mod/notification-email index 8868941..b03e176 100644 --- a/mod/notification-email +++ b/mod/notification-email @@ -107,10 +107,11 @@ # generate the e-mail subject :set NotificationEMailSubject do={ :global Identity; + :global IdentityExtra; :global QuotedPrintable; - :return [ $QuotedPrintable ("[" . $Identity . "] " . $1) ]; + :return [ $QuotedPrintable ("[" . $IdentityExtra . $Identity . "] " . $1) ]; } # send notification via e-mail - expects one array argument diff --git a/mod/notification-matrix b/mod/notification-matrix index c43514d..6266b75 100644 --- a/mod/notification-matrix +++ b/mod/notification-matrix @@ -56,6 +56,7 @@ :local Notification $1; :global Identity; + :global IdentityExtra; :global MatrixAccessToken; :global MatrixAccessTokenOverride; :global MatrixHomeServer; @@ -106,10 +107,11 @@ :return false; } - :local Plain [ $PrepareText ("## [" . $Identity . "] " . ($Notification->"subject") . "\n```\n" . \ - ($Notification->"message") . "\n```") "plain" ]; - :local Formatted ("
" . [ $PrepareText ($Notification->"message") "format" ] . "
");
+ :local Plain [ $PrepareText ("## [" . $IdentityExtra . $Identity . "] " . \
+ ($Notification->"subject") . "\n```\n" . ($Notification->"message") . "\n```") "plain" ];
+ :local Formatted ("" . \
+ [ $PrepareText ($Notification->"message") "format" ] . "
");
:if ([ :len ($Notification->"link") ] > 0) do={
:set Plain ($Plain . "\\n" . [ $SymbolForNotification "link" ] . \
[ $PrepareText ("[" . $Notification->"link" . "](" . $Notification->"link" . ")") "plain" ]);
diff --git a/mod/notification-telegram b/mod/notification-telegram
index de8cdd8..03ccc3b 100644
--- a/mod/notification-telegram
+++ b/mod/notification-telegram
@@ -55,6 +55,7 @@
:local Notification $1;
:global Identity;
+ :global IdentityExtra;
:global TelegramChatId;
:global TelegramChatIdOverride;
:global TelegramFixedWidthFont;
@@ -105,7 +106,8 @@
}
:local Truncated false;
- :local Text ("*__" . [ $EscapeMD ("[" . $Identity . "] " . ($Notification->"subject")) "plain" ] . "__*\n\n");
+ :local Text ("*__" . [ $EscapeMD ("[" . $IdentityExtra . $Identity . "] " . \
+ ($Notification->"subject")) "plain" ] . "__*\n\n");
:local LenSubject [ :len $Text ];
:local LenMessage [ :len ($Notification->"message") ];
:local LenLink [ :len ($Notification->"link") ];