Aweary
Aweary

Reputation: 2312

Parsing occupant's real JID in groupchats (MUC) in XMPP

So I'm using node-xmpp-client for a Jabber bot I have running. What I want to do is get the actual JID for the user in a group chat, not the alias. So using code something like this:

client.on('stanza', function(stanza) {
    if (stanza.is('message') && (stanza.attrs.type == 'grouchat')) {
        console.log(stanza.attrs.from)
    }
})

Will output something like [email protected]/group_alias and what I need is not their alias but the actual JID of the user. The stanza provided does not seem to have that information.

So someone might have an alias of Johnny Smith but their actual JID is [email protected] so the alias is kind of useless for me with this project.

Any insights?

Upvotes: 0

Views: 335

Answers (1)

Flow
Flow

Reputation: 24063

You need a non-anonymous (or semi-anonymous) MUC to get the real JID of a occupant. See XEP-0045 § 7.2.4

Upvotes: 1

Related Questions