美文网首页
逆向宝藏具体方法之拉群、建群

逆向宝藏具体方法之拉群、建群

作者: JoeTong | 来源:发表于2018-08-15 15:26 被阅读33次

    #pragma mark - 建群

    - (_Bool)CreateGroup:(id)arg1 withMemberList:(id)arg2;

    #pragma mark - 拉群

    CGroupMgr类

    - (_Bool)AddGroupMember:(id)arg1 withMemberList:(id)arg2 withDesp:(id)arg3;

    #pragma mark - 获取好友列表

    idcontactMgr = [[%c(MMServiceCenter) defaultCenter] getService:[%c(CContactMgr) class]];

    NSMutableArray *contactList = [contactMgr getContactList:1contactType:0];//这里的type为1获取到全部好友,为2不全

    #pragma mark - 根据userName在CContactMgr中获取联系人对象

    idcontactMgr = [[%c(MMServiceCenter) defaultCenter] getService:[%c(CContactMgr) class]];

    iduserContact = [contactMgr getContactByName:@""];或

    iduserContact = [[[%c(MMServiceCenter) defaultCenter] getService:[%c(CContactMgr) class]] getContactByName:[rcd objectForKey:@"userName"]];

    //获取除了自己的微信好友数组 为CContact对象

    idcontactMgr = [[%c(MMServiceCenter) defaultCenter] getService:[%c(CContactMgr) class]];

    NSMutableArray *contactList = [contactMgr getContactList:2contactType:0];

    idDC = [%c(MMServiceCenter) defaultCenter];

    CContactMgr *contactManager = [DC getService:[%c(CContactMgr) class]];

    idselfContact = [contactManager getSelfContact];//CContact类继承于CBaseContact

    NSMutableArray *realContactList = [NSMutableArray new];

    //便利联系人 获取剔除自己后的数组

    for(CContact *contactincontactList) {

        if([contact isNormalFriendContact] && ![[contact getContactDisplayUsrName] isEqualToString:[selfContact getContactDisplayUsrName]]){

            [realContactList addObject:contact];

        }

    }

    NSLog(@"realContactList = %@",realContactList);

    #pragma mark - 拉群具体实现

    -(void)pullToGroup{

        idcontactMgr = [[%c(MMServiceCenter) defaultCenter] getService:[%c(CContactMgr)class]];

        //NSMutableArray *contactList = [contactMgr getContactList:0 contactType:0];

        NSMutableArray *contactList = [contactMgr getContactList:1contactType:0];

        //NSMutableArray *contactListFour = [contactMgr getContactList:2 contactType:0];

        //NSMutableArray *contactListFif = [contactMgr getContactList:3 contactType:0];

        idobj = contactList[0];

        //NSLog(@"obj class = %@",[obj class]);//CContact

        idDC = [%c(MMServiceCenter) defaultCenter];

        CContactMgr *contactManager = [DC getService:[%c(CContactMgr)class]];

        idselfContact = [contactManager getSelfContact];//CContact类继承于CBaseContact

        NSMutableArray *realContactList = [NSMutableArraynew];

        //便利联系人 获取剔除自己后的数组

        for(CContact *contactincontactList) {

            if([contact isNormalFriendContact] && ![[contact getContactDisplayUsrName] isEqualToString:[selfContact getContactDisplayUsrName]]){

                FriendEntity *entity = [FriendEntitynew];

                //username nickname

                entity.wxid = contact.m_nsUsrName;

                entity.username = [contact getContactDisplayUsrName];

                entity.nickname = [contact getContactDisplayName];

                [realContactList addObject:entity];

                NSLog(@"该好友符合 getContactDisplayName = %@",[contact getContactDisplayName]);

                NSLog(@"m_nsUsrName = %@",contact.m_nsUsrName);

            }else{

                //NSLog(@"该好友不符合 getContactDisplayName = %@",[contact getContactDisplayName]);

            }

        }

        //NSLog(@"realContactList = %@",realContactList);

        NSMutableArray *pullContactList = [NSMutableArraynew];

        for(FriendEntity *entityinrealContactList){

            //[pullContactList addObject:@{@"m_nsMemberName":entity.username,@"m_uiMemberStatus":@"0",@"m_nsNickName":@"null"}];

            GroupMember *member = [[%c(GroupMember) alloc] init];

            member.m_nsMemberName = entity.wxid;

            member.m_nsNickName = entity.nickname;

            member.m_uiMemberStatus =0;

            [pullContactList addObject:member];

        }

        NSLog(@"pullContactList = %@",pullContactList);

        if(currentChatRoomName.length >0){

            NSLog(@"currentChatRoomName = %@",currentChatRoomName);

            idobjc = pullContactList[0];

            NSLog(@"objc = %@",objc);

            [[DC getService:[%c(CGroupMgr)class]] AddGroupMember:currentChatRoomName withMemberList:pullContactList withDesp:@"hello"];

        }

    }

    相关文章

      网友评论

          本文标题:逆向宝藏具体方法之拉群、建群

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