0

In my application if i am sending invitation to other user then moderator and all user who got the request will join the room but if another user will send the request to all then moderator of previous room is not getting invitation.

For Example:
user 1 will send invitation for Room 1 to user 2 and user 3 then all three are in Room 1.
if User 2 will send invitation for Room 2 to User 1 and User 3 then User 1 will is not getting invitation.
And also if User 3 will send invitation for Room 3 then User 3 only be present in Room and all other two are not getting invitation too.

In my application i am inviting other user with this request

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];

and other user gets invitation here

- (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;
}

How to get invitation from all user all the time.
Any kind of help is welcomed...
Thanks in Advance.

Sam
  • 431
  • 7
  • 23

2 Answers2

1

I'm actually working on it, I use XMPPMUC delegate (MUC stands for MultiUserChat)

Delegate has this method :

-(void)xmppMUC:(XMPPMUC *)sender roomJID:(XMPPJID *)roomJID didReceiveInvitation:(XMPPMessage *)message
{
}

I haven't done this yet, but I guess that you could search on this...

GUEST_hehe
  • 11
  • 1
  • I did this man... from my above code you just put whole Invitation code in for loop, so from that each time user join room and send invitation to every friend that is in array. May be this is not the right thing but i have to do it in a less time so i did it with this logic. if you find anything so please put it here for others...and thanks for the time bro... – Sam Mar 07 '14 at 09:13
0

I think you made mistake while inviting users.You just use an array of user to invite other peoples that's fine but invitation must be sent when this XMPPRooms's delegate method call

- (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!"];
}

Just use XMPPRoomdelegates in proper way to invite user.Refer thins link for delegates.. XMPPFramework - How to create a MUC room and invite users?

Community
  • 1
  • 1
Arpan Dixit
  • 995
  • 1
  • 12
  • 24