Use a random squirrel id and an incremental nonce
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
@ -227,13 +227,17 @@ class DataTLV(TLV):
|
||||
sender.nickname = nickname
|
||||
|
||||
@staticmethod
|
||||
def construct(message: str) -> "DataTLV":
|
||||
def construct(message: str, squirrel: Any) -> "DataTLV":
|
||||
tlv = DataTLV()
|
||||
tlv.type = 4
|
||||
tlv.sender_id = 42 # FIXME Use the good sender id
|
||||
tlv.nonce = 42 # FIXME Use an incremental nonce
|
||||
tlv.sender_id = squirrel.id if squirrel else 0
|
||||
tlv.nonce = squirrel.incr_nonce if squirrel else 0
|
||||
tlv.data = message.encode("UTF-8")
|
||||
tlv.length = 12 + len(tlv.data)
|
||||
|
||||
if squirrel:
|
||||
squirrel.incr_nonce += 1
|
||||
|
||||
return tlv
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user