supportsOmemo method
- JID jid
Attempts to find out if jid
supports omemo:2.
On success, returns whether jid
has published a device list and device bundles.
On failure, returns an OmemoError.
Implementation
Future<Result<OmemoError, bool>> supportsOmemo(JID jid) async {
final dm = getAttributes().getManagerById<DiscoManager>(discoManager)!;
final items = await dm.discoItemsQuery(jid.toBare());
if (items.isType<DiscoError>()) return Result(UnknownOmemoError());
final nodes = items.get<List<DiscoItem>>();
final result = nodes.any((item) => item.node == omemoDevicesXmlns) &&
nodes.any((item) => item.node == omemoBundlesXmlns);
return Result(result);
}