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

@ -4066,6 +4066,10 @@ class SidebandCore():
if propagation:
desired_method = LXMF.LXMessage.PROPAGATED
else:
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

View File

@ -102,7 +102,6 @@ class Messages():
self.list.remove_widget(self.load_more_button)
def message_details_dialog(self, lxm_hash):
RNS.log(f"Opening dialog for {RNS.prettyhexrep(lxm_hash)}", RNS.LOG_DEBUG)
ss = int(dp(16))
ms = int(dp(14))
@ -247,10 +246,10 @@ class Messages():
else:
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"])
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)
txstr = time.strftime(ts_format, time.localtime(msg["sent"]))
titlestr = ""