feat(xep): Expose new/replaced ratchets in the MessageEvent

This commit is contained in:
PapaTutuWawa 2023-06-20 16:35:51 +02:00
parent d35b955259
commit b5efc2dfae
3 changed files with 23 additions and 1 deletions

View File

@ -1,3 +1,4 @@
import 'package:moxxmpp/src/managers/data.dart';
import 'package:omemo_dart/omemo_dart.dart'; import 'package:omemo_dart/omemo_dart.dart';
/// A simple wrapper class for defining elements that should not be encrypted. /// A simple wrapper class for defining elements that should not be encrypted.
@ -18,3 +19,11 @@ class OmemoEncryptionError {
/// See omemo_dart's EncryptionResult for info on this field. /// See omemo_dart's EncryptionResult for info on this field.
final Map<String, List<EncryptToJidError>> deviceEncryptionErrors; final Map<String, List<EncryptToJidError>> deviceEncryptionErrors;
} }
class OmemoData extends StanzaHandlerExtension {
OmemoData(this.newRatchets, this.replacedRatchets);
final Map<String, List<int>> newRatchets;
final Map<String, List<int>> replacedRatchets;
}

View File

@ -516,6 +516,12 @@ class OmemoManager extends XmppManagerBase {
children: children, children: children,
tag: stanza.tag, tag: stanza.tag,
attributes: Map<String, String>.from(stanza.attributes), attributes: Map<String, String>.from(stanza.attributes),
)
..extensions.set<OmemoData>(
OmemoData(
result.newRatchets,
result.replacedRatchets,
),
); );
} }

View File

@ -19,7 +19,7 @@ dependencies:
version: ^0.2.0 version: ^0.2.0
omemo_dart: omemo_dart:
hosted: https://git.polynom.me/api/packages/PapaTutuWawa/pub hosted: https://git.polynom.me/api/packages/PapaTutuWawa/pub
version: ^0.5.0 version: ^0.5.1
random_string: ^2.3.1 random_string: ^2.3.1
saslprep: ^1.0.2 saslprep: ^1.0.2
synchronized: ^3.0.0+2 synchronized: ^3.0.0+2
@ -30,3 +30,10 @@ dev_dependencies:
build_runner: ^2.1.11 build_runner: ^2.1.11
test: ^1.16.0 test: ^1.16.0
very_good_analysis: ^3.0.1 very_good_analysis: ^3.0.1
# TODO: Remove once we release 0.5.1
dependency_overrides:
omemo_dart:
git:
url: https://github.com/PapaTutuWawa/omemo_dart.git
rev: 49c7e114e6cf80dcde55fbbd218bba3182045862