如何从openfire取得房间清单? [英] How to fetch room list from openfire?

查看:142
本文介绍了如何从openfire取得房间清单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用openfire服务器和XMPP协议进行聊天,并且在其中取得了成功.

I am using openfire server and XMPP protocol for chatting and i got success in it.

现在,我想进行聊天室.我在Google上搜索了很多,我得到的是"Joing Room","Create Room",但首先我想从会议中获取所有房间名称的列表.

Now i want to implement room chatting. I google lots about it, what i get is 'Joing Room', 'Create Room' but first i want to get list of all room name from conferrance.

我有会议和空间:

#define CONFERENCE_ROOM_SERVER      @"chatroomforfriends"
#define CONFERENCE_ROOM_NAME        @"cr1"

"chatroomforfriends"是会议名称,其中包含"cr1"房间.

'chatroomforfriends' is conferance name and it contain 'cr1' room.

我如何在iOS中获取所有房间名称?

How do i fetch all room name in iOS ?

推荐答案

根据MUC XEP(0045),您可以通过查询以下内容获取所有房间的列表:

As per MUC XEP (0045) you can get list of all rooms by querying:

<iq from='hag66@shakespeare.lit/pda'
id='zb8q41f4'
to='chat.shakespeare.lit'
type='get'>
  <query xmlns='http://jabber.org/protocol/disco#items'/>
</iq>

,您得到的响应为:

<iq from='chat.shakespeare.lit'
  id='zb8q41f4' to='hag66@shakespeare.lit/pda' type='result'>
  <query xmlns='http://jabber.org/protocol/disco#items'>
    <item jid='heath@chat.shakespeare.lit'
      name='A Lonely Heath'/>
    <item jid='coven@chat.shakespeare.lit'
      name='A Dark Cave'/>
    <item jid='forres@chat.shakespeare.lit'
      name='The Palace'/>
    <item jid='inverness@chat.shakespeare.lit'
      name='Macbeth&apos;s Castle'/>
  </query>
</iq>

XEP-0045

此方法返回MUC服务托管的所有公共房间. 要获得私人房间或获得特定用户的房间,您将必须编写一个插件来处理您的自定义查询(XMPP方式),或者为此可以在Openfire中编写一个Servlet(HTTP方式).

This method returns all public rooms hosted by MUC Service. To get private rooms, or to get rooms of a specific user, you will have to write a plugin to handle your custom query (XMPP Way) or you can write a servlet (HTTP Way) in Openfire for this.

这篇关于如何从openfire取得房间清单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆