aboutsummaryrefslogtreecommitdiff
path: root/build/test.py
blob: f23bbc45fa48aa02501c9da293f422cf0dc0ba9a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import NetworkPacket_pb2
import BuddyListNotifyCommand_pb2

request = NetworkPacket_pb2.NetworkPacket()

request.length = 3
request.short_object_id = 0xFF
request.type = 0x0A
request.buddy_list_notify_command.CopyFrom(
    BuddyListNotifyCommand_pb2.BuddyListNotifyCommand()
)
request.buddy_list_notify_command.buddy_name = "Whirl"
request.buddy_list_notify_command.logged_on = 1

print(request.SerializeToString())
print(request.WhichOneof("command"))

deserialised_request = NetworkPacket_pb2.NetworkPacket()

deserialised_request.ParseFromString(request.SerializeToString())

print(deserialised_request.length)
print(deserialised_request.short_object_id)
print(deserialised_request.type)
print(deserialised_request.buddy_list_notify_command.buddy_name)
print(deserialised_request.buddy_list_notify_command.logged_on)