Hi I'm developing a chat application in IOS and completed one to one chat, after searching a lot about groupChat, unable to got how to create a normal group in xmppframework.
What I already tried here is a link
iOS XMPP group chat implementation
How to create MultiUserChatRoom using XMPPFramework in iPhone
But didnt get any positive response from these above links,
In coding I tried
XMPPRoomCoreDataStorage *rosterstorage = [[XMPPRoomCoreDataStorage alloc] init];
XMPPRoom *xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:rosterstorage jid:[XMPPJID jidWithString:@"test@conference.domainName.com/rohit"] dispatchQueue:dispatch_get_main_queue()];
[xmppRoom configureRoomUsingOptions:nil];
[xmppRoom activate:[self xmppStream]];
[xmppRoom addDelegate:self
delegateQueue:dispatch_get_main_queue()];
[xmppRoom inviteUser:[XMPPJID jidWithString:@"abc@domainName.com"] withMessage:@"Hi join room"];
Also this
- (void)createOrEnterRoom:(NSString *)roomName
{
//here we enter a room, or if the room does not yet exist, this method creates it
//per XMPP documentation: "If the room does not yet exist, the service SHOULD create the room"
//this method accepts an argument which is what you would baptize the room you wish created
XMPPPresence *presence = [XMPPPresence presence];
NSString *room = [roomName stringByAppendingString:@"@conference.domain.com"];
[presence addAttributeWithName:@"to" stringValue:room];
NSXMLElement *x = [NSXMLElement elementWithName:@"x" xmlns:@"http://jabber.org/protocol/muc"];
NSXMLElement *history = [NSXMLElement elementWithName:@"history"];
[history addAttributeWithName:@"maxstanzas" stringValue:@"50"];
[x addChild:history];
[presence addChild:x];
[[self xmppStream] sendElement:presence];
}
Last one is
-(void)createGroup
{
@try {
NSString *username=@"user_3";//[self.userDefault valueForKey:@"userid"];
NSXMLElement *presenceElement=[NSXMLElement elementWithName:@"presence"];
[presenceElement addAttributeWithName:@"type" stringValue:@"groupchat"];
[presenceElement addAttributeWithName:@"from" stringValue:[NSString stringWithFormat:@"%@%@",username,HostName]];
[presenceElement addAttributeWithName:@"to" stringValue:[NSString stringWithFormat:@"testGroup@conference.%@/%@",HostName,username]];
NSXMLElement *xElement=[NSXMLElement elementWithName:@"x" xmlns:@"http://jabber.org/protocol/muc"];
NSXMLElement *historyElement=[NSXMLElement elementWithName:@"history"];
[xElement addChild:historyElement];
[presenceElement addChild:xElement];
[self.xmppStream sendElement:presenceElement];
}
@catch (NSException *exception) {
}
}
Anyone please show me a way to solve out this. Please also let me know if we need to configure something extra in ejjabered configuration.