fix: Fix LMC not working

This commit is contained in:
PapaTutuWawa 2022-11-26 15:48:29 +01:00
parent d1de394cd9
commit d383fa31ae
2 changed files with 4 additions and 5 deletions

View File

@ -59,6 +59,7 @@ export 'package:moxxmpp/src/xeps/xep_0203.dart';
export 'package:moxxmpp/src/xeps/xep_0280.dart'; export 'package:moxxmpp/src/xeps/xep_0280.dart';
export 'package:moxxmpp/src/xeps/xep_0297.dart'; export 'package:moxxmpp/src/xeps/xep_0297.dart';
export 'package:moxxmpp/src/xeps/xep_0300.dart'; export 'package:moxxmpp/src/xeps/xep_0300.dart';
export 'package:moxxmpp/src/xeps/xep_0308.dart';
export 'package:moxxmpp/src/xeps/xep_0333.dart'; export 'package:moxxmpp/src/xeps/xep_0333.dart';
export 'package:moxxmpp/src/xeps/xep_0334.dart'; export 'package:moxxmpp/src/xeps/xep_0334.dart';
export 'package:moxxmpp/src/xeps/xep_0352.dart'; export 'package:moxxmpp/src/xeps/xep_0352.dart';

View File

@ -30,8 +30,8 @@ class LastMessageCorrectionManager extends XmppManagerBase {
List<StanzaHandler> getIncomingStanzaHandlers() => [ List<StanzaHandler> getIncomingStanzaHandlers() => [
StanzaHandler( StanzaHandler(
stanzaTag: 'message', stanzaTag: 'message',
tagName: 'reply', tagName: 'replace',
tagXmlns: replyXmlns, tagXmlns: lmcXmlns,
callback: _onMessage, callback: _onMessage,
// Before the message handler // Before the message handler
priority: -99, priority: -99,
@ -42,9 +42,7 @@ class LastMessageCorrectionManager extends XmppManagerBase {
Future<bool> isSupported() async => true; Future<bool> isSupported() async => true;
Future<StanzaHandlerData> _onMessage(Stanza stanza, StanzaHandlerData state) async { Future<StanzaHandlerData> _onMessage(Stanza stanza, StanzaHandlerData state) async {
final edit = stanza.firstTag('replace', xmlns: lmcXmlns); final edit = stanza.firstTag('replace', xmlns: lmcXmlns)!;
if (edit == null) return state;
return state.copyWith( return state.copyWith(
lastMessageCorrectionSid: edit.attributes['id']! as String, lastMessageCorrectionSid: edit.attributes['id']! as String,
); );