This change added a version flag to chunk header
``ChunkHeader()`` no longer works! You now have to do
``ChunkHeader(version = '0.6')`` or ``ChunkHeader(version = '0.7')``
This fixes 0.6 chunk header packing.
It has a suddle difference to 0.7 and it is now packed correctly.
Also unpacking 0.6.5 chunk headers is fixed by reading the correct size.
The recommended way now is setting the version when constructing the
packet. Like this:
packet = TwPacket(version = '0.6')
which will then set the correct header object in version 6 or 7
and thus also set the correct flags. And the version field is also set.
It is not recommended to do this:
packet = TwPacket() # defaults to 0.7
packet.version = '0.6'
That might cause confusion. This should be made more failsafe in a new
commit.
This commit is not about snapshots!
Generated the snap item classes for 0.6 and 0.7
And changed the type used for snap items from int to the snap class
This now allows to properly serialize and deserialize
messages such as sys.input
This sets message fields to `None` if they were not set.
And also does not pack fields that are set to `None`
BREAKING CHANGE: earlier to this commit the control close reason field
was set to an empty string if it was not set. Now it is set to None
Set the token flag automatically if a token is provided. So lib users
have less boilerplate code to send a packet. But it can still be
set explicitly to false if desired.
Also add a test for cl_start_info
python handles bools more like the ints 0 and 1
and those are exactly the values the
teeworlds network protocol expects
I can totally see this breaking in python4
or a new mypy version
maybe one day a ``get_bool()`` could make sense
also for readability
but for now this should be stable as long as the
tests pass