mirror of
https://github.com/markqvist/Sideband.git
synced 2024-10-01 03:15:37 -04:00
Added message transfer progress indication
This commit is contained in:
parent
70b8ebef58
commit
e800ce054b
@ -3248,6 +3248,13 @@ class SidebandCore():
|
||||
RNS.log("Error while creating paper message: "+str(e), RNS.LOG_ERROR)
|
||||
return False
|
||||
|
||||
def get_lxm_progress(self, lxm_hash):
|
||||
try:
|
||||
return self.message_router.get_outbound_progress(lxm_hash)
|
||||
except Exception as e:
|
||||
RNS.log("An error occurred while getting message transfer progress: "+str(e), RNS.LOG_ERROR)
|
||||
return None
|
||||
|
||||
def send_message(self, content, destination_hash, propagation, skip_fields=False, no_display=False, attachment = None, image = None, audio = None):
|
||||
try:
|
||||
if content == "":
|
||||
|
@ -135,6 +135,20 @@ class Messages():
|
||||
|
||||
if m["state"] == LXMF.LXMessage.SENDING or m["state"] == LXMF.LXMessage.OUTBOUND:
|
||||
msg = self.app.sideband.message(m["hash"])
|
||||
|
||||
if msg["state"] == LXMF.LXMessage.OUTBOUND or msg["state"] == LXMF.LXMessage.SENDING:
|
||||
w.md_bg_color = msg_color = mdc(color_unknown, intensity_msgs)
|
||||
txstr = time.strftime(ts_format, time.localtime(msg["sent"]))
|
||||
titlestr = ""
|
||||
prgstr = ""
|
||||
prg = self.app.sideband.get_lxm_progress(msg["hash"])
|
||||
if prg != None:
|
||||
prgstr = ", "+str(round(prg*100, 1))+"% progress"
|
||||
if msg["title"]:
|
||||
titlestr = "[b]Title[/b] "+msg["title"].decode("utf-8")+"\n"
|
||||
w.heading = titlestr+"[b]Sent[/b] "+txstr+"\n[b]State[/b] Sending"+prgstr+" "
|
||||
m["state"] = msg["state"]
|
||||
|
||||
if msg["state"] == LXMF.LXMessage.DELIVERED:
|
||||
w.md_bg_color = msg_color = mdc(color_delivered, intensity_msgs)
|
||||
txstr = time.strftime(ts_format, time.localtime(msg["sent"]))
|
||||
|
Loading…
Reference in New Issue
Block a user