Currently i am making chat application.
I will implement Group chat exit same like Whats app.
For example, I am group owner and after some time i will leave from Group.After i leaving from group any one member of the Group assign as a Group owner.
For that i applied following code :
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 any one have code or related information then please help me.
Thank you.
I think you need to set the affiliation
to owner
but not member
.
As Xmpp Owner Usecases , Xmpp Admin Usecases describe (Notice the values of affiliation
):
<iq from='crone1@shakespeare.lit/desktop' id='owner1' to='coven@chat.shakespeare.lit' type='set'> <query xmlns='http://jabber.org/protocol/muc#admin'> <item affiliation='owner' jid='hecate@shakespeare.lit'> <reason>A worthy witch indeed!</reason> </item> </query> </iq>
<iq from='crone1@shakespeare.lit/desktop' id='member2' to='coven@chat.shakespeare.lit' type='set'> <query xmlns='http://jabber.org/protocol/muc#admin'> <item affiliation='none' jid='hag66@shakespeare.lit'> <reason>Not so worthy after all!</reason> </item> </query> </iq>
<iq from='kinghenryv@shakespeare.lit/throne' id='ban1' to='southampton@chat.shakespeare.lit' type='set'> <query xmlns='http://jabber.org/protocol/muc#admin'> <item affiliation='outcast' jid='earlofcambridge@shakespeare.lit'> <reason>Treason</reason> </item> </query> </iq>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.