ExWapp.Session.MessageNode (ExWapp v0.1.2)

Copy Markdown View Source

Builders/parsers for encrypted message participant nodes.

Summary

Functions

Applies the stanza options shared by encrypted direct and group messages.

Builds a participant node containing one encrypted payload.

Converts an internal Signal encryption type to its WhatsApp wire value.

Extracts non-empty participant JIDs from encrypted participant nodes.

Generates WhatsApp's version 2 participant hash for a recipient list.

Converts a JID string to ADString format matching whatsmeow/whatsapp-rust.

Adds a message attribute only when its value is present.

Functions

apply_outbound_options(node, opts)

@spec apply_outbound_options(
  ExWapp.Binary.Node.t(),
  keyword()
) :: ExWapp.Binary.Node.t()

Applies the stanza options shared by encrypted direct and group messages.

Message type remains a stanza attribute. Media type is attached to each encrypted payload, and additional metadata nodes are appended after the encrypted content.

build_participant_encrypted_node(jid, ciphertext, enc_type)

@spec build_participant_encrypted_node(String.t(), binary(), atom() | String.t()) ::
  ExWapp.Binary.Node.t()

Builds a participant node containing one encrypted payload.

enc_type_to_wire(arg1)

@spec enc_type_to_wire(atom() | String.t()) :: String.t()

Converts an internal Signal encryption type to its WhatsApp wire value.

extract_participant_jids(participant_nodes)

@spec extract_participant_jids(term()) :: [String.t()]

Extracts non-empty participant JIDs from encrypted participant nodes.

generate_participant_hash_v2(participants)

@spec generate_participant_hash_v2(list()) :: String.t() | nil

Generates WhatsApp's version 2 participant hash for a recipient list.

jid_to_ad_string(jid)

@spec jid_to_ad_string(term()) :: String.t()

Converts a JID string to ADString format matching whatsmeow/whatsapp-rust.

Format: user.agent:device@server Example: 1234567890@s.whatsapp.net1234567890.0:0@s.whatsapp.net Example: 1234567890:37@s.whatsapp.net1234567890.0:37@s.whatsapp.net

maybe_put_message_attr(attrs, key, value)

@spec maybe_put_message_attr(map(), String.t(), term()) :: map()

Adds a message attribute only when its value is present.