Added default app data to destinations
This commit is contained in:
parent
8800a6ab4e
commit
bdf1d289b0
|
@ -94,6 +94,7 @@ class Destination:
|
||||||
self.name = Destination.full_name(app_name, *aspects)
|
self.name = Destination.full_name(app_name, *aspects)
|
||||||
self.hash = Destination.hash(app_name, *aspects)
|
self.hash = Destination.hash(app_name, *aspects)
|
||||||
self.hexhash = self.hash.hex()
|
self.hexhash = self.hash.hex()
|
||||||
|
self.default_app_data = None
|
||||||
|
|
||||||
self.callback = None
|
self.callback = None
|
||||||
self.proofcallback = None
|
self.proofcallback = None
|
||||||
|
@ -217,12 +218,20 @@ class Destination:
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def set_default_app_data(self, app_data=None):
|
||||||
|
self.default_app_data = app_data
|
||||||
|
|
||||||
|
def clear_default_app_data(self):
|
||||||
|
self.set_default_app_data(app_data=None)
|
||||||
|
|
||||||
# Creates an announce packet for this destination.
|
# Creates an announce packet for this destination.
|
||||||
# Application specific data can be added to the announce.
|
# Application specific data can be added to the announce.
|
||||||
def announce(self, app_data=None, path_response=False):
|
def announce(self, app_data=None, path_response=False):
|
||||||
destination_hash = self.hash
|
destination_hash = self.hash
|
||||||
random_hash = RNS.Identity.getRandomHash()
|
random_hash = RNS.Identity.getRandomHash()
|
||||||
|
|
||||||
|
if app_data == None and self.default_app_data != None:
|
||||||
|
app_data = self.default_app_data
|
||||||
|
|
||||||
signed_data = self.hash+self.identity.getPublicKey()+random_hash
|
signed_data = self.hash+self.identity.getPublicKey()+random_hash
|
||||||
if app_data != None:
|
if app_data != None:
|
||||||
|
|
Loading…
Reference in New Issue