Amarula.Protocol.Receipt (amarula v0.1.0)

View Source

Build read receipts, ported from Baileys sendReceipt (type: "read", src/Socket/messages-send.ts).

A read receipt acks one or more message ids in a chat:

<receipt id="<first id>" type="read" t="<unix s>" to="<jid>" [participant=]>
  <list><item id="<id2>"/></list>   # only if >1 id
</receipt>

The ids must belong to the same chat (to) / sender (participant). Pure construction; the Connection writes the node.

Summary

Functions

A read receipt for message_ids in chat jid (optionally from participant in a group). now is the unix-seconds timestamp (injectable for tests).

Functions

read(list, jid, participant \\ nil, now \\ System.os_time(:second))

@spec read([String.t(), ...], String.t(), String.t() | nil, integer()) ::
  Amarula.Protocol.Binary.Node.t()

A read receipt for message_ids in chat jid (optionally from participant in a group). now is the unix-seconds timestamp (injectable for tests).