简体   繁体   中英

Add a user to xmpp group or in muc

I want to add 4 members (who are already users in oprefire) to a group. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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