feat(core): Add encryption info to MessageEvent

This commit is contained in:
PapaTutuWawa 2023-06-07 23:42:05 +02:00
parent e234c812ff
commit 8266765ff8
2 changed files with 10 additions and 0 deletions

View File

@ -71,9 +71,11 @@ class MessageEvent extends XmppEvent {
this.from, this.from,
this.to, this.to,
this.id, this.id,
this.encrypted,
this.extensions, { this.extensions, {
this.type, this.type,
this.error, this.error,
this.encryptionError,
}); });
/// The from attribute of the message. /// The from attribute of the message.
@ -90,6 +92,12 @@ class MessageEvent extends XmppEvent {
final StanzaError? error; final StanzaError? error;
/// Flag indicating whether the message was encrypted.
final bool encrypted;
/// The error in case an encryption error occurred.
final Object? encryptionError;
/// Data added by other handlers. /// Data added by other handlers.
final TypedMap<StanzaHandlerExtension> extensions; final TypedMap<StanzaHandlerExtension> extensions;

View File

@ -81,9 +81,11 @@ class MessageManager extends XmppManagerBase {
JID.fromString(state.stanza.attributes['from']! as String), JID.fromString(state.stanza.attributes['from']! as String),
JID.fromString(state.stanza.attributes['to']! as String), JID.fromString(state.stanza.attributes['to']! as String),
state.stanza.attributes['id']! as String, state.stanza.attributes['id']! as String,
state.encrypted,
state.extensions, state.extensions,
type: state.stanza.attributes['type'] as String?, type: state.stanza.attributes['type'] as String?,
error: StanzaError.fromStanza(state.stanza), error: StanzaError.fromStanza(state.stanza),
encryptionError: state.encryptionError,
), ),
); );