XMPPFarmework 如何获取iOS中的XMPP聊天室列表?
XMPPFarmework How to obtain XMPP chat room list in iOS?
XMPPFarmework 我们 openfire
如何获取iOS中的XMPP聊天室列表?
任何人请告诉我解决问题的方法 this.Thanks!
当连接到 Amazon EC2
上的 ejabberd
服务器时,下面的代码适用于我们,希望它也适用于 Openfire
。
- (void) getChatRooms:(XMPPStream *)stream
{
NSString* server = @"conference.myserver.com";
XMPPJID *servrJID = [XMPPJID jidWithString:server];
XMPPIQ *iq = [XMPPIQ iqWithType:@"get" to:servrJID];
[iq addAttributeWithName:@"id" stringValue:@"chatroom_list"];
[iq addAttributeWithName:@"from" stringValue:[stream myJID].full];
NSXMLElement *query = [NSXMLElement elementWithName:@"query"];
[query addAttributeWithName:@"xmlns" stringValue:@"http://jabber.org/protocol/disco#items"];
[iq addChild:query];
[firstStream sendElement:iq];
}
- (BOOL)xmppStream:(XMPPStream *)sender didReceiveIQ:(XMPPIQ *)iq
{
DDLogVerbose(@"%@", [iq description]);
}
XMPPFarmework 我们 openfire
如何获取iOS中的XMPP聊天室列表? 任何人请告诉我解决问题的方法 this.Thanks!
当连接到 Amazon EC2
上的 ejabberd
服务器时,下面的代码适用于我们,希望它也适用于 Openfire
。
- (void) getChatRooms:(XMPPStream *)stream
{
NSString* server = @"conference.myserver.com";
XMPPJID *servrJID = [XMPPJID jidWithString:server];
XMPPIQ *iq = [XMPPIQ iqWithType:@"get" to:servrJID];
[iq addAttributeWithName:@"id" stringValue:@"chatroom_list"];
[iq addAttributeWithName:@"from" stringValue:[stream myJID].full];
NSXMLElement *query = [NSXMLElement elementWithName:@"query"];
[query addAttributeWithName:@"xmlns" stringValue:@"http://jabber.org/protocol/disco#items"];
[iq addChild:query];
[firstStream sendElement:iq];
}
- (BOOL)xmppStream:(XMPPStream *)sender didReceiveIQ:(XMPPIQ *)iq
{
DDLogVerbose(@"%@", [iq description]);
}