Correct struct unpack

This commit is contained in:
simon.kagstrom 2009-11-01 08:43:18 +00:00
parent 3518863b67
commit 958eddfd37

View File

@ -141,7 +141,7 @@ class ConnectToBrokerPacket(Packet):
if self.version >= 4: if self.version >= 4:
self.avatar = struct.unpack(">L", data[88:92])[0] self.avatar = struct.unpack(">L", data[88:92])[0]
self.screenshot = struct.unpack(">%dB" % (image.SCREENSHOT_SIZE), self.screenshot = struct.unpack(">%ds" % (image.SCREENSHOT_SIZE),
data[92:92 + image.SCREENSHOT_SIZE])[0] data[92:92 + image.SCREENSHOT_SIZE])[0]
print "VOBB", self.screenshot print "VOBB", self.screenshot
@ -192,7 +192,7 @@ class ListPeersPacket(Packet):
0, peer.id, self.version) 0, peer.id, self.version)
if self.version >= 4: if self.version >= 4:
print "Marshalling", peer.screenshot print "Marshalling", peer.screenshot
out = out + struct.pack(">L%dB" % (image.SCREENSHOT_SIZE), out = out + struct.pack(">L%ds" % (image.SCREENSHOT_SIZE),
peer.avatar, peer.screenshot) peer.avatar, peer.screenshot)
return Packet.marshal(self) + out return Packet.marshal(self) + out