MCPcopy Create free account
hub / github.com/Bitmessage/PyBitmessage / loadSent

Function loadSent

src/bitmessagecurses/__init__.py:879–954  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

877 l10n.formatTimestamp(received, False), read])
878 inbox.reverse()
879def loadSent():
880 sys.stdout = sys.__stdout__
881 print("Loading sent messages...")
882 sys.stdout = printlog
883
884 where = "toaddress || fromaddress || subject || message"
885 what = "%%"
886 ret = sqlQuery("""SELECT toaddress, fromaddress, subject, status, ackdata, lastactiontime
887 FROM sent WHERE folder='sent' AND %s LIKE ?
888 ORDER BY lastactiontime
889 """ % (where,), what)
890 for row in ret:
891 toaddr, fromaddr, subject, status, ackdata, lastactiontime = row
892 subject = ascii(shared.fixPotentiallyInvalidUTF8Data(subject))
893
894 # Set label for to address
895 tolabel = ""
896 qr = sqlQuery("SELECT label FROM addressbook WHERE address=?", toaddr)
897 if qr != []:
898 for r in qr:
899 tolabel, = r
900 if tolabel == "":
901 qr = sqlQuery("SELECT label FROM subscriptions WHERE address=?", toaddr)
902 if qr != []:
903 for r in qr:
904 tolabel, = r
905 if tolabel == "":
906 if BMConfigParser().has_section(toaddr):
907 tolabel = BMConfigParser().get(toaddr, "label")
908 if tolabel == "":
909 tolabel = toaddr
910
911 # Set label for from address
912 fromlabel = ""
913 if BMConfigParser().has_section(fromaddr):
914 fromlabel = BMConfigParser().get(fromaddr, "label")
915 if fromlabel == "":
916 fromlabel = fromaddr
917
918 # Set status string
919 if status == "awaitingpubkey":
920 statstr = "Waiting for their public key. Will request it again soon"
921 elif status == "doingpowforpubkey":
922 statstr = "Encryption key request queued"
923 elif status == "msgqueued":
924 statstr = "Message queued"
925 elif status == "msgsent":
926 t = l10n.formatTimestamp(lastactiontime, False)
927 statstr = "Message sent at "+t+".Waiting for acknowledgement."
928 elif status == "msgsentnoackexpected":
929 t = l10n.formatTimestamp(lastactiontime, False)
930 statstr = "Message sent at "+t+"."
931 elif status == "doingmsgpow":
932 statstr = "The proof of work required to send the message has been queued."
933 elif status == "ackreceived":
934 t = l10n.formatTimestamp(lastactiontime, False)
935 statstr = "Acknowledgment of the message received at "+t+"."
936 elif status == "broadcastqueued":

Callers 1

runwrapperFunction · 0.85

Calls 4

BMConfigParserClass · 0.90
sqlQueryFunction · 0.85
asciiFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected