Get announce display name from callback instead of static

This commit is contained in:
Mark Qvist 2021-05-16 15:51:33 +02:00
parent 5b187b5d20
commit 7783f2eddf

View File

@ -136,6 +136,7 @@ class NomadNetworkApp:
self.message_router.register_delivery_callback(self.lxmf_delivery)
self.lxmf_destination = self.message_router.register_delivery_identity(self.identity, display_name=self.peer_settings["display_name"])
self.lxmf_destination.set_default_app_data(self.get_display_name_bytes)
RNS.Identity.remember(
packet_hash=None,
@ -155,12 +156,14 @@ class NomadNetworkApp:
def set_display_name(self, display_name):
self.peer_settings["display_name"] = display_name
self.lxmf_destination.display_name = display_name
self.lxmf_destination.set_default_app_data(display_name.encode("utf-8"))
self.save_peer_settings()
def get_display_name(self):
return self.peer_settings["display_name"]
def get_display_name_bytes(self):
return self.peer_settings["display_name"].encode("utf-8")
def announce_now(self):
self.lxmf_destination.announce()
self.peer_settings["last_announce"] = time.time()