From 6873ba63c5df10c733abd12a3bc97e8e62b675f1 Mon Sep 17 00:00:00 2001 From: Fabian Trampusch Date: Fri, 31 May 2019 11:46:03 +0200 Subject: [PATCH] fix: muc compatibility when mod_vcard module in ejabberd is enabled also changed roster query to prevent (theoretical) similar issues there. --- .../adapters/xmpp/plugins/multi-user-chat.plugin.ts | 8 ++++---- .../lib/services/adapters/xmpp/plugins/roster.plugin.ts | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/projects/pazznetwork/ngx-chat/src/lib/services/adapters/xmpp/plugins/multi-user-chat.plugin.ts b/projects/pazznetwork/ngx-chat/src/lib/services/adapters/xmpp/plugins/multi-user-chat.plugin.ts index 4cb5e87a..952749d7 100644 --- a/projects/pazznetwork/ngx-chat/src/lib/services/adapters/xmpp/plugins/multi-user-chat.plugin.ts +++ b/projects/pazznetwork/ngx-chat/src/lib/services/adapters/xmpp/plugins/multi-user-chat.plugin.ts @@ -175,10 +175,10 @@ export class MultiUserChatPlugin extends AbstractXmppPlugin { } private isRoomPresenceStanza(stanza: Stanza) { - return stanza.name === 'presence' - && stanza.getChild('x') - && stanza.getChild('x').attrs.xmlns - && stanza.getChild('x').attrs.xmlns.startsWith('http://jabber.org/protocol/muc'); + return stanza.name === 'presence' && ( + stanza.getChild('x', 'http://jabber.org/protocol/muc') + || stanza.getChild('x', 'http://jabber.org/protocol/muc#user') + ); } private handleRoomPresenceStanza(stanza: Stanza): boolean { diff --git a/projects/pazznetwork/ngx-chat/src/lib/services/adapters/xmpp/plugins/roster.plugin.ts b/projects/pazznetwork/ngx-chat/src/lib/services/adapters/xmpp/plugins/roster.plugin.ts index 3551c597..7a551497 100644 --- a/projects/pazznetwork/ngx-chat/src/lib/services/adapters/xmpp/plugins/roster.plugin.ts +++ b/projects/pazznetwork/ngx-chat/src/lib/services/adapters/xmpp/plugins/roster.plugin.ts @@ -25,10 +25,9 @@ export class RosterPlugin extends AbstractXmppPlugin { } private isRosterPushStanza(stanza: Stanza) { - const queryChild = stanza.getChild('query'); return stanza.name === 'iq' && stanza.attrs.type === 'set' - && queryChild && queryChild.attrs.xmlns === 'jabber:iq:roster'; + && stanza.getChild('query', 'jabber:iq:roster'); } private handleRosterPushStanza(stanza: Stanza) {