Point 2: Send invitation to join chat room.
You can send invitation to others when you get the response in following delegate (xmppRoomDidCreate):
- (void)xmppRoomDidCreate:(XMPPRoom *)xmppRoom
{
NSLog(@"xmppRoomDidCreate");
[xmppRoom inviteUser:[User JID Here] withMessage:@"Your Message Here"];
// You can send invitations in loop if you have multiple users to invite
}
Point 3: Send message to chat room's friends.
Actually the message is broadcasted in group. Surely shall be delivered to all members in group.
- (void) sendMessageInGroup:(NSString *) message withGroupName:(NSString *) groupName
{
NSString * qualifiedGroupName = [NSString stringWithFormat:@"%@@%@", [groupName lowercaseString], SERVER_NAME];
// self.xmppRoomDetails consists of your muc rooms' objects i.i XMPPRoom
for (int i = 0; i < self.xmppRoomDetails.count; i++)
{
XMPPRoom * room = [self.xmppRoomDetails objectAtIndex:i];
XMPPJID * myRoomJID = room.myRoomJID;
NSString * roomName = [NSString stringWithFormat:@"%@@%@", [myRoomJID.user lowercaseString], SERVER_NAME];
if ([qualifiedGroupName rangeOfString:roomName].location != NSNotFound)
{
XMPPRoom * sendMessageWithRoom = [self.xmppRoomDetails objectAtIndex:i];
[sendMessageWithRoom sendMessage:message];
}
}
}