mail fixes
This commit is contained in:
parent
1d32b3daa1
commit
b09dae276c
6 changed files with 35 additions and 31 deletions
|
@ -194,9 +194,9 @@ class OnionrMail:
|
|||
self.sentMessages = {}
|
||||
for i in self.sentboxTools.listSent():
|
||||
self.sentboxList.append(i['hash'])
|
||||
self.sentMessages[i['hash']] = (self.myCore._utils.bytesToStr(i['message']), i['peer'])
|
||||
self.sentMessages[i['hash']] = (self.myCore._utils.bytesToStr(i['message']), i['peer'], i['subject'])
|
||||
if display:
|
||||
logger.info('%s. %s - %s - %s' % (count, i['hash'], i['peer'][:12], i['date']))
|
||||
logger.info('%s. %s - %s - (%s) - %s' % (count, i['hash'], i['peer'][:12], i['subject'], i['date']))
|
||||
count += 1
|
||||
return json.dumps(self.sentMessages)
|
||||
|
||||
|
@ -247,7 +247,6 @@ class OnionrMail:
|
|||
logger.info('Inserting encrypted message as Onionr block....')
|
||||
|
||||
blockID = self.myCore.insertBlock(message, header='pm', encryptType='asym', asymPeer=recip, sign=self.doSigs, meta={'subject': subject})
|
||||
self.sentboxTools.addToSent(blockID, recip, message)
|
||||
|
||||
def toggle_signing(self):
|
||||
self.doSigs = not self.doSigs
|
||||
|
@ -291,8 +290,8 @@ class OnionrMail:
|
|||
|
||||
def on_insertblock(api, data={}):
|
||||
sentboxTools = sentboxdb.SentBox(api.get_core())
|
||||
meta = json.dumps(data['meta'])
|
||||
sentboxTools.addToSent(data['hash'], data['peer'], data['content'])
|
||||
meta = json.loads(data['meta'])
|
||||
sentboxTools.addToSent(data['hash'], data['peer'], data['content'], meta['subject'])
|
||||
|
||||
def on_pluginrequest(api, data=None):
|
||||
resp = ''
|
||||
|
|
|
@ -37,6 +37,7 @@ class SentBox:
|
|||
hash id not null,
|
||||
peer text not null,
|
||||
message text not null,
|
||||
subject text not null,
|
||||
date int not null
|
||||
);
|
||||
''')
|
||||
|
@ -46,12 +47,12 @@ class SentBox:
|
|||
def listSent(self):
|
||||
retData = []
|
||||
for entry in self.cursor.execute('SELECT * FROM sent;'):
|
||||
retData.append({'hash': entry[0], 'peer': entry[1], 'message': entry[2], 'date': entry[3]})
|
||||
retData.append({'hash': entry[0], 'peer': entry[1], 'message': entry[2], 'subject': entry[3], 'date': entry[4]})
|
||||
return retData
|
||||
|
||||
def addToSent(self, blockID, peer, message):
|
||||
args = (blockID, peer, message, self.core._utils.getEpoch())
|
||||
self.cursor.execute('INSERT INTO sent VALUES(?, ?, ?, ?)', args)
|
||||
def addToSent(self, blockID, peer, message, subject=''):
|
||||
args = (blockID, peer, message, subject, self.core._utils.getEpoch())
|
||||
self.cursor.execute('INSERT INTO sent VALUES(?, ?, ?, ?, ?)', args)
|
||||
self.conn.commit()
|
||||
return
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
<body>
|
||||
<div id="infoOverlay" class='overlay'>
|
||||
</div>
|
||||
<img class='logo' src='/shared/onionr-icon.png' alt='onionr logo'>
|
||||
<span class='logoText'>Onionr Mail ✉️</span>
|
||||
<div class='content'>
|
||||
<img class='logo' src='/shared/onionr-icon.png' alt='onionr logo'>
|
||||
<span class='logoText'>Onionr Mail ✉️</span>
|
||||
<div>Current Used Identity: <input class='myPub' type='text' readonly> <button class='refresh'>Refresh Page</button></div>
|
||||
<br><br>
|
||||
<div class="btn-group" id='tabBtns'>
|
||||
|
|
|
@ -154,7 +154,7 @@ function getSentbox(){
|
|||
var preview = document.createElement('span')
|
||||
toEl.readOnly = true
|
||||
toEl.value = resp[keys[i]][1]
|
||||
preview.innerText = resp[keys[i]][0].split('\n')[0];
|
||||
preview.innerText = '(' + resp[keys[i]][2] + ')'
|
||||
entry.appendChild(toLabel)
|
||||
entry.appendChild(toEl)
|
||||
entry.appendChild(preview)
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
Onionr - P2P Anonymous Storage Network
|
||||
|
||||
This file handles the mail interface
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
webpass = document.location.hash.replace('#', '')
|
||||
nowebpass = false
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue