Beispiel #1
0
def clear_blacklist():
    arena = getattr(BigWorld.player(), 'arena', None)
    if arena is None and not global_vars.check_running:
        global_vars.check_running = True
        blacklisted_contacts = ContactsManager()
        all_users = blacklisted_contacts.usersStorage.getList(
            ItemsFindCriteria(XMPP_ITEM_TYPE.PERSISTENT_BLOCKING_LIST))
        idx = 0
        while idx < len(all_users) and global_vars.enable_clear:
            blacklisted_contacts.removeIgnored(all_users[idx].getID(), False)
            idx += 1
            yield wait(1.1)
            if idx % 500 == 0:
                users_left = len(all_users) - idx
                SendGuiMessage(
                    'There is ' +
                    str(datetime.timedelta(seconds=round(users_left * 1.1))) +
                    ' left!')
        if idx == len(all_users) - 1:
            SendGuiMessage('Cleared your blacklist!')
        global_vars.check_running = False