【发布时间】:2012-10-18 01:34:06
【问题描述】:
如何加入我的 openfire 服务器上的现有 MUC?
我已成功使用我的凭据和所有凭据加入服务器。
但我似乎找不到任何关于如何加入 MUC 的代码示例?
【问题讨论】:
-
你必须被邀请到一个 MUC 房间。
标签: ios objective-c xmpp xmppframework
如何加入我的 openfire 服务器上的现有 MUC?
我已成功使用我的凭据和所有凭据加入服务器。
但我似乎找不到任何关于如何加入 MUC 的代码示例?
【问题讨论】:
标签: ios objective-c xmpp xmppframework
0045http://xmpp.org/extensions/xep-0045.html
只需按照所有步骤操作,您就可以进行多用户聊天。希望它对你有用:)
【讨论】:
试试这个
- (void)joinRoomWithRoomName:(NSString *)roomName nickName:(NSString *)nickName
{
if(roomName && nickName)
{
_xmppRoomStorage = [XMPPRoomHybridStorage sharedInstance];
XMPPJID *roomJid = [XMPPJID jidWithString:[NSString stringWithFormat:@"%@@%@.%@",roomName,@"conference",self.hostName]];
_xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:_xmppRoomStorage jid:roomJid];
[_xmppRoom addDelegate:self delegateQueue:dispatch_get_main_queue()];
[_xmppRoom activate:_xmppStream];
NSXMLElement *history = [NSXMLElement elementWithName:@"history"];
[history addAttributeWithName:@"maxstanzas" stringValue:MAX_ROOM_HISTORY];
[_xmppRoom joinRoomUsingNickname:nickName history:history];
}
else
{
NSLog(@"room creation arguments missing");
}
}
【讨论】: