]> git.giacomolli.uk - onechat/commit
Give the WhatsApp batches their own type
authorAnderson A. Giacomolli <redacted>
Sun, 8 Nov 2026 21:38:18 +0000 (18:38 -0300)
committerAnderson A. Giacomolli <redacted>
Sun, 8 Nov 2026 21:38:18 +0000 (18:38 -0300)
commita6a82d96b4906e9e1f09f45f69f48124f11ae1bb
tree660de7c538876e48a71129e5360ea41e0da591de
parent1804474c7a03cca8bf780dd870a985e7badb4331
Give the WhatsApp batches their own type

WhatsAppInbox in whatsapp_inbox.go puts the incoming text messages into
batches, logs the closed batches, and holds the catch-up after each
connection. It owns the wake and failures channels of Run, the limit of
the catch-up, and, under its own mutex, the state of the catch-up and
its timer. The conversion of an event to a batch message goes with it.

WhatsApp keeps the session and the connection. Its event handler gives
each message to the inbox with a WhatsAppLink, and starts and ends the
catch-up there. The state file stays a field of WhatsApp too, because it
also holds the send records, and it has a mutex of its own. The tests of
the batches and the catch-up move to whatsapp_inbox_test.go, and the
helpers that more test files use move to whatsapp_fake_helper_test.go.
The behavior does not change.

Issue: 6f69ca1
whatsapp.go
whatsapp_fake_helper_test.go
whatsapp_inbox.go [new file with mode: 0644]
whatsapp_inbox_test.go [new file with mode: 0644]
whatsapp_test.go