使用iOS中的XMPP退出Groupchat/Room的特定成员/所有者

问题描述:

当前我正在进行聊天应用程序。使用iOS中的XMPP退出Groupchat/Room的特定成员/所有者

我将实施Group WhatsApp类似的聊天出口。

例如, 我是集团所有者,经过一段时间后,我将离开集团。离开集团后,集团的任何一位成员将被指定为集团所有者。

对于我施加以下代码:

第一取在群聊所有成员,然后所有成员群聊手动左但它也无法工作。

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]; 

所以任何人有代码或相关信息,那么请帮助我。

谢谢。

我认为你需要设置affiliationowner但不是member

作为Xmpp Owner UsecasesXmpp Admin Usecases描述(注意的affiliation值):

  • 为了促进用户作为所有者:

<iq from='[email protected]/desktop' id='owner1' to='[email protected]' type='set'> <query xmlns='http://jabber.org/protocol/muc#admin'> <item affiliation='owner' jid='[email protected]'> <reason>A worthy witch indeed!</reason> </item> </query> </iq>

  • 要撤销会员

<iq from='[email protected]/desktop' id='member2' to='[email protected]' type='set'> <query xmlns='http://jabber.org/protocol/muc#admin'> <item affiliation='none' jid='[email protected]'> <reason>Not so worthy after all!</reason> </item> </query> </iq>

  • 要禁止用户

<iq from='[email protected]/throne' id='ban1' to='[email protected]' type='set'> <query xmlns='http://jabber.org/protocol/muc#admin'> <item affiliation='outcast' jid='[email protected]'> <reason>Treason</reason> </item> </query> </iq>

+0

是,它的工作,如果我是该组的管理员,但如果我不联系了该组并希望删除或退出小组,然后我该怎么做? –

+0

@KaushikMovaliya您是否找到解决问题的方法?我也面临同样的问题。 – nikBhosale

+0

没有@nikBhosale,还没有 –