added subject line in mail, improved readme
This commit is contained in:
parent
557ffa2f4a
commit
13c2289096
6 changed files with 51 additions and 15 deletions
|
@ -74,6 +74,7 @@ class OnionrMail:
|
|||
logger.info('Decrypting messages...')
|
||||
choice = ''
|
||||
displayList = []
|
||||
subject = ''
|
||||
|
||||
# this could use a lot of memory if someone has recieved a lot of messages
|
||||
for blockHash in self.myCore.getBlocksByType('pm'):
|
||||
|
@ -97,7 +98,12 @@ class OnionrMail:
|
|||
senderDisplay = senderKey
|
||||
|
||||
blockDate = pmBlocks[blockHash].getDate().strftime("%m/%d %H:%M")
|
||||
displayList.append('%s. %s - %s: %s' % (blockCount, blockDate, senderDisplay[:12], blockHash))
|
||||
try:
|
||||
subject = pmBlocks[blockHash].bmetadata['subject']
|
||||
except KeyError:
|
||||
subject = ''
|
||||
|
||||
displayList.append('%s. %s - %s - <%s>: %s' % (blockCount, blockDate, senderDisplay[:12], subject[:10], blockHash))
|
||||
while choice not in ('-q', 'q', 'quit'):
|
||||
for i in displayList:
|
||||
logger.info(i)
|
||||
|
@ -188,6 +194,7 @@ class OnionrMail:
|
|||
def draftMessage(self, recip=''):
|
||||
message = ''
|
||||
newLine = ''
|
||||
subject = ''
|
||||
entering = False
|
||||
if len(recip) == 0:
|
||||
entering = True
|
||||
|
@ -207,6 +214,10 @@ class OnionrMail:
|
|||
else:
|
||||
# if -q or ctrl-c/d, exit function here, otherwise we successfully got the public key
|
||||
return
|
||||
try:
|
||||
subject = logger.readline('Message subject: ')
|
||||
except (KeyboardInterrupt, EOFError):
|
||||
pass
|
||||
|
||||
cancelEnter = False
|
||||
logger.info('Enter your message, stop by entering -q on a new line. -c to cancel')
|
||||
|
@ -226,7 +237,7 @@ class OnionrMail:
|
|||
if not cancelEnter:
|
||||
logger.info('Inserting encrypted message as Onionr block....')
|
||||
|
||||
blockID = self.myCore.insertBlock(message, header='pm', encryptType='asym', asymPeer=recip, sign=True)
|
||||
blockID = self.myCore.insertBlock(message, header='pm', encryptType='asym', asymPeer=recip, sign=True, meta={'subject': subject})
|
||||
self.sentboxTools.addToSent(blockID, recip, message)
|
||||
def menu(self):
|
||||
choice = ''
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
</title>
|
||||
<link rel='stylesheet' href='/shared/style/modal.css'>
|
||||
<link rel='stylesheet' href='/shared/main/style.css'>
|
||||
<link rel='stylesheet' href='/mail/mail.css'>
|
||||
</head>
|
||||
<body>
|
||||
<div id="infoOverlay" class='overlay'>
|
||||
|
@ -15,7 +16,7 @@
|
|||
<span class='logoText'>Onionr Mail</span>
|
||||
<div class='content'>
|
||||
<button class='refresh'>Refresh</button>
|
||||
<div id='threads'></div>
|
||||
<div id='threads' class='threads'></div>
|
||||
</div>
|
||||
<script src='/shared/misc.js'></script>
|
||||
<script src='/mail/mail.js'></script>
|
||||
|
|
|
@ -9,8 +9,30 @@ function getInbox(){
|
|||
.then((resp) => resp.json()) // Transform the data into json
|
||||
.then(function(resp) {
|
||||
var entry = document.createElement('div')
|
||||
entry.innerHTML = resp['meta']['time'] + ' - ' + resp['meta']['signer']
|
||||
var bHash = pms[i].substring(0, 10)
|
||||
var bHashDisplay = document.createElement('span')
|
||||
var senderInput = document.createElement('input')
|
||||
var subjectLine = document.createElement('span')
|
||||
var dateStr = document.createElement('span')
|
||||
var humanDate = new Date(0)
|
||||
humanDate.setUTCSeconds(resp['meta']['time'])
|
||||
senderInput.value = resp['meta']['signer']
|
||||
bHashDisplay.innerText = bHash
|
||||
senderInput.readOnly = true
|
||||
dateStr.innerText = humanDate.toString()
|
||||
if (resp['metadata']['subject'] === undefined || resp['metadata']['subject'] === null) {
|
||||
subjectLine.innerText = '()'
|
||||
}
|
||||
else{
|
||||
subjectLine.innerText = '(' + resp['metadata']['subject'] + ')'
|
||||
}
|
||||
//entry.innerHTML = 'sender ' + resp['meta']['signer'] + ' - ' + resp['meta']['time']
|
||||
threadPart.appendChild(entry)
|
||||
entry.appendChild(bHashDisplay)
|
||||
entry.appendChild(senderInput)
|
||||
entry.appendChild(subjectLine)
|
||||
entry.appendChild(dateStr)
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue