在我的应用程序中,如果我向其他用户发送邀请,那么主持人和收到请求的所有用户都将加入房间,但如果另一个用户将发送请求到然后所有前一个房间的主持人都没有收到邀请。
例如:
用户 1 将向用户 2 和用户 3 发送房间 1 的邀请,然后是所有三个 strong> 在房间 1。
如果 User 2 将向 User 1 和 User 3 发送 Room 2 的邀请,则 User 1 will 没有收到邀请。
此外,如果用户 3 将发送对房间 3 的邀请,则仅用户 3 存在 在房间中并且所有 < strong>另外两个也没有收到邀请。
在我的应用程序中,我通过此请求邀请其他用户
XMPPRoomMemoryStorage * _roomMemory = [[XMPPRoomMemoryStorage alloc]init];
NSString* roomID = [NSString stringWithFormat:@"RoomName@conference.openfire id"];
XMPPJID * roomJID = [XMPPJID jidWithString:roomID];
xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:_roomMemory jid:roomJID dispatchQueue:dispatch_get_main_queue()];
[xmppRoom addDelegate:_roomMemory delegateQueue:dispatch_get_main_queue()];
[xmppRoom activate:xmppStream];
[xmppRoom joinRoomUsingNickname:[NSString stringWithFormat:@"%@",strCureentUserName] history:nil];
//.........inviting the Friend.......
for (int i=0; i<[arrUserName count];i++) {
[xmppRoom inviteUser:[XMPPJID jidWithString:[NSString stringWithFormat:@"Invite user's ID"]] withMessage:@"Come Join me in this room"];
}
[xmppRoom fetchConfigurationForm];
[xmppRoom configureRoomUsingOptions:nil];
其他用户在这里获得邀请
- (void)xmppStream:(XMPPStream *)sender didReceiveMessage:(XMPPMessage *)message
{
NSXMLElement * x = [message elementForName:@"x" xmlns:XMPPMUCUserNamespace];
NSXMLElement * invite = [x elementForName:@"invite"];
NSXMLElement * decline = [x elementForName:@"decline"];
NSXMLElement * directInvite = [message elementForName:@"x" xmlns:@"jabber:x:conference"];
NSString *msg1 = [[message elementForName:@"body"]stringValue];
NSString *from1 = [[message attributeForName:@"from"]stringValue];
if (invite || directInvite)
{
NSLog(@"come in invite method of if condition");
[self createAndEnterRoom:from1 Message:msg1];
return;
}
如何一直收到所有用户的邀请。
欢迎任何形式的帮助...
提前致谢。
最佳答案
我实际上正在研究它,我使用 XMPPMUC 委托(delegate)(MUC 代表 MultiUserChat)
委托(delegate)有这个方法:
-(void)xmppMUC:(XMPPMUC *)sender roomJID:(XMPPJID *)roomJID didReceiveInvitation:(XMPPMessage *)message
{
}
我还没有这样做,但我想你可以搜索这个...
关于ios - 用户不接受 XMPPRoom 中的邀请,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21234638/