Amarula.Protocol.Groups.Notification (amarula v0.1.0)
View SourceParse a w:gp2 group notification into a structured update, ported from the
group branch of Baileys handleGroupNotification (Socket/messages-recv.ts).
A w:gp2 notification's first child names the change; we turn it into a
{action, payload} the connection emits as a :group_update event. Only the
common, high-value changes are decoded; unrecognised children yield
{:other, tag} so nothing is silently lost.
Summary
Functions
Parse a w:gp2 notification node. Returns {:ok, %{group, author, action}} or
{:error, reason} when there's no change child to interpret.
Types
@type participant() :: %{address: Amarula.Address.t(), admin: String.t() | nil}
@type t() :: %{ group: Amarula.Address.t(), author: Amarula.Address.t() | nil, action: action() }
Functions
@spec parse(Amarula.Protocol.Binary.Node.t()) :: {:ok, t()} | {:error, term()}
Parse a w:gp2 notification node. Returns {:ok, %{group, author, action}} or
{:error, reason} when there's no change child to interpret.