I did this using the code below.
XMPPRoomCoreDataStorage * rosterstorage = [[XMPPRoomCoreDataStorage alloc] init]; XMPPRoom * xmppRoom = [[XMPPRoom alloc] initWithRoomStorage: rosterstorage jid: [XMPPJID jidWithString: @ " MyFirstGroup@conference.test-desktop "] dispatchQueue: dispatch_get_main_queue ()];
[xmppRoom activate:[[self appDelegate]xmppStream]]; [xmppRoom joinRoomUsingNickname:@"DeveloperQ" history:nil]; [[[self appDelegate] xmppStream] addDelegate:self delegateQueue:dispatch_get_main_queue()]; [xmppRoom addDelegate:self delegateQueue:dispatch_get_main_queue()];
Then
- (void) xmppRoomDidJoin: (XMPPRoom *) sender
{
NSXMLElement * iq = [NSXMLElement elementWithName: @ "iq"];
[iq addAttributeWithName:@"id" stringValue:[NSString stringWithFormat:@"inroom-cr%@",groupName]]; [iq addAttributeWithName:@"to" stringValue::@" MyFirstGroup@conference.test-desktop "]; [iq addAttributeWithName:@"type" stringValue:@"set"]; NSXMLElement *query = [NSXMLElement elementWithName:@"query" xmlns:XMPPMUCOwnerNamespaceName]; NSXMLElement *xelem = [NSXMLElement elementWithName:@"x" xmlns:@"jabber:x:data"]; [xelem addAttributeWithName:@"type" stringValue:@"submit"]; [query addChild:xelem]; [iq addChild:query]; [[[self appDelegate] xmppStream] sendElement:iq];
}
source share