Skip to content
This repository has been archived by the owner on Nov 19, 2021. It is now read-only.

How can I list of users present in a MUC? #50

Open
soichih opened this issue Jul 8, 2014 · 2 comments
Open

How can I list of users present in a MUC? #50

soichih opened this issue Jul 8, 2014 · 2 comments

Comments

@soichih
Copy link

soichih commented Jul 8, 2014

I have written a XMPP bot that lives in our MUC chatroom. I am wondering if there is a way to detect who are currently in the XMPP chatroom with simple-xmpp.

Thanks!

@mutil
Copy link

mutil commented Aug 24, 2014

I wonder too...

@jwoertink
Copy link
Contributor

You can always just proxy to node-xmpp using xmpp.conn if you wanted.
note: this is untested code

var xmpp = require('simple-xmpp');

var stanza = new xmpp.Element('iq', {from: 'me@my.server', to: 'room@chat.server', type: 'get', id: 'muc_id'}).c('query', { xmlns: 'http://jabber.org/protocol/disco#items'});
xmpp.conn.send(stanza);

xmpp.on('stanza', function(stanza) {
  if(stanza.name == 'iq' && stanza.attrs.type == 'result' && stanza.attrs.id == 'muc_id') {
    // stanza.children[0].children should have your users available in the room
  }
});

You can check out the implementation here

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants