1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Chat protocol rewrite (#5117)

* New TOCLIENT_CHAT_MESSAGE packet

* Rename old packet to TOCLIENT_CHAT_MESSAGE_OLD for compat
* Handle TOCLIENT_CHAT_MESSAGE new structure client side
* Client chat queue should use a specific object
* SendChatMessage: use the right packet depending on protocol version (not complete yet)
* Add chatmessage(type) objects and handle them client side (partially)
* Use ChatMessage instead of std::wstring server side

* Update with timestamp support
This commit is contained in:
Loïc Blot 2017-07-16 10:47:31 +02:00 committed by GitHub
parent ecbc972ea6
commit 7ddf67aa14
16 changed files with 251 additions and 51 deletions

View file

@ -275,6 +275,12 @@ NetworkPacket& NetworkPacket::operator<<(u64 src)
return *this;
}
NetworkPacket& NetworkPacket::operator<<(std::time_t src)
{
*this << (u64) src;
return *this;
}
NetworkPacket& NetworkPacket::operator<<(float src)
{
checkDataSize(4);
@ -360,6 +366,16 @@ NetworkPacket& NetworkPacket::operator>>(u64& dst)
return *this;
}
NetworkPacket& NetworkPacket::operator>>(std::time_t& dst)
{
checkReadOffset(m_read_offset, 8);
dst = readU64(&m_data[m_read_offset]);
m_read_offset += 8;
return *this;
}
NetworkPacket& NetworkPacket::operator>>(float& dst)
{
checkReadOffset(m_read_offset, 4);