簡體   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