Save and display stamp status on messages

This commit is contained in:
Mark Qvist 2024-09-08 01:20:52 +02:00
parent 7ec35db6c9
commit c6f82a917d
3 changed files with 19 additions and 1 deletions

View File

@ -2606,6 +2606,14 @@ class SidebandCore():
extras["snr"] = lxm.snr
extras["q"] = lxm.q
if lxm.stamp_checked:
extras["stamp_checked"] = True
extras["stamp_valid"] = lxm.stamp_valid
extras["stamp_value"] = lxm.stamp_value
if lxm.ratchet_id:
extras["ratchet_id"] = lxm.ratchet_id
if packed_telemetry != None:
extras["packed_telemetry"] = packed_telemetry
@ -2671,7 +2679,7 @@ class SidebandCore():
def lxmf_announce(self, attached_interface=None):
if self.is_standalone or self.is_service:
if self.config["lxmf_require_stamps"]:
self.message_router.set_inbound_stamp_cost(self.lxmf_destination, self.config["lxmf_inbound_stamp_cost"])
self.message_router.set_inbound_stamp_cost(self.lxmf_destination.hash, self.config["lxmf_inbound_stamp_cost"])
self.message_router.announce(self.lxmf_destination.hash, attached_interface=attached_interface)
else:
self.lxmf_destination.announce(attached_interface=attached_interface)

View File

@ -280,6 +280,8 @@ class Messages():
has_attachment = False
force_markup = False
signature_valid = False
stamp_valid = False
stamp_value = None
if "lxm" in m and m["lxm"] != None and m["lxm"].signature_validated:
signature_valid = True
@ -290,6 +292,10 @@ class Messages():
except Exception as e:
pass
if "extras" in m and m["extras"] != None and "stamp_checked" in m["extras"] and m["extras"]["stamp_checked"] == True:
stamp_valid = m["extras"]["stamp_valid"]
stamp_value = m["extras"]["stamp_value"]
if "lxm" in m and m["lxm"] != None and m["lxm"].fields != None and LXMF.FIELD_COMMANDS in m["lxm"].fields:
try:
commands = m["lxm"].fields[LXMF.FIELD_COMMANDS]
@ -409,6 +415,8 @@ class Messages():
heading_str = titlestr
if phy_stats_str != "" and self.app.sideband.config["advanced_stats"]:
heading_str += phy_stats_str+"\n"
if stamp_valid:
txstr += f" [b]Stamp[/b] value is {stamp_value} "
heading_str += "[b]Sent[/b] "+txstr
heading_str += "\n[b]Received[/b] "+rxstr

View File

@ -821,6 +821,8 @@ class RVDetails(MDRecycleView):
t_str = ", but have ticket"
if stamp_cost:
self.entries.append({"icon": "postage-stamp", "text": f"Required stamp cost [b]{stamp_cost}[/b]"+t_str, "on_release": pass_job})
else:
self.entries.append({"icon": "postage-stamp", "text": f"No required stamp cost", "on_release": pass_job})
if ticket_expires:
valid_for = ticket_expires - time.time()
self.entries.append({"icon": "ticket-confirmation", "text": f"Delivery ticket valid for [b]{RNS.prettytime(valid_for)}[/b]", "on_release": pass_job})