PyBitmessage/src/protocol.py
mailchuck a727847e55 Addresses can be configured not to send acks
Manually by specifying "dontsendack" = true in the address section
2016-05-02 15:00:22 +02:00

14 lines
426 B
Python

import struct
import shared
def getBitfield(address):
# bitfield of features supported by me (see the wiki).
bitfield = 0
# send ack
if not shared.safeConfigGetBoolean(address, 'dontsendack'):
bitfield |= shared.BITFIELD_DOESACK
return struct.pack('>I', bitfield)
def checkBitfield(bitfieldBinary, flags):
bitfield, = struct.unpack('>I', bitfieldBinary)
return (bitfield & flags) == flags