Direct-message and self-chat outbound orchestration decisions.
The session worker provides callbacks for USync and prekey IQ effects and remains responsible for encryption, persistence, and transport sends. This module owns direct session preparation, payload construction, fanout resolution, and final direct message-node composition.
Summary
Functions
Builds the final multi-device direct message node.
Builds padded recipient and own-device payloads for a direct send.
Returns the retry message ID or generates a new outbound ID.
Prepares Signal sessions and target hints for a direct or self-chat send.
Resolves direct recipient and own-device fanout targets.
Verifies that every encrypted participant uses the destination JID family.
Types
@type discover_fun() :: (String.t(), String.t(), non_neg_integer() | nil -> discovery_result())
@type payloads() :: %{recipient: binary(), own: binary(), raw_size: non_neg_integer()}
Functions
@spec build_encrypted_message_node( String.t(), String.t(), [ExWapp.Binary.Node.t()], term(), boolean() ) :: ExWapp.Binary.Node.t()
Builds the final multi-device direct message node.
@spec build_payloads(WAWebProtobufsE2E.Message.t(), String.t(), keyword()) :: {:ok, payloads()} | {:error, {:proto_encode, term()}}
Builds padded recipient and own-device payloads for a direct send.
Returns the retry message ID or generates a new outbound ID.
@spec prepare_sessions( map(), String.t(), non_neg_integer(), discover_fun(), ExWapp.Session.Outbound.Prekeys.fetch_many_fun(), ExWapp.Session.Outbound.Prekeys.fetch_one_fun(), keyword() ) :: {:ok, ExWapp.Signal.SessionStore.t(), map(), target_hints()} | {:error, term()}
Prepares Signal sessions and target hints for a direct or self-chat send.
Network effects are supplied as callbacks so the worker keeps ownership of IQ sends, receives, and timeouts.
@spec resolve_targets( term(), ExWapp.Signal.SessionStore.t(), String.t(), map(), map(), keyword() ) :: {[map()], [String.t()]}
Resolves direct recipient and own-device fanout targets.
Stale cached device entries rejected by the resolution are evicted.
@spec validate_participant_family(String.t(), [ExWapp.Binary.Node.t()]) :: :ok | {:error, {:mixed_addressing_family, non_neg_integer()}}
Verifies that every encrypted participant uses the destination JID family.
This is the final pre-send invariant. Fanout resolution performs the mapping; this check prevents a later regression from putting a PN participant into a LID message (or the reverse).