From fa11a3a38479e29dd9ef77770a8e85832be2fabb Mon Sep 17 00:00:00 2001 From: Ikjot Singh Dhody Date: Sun, 11 Jun 2023 23:29:17 +0530 Subject: [PATCH] feat(xep): Checked for the occupant-id directly. Signed-off-by: Ikjot Singh Dhody --- packages/moxxmpp/lib/src/xeps/xep_0421.dart | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/packages/moxxmpp/lib/src/xeps/xep_0421.dart b/packages/moxxmpp/lib/src/xeps/xep_0421.dart index 311fd5b..c58d5b6 100644 --- a/packages/moxxmpp/lib/src/xeps/xep_0421.dart +++ b/packages/moxxmpp/lib/src/xeps/xep_0421.dart @@ -39,6 +39,8 @@ class OccupantIdManager extends XmppManagerBase { List getIncomingStanzaHandlers() => [ StanzaHandler( stanzaTag: 'message', + tagName: 'occupant-id', + tagXmlns: occupantIdXmlns, callback: _onMessage, // Before the MessageManager priority: -99, @@ -52,15 +54,7 @@ class OccupantIdManager extends XmppManagerBase { Stanza stanza, StanzaHandlerData state, ) async { - OccupantIdData? occupantId; - final occupantIdElement = - stanza.firstTag('occupant-id', xmlns: occupantIdXmlns); - // Process the occupant id - if (occupantIdElement != null) { - occupantId = - OccupantIdData(occupantIdElement.attributes['id']! as String); - state.extensions.set(occupantId); - } + state.extensions.set(OccupantIdData(stanza.attributes['id']! as String)); return state; } }