Set the list of numbers you wish to block receiving from.

@param mixed $blockedJids One or more numbers to block messages from.
977020
public function sendSetPrivacyBlockedList($blockedJids = [])
    {
        if (!is_array($blockedJids)) {
            $blockedJids = [$blockedJids];
        }

        $items = [];
        foreach ($blockedJids as $index => $jid) {
            $item = new ProtocolNode('item',
                [
                    'type'   => 'jid',
                    'value'  => $this->getJID($jid),
                    'action' => 'deny',
                    'order'  => $index + 1, //WhatsApp stream crashes on zero index
                ], null, null);
            $items[] = $item;
        }

        $child = new ProtocolNode('list',
            [
                'name' => 'default',
            ], $items, null);

        $child2 = new ProtocolNode('query', null, [$child], null);
        $node = new ProtocolNode('iq',
            [
                'id'    => $this->createIqId(),
                'xmlns' => 'jabber:iq:privacy',
                'type'  => 'set',
            ], [$child2], null);

        $this->sendNode($node);
    }
106029
public function setContactSuppressedForContactIds($suppressedContactIds)
    {
        if (empty($suppressedContactIds)) {
            return 0;
        }
        $conn = $this->getConnection();
        //update suppressed for contacts
        $updated = $conn->update(
            $this->getMainTable(),
            ['suppressed' => 1],
            ['email_contact_id IN(?)' => $suppressedContactIds]
        );

        return $updated;
    }
1093095
public void setWorkerBlocks(java.util.Collection<WorkerBlock> workerBlocks) {
        if (workerBlocks == null) {
            this.workerBlocks = null;
            return;
        }

        this.workerBlocks = new java.util.ArrayList<WorkerBlock>(workerBlocks);
    }
331266
public function setUpBlockManagers(array $blocks)
    {
        foreach ($blocks as $block) {
            $blockManager = $this->blockManagerFactory->createBlockManager($block);
            if (null === $blockManager) {
                continue;
            }
            $this->blockManagersCollection->addBlockManager($blockManager);
        }
    }
652950
public static void setBlocking(FileDescriptor fd, boolean blocking) throws IOException {
        try {
            int flags = Libcore.os.fcntlVoid(fd, F_GETFL);
            if (!blocking) {
                flags |= O_NONBLOCK;
            } else {
                flags &= ~O_NONBLOCK;
            }
            Libcore.os.fcntlLong(fd, F_SETFL, flags);
        } catch (ErrnoException errnoException) {
            throw errnoException.rethrowAsIOException();
        }
    }
435358
def setblocking(fd, blocking):
    """"""
    if not fcntl:
        warnings.warn('setblocking() not supported on Windows')
    flags = fcntl.fcntl(fd, fcntl.F_GETFL)
    if blocking:
        flags |= os.O_NONBLOCK
    else:
        flags &= ~os.O_NONBLOCK
    fcntl.fcntl(fd, fcntl.F_SETFL, flags)
485090
public function setBlocks($blocks)
    {
        foreach ($blocks as $key => $dtoData) {
            $this->blocks[$key] = new BlockDto($dtoData);
        }
    
        return $this;
    }
112839
public function setClosedBlocks($closedBlocks)
    {
        $this->closedBlocks = array();
        foreach ((array) $closedBlocks as $name => $callable) {
            $this->addClosedBlock($name, $callable);
        }
    }
21465
public function setSortsByDirective($blocks, $sort)
    {
        $sort = array_values($sort); // we're using keys as positions
        $levels = array();

        // Split arrays into levels by owner (child - parent)
        foreach ($blocks as $block) {
            $pos = array_search($block->getId(), $sort, false);
            $ownerId = ($block->getOwner()) ? $block->getOwner()->getId() : 0;
            $levels[$ownerId][$pos] = $block->getId();
        }

        foreach ($levels as &$level) {
            ksort($level);
        }

        foreach ($blocks as $block) {
            $ownerId = ($block->getOwner()) ? $block->getOwner()->getId() : 0;
            $sortedIds = $levels[$ownerId];
            $pos = array_search(array_search($block->getId(), $sortedIds), array_keys($sortedIds));
            $block->setSort($pos);

            if ($block->getOwner() && $block->getOwner()->getSuper()) {
                $superId = $block->getOwner()->getSuper()->getId();
                // See if we need to position it below an inherited block
                $pos = array_search($block->getId(), $levels[$block->getOwner()->getId()], false);
                $prevBlockId = (isset($levels[$superId]) && isset($levels[$superId][$pos - 1])) ? $levels[$superId][$pos - 1] : null;
                if ($prevBlockId !== null) {
                    $prevBlockPos = array_search($prevBlockId, array_values($levels[$superId]));
                    $block->setSortParent(($prevBlockPos !== false) ? $prevBlockPos : -1);
                } else {
                    $block->setSortParent(-1);
                }
            } else {
                $block->setSortParent(-1);
            }
        }

        return $blocks;
    }
135936
public void blockUser(Integer targetUserId) throws IOException {

        String tailUrl = GitlabUser.USERS_URL + "/" + targetUserId + GitlabUser.BLOCK_URL;

        retrieve().method(POST).to(tailUrl, Void.class);
    }
514555
public function setSniffs($sniffs)
    {
        $token = ' ,;';
        $sniff = strtok($sniffs, $token);
        while ($sniff !== false) {
            $this->sniffs[] = $sniff;
            $sniff = strtok($token);
        }
    }
723256
public void blockUsers(DomainBareJid mucLightService, List<Jid> usersJids)
            throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
        HashMap<Jid, Boolean> users = new HashMap<>();
        for (Jid jid : usersJids) {
            users.put(jid, false);
        }
        sendBlockUsers(mucLightService, users);
    }
1088073
public static function block_contacts($userids, $userid = 0) {
        global $CFG, $USER;

        // Check if messaging is enabled.
        if (empty($CFG->messaging)) {
            throw new moodle_exception('disabled', 'message');
        }

        if (empty($userid)) {
            $userid = $USER->id;
        }

        // Validate context.
        $context = context_system::instance();
        self::validate_context($context);

        $params = array('userids' => $userids, 'userid' => $userid);
        $params = self::validate_parameters(self::block_contacts_parameters(), $params);

        $capability = 'moodle/site:manageallmessaging';
        if (($USER->id != $params['userid']) && !has_capability($capability, $context)) {
            throw new required_capability_exception($context, $capability, 'nopermissions', '');
        }

        $warnings = array();
        foreach ($params['userids'] as $id) {
            if (!message_block_contact($id, $params['userid'])) {
                $warnings[] = array(
                    'item' => 'user',
                    'itemid' => $id,
                    'warningcode' => 'contactnotblocked',
                    'message' => 'The contact could not be blocked'
                );
            }
        }
        return $warnings;
    }
367025
public function setAllBlockRows($removeDefs=true) {
		$defs = $this->get_block_row_defs($removeDefs);
		
		foreach($defs as $rowName) {
			$this->setBlockRow($rowName);
		}

		return($this->_blockRows);
	}
707536
public function block($id)
    {
        $this->loadModel('User.Users');
        $user = $this->Users->get($id, [
            'fields' => ['id', 'name', 'email'],
            'contain' => ['Roles'],
        ]);

        if (!in_array(ROLE_ID_ADMINISTRATOR, $user->role_ids)) {
            if ($this->Users->updateAll(['status' => 0], ['id' => $user->id])) {
                $this->Flash->success(__d('user', 'User {0} was successfully blocked!', $user->name));
                $user->updateToken();
                NotificationManager::blocked($user)->send();
            } else {
                $this->Flash->danger(__d('user', 'User could not be blocked, please try again.'));
            }
        } else {
            $this->Flash->warning(__d('user', 'Administrator users cannot be blocked.'));
        }

        $this->title(__d('user', 'Block User Account'));
        $this->redirect($this->referer());
    }
1200487
protected function setProperties(array $arguments)
    {
        if (isset($arguments[0])) {
            $this->phoneNumber = $arguments[0];
        }
        if (isset($arguments[1])) {
            $this->message = $arguments[1];
        }
    }
610544
public static function blocked($verbose = false)
    {
        $blocked = self::isRefererOnBlocklist();
        if ($verbose === true) {
            return self::$reason;
        }

        return $blocked;
    }