iOS XMPP之置顶黑名单

我当时做置顶黑名单的时候也困扰了我好久,最后再到xmpp里面的隐私列表,这个方法可以将要置顶的或要拉黑名单的好友jid存起来,到时候在做置顶和黑名单的处理

//Init XMPPPrivacy List
        //xmppPrivacy = [[XMPPPrivacy alloc] init];
        _xmppPrivacy = [[XMPPPrivacy alloc] initWithDispatchQueue:dispatch_get_main_queue()];
        //Activate xmpp modules
        [_xmppPrivacy activate:[WCXMPPTool sharedWCXMPPTool].xmppStream];
        //Delegate XMPPPrivacy
        [_xmppPrivacy addDelegate:self delegateQueue:dispatch_get_main_queue()];
        [_xmppPrivacy retrieveListWithName :@"multi_top_list"];
        [_xmppPrivacy setActiveListName:@"multi_top_list"];

        //NSString * friendJid = [NSString stringWithFormat:@"%@",_friendJid];
        //NSLog(@"%@", [friendJid substringToIndex:11]);
        NSXMLElement *privacyElement = [XMPPPrivacy privacyItemWithType:@"jid" value:_jidRoom action:@"allow" order:100];
        [XMPPPrivacy blockIQs:privacyElement];
        [XMPPPrivacy blockMessages:privacyElement];
        [XMPPPrivacy blockPresenceIn:privacyElement];
        [XMPPPrivacy blockPresenceOut:privacyElement];
        //NSLog(@"-------> PRIVACY ELEMENT: %@", privacyElement);
        NSMutableArray * arrayPrivacy = [[NSMutableArray alloc] init];
        [arrayPrivacy addObject:privacyElement];
        //NSLog(@"%@",arrayPrivacy);    [_xmppPrivacy setListWithName:@"multi_top_list" items:arrayPrivacy];

你可能感兴趣的:(iOS XMPP之置顶黑名单)