iOS阻止使用XEP-0191的用户
我正在开发iOS的聊天应用程序,并使用openfire xmpp服务器? 我试图阻止用户使用XEP-0191:阻止命令,但得到错误的结果。
error xmlns =“jabber:client”type =“cancel”code =“503”service-unavailable xmlns =“urn:ietf:params:xml:ns:xmpp-stanzas”
因为我知道openfier不支持阻止用户的XEP-0191 。 您需要实施XEP-0016隐私列表。 所以你必须使用这种方法创build隐私列表。
- (void)setListWithName:(NSString *)privacyListName items:(NSArray *)items fromUser:(NSString *)user
你可以使用下面的方法来激活它
- (void)setActiveListName:(NSString *)privacyListName;
请参阅
如何在iOS中阻止与xmpp的朋友?
欲了解更多详情请关注隐私清单
XEP-0016
这对我有用。
XMPPPrivacy * xmppPrivacy =[[XMPPPrivacy alloc] initWithDispatchQueue:dispatch_get_main_queue()]; [xmppPrivacy activate:[XmppGlobalClass sharedInstance].xmppStream]; [xmppPrivacy addDelegate:self delegateQueue:dispatch_get_main_queue()]; NSMutableArray * arraypriv = [[NSMutableArray alloc]init]; NSMutableDictionary * privdict = [[NSMutableDictionary alloc] init]; [privdict setValue:@"deny" forKey:@"action"]; [privdict setValue:jid forKey:@"jid"]; [arraypriv addObject:privdict]; NSXMLElement *privacyElement; NSMutableArray *arrayPrivacy = [[NSMutableArray alloc] init]; privacyElement = [XMPPPrivacy privacyItemWithType:@"jid" value:[NSString stringWithFormat:@"%@@%@",[arraypriv valueForKey:@"jid"],domainName] action:[NSString stringWithFormat:@"%@",[arraypriv valueForKey:@"action"]] order:0]; [arrayPrivacy addObject:privacyElement]; [XMPPPrivacy blockIQs:privacyElement]; [XMPPPrivacy blockMessages:privacyElement]; [XMPPPrivacy blockPresenceIn:privacyElement]; [XMPPPrivacy blockPresenceOut:privacyElement]; [xmppPrivacy setListWithName:@"public" items:arrayPrivacy]; [xmppPrivacy setActiveListName:@"public"];
然后,您将通过代理方法(在XEP-0016中)接收阻止的用户列表,
- (void)xmppPrivacy:(XMPPPrivacy *)sender didReceiveListWithName:(NSString *)name items:(NSArray *)items;
- performSelector:withObject:afterDelay:不打电话
- 如何通过在Swift中从UIScrollViewinheritanceUITextView来制作垂直UITextView?
- 更改任何单元名称时,顶部单元名称会更改
- – (void)finishedWithAuth:(GTMOAuth2Authentication *)auth error:(NSError *)error – Method is not call
- 如何在某些日子获得UILocalNotification重复
- 如何获得TableView内的填充?
- 如何在Fitbit API集成中使用访问令牌请求 – iOS?
- iOS Swift3检查ViewController对象的nil值
- 如何在Swift中使用dequeueReusableCellWithIdentifier?