From 1ce0f63ef7206e130981a2ab49f3fbda281b0a12 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 15 Jun 2021 14:39:42 +0200 Subject: log-forward: use $HexToNum, do not resend old messages Now we know the order of messages and can compare. Changing the filter does no longer result in old messages being resent. --- log-forward | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'log-forward') diff --git a/log-forward b/log-forward index 2e66089..e0cb3aa 100644 --- a/log-forward +++ b/log-forward @@ -20,6 +20,7 @@ :global NotificationsWithSymbols; :global EscapeForRegEx; +:global HexToNum; :global IfThenElse; :global LogPrintExit2; :global QuotedPrintable; @@ -43,6 +44,7 @@ $WaitFullyConnected; :local Count 0; :local Duplicates false; +:local Last [ $HexToNum $LogForwardLast ]; :local Messages ""; :local MessageVal; :local MessageDups [ :toarray "" ]; @@ -55,12 +57,7 @@ $WaitFullyConnected; topics~$LogForwardInclude or message~$LogForwardIncludeMessage ] do={ :set MessageVal [ / log get $Message ]; - :if ($LogForwardLast = ($MessageVal->".id")) do={ - :set Count 0; - :set Duplicates false; - :set Messages ""; - :set MessageDups [ :toarray "" ]; - } else={ + :if ($Last < [ $HexToNum ($MessageVal->".id") ]) do={ :local DupCount ($MessageDups->($MessageVal->"message")); :if ($DupCount < 3) do={ :set Messages ($Messages . "\n" . [ $IfThenElse ($NotificationsWithSymbols = true) (" \E2\97\8F ") ] . \ -- cgit v1.2.3-70-g09d2