- Модуль: im
- Путь к файлу: ~/bitrix/modules/im/lib/V2/Message/Send/SendingService.php
- Класс: BitrixImV2MessageSendSendingService
- Вызов: SendingService::fireEventBeforeNotifySend
public function fireEventBeforeNotifySend(Chat $chat, Message $message): Result
{
$result = new Result;
$compatibleFields = array_merge(
$message->toArray(),
$chat->toArray(),
$this->sendingConfig->toArray(),
);
foreach (GetModuleEvents('im', self::EVENT_BEFORE_NOTIFY_ADD, true) as $arEvent)
{
$eventResult = ExecuteModuleEventEx($arEvent, [&$compatibleFields]);
if ($eventResult === false || isset($eventResult['result']) && $eventResult['result'] === false)
{
$reason = $this->detectReasonSendError($chat->getType(), $eventResult['reason'] ?? '');
return $result->addError(new ChatError(ChatError::FROM_OTHER_MODULE, $reason));
}
}
return $result;
}