Longpool: Update format for use in modern clients

This commit is contained in:
veselcraft 2022-09-19 16:54:23 +03:00
parent 283d8c1c2d
commit 697a365205
No known key found for this signature in database
GPG key ID: AED66BC1AC628A4E

View file

@ -27,14 +27,23 @@ class NewMessageEvent implements ILPEmitable
if($peer === $userId) if($peer === $userId)
$peer = $msg->getRecipient()->getId(); $peer = $msg->getRecipient()->getId();
/*
* Source:
* https://github.com/danyadev/longpoll-doc
*/
return [ return [
4, # event type 4, # event type
$msg->getId(), # messageId
256, # checked for spam flag 256, # checked for spam flag
$peer, # TODO calculate peer correctly $peer, # TODO calculate peer correctly
$msg->getSendTime()->timestamp(), # creation time in unix $msg->getSendTime()->timestamp(), # creation time in unix
$msg->getText(), # text (formatted) $msg->getText(), # text (formatted)
[], # empty additional info
[], # empty attachments [], # empty attachments
$msg->getId() << 2, # id as random_id $msg->getId() << 2, # id as random_id
$peer, # conversation id
0 # not edited yet
]; ];
} }
} }