繁体   English   中英

将用户添加到xmpp组或muc中

[英]Add a user to xmpp group or in muc

我想将4个成员(已经是oprefire中的用户)添加到组中。 我想在没有用户许可或发送邀请的情况下添加它们

现在,我邀请用户使用此代码:

[sender inviteUser:[XMPPJID jidWithString:@"keithoys"] withMessage:@"Greetings!"];

还有其他方法可以做到这一点吗?

当用户向其他用户发送请求时,将调用以下委托方法:

-(void)xmppMUC:(XMPPMUC *)sender roomJID:(XMPPJID *)roomJID didReceiveInvitation:(XMPPMessage *)message{

    roomMemoryStorage = [[XMPPRoomMemoryStorage alloc] init];
    xmppRoom = [[XMPPRoom alloc]
                initWithRoomStorage:roomMemoryStorage
                                jid:roomJID
                      dispatchQueue:dispatch_get_main_queue()];

    [xmppRoom activate:[self xmppStream]];

    [xmppRoom addDelegate:self delegateQueue:dispatch_get_main_queue()];

    //Now add user to the group directly without prompting them
    [xmppRoom joinRoomUsingNickname:[xmppStream myJID].user history:nil];
}

我只写了代码,如果您需要解释,我会的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM