- Модуль: im
- Путь к файлу: ~/bitrix/modules/im/lib/dialog.php
- Класс: BitrixImDialog
- Вызов: Dialog::getChatId
static function getChatId($dialogId, $userId = null)
{
if (preg_match('/^chat[0-9]{1,}$/i', $dialogId))
{
$chatId = (int)mb_substr($dialogId, 4);
}
else if (preg_match('/^d{1,}$/i', $dialogId))
{
$dialogId = intval($dialogId);
if (!$dialogId)
{
return false;
}
$userId = BitrixImCommon::getUserId($userId);
if (!$userId)
{
return false;
}
$chatId = CIMMessage::GetChatId($dialogId, $userId);
if (!$chatId)
{
return false;
}
}
else if (preg_match('/^crm|w+?|d+?$/i', $dialogId))
{
$chatId = CIMChat::GetCrmChatId(mb_substr($dialogId, 4));
}
else if (preg_match('/^sg[0-9]{1,}$/i', $dialogId))
{
$chatId = CIMChat::GetSonetGroupChatId(mb_substr($dialogId, 2));
}
else
{
$chatId = 0;
}
return $chatId;
}