mirror of
https://github.com/markqvist/LXMF-Tools.git
synced 2025-06-08 06:22:43 -04:00
LXMF class improved, title and fields transport of distribution group and echo, added lxmf_provisioning server/script
This commit is contained in:
parent
537a59cdd3
commit
81084f17f8
11 changed files with 1378 additions and 65 deletions
|
@ -99,7 +99,7 @@ class lxmf_connection:
|
|||
message_notification_failed_callback = None
|
||||
|
||||
|
||||
def __init__(self, storage_path=None, identity_file="identity", identity=None, destination_name="lxmf", destination_type="delivery", display_name="", send_delay=0, desired_method="direct", propagation_node=None, try_propagation_on_fail=False, announce_startup=False, announce_startup_delay=0, announce_periodic=False, announce_periodic_interval=360, sync_startup=False, sync_startup_delay=0, sync_limit=8, sync_periodic=False, sync_periodic_interval=360):
|
||||
def __init__(self, storage_path=None, identity_file="identity", identity=None, destination_name="lxmf", destination_type="delivery", display_name="", announce_data=None, send_delay=0, desired_method="direct", propagation_node=None, try_propagation_on_fail=False, announce_startup=False, announce_startup_delay=0, announce_periodic=False, announce_periodic_interval=360, sync_startup=False, sync_startup_delay=0, sync_limit=8, sync_periodic=False, sync_periodic_interval=360):
|
||||
self.storage_path = storage_path
|
||||
|
||||
self.identity_file = identity_file
|
||||
|
@ -111,6 +111,7 @@ class lxmf_connection:
|
|||
self.aspect_filter = self.destination_name + "." + self.destination_type
|
||||
|
||||
self.display_name = display_name
|
||||
self.announce_data = announce_data
|
||||
|
||||
self.send_delay = int(send_delay)
|
||||
|
||||
|
@ -166,9 +167,11 @@ class lxmf_connection:
|
|||
|
||||
self.message_router = LXMF.LXMRouter(identity=self.identity, storagepath=self.storage_path)
|
||||
|
||||
self.destination = self.message_router.register_delivery_identity(self.identity, display_name=self.display_name)
|
||||
|
||||
self.message_router.register_delivery_callback(self.process_lxmf_message_propagated)
|
||||
if self.destination_name == "lxmf" and self.destination_type == "delivery":
|
||||
self.destination = self.message_router.register_delivery_identity(self.identity, display_name=self.display_name)
|
||||
self.message_router.register_delivery_callback(self.process_lxmf_message_propagated)
|
||||
else:
|
||||
self.destination = RNS.Destination(self.identity, RNS.Destination.IN, RNS.Destination.SINGLE, self.destination_name, self.destination_type)
|
||||
|
||||
if self.display_name == "":
|
||||
self.display_name = RNS.prettyhexrep(self.destination_hash())
|
||||
|
@ -368,8 +371,19 @@ class lxmf_connection:
|
|||
|
||||
def announce_now(self, app_data=None):
|
||||
if app_data:
|
||||
self.destination.announce(app_data.encode("utf-8"))
|
||||
log("LXMF - Announced: " + RNS.prettyhexrep(self.destination_hash()) + ":" + app_data, LOG_DEBUG)
|
||||
if isinstance(app_data, str):
|
||||
self.destination.announce(app_data.encode("utf-8"))
|
||||
log("LXMF - Announced: " + RNS.prettyhexrep(self.destination_hash()) +":" + announce_data, LOG_DEBUG)
|
||||
else:
|
||||
self.destination.announce(app_data)
|
||||
log("LMF - Announced: " + RNS.prettyhexrep(self.destination_hash()), LOG_DEBUG)
|
||||
elif self.announce_data:
|
||||
if isinstance(self.announce_data, str):
|
||||
self.destination.announce(self.announce_data.encode("utf-8"))
|
||||
log("LXMF - Announced: " + RNS.prettyhexrep(self.destination_hash()) +":" + self.announce_data, LOG_DEBUG)
|
||||
else:
|
||||
self.destination.announce(self.announce_data)
|
||||
log("LXMF - Announced: " + RNS.prettyhexrep(self.destination_hash()), LOG_DEBUG)
|
||||
else:
|
||||
self.destination.announce()
|
||||
log("LXMF - Announced: " + RNS.prettyhexrep(self.destination_hash()) + ": " + self.display_name, LOG_DEBUG)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue