ios - 用户不接受 XMPPRoom 中的邀请

标签 ios iphone objective-c xmpp openfire

在我的应用程序中,如果我向其他用户发送邀请,那么主持人和收到请求的所有用户都将加入房间,但如果另一个用户发送请求到然后所有前一个房间的主持人没有收到邀请

例如:
用户 1 将向用户 2用户 3 发送房间 1 的邀请,然后是所有三个 strong> 在房间 1
如果 User 2 将向 User 1User 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/

相关文章:

ios - Google MapView 控件没有 "swallow"手势,导致包含 scrollview 消耗它们

ios - 如何定义特定类型字典的扩展?

iphone - 我如何连接到名为 "A"的受密码保护的 wifi

iphone - 应用程序在模拟器上崩溃,但在 iPod 3.1.3 上运行良好。当应用程序在模拟器中运行时, super 类的 init 方法没有被命中(即使在调试时)

iphone - 正则表达式检测 $<name> 时出现问题

ios - 如何播放本地文件中的音频?

ios - 是否应该在 UIViewController viewDidUnload 中将 IBOutletCollections 设置为 nil?

objective-c - 尝试编写 NSString sha1 函数,但它返回 null

objective-c - 带有 Cordova 的 OSX 上的圆形 WebView?

ios - 如何在 Swift 中使用 libxml?