Send messages opportunistically if ratchets are available

This commit is contained in:
Mark Qvist 2024-09-16 18:59:33 +02:00
parent f8b3e3760b
commit 2ecdf1c853
2 changed files with 7 additions and 4 deletions

View File

@ -4067,7 +4067,11 @@ class SidebandCore():
if propagation: if propagation:
desired_method = LXMF.LXMessage.PROPAGATED desired_method = LXMF.LXMessage.PROPAGATED
else: else:
desired_method = LXMF.LXMessage.DIRECT if not self.message_router.delivery_link_available(destination_hash) and RNS.Identity.current_ratchet_id(destination_hash) != None:
RNS.log(f"Have ratchet for {RNS.prettyhexrep(destination_hash)}, requesting opportunistic delivery of message", RNS.LOG_DEBUG)
desired_method = LXMF.LXMessage.OPPORTUNISTIC
else:
desired_method = LXMF.LXMessage.DIRECT
if skip_fields: if skip_fields:
fields = {} fields = {}

View File

@ -102,7 +102,6 @@ class Messages():
self.list.remove_widget(self.load_more_button) self.list.remove_widget(self.load_more_button)
def message_details_dialog(self, lxm_hash): def message_details_dialog(self, lxm_hash):
RNS.log(f"Opening dialog for {RNS.prettyhexrep(lxm_hash)}", RNS.LOG_DEBUG)
ss = int(dp(16)) ss = int(dp(16))
ms = int(dp(14)) ms = int(dp(14))
@ -247,10 +246,10 @@ class Messages():
else: else:
w.line_color = (1.0, 1.0, 1.0, 0.5) w.line_color = (1.0, 1.0, 1.0, 0.5)
if m["state"] == LXMF.LXMessage.SENDING or m["state"] == LXMF.LXMessage.OUTBOUND: if m["state"] == LXMF.LXMessage.SENDING or m["state"] == LXMF.LXMessage.OUTBOUND or m["state"] == LXMF.LXMessage.SENT:
msg = self.app.sideband.message(m["hash"]) msg = self.app.sideband.message(m["hash"])
if msg["state"] == LXMF.LXMessage.OUTBOUND or msg["state"] == LXMF.LXMessage.SENDING: if msg["state"] == LXMF.LXMessage.OUTBOUND or msg["state"] == LXMF.LXMessage.SENDING or msg["state"] == LXMF.LXMessage.SENT:
w.md_bg_color = msg_color = mdc(color_unknown, intensity_msgs) w.md_bg_color = msg_color = mdc(color_unknown, intensity_msgs)
txstr = time.strftime(ts_format, time.localtime(msg["sent"])) txstr = time.strftime(ts_format, time.localtime(msg["sent"]))
titlestr = "" titlestr = ""