在我的申请中,如果我向其他用户发送邀请,则主持人和获得请求的所有用户都将加入会议室,但如果其他用户将发送请求然后以前会议室的主持人 未获得邀请。
例如:
用户1 会向用户2 和用户3 发送邀请用户3 然后全部三 strong>在房间1
如果用户2 会向用户1 发送邀请用户1 和用户3 ,则用户1 < / strong>将未获得邀请
如果用户3 将发送会议室3 的邀请,则仅限用户3 在会议室中在场 <全部其他两个 没有得到邀请。
在我的应用程序中,我正在邀请其他用户使用此请求
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;
}
如何始终获得所有用户的邀请
欢迎任何形式的帮助......
在此先感谢。
答案 0 :(得分:1)
我正在研究它,我使用XMPPMUC委托(MUC代表MultiUserChat)
Delegate有这个方法:
-(void)xmppMUC:(XMPPMUC *)sender roomJID:(XMPPJID *)roomJID didReceiveInvitation:(XMPPMessage *)message
{
}
我还没有这样做,但我想你可以搜索一下......
答案 1 :(得分:0)
我认为你在邀请用户时犯了错误。你只是使用一组用户来邀请其他人很好但是当这个XMPPRooms的委托方法调用时必须发送邀请
- (void)xmppRoomDidJoin:(XMPPRoom *)sender
{
/**
* You can read from an array containing participants in a for-loop
* and send multiple invites in the same way here
*/
[sender inviteUser:[XMPPJID jidWithString:@"arpan"] withMessage:@"Greetings!"];
}
只需以正确的方式使用XMPPRoomdelegates来邀请用户。请为代理人设置链接。 XMPPFramework - How to create a MUC room and invite users?