From e031e6d7603ffc86dd017570ad7a761baee19854 Mon Sep 17 00:00:00 2001 From: "Alexander \"PapaTutuWawa" Date: Sat, 21 Jan 2023 15:42:00 +0100 Subject: [PATCH] feat: Add cancelReason if recipient likely does not support OMEMO:2 --- packages/moxxmpp/lib/src/xeps/xep_0384/xep_0384.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/moxxmpp/lib/src/xeps/xep_0384/xep_0384.dart b/packages/moxxmpp/lib/src/xeps/xep_0384/xep_0384.dart index b1c736f..6ea142a 100644 --- a/packages/moxxmpp/lib/src/xeps/xep_0384/xep_0384.dart +++ b/packages/moxxmpp/lib/src/xeps/xep_0384/xep_0384.dart @@ -357,6 +357,11 @@ abstract class BaseOmemoManager extends XmppManagerBase { other['encryption_error_devices'] = result.deviceEncryptionErrors; return state.copyWith( other: other, + // If we have no device list for toJid, then the contact most likely does not + // support OMEMO:2 + cancelReason: result.jidEncryptionErrors[toJid.toString()] is NoKeyMaterialAvailableException ? + OmemoNotSupportedForContactException() : + null, cancel: true, ); }