如何从XMPPRoom中挑选用户或成员

时间:2015-06-22 07:19:15

标签: java ios objective-c xmpp openfire

我实现了以下代码,用于从XMPPRoom中踢取用户。我用过XMPPFramework。见下面的代码

NSXMLElement *destroy = [NSXMLElement elementWithName:@"iq"];
    [destroy addAttributeWithName:@"type" stringValue:@"set"];
    [destroy addAttributeWithName:@"from" stringValue:[NSString stringWithFormat:@"%@",[_dictionaryStadium objectForKey:@"RoomID"]]];//stadium nam
    [destroy addAttributeWithName:@"to" stringValue:[NSString stringWithFormat:@"%@@%@",@"+923425623868",kXMPPHost]]; // user number.

NSXMLElement *reason = [NSXMLElement elementWithName:@"reason" stringValue:@"leave"];

NSXMLElement *item = [NSXMLElement elementWithName:@"item"];
[item addAttributeWithName:@"role" stringValue:@"none"];
[item addAttributeWithName:@"nick" stringValue:@"nawazish2"]; // usernickname

[item addChild:reason];

NSXMLElement *query = [NSXMLElement elementWithName:@"query"];
[query addAttributeWithName:@"xmlns" stringValue:@"http://jabber.org/protocol/muc#admin"];


[query addChild:item];

[destroy addChild:query];


[kKXMPPManager.xmppStream sendElement:destroy];
[kKXMPPManager.xmppStream addDelegate:self delegateQueue:dispatch_get_main_queue()];

发送请求时收到错误消息。但我收到了一个错误,例如:service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>

以下是我通过XMPP发送和接收的请求。

发送请求:

SEND: <iq type="set" from="abkcak@conference.mydomain.com" to="+923425623868@mydomain.com"><query xmlns="http://jabber.org/protocol/muc#admin"><item role="none" nick="nawazish2"><reason>leave</reason></item></query></iq>

收到请求:

RECV: <iq xmlns="jabber:client" type="error" from="+923425623868@mydomain.com" to="+923472447462@mydomain.com/b228fc86"><query xmlns="http://jabber.org/protocol/muc#admin"><item role="none" nick="nawazish2"><reason>leave</reason></item></query><error code="503" type="cancel"><service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq>

请告诉我如何解决踢用户的问题。我搜索了很多文章并实施了所有这些文章。但

由于

0 个答案:

没有答案