From 7f843e8f12be535fdd1be6e46adabd3126aefa96 Mon Sep 17 00:00:00 2001 From: Gerardo Rodriguez Date: Sat, 24 Oct 2026 11:02:54 +0000 Subject: [PATCH 1/2] handlematrix: send unified_session daily on outgoing messages --- pkg/connector/client.go | 9 +++++++++ pkg/connector/handlematrix.go | 1 + 2 files changed, 10 insertions(+) diff --git a/pkg/connector/client.go b/pkg/connector/client.go index cd52be28..6b00d8e6 100644 --- a/pkg/connector/client.go +++ b/pkg/connector/client.go @@ -124,6 +124,7 @@ type WhatsAppClient struct { isNewLogin bool pushNamesSynced *exsync.Event lastPresence types.Presence + lastUnifiedSession atomic.Int64 blocklistLock sync.Mutex disableNewsletter bool @@ -511,6 +512,14 @@ func (wa *WhatsAppClient) updatePresence(ctx context.Context, presence types.Pre return err } +func (wa *WhatsAppClient) sendDailyUnifiedSession() { + last := wa.lastUnifiedSession.Load() + if time.Since(time.Unix(last, 0)) < 24*time.Hour || !wa.lastUnifiedSession.CompareAndSwap(last, time.Now().Unix()) { + return + } + go wa.Client.DangerousInternals().SendUnifiedSession() +} + func (wa *WhatsAppClient) DownloadImagePack(ctx context.Context, url string) (*bridgev2.ImportedImagePack, error) { return wa.Main.MsgConv.DownloadImagePack(ctx, wa.UserLogin.ID, wa.Client, url) } diff --git a/pkg/connector/handlematrix.go b/pkg/connector/handlematrix.go index fec40c3c..074439fa 100644 --- a/pkg/connector/handlematrix.go +++ b/pkg/connector/handlematrix.go @@ -141,6 +141,7 @@ func (wa *WhatsAppClient) handleConvertedMatrixMessage(ctx context.Context, msg } return nil, wrapWhatsAppError(err) } + wa.sendDailyUnifiedSession() var pickedMessageID networkid.MessageID if resp.Sender == wa.GetLID() { pickedMessageID = wrappedMsgID2 From 52f7da12b2c9041549dc393dac1af3956a4997c5 Mon Sep 17 00:00:00 2001 From: Gerardo Rodriguez Date: Sat, 24 Oct 2026 11:12:55 +0000 Subject: [PATCH 2/2] client: ignore DangerousInternals deprecation for unified_session --- pkg/connector/client.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/connector/client.go b/pkg/connector/client.go index 6b00d8e6..85e55546 100644 --- a/pkg/connector/client.go +++ b/pkg/connector/client.go @@ -517,6 +517,7 @@ func (wa *WhatsAppClient) sendDailyUnifiedSession() { if time.Since(time.Unix(last, 0)) < 24*time.Hour || !wa.lastUnifiedSession.CompareAndSwap(last, time.Now().Unix()) { return } + //lint:ignore SA1019 this is supposed to be dangerous go wa.Client.DangerousInternals().SendUnifiedSession() }