diff options
author | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-07-16 10:47:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-16 10:47:31 +0200 |
commit | 7ddf67aa1478813e12a5fcdfb4986b9e5adfe62f (patch) | |
tree | 0bbbee7ed9470e0de149ec9bdaf6a51693ec0e22 /src/network/networkpacket.cpp | |
parent | ecbc972ea6a2371d64b1d9c9576d31be36b8ae6a (diff) | |
download | minetest-7ddf67aa1478813e12a5fcdfb4986b9e5adfe62f.tar.xz |
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
Diffstat (limited to 'src/network/networkpacket.cpp')
-rw-r--r-- | src/network/networkpacket.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/network/networkpacket.cpp b/src/network/networkpacket.cpp index 48cf3a374..78c73d253 100644 --- a/src/network/networkpacket.cpp +++ b/src/network/networkpacket.cpp @@ -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); |