XMPP - 如何加入现有的MUC会议室

时间:2012-10-28 14:36:46

标签: ios objective-c xmpp xmppframework

如何在我的openfire服务器上加入现有的MUC?

我已设法使用我的凭据加入服务器。

但我似乎找不到任何关于如何加入MUC的代码示例?

2 个答案:

答案 0 :(得分:0)

0045 http://xmpp.org/extensions/xep-0045.html

JUst按照所有步骤操作,您就可以进行多用户聊天。 HOpe它适合你:)

答案 1 :(得分:0)

试试这个

- (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");
        }
    }