如何获取特定用户xmpp的房间列表?

时间:2016-08-02 05:36:31

标签: ios objective-c openfire xmp

我正在获取用户房间列表并获取所有已创建的房间。但我只想要用户拥有的房间清单。

以下是我正在使用的代码:

-(void) getListofRooms
{
    NSString* server = @"conference.test";
    XMPPJID *servrJID = [XMPPJID jidWithString:server];
    XMPPIQ *iq = [XMPPIQ iqWithType:@"get" to:servrJID];

    [iq addAttributeWithName:@"from" stringValue:[xmppStream myJID].full];

    NSXMLElement *query = [NSXMLElement elementWithName:@"query"];
    [query addAttributeWithName:@"xmlns" stringValue:@"http://jabber.org/protocol/disco#items"];
    [iq addChild:query];

    [xmppStream sendElement:iq];
}

这是我的XML回复:

RECV: <iq xmlns="jabber:client" type="result" from="conference.test" to="user@test/2ufrroh7xi">
    <query xmlns="http://jabber.org/protocol/disco#items">
    <item jid="ios@conference.test" name="ios"/>
    <item jid="newroom@conference.test" name="newRoomNatureName"/>
    <item jid="jay@conference.test" name="jay"/>
    <item jid="crs@conference.test" name="aaa"/>
    <item jid="newRoom@conference.test" name="newRoomNatureName"/>
    </query>
    </iq>

0 个答案:

没有答案