- Модуль: imopenlines
- Путь к файлу: ~/bitrix/modules/imopenlines/lib/chat.php
- Класс: BitrixImOpenLinesChat
- Вызов: Chat::__construct
public function __construct($chatId = 0, $params = [])
{
$imLoad = Loader::includeModule('im');
$pullLoad = Loader::includeModule('pull');
if ($imLoad && $pullLoad)
{
$this->error = new BasicError(null, '', '');
$this->moduleLoad = true;
}
else
{
if (!$imLoad)
{
$this->error = new BasicError(__METHOD__, 'IM_LOAD_ERROR', Loc::getMessage('IMOL_CHAT_ERROR_IM_LOAD'));
}
elseif (!$pullLoad)
{
$this->error = new BasicError(__METHOD__, 'PULL_LOAD_ERROR', Loc::getMessage('IMOL_CHAT_ERROR_PULL_LOAD'));
}
}
if ($imLoad)
{
$chatId = (int)$chatId;
if ($chatId > 0)
{
$chat = ChatTable::getById($chatId)->fetch();
if (
!empty($chat)
&& in_array($chat['ENTITY_TYPE'], [self::CHAT_TYPE_OPERATOR, self::CHAT_TYPE_CLIENT], true)
)
{
if (
isset($params['CONNECTOR']['chat']['description'])
&& $chat['DESCRIPTION'] != $params['CONNECTOR']['chat']['description']
)
{
$chatManager = new CIMChat(0);
$chatManager->SetDescription($chat['ID'], $params['CONNECTOR']['chat']['description']);
$chat['DESCRIPTION'] = $params['CONNECTOR']['chat']['description'];
}
$this->chat = $chat;
$this->isDataLoaded = true;
//TODO: Hack for telegram 22.04.2022
$this->isNoSession($chat);
}
}
}
}