Get members nickname of MUC Room

冷暖自知 提交于 2019-12-09 18:35:59

问题


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

I'm trying with:

<iq from='crone1@shakespeare.lit/desktop'
  id='member3'
  to='coven@chat.shakespeare.lit'
  type='get'>
  <query xmlns='http://jabber.org/protocol/muc#admin'>
   <item affiliation='member'/>
  </query>
</iq>

but I obtain only jid without nicknames:

<iq from='coven@chat.shakespeare.lit'
  id='member3'
  to='crone1@shakespeare.lit/desktop'
  type='result'>
  <query xmlns='http://jabber.org/protocol/muc#admin'>
    <item affiliation='member'
      jid='hag66@shakespeare.lit'
      role='participant'/>
  </query>
</iq>

回答1:


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.



来源:https://stackoverflow.com/questions/17145899/get-members-nickname-of-muc-room

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!