Added helper_db.put_trash and replaced helper_inbox in api
This commit is contained in:
parent
9367948387
commit
1364116304
|
@ -74,7 +74,6 @@ from struct import pack
|
|||
|
||||
import defaults
|
||||
import helper_db
|
||||
import helper_inbox
|
||||
import network.stats
|
||||
import proofofwork
|
||||
import queues
|
||||
|
@ -1051,23 +1050,23 @@ class BMRPCDispatcher(object):
|
|||
"""
|
||||
msgid = self._decode(msgid, "hex")
|
||||
# Trash if in inbox table
|
||||
helper_inbox.trash(msgid)
|
||||
helper_db.put_trash(msgid)
|
||||
# Trash if in sent table
|
||||
sqlExecute("UPDATE sent SET folder='trash' WHERE msgid=?", msgid)
|
||||
helper_db.put_trash(msgid, sent=True)
|
||||
return 'Trashed message (assuming message existed).'
|
||||
|
||||
@command('trashInboxMessage')
|
||||
def HandleTrashInboxMessage(self, msgid):
|
||||
"""Trash inbox message by msgid (encoded in hex)."""
|
||||
msgid = self._decode(msgid, "hex")
|
||||
helper_inbox.trash(msgid)
|
||||
helper_db.put_trash(msgid)
|
||||
return 'Trashed inbox message (assuming message existed).'
|
||||
|
||||
@command('trashSentMessage')
|
||||
def HandleTrashSentMessage(self, msgid):
|
||||
"""Trash sent message by msgid (encoded in hex)."""
|
||||
msgid = self._decode(msgid, "hex")
|
||||
sqlExecute('''UPDATE sent SET folder='trash' WHERE msgid=?''', msgid)
|
||||
helper_db.put_trash(msgid, sent=True)
|
||||
return 'Trashed sent message (assuming message existed).'
|
||||
|
||||
@command('sendMessage')
|
||||
|
|
|
@ -74,6 +74,15 @@ def put_inbox(
|
|||
"newBroadcast" if broadcast else "newMessage"])
|
||||
|
||||
|
||||
def put_trash(msgid, sent=False):
|
||||
"""Put inbox message (or sent if sent=True) into trash by msgid"""
|
||||
sqlExecute(
|
||||
"UPDATE %s SET folder='trash' WHERE msgid=?" %
|
||||
('sent' if sent else 'inbox'), msgid)
|
||||
if not sent:
|
||||
queues.UISignalQueue.put(('removeInboxRowByMsgid', msgid))
|
||||
|
||||
|
||||
def put_pubkey(address, address_version, data, used_personally=None):
|
||||
"""Put pubkey into Pubkeys table"""
|
||||
if used_personally is None:
|
||||
|
|
Loading…
Reference in New Issue
Block a user