• Модуль: imconnector
  • Путь к файлу: ~/bitrix/modules/imconnector/lib/connectors/olx.php
  • Класс: BitrixImConnectorConnectorsOlx
  • Вызов: Olx::initializeReceiveMessages
static function initializeReceiveMessages(): string
{
	if (
		Loader::includeModule('imconnector')
		&& Connector::isConnector(Library::ID_OLX_CONNECTOR)
	)
	{
		$statuses = Status::getInstanceAllLine(Library::ID_OLX_CONNECTOR);
		if (!empty($statuses))
		{
			$isAnyConnected = false;
			foreach ($statuses as $lineId => $status)
			{
				$needNotification = false;
				if ($status->isStatus())
				{
					$isAnyConnected = true;
					$connectorOutput = new Output(Library::ID_OLX_CONNECTOR, $lineId);

					$responseResult = $connectorOutput->initializeReceiveMessages($status->getData());
					if ($responseResult->isSuccess())
					{
						$responseResultData = $responseResult->getData();

						if (
							isset($responseResultData['need_notification'])
							&& $responseResultData['need_notification'] === 'Y'
						)
						{
							$needNotification = true;
						}
					}

					if ($needNotification)
					{
						self::sendNotificationToRenewToken($lineId);
					}
				}
			}
			if (!$isAnyConnected)
			{
				return '';
			}
		}
		else
		{
			return '';
		}
	}

	return 'BitrixImConnectorConnectorsOLX::initializeReceiveMessages();';
}