Rino Seminara
Rino Seminara

Reputation: 41

Get members nickname of MUC Room

Is there a way to get all nicknames of a MUC Room with an ejabberd server?

I'm trying with:

<iq from='[email protected]/desktop'
  id='member3'
  to='[email protected]'
  type='get'>
  <query xmlns='http://jabber.org/protocol/muc#admin'>
   <item affiliation='member'/>
  </query>
</iq>

but I obtain only jid without nicknames:

<iq from='[email protected]'
  id='member3'
  to='[email protected]/desktop'
  type='result'>
  <query xmlns='http://jabber.org/protocol/muc#admin'>
    <item affiliation='member'
      jid='[email protected]'
      role='participant'/>
  </query>
</iq>

Upvotes: 4

Views: 2468

Answers (1)

Nuno Freitas
Nuno Freitas

Reputation: 993

On 6.5 Querying for Room Items from XEP 0045 when you send

<iq from='$user-name@$user-server/$user-resorce'
    id='someid'
    to='$chat-room-to-query@$chatserver'
    type='get'>
  <query xmlns='http://jabber.org/protocol/disco#items'/>
</iq> 

You have the following description

An implementation MAY return a list of existing occupants if that information is publicly available, or return no list at all if this information is kept private.(emphasis mine)

if the room is public them you get

<iq from='$chat-room-to-query@$chatserver'
    id='someid'
    to='$user-name@$user-server/$user-resorce'
    type='result'>
  <query xmlns='http://jabber.org/protocol/disco#items'>
    <item jid='$chat-room-to-query@$chatserver/$firstnick'/>
    <item jid='$chat-room-to-query@$chatserver/$secondnick'/>
    <...>
  </query>
</iq>

From my knowledge ejabberd implements this correctly.

Upvotes: 1

Related Questions