sendUnavailablePresence method

Future<void> sendUnavailablePresence()

Send an unavailable presence with no 'to' attribute.

Implementation

Future<void> sendUnavailablePresence() async {
  // Bypass the queue so that this get's sent immediately.
  // If we do it like this, we can also block the disconnection
  // until we're actually ready.
  await getAttributes().sendStanza(
    StanzaDetails(
      Stanza.presence(
        type: 'unavailable',
      ),
      awaitable: false,
      bypassQueue: true,
      postSendExtensions: TypedMap<StanzaHandlerExtension>.fromList([
        const StreamManagementData(true, null),
      ]),
    ),
  );
}