public function SendChatMessage($dialogId, $incomingType, $message) { if (strlen($message) <= 0 || strlen($dialogId) <= 0) { return false; } if (CVoxImplantConfig::GetChatAction() == CVoxImplantConfig::INTERFACE_CHAT_NONE) { return false; } if (!CModule::IncludeModule('im')) { return false; } // TODO CHECK NULL USER BEFORE SEND $chatId = 0; if (substr($dialogId, 0, 4) == 'chat') { $chatId = intval(substr($dialogId, 4)); CIMChat::AddMessage(array("FROM_USER_ID" => $incomingType == CVoxImplantMain::CALL_OUTGOING ? $this->userId : 0, "TO_CHAT_ID" => $chatId, "MESSAGE" => $message, "SYSTEM" => 'Y')); } else { if (intval($dialogId) > 0) { CIMMessage::Add(array("FROM_USER_ID" => $incomingType == CVoxImplantMain::CALL_OUTGOING ? $this->userId : intval($dialogId), "TO_USER_ID" => $incomingType == CVoxImplantMain::CALL_OUTGOING ? intval($dialogId) : $this->userId, "MESSAGE" => $message, "SYSTEM" => 'Y')); } } return true; }
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } /** * @var $arParams array * @var $arResult array * @var $this CBitrixComponent * @var $APPLICATION CMain * @var $USER CUser */ if (!CModule::IncludeModule('voximplant')) { return; } $arResult['INTERFACE_CHAT_OPTIONS'] = array(CVoxImplantConfig::INTERFACE_CHAT_ADD, CVoxImplantConfig::INTERFACE_CHAT_APPEND, CVoxImplantConfig::INTERFACE_CHAT_NONE); $arResult['INTERFACE_CHAT_ACTION'] = CVoxImplantConfig::GetChatAction(); if (!(isset($arParams['TEMPLATE_HIDE']) && $arParams['TEMPLATE_HIDE'] == 'Y')) { $this->IncludeComponentTemplate(); } return $arResult;