Amarula.Protocol.Messages.Receipt (amarula v0.1.0)
View SourceParse an inbound <receipt> into a delivery/read status update, ported from the
status side of Baileys handleReceipt (Socket/messages-recv.ts) +
getStatusFromReceiptType (Utils/generics.ts).
A receipt tells us a message we sent reached or was read by the recipient (or
that another of our devices read something). We surface that as a
:receipt_update event so a consumer can track delivery/read state — the half
of receipts that was previously just acked and dropped.
Summary
Functions
Parse a <receipt> node into %{message_ids, from, participant, status, timestamp}. Returns {:ok, t}, or {:error, :unknown_type} for a receipt type
we don't map (e.g. retry, handled elsewhere).
Types
@type status() :: :delivered | :server_ack | :read | :played
Message status implied by a receipt's type attribute.
@type t() :: %{ message_ids: [String.t()], from: Amarula.Address.t() | nil, participant: Amarula.Address.t() | nil, status: status(), timestamp: integer() | nil }
Functions
@spec parse(Amarula.Protocol.Binary.Node.t()) :: {:ok, t()} | {:error, :unknown_type}
Parse a <receipt> node into %{message_ids, from, participant, status, timestamp}. Returns {:ok, t}, or {:error, :unknown_type} for a receipt type
we don't map (e.g. retry, handled elsewhere).