美文网首页iOS OC
iOS XMPP之置顶黑名单

iOS XMPP之置顶黑名单

作者: 流年小书 | 来源:发表于2018-06-27 10:44 被阅读0次

我当时做置顶黑名单的时候也困扰了我好久,最后再到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之置顶黑名单

    本文链接:https://www.haomeiwen.com/subject/bqhbyftx.html