简体   繁体   English

将用户添加到xmpp组或muc中

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

I want to add 4 members (who are already users in oprefire) to a group. 我想将4个成员(已经是oprefire中的用户)添加到组中。 I want to add them without user permission nor sending invitation 我想在没有用户许可或发送邀请的情况下添加它们

Right now i am inviting a user using this code: 现在,我邀请用户使用此代码:

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

Is there some another way to achieve this? 还有其他方法可以做到这一点吗?

When user send request to other user, the following delegate method is called: 当用户向其他用户发送请求时,将调用以下委托方法:

-(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];
}

I've only written the code, if you need explanation, i'll. 我只写了代码,如果您需要解释,我会的。

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

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