• Модуль: mail
  • Путь к файлу: ~/bitrix/modules/mail/lib/imapcommands/mailsflagsmanager.php
  • Класс: BitrixMailImapCommandsMailsFlagsManager
  • Вызов: MailsFlagsManager::setMessagesFlag
private function setMessagesFlag($flag)
{
	$result = new MainResult();

	if ($flag === static::FLAG_SEEN)
	{
		$result = $this->mailboxHelper->markSeen($this->messages);
	}
	elseif ($flag === static::FLAG_UNSEEN)
	{
		$result = $this->mailboxHelper->markUnseen($this->messages);
	}

	if ($result->isSuccess())
	{
		if ($flag === static::FLAG_SEEN)
		{
			$this->repository->markMessagesSeen($this->messages, $this->mailbox);
		}
		elseif ($flag === static::FLAG_UNSEEN)
		{
			$this->repository->markMessagesUnseen($this->messages, $this->mailbox);
		}

		return new MainResult();
	}
	return (new MainResult())->addError(new MainError(Loc::getMessage('MAIL_CLIENT_SYNC_ERROR'), 'MAIL_CLIENT_SYNC_ERROR'));
}