Currently i am making chat application and i required to delete Particular groupchat.
To delete group i tried 2 solutions but are not working.
1st solution i applied as follow :-
xmppRoomStorage = [[XMPPRoomMemoryStorage alloc] init];
XMPPJID *roomJid = [XMPPJID jidWithString:self.strnameofgroup];
_xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:xmppRoomStorage jid:roomJid];
[_xmppRoom removeDelegate:self delegateQueue:dispatch_get_main_queue()];
[_xmppRoom deactivate];
[_xmppRoom leaveRoom];
1st fetch all members in the groupchat and then all members left groupchat manually but it also not working.
NSXMLElement *query = [NSXMLElement elementWithName:@"query" xmlns:@"http://jabber.org/protocol/muc#admin"];
NSXMLElement *item = [NSXMLElement elementWithName:@"item"];
[item addAttributeWithName:@"affiliation" stringValue:@"member"];
[item addAttributeWithName:@"jid" stringValue:@"jid to remove"];
[query addChild:item];
XMPPIQ *RemoveUser = [[XMPPIQ alloc] initWithType:@"set" to:[XMPPJID jidWithString:[NSString stringWithFormat:@"%@@%@",dialuser2,kSIPDomain]] elementID:@"some random id" child:query];
[SharedAppDelegate.xmppStream sendElement:RemoveUser];
So please help me if any solution to delete particular group.
Thank you
What's the configure of your room? Is it a persistent room?
If yes, then the room must be destroyed by the owner.
xmppRoom.destroyRoom()
Otherwise, the room will be automatically deleted if all the members left.