- Модуль: xmpp
- Путь к файлу: ~/bitrix/modules/xmpp/classes/util.php
- Класс: CXMPPUtility
- Вызов: CXMPPUtility::GetMessageArray
static function GetMessageArray($senderJId, $receiverJId, $messageType, $body, $domain = "")
{
if ($receiverJId == '')
return false;
if (empty($domain))
$domain = CXMPPServer::GetDomain();
// chat - The message is sent in the context of a one-to-one chat conversation.
// error - An error has occurred related to a previous message sent by the sender.
// groupchat - The message is sent in the context of a multi-user chat environment.
// headline - The message is probably generated by an automated service that delivers or broadcasts content.
// normal - The message is a single message that is sent outside the context of a one-to-one conversation or
// groupchat, and to which it is expected that the recipient will reply.
$arAllowableMessageTypes = array("chat", "groupchat", "headline", "normal");
if (!in_array($messageType, $arAllowableMessageTypes))
return false;
$arResult = array(
"message" => array(
"." => array(
"from" => CXMPPUtility::GetJIdWithResource($senderJId, $domain),
"to" => CXMPPUtility::GetJIdWithResource($receiverJId, $domain),
"type" => $messageType,
"id" => "u".rand(1000, 9999),
),
"body" => array(
"#" => $body,
),
),
);
return $arResult;
}